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

2023-11-27 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/writertreevisiting.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5589659829f8a1cef8ca1c8a468732105bbe231b
Author: Kevin Suo 
AuthorDate: Wed Nov 22 16:11:33 2023 +0800
Commit: Kevin Suo 
CommitDate: Tue Nov 28 03:08:39 2023 +0100

tdf#157589 tdf#153969: Revert "sdext.pdfimport Writer: Do not visit...

... DrawElement twice in WriterXmlEmitter"

This reverts commit 9ea9d3ccc0f8e4833e745d9655b61d42d6d8fe83.

The reason for the revert:
It causes regressions as indicated in tdf#157589 and tdf#153969.
That commit may be my misunderstanding of the code.

Change-Id: Idd188bf83721d309623a7f8484d064327a3a23af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159811
Tested-by: Jenkins
Reviewed-by: Kevin Suo 

diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 7941f7d35709..9ecce8f48be4 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -413,7 +413,7 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const 
std::list< std::uniqu
 // only DrawElement types
 for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
 {
-if( dynamic_cast(it->get()) != nullptr )
+if( dynamic_cast(it->get()) == nullptr )
 (*it)->visitedBy( *this, it );
 }
 


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

2023-10-31 Thread Mike Kaganski (via logerrit)
 sdext/source/pdfimport/pdfparse/pdfparse.cxx |   19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit ba26d5f5e0529d7accf6f268559b8d659ba7c6c2
Author: Mike Kaganski 
AuthorDate: Tue Oct 31 20:43:52 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Oct 31 21:11:34 2023 +0100

tdf#106057: Don't fail PDFReader::read, when several entries in stack

It may happen in case of several trailers, which is OK. The calling code
will check the type of the returned object anyway.

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

diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx 
b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
index baa322c1aa3c..cdd3ac13ff35 100644
--- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
@@ -601,21 +601,26 @@ std::unique_ptr PDFReader::read( const char* 
pFileName )
 pRet.reset(aGrammar.m_aObjectStack.back());
 aGrammar.m_aObjectStack.pop_back();
 }
-#if OSL_DEBUG_LEVEL > 0
 else if( nEntries > 1 )
 {
+// It is possible that there are multiple trailers, which is OK.
+// But still keep the warnings, just in case.
 SAL_WARN("sdext.pdfimport.pdfparse", "error got " << nEntries << " 
stack objects in parse");
-for( unsigned int i = 0; i < nEntries; i++ )
+for (;;)
 {
-SAL_WARN("sdext.pdfimport.pdfparse", 
typeid(*aGrammar.m_aObjectStack[i]).name());
-PDFObject* pObj = 
dynamic_cast(aGrammar.m_aObjectStack[i]);
+PDFEntry* pEntry = aGrammar.m_aObjectStack.back();
+aGrammar.m_aObjectStack.pop_back();
+SAL_WARN("sdext.pdfimport.pdfparse", typeid(*pEntry).name());
+PDFObject* pObj = dynamic_cast(pEntry);
 if( pObj )
 SAL_WARN("sdext.pdfimport.pdfparse", "   -> object " << 
pObj->m_nNumber << " generation " << pObj->m_nGeneration);
-else
-SAL_WARN("sdext.pdfimport.pdfparse", "(type " << 
typeid(*aGrammar.m_aObjectStack[i]).name() << ")");
+if (aGrammar.m_aObjectStack.empty())
+{
+pRet.reset(pEntry); // The first entry references all others - 
see PDFGrammar dtor
+break;
+}
 }
 }
-#endif
 return pRet;
 }
 


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

2023-10-31 Thread Mike Kaganski (via logerrit)
 sdext/source/pdfimport/pdfparse/pdfparse.cxx |   76 ---
 1 file changed, 76 deletions(-)

New commits:
commit 046e9545956d8ad1d69345d6b4a4c0a33714d179
Author: Mike Kaganski 
AuthorDate: Tue Oct 31 20:09:35 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Oct 31 21:01:10 2023 +0100

Try to revert to use of file_iterator from boost on Windows

It was disabled in commit ef8d59c5b909d5a9b956934ab1120f90b90a4e10
(vcl108: #i106853# work around broken file_iterator on Windows,
2009-12-01), referencing boost 1.39. It seems to work fine now,
so let's revert it, and hope it doesn't break something.

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

diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx 
b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
index 7cef299e8eaa..baa322c1aa3c 100644
--- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
@@ -558,83 +558,8 @@ public:
 
 }
 
-#ifdef _WIN32
-std::unique_ptr PDFReader::read( const char* pBuffer, unsigned int 
nLen )
-{
-PDFGrammar aGrammar( pBuffer );
-
-try
-{
-#if OSL_DEBUG_LEVEL > 0
-boost::spirit::classic::parse_info aInfo =
-#endif
-boost::spirit::classic::parse( pBuffer,
-  pBuffer+nLen,
-  aGrammar,
-  boost::spirit::classic::space_p );
-#if OSL_DEBUG_LEVEL > 0
-SAL_INFO("sdext.pdfimport.pdfparse", "parseinfo: stop = " << 
aInfo.stop << " (buff=" << pBuffer << ", offset = " << aInfo.stop - pBuffer << 
"), hit = " << (aInfo.hit ? OUString("true") : OUString("false")) << ", full = 
" << (aInfo.full ? OUString("true") : OUString("false")) << ", length = " << 
static_cast(aInfo.length) );
-#endif
-}
-catch( const parser_error& rError )
-{
-#if OSL_DEBUG_LEVEL > 0
-OString aTmp;
-unsigned int nElem = aGrammar.m_aObjectStack.size();
-for( unsigned int i = 0; i < nElem; i++ )
-aTmp += OString::Concat("   ") + typeid( 
*(aGrammar.m_aObjectStack[i]) ).name();
-
-SAL_WARN("sdext.pdfimport.pdfparse", "parse error: " << 
rError.descriptor << " at buffer pos " << rError.where - pBuffer << ", object 
stack: " << aTmp);
-#else
-(void)rError;
-#endif
-}
-
-std::unique_ptr pRet;
-unsigned int nEntries = aGrammar.m_aObjectStack.size();
-if( nEntries == 1 )
-{
-pRet.reset(aGrammar.m_aObjectStack.back());
-aGrammar.m_aObjectStack.pop_back();
-}
-#if OSL_DEBUG_LEVEL > 0
-else if( nEntries > 1 )
-SAL_WARN("sdext.pdfimport.pdfparse", "error got " << nEntries << " 
stack objects in parse" );
-#endif
-
-return pRet;
-}
-#endif
-
 std::unique_ptr PDFReader::read( const char* pFileName )
 {
-#ifdef _WIN32
-/* #i106583#
-   since converting to boost 1.39 file_iterator does not work anymore on 
all Windows systems
-   C++ stdlib istream_iterator does not allow "-" apparently
-   using spirit 2.0 doesn't work in our environment with the MSC
-
-   So for the time being bite the bullet and read the whole file.
-   FIXME: give Spirit 2.x another try when we upgrade boost again.
-*/
-std::unique_ptr pRet;
-FILE* fp = fopen( pFileName, "rb" );
-if( fp )
-{
-fseek( fp, 0, SEEK_END );
-unsigned int nLen = static_cast(ftell( fp ));
-fseek( fp, 0, SEEK_SET );
-char* pBuf = static_cast(std::malloc( nLen ));
-if( pBuf )
-{
-fread( pBuf, 1, nLen, fp );
-pRet = read( pBuf, nLen );
-std::free( pBuf );
-}
-fclose( fp );
-}
-return pRet;
-#else
 file_iterator<> file_start( pFileName );
 if( ! file_start )
 return nullptr;
@@ -692,7 +617,6 @@ std::unique_ptr PDFReader::read( const char* 
pFileName )
 }
 #endif
 return pRet;
-#endif // WIN32
 }
 
 #if defined(_MSC_VER)


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

2023-09-28 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/filterdet.cxx |   39 +++
 1 file changed, 39 insertions(+)

New commits:
commit 9dd0af943df70d7797196ee8f9717596f28b1849
Author: Caolán McNamara 
AuthorDate: Tue Sep 26 15:52:17 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 28 10:14:49 2023 +0200

cool#7307 short-circuit pdf parsing during detect if no 'AdditionalStreams'

looks to me that we ignore the contents of the AdditionalStream and
re-parse to get it in the final importer, in which case we could
presumably parse the mimetype in AdditionalStream here and drop the
extraction of the stream.

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

diff --git a/sdext/source/pdfimport/filterdet.cxx 
b/sdext/source/pdfimport/filterdet.cxx
index ef29e8a2c022..5f6392e18983 100644
--- a/sdext/source/pdfimport/filterdet.cxx
+++ b/sdext/source/pdfimport/filterdet.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -512,6 +513,40 @@ bool checkDocChecksum( const OUString& rInPDFFileURL,
 && (0 == memcmp(nChecksum.data(), nTestChecksum, nChecksum.size()));
 }
 
+/* https://github.com/CollaboraOnline/online/issues/7307
+
+   Light-weight detection to determine if this is a hybrid
+   pdf document worth parsing to get its AdditionalStream
+   and mimetype.
+
+   TODO: a) do we really ignore the contents of the AdditionalStream
+   and re-parse to get it in the final importer?
+ b) in which case we could presumably parse the mimetype in
+   AdditionalStream here and drop the extraction of the stream.
+*/
+static bool detectHasAdditionalStreams(const OUString& rSysUPath)
+{
+SvFileStream aHybridDetect(rSysUPath, StreamMode::READ);
+std::vector aTrailingLines;
+const sal_uInt64 nLen = aHybridDetect.remainingSize();
+aHybridDetect.Seek(nLen - std::min(nLen, 4096));
+OString aLine;
+while (aHybridDetect.ReadLine(aLine))
+aTrailingLines.push_back(aLine);
+bool bAdditionalStreams(false);
+for (auto it = aTrailingLines.rbegin(); it != aTrailingLines.rend(); ++it)
+{
+if (*it == "trailer")
+break;
+if (it->startsWith("/AdditionalStreams "))
+{
+bAdditionalStreams = true;
+break;
+}
+}
+return bAdditionalStreams;
+}
+
 uno::Reference< io::XStream > getAdditionalStream( const OUString& 
 rInPDFFileURL,
OUString&   
 rOutMimetype,
OUString&   
 io_rPwd,
@@ -524,6 +559,10 @@ uno::Reference< io::XStream > getAdditionalStream( const 
OUString&
 OUString aSysUPath;
 if( osl_getSystemPathFromFileURL( rInPDFFileURL.pData, &aSysUPath.pData ) 
!= osl_File_E_None )
 return xEmbed;
+
+if (!detectHasAdditionalStreams(aSysUPath))
+return xEmbed;
+
 aPDFFile = OUStringToOString( aSysUPath, osl_getThreadTextEncoding() );
 
 std::unique_ptr pEntry( pdfparse::PDFReader::read( 
aPDFFile.getStr() ));


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

2023-04-30 Thread Mike Kaganski (via logerrit)
 sdext/source/pdfimport/pdfiadaptor.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 116adf5341c681e4044f9fe940d0d143eeabc457
Author: Mike Kaganski 
AuthorDate: Sun Apr 23 20:14:38 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sun Apr 30 17:45:22 2023 +0200

Use getXWeak in sdext

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

diff --git a/sdext/source/pdfimport/pdfiadaptor.cxx 
b/sdext/source/pdfimport/pdfiadaptor.cxx
index 9cca84cdf92f..0d5bad2d6373 100644
--- a/sdext/source/pdfimport/pdfiadaptor.cxx
+++ b/sdext/source/pdfimport/pdfiadaptor.cxx
@@ -329,7 +329,7 @@ sdext_PDFIRawAdaptor_Writer_get_implementation(
 rtl::Reference pAdaptor = new pdfi::PDFIRawAdaptor( 
"org.libreoffice.comp.documents.WriterPDFImport", context );
 pAdaptor->setTreeVisitorFactory(pdfi::createWriterTreeVisitorFactory());
 pAdaptor->acquire();
-return static_cast(pAdaptor.get());
+return getXWeak(pAdaptor.get());
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
@@ -339,7 +339,7 @@ sdext_PDFIRawAdaptor_Draw_get_implementation(
 rtl::Reference pAdaptor = new pdfi::PDFIRawAdaptor( 
"org.libreoffice.comp.documents.DrawPDFImport", context );
 pAdaptor->setTreeVisitorFactory(pdfi::createDrawTreeVisitorFactory());
 pAdaptor->acquire();
-return static_cast(pAdaptor.get());
+return getXWeak(pAdaptor.get());
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
@@ -349,7 +349,7 @@ sdext_PDFIRawAdaptor_Impress_get_implementation(
 rtl::Reference pAdaptor = new pdfi::PDFIRawAdaptor( 
"org.libreoffice.comp.documents.ImpressPDFImport", context );
 pAdaptor->setTreeVisitorFactory(pdfi::createImpressTreeVisitorFactory());
 pAdaptor->acquire();
-return static_cast(pAdaptor.get());
+return getXWeak(pAdaptor.get());
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*


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

2023-01-26 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/filterdet.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit b9249d7c4db6e20dcc1bcca88b350e9ee547c992
Author: Caolán McNamara 
AuthorDate: Thu Jan 26 14:02:10 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Jan 26 14:58:46 2023 +

cid#1520592 Logically dead code

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

diff --git a/sdext/source/pdfimport/filterdet.cxx 
b/sdext/source/pdfimport/filterdet.cxx
index 24bff08ccb6f..69aa90a26b9b 100644
--- a/sdext/source/pdfimport/filterdet.cxx
+++ b/sdext/source/pdfimport/filterdet.cxx
@@ -357,9 +357,6 @@ OUString SAL_CALL PDFDetector::detect( uno::Sequence< 
beans::PropertyValue >& rF
 aOutFilterName = "calc_pdf_addstream_import";
 }
 
-if (!bSuccess)
-return OUString();
-
 if (!aOutFilterName.isEmpty())
 {
 if( nFilterNamePos == -1 )


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

2022-12-17 Thread Caolán McNamara (via logerrit)
 sdext/source/minimizer/optimizerdialog.cxx |   10 +-
 sdext/source/minimizer/optimizerdialog.hxx |6 ++
 2 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit 4e0970bebd06ba988a59213b827a1c0a44c76ac2
Author: Caolán McNamara 
AuthorDate: Sat Dec 17 20:57:46 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Dec 17 21:51:42 2022 +

cid#1517773 silence Wrapper object use after free

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

diff --git a/sdext/source/minimizer/optimizerdialog.cxx 
b/sdext/source/minimizer/optimizerdialog.cxx
index 351c98df6c41..68aaf2662fb5 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -61,6 +61,7 @@ IntroPage::IntroPage(weld::Container* pPage, OptimizerDialog& 
rOptimizerDialog)
 , mxComboBox(m_xBuilder->weld_combo_box("LB_SETTINGS"))
 , mxButton(m_xBuilder->weld_button("STR_REMOVE"))
 {
+rOptimizerDialog.SetIntroPage(this);
 mxComboBox->connect_changed(LINK(this, IntroPage, 
ComboBoxActionPerformed));
 mxButton->connect_clicked(LINK(this, IntroPage, ButtonActionPerformed));
 }
@@ -83,6 +84,7 @@ SlidesPage::SlidesPage(weld::Container* pPage, 
OptimizerDialog& rOptimizerDialog
 , mxComboBox(m_xBuilder->weld_combo_box("LB_SLIDES"))
 , mxClearNodes(m_xBuilder->weld_check_button("STR_DELETE_NOTES_PAGES"))
 {
+rOptimizerDialog.SetSlidesPage(this);
 mxMasterSlides->connect_toggled(LINK(this, SlidesPage, 
UnusedMasterPagesActionPerformed));
 mxHiddenSlides->connect_toggled(LINK(this, SlidesPage, 
UnusedHiddenSlidesActionPerformed));
 mxUnusedSlides->connect_toggled(LINK(this, SlidesPage, 
UnusedSlidesActionPerformed));
@@ -116,6 +118,7 @@ ImagesPage::ImagesPage(weld::Container* pPage, 
OptimizerDialog& rOptimizerDialog
 , m_xRemoveCropArea(m_xBuilder->weld_check_button("STR_REMOVE_CROP_AREA"))
 , 
m_xEmbedLinkedGraphics(m_xBuilder->weld_check_button("STR_EMBED_LINKED_GRAPHICS"))
 {
+rOptimizerDialog.SetImagesPage(this);
 m_xRemoveCropArea->connect_toggled(LINK(this, ImagesPage, 
RemoveCropAreaActionPerformed));
 m_xEmbedLinkedGraphics->connect_toggled(LINK(this, ImagesPage, 
EmbedLinkedGraphicsActionPerformed));
 m_xResolution->connect_changed(LINK(this, ImagesPage, 
ComboBoxActionPerformed));
@@ -146,6 +149,7 @@ ObjectsPage::ObjectsPage(weld::Container* pPage, 
OptimizerDialog& rOptimizerDial
 , 
m_xForeignOLEObjects(m_xBuilder->weld_radio_button("STR_ALIEN_OLE_OBJECTS_ONLY"))
 , m_xLabel(m_xBuilder->weld_label("STR_OLE_OBJECTS_DESC"))
 {
+rOptimizerDialog.SetObjectsPage(this);
 m_xCreateStaticImage->connect_toggled(LINK(this, ObjectsPage, 
OLEOptimizationActionPerformed));
 m_xAllOLEObjects->connect_toggled(LINK(this, ObjectsPage, 
OLEActionPerformed));
 m_xForeignOLEObjects->connect_toggled(LINK(this, ObjectsPage, 
OLEActionPerformed));
@@ -180,6 +184,7 @@ SummaryPage::SummaryPage(weld::Container* pPage, 
OptimizerDialog& rOptimizerDial
 , m_xComboBox(m_xBuilder->weld_combo_box("MY_SETTINGS"))
 , m_xSaveSettings(m_xBuilder->weld_check_button("STR_SAVE_SETTINGS"))
 {
+rOptimizerDialog.SetSummaryPage(this);
 m_xApplyToCurrent->connect_toggled(LINK(this, SummaryPage, 
SaveAsNewActionPerformed));
 m_xSaveToNew->connect_toggled(LINK(this, SummaryPage, 
SaveAsNewActionPerformed));
 m_xSaveSettings->connect_toggled(LINK(this, SummaryPage, 
SaveSettingsActionPerformed));
@@ -316,23 +321,18 @@ std::unique_ptr 
OptimizerDialog::createPage(vcl::WizardTypes::Wizar
 {
 case ITEM_ID_INTRODUCTION:
 xRet.reset(new IntroPage(pPageContainer, *this));
-mpPage0 = static_cast(xRet.get());
 break;
 case ITEM_ID_SLIDES:
 xRet.reset(new SlidesPage(pPageContainer, *this));
-mpPage1 = static_cast(xRet.get());
 break;
 case ITEM_ID_GRAPHIC_OPTIMIZATION:
 xRet.reset(new ImagesPage(pPageContainer, *this));
-mpPage2 = static_cast(xRet.get());
 break;
 case ITEM_ID_OLE_OPTIMIZATION:
 xRet.reset(new ObjectsPage(pPageContainer, *this));
-mpPage3 = static_cast(xRet.get());
 break;
 case ITEM_ID_SUMMARY:
 xRet.reset(new SummaryPage(pPageContainer, *this));
-mpPage4 = static_cast(xRet.get());
 break;
 }
 
diff --git a/sdext/source/minimizer/optimizerdialog.hxx 
b/sdext/source/minimizer/optimizerdialog.hxx
index e36e5fe43262..88c01b54300b 100644
--- a/sdext/source/minimizer/optimizerdialog.hxx
+++ b/sdext/source/minimizer/optimizerdialog.hxx
@@ -231,6 +231,12 @@ public:
 
 void UpdateControlStates( sal_Int16 nStep = -1 );
 
+void SetIntroPage(IntroPage* pPage0) { mpPage0 = pPage0; }
+void SetSlidesPage(SlidesPage* pPage1) { mpPage1 = p

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

2022-12-08 Thread Andrea Gelmini (via logerrit)
 sdext/source/minimizer/optimizerdialog.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 705b2924a14841883b4a8cac549f7af326d7a185
Author: Andrea Gelmini 
AuthorDate: Tue Dec 6 22:34:11 2022 +0100
Commit: Noel Grandin 
CommitDate: Thu Dec 8 08:04:14 2022 +

Removed useless semicolon

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

diff --git a/sdext/source/minimizer/optimizerdialog.cxx 
b/sdext/source/minimizer/optimizerdialog.cxx
index 1d54b6c8ede1..351c98df6c41 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -334,7 +334,7 @@ std::unique_ptr 
OptimizerDialog::createPage(vcl::WizardTypes::Wizar
 xRet.reset(new SummaryPage(pPageContainer, *this));
 mpPage4 = static_cast(xRet.get());
 break;
-};
+}
 
 m_xAssistant->set_page_title(sIdent, getStateDisplayName(nState));
 


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

2022-12-06 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/pdfiprocessor.hxx |1 +
 sdext/source/pdfimport/tree/drawtreevisiting.hxx |2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 83e58fc9f19a8da751cabdc0440aded62dc67fea
Author: Kevin Suo 
AuthorDate: Fri Dec 2 19:22:11 2022 +0800
Commit: Stephan Bergmann 
CommitDate: Wed Dec 7 07:33:41 2022 +

sdext: move the include of XComponentContext.hpp to where it is used

... and remove unsed include.

XComponentContext.hpp is used in pdfiprocessor.hxx but not in 
drawtreevisiting.hxx.
XMultiServiceFactory.hpp is not used drawtreevisiting.hxx.

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

diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx 
b/sdext/source/pdfimport/inc/pdfiprocessor.hxx
index 7cbe7d7a5104..3fdc146716b3 100644
--- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx
+++ b/sdext/source/pdfimport/inc/pdfiprocessor.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_PDFIPROCESSOR_HXX
 #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_PDFIPROCESSOR_HXX
 
+#include 
 #include 
 #include 
 #include 
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.hxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.hxx
index 81bfd927354b..e3ea8e537ff5 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.hxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.hxx
@@ -24,8 +24,6 @@
 
 #include 
 #include 
-#include 
-#include 
 
 namespace pdfi
 {


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

2022-12-05 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/genericelements.hxx  |4 +---
 sdext/source/pdfimport/tree/genericelements.cxx |4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit c9e961e6803a70587bd4686d05abdd4ac11de434
Author: Kevin Suo 
AuthorDate: Mon Dec 5 17:37:39 2022 +0800
Commit: Kevin Suo 
CommitDate: Tue Dec 6 03:42:27 2022 +

"using namespace com::sun::star" -> css in header file

See Stephan Bergmann's comment the following change (thanks!):
https://gerrit.libreoffice.org/c/core/+/143598

Change-Id: I409b823439979c64cadcb582d8fb4dec4ff412b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143664
Tested-by: Jenkins
Reviewed-by: Kevin Suo 

diff --git a/sdext/source/pdfimport/inc/genericelements.hxx 
b/sdext/source/pdfimport/inc/genericelements.hxx
index 37b448d2b613..6d1459a1f032 100644
--- a/sdext/source/pdfimport/inc/genericelements.hxx
+++ b/sdext/source/pdfimport/inc/genericelements.hxx
@@ -32,8 +32,6 @@
 
 #include 
 
-using namespace com::sun::star;
-
 namespace pdfi
 {
 class XmlEmitter;
@@ -313,7 +311,7 @@ namespace pdfi
 { return std::make_shared(); }
 };
 
-bool isComplex(const uno::Reference& rBreakIterator, 
TextElement* const pTextElem);
+bool isComplex(const css::uno::Reference& 
rBreakIterator, TextElement* const pTextElem);
 }
 
 #endif
diff --git a/sdext/source/pdfimport/tree/genericelements.cxx 
b/sdext/source/pdfimport/tree/genericelements.cxx
index c3c816aecdf2..1d11cd0d914e 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -431,12 +431,12 @@ void DocumentElement::visitedBy( ElementTreeVisitor&  
rV
 rVisitor.visit(*this, rParentIt);
 }
 
-bool isComplex(const uno::Reference& rBreakIterator, 
TextElement* const pTextElem) {
+bool isComplex(const css::uno::Reference& 
rBreakIterator, TextElement* const pTextElem) {
 OUString str(pTextElem->Text.toString());
 for(int i=0; i< str.getLength(); i++)
 {
 sal_Int16 nType = rBreakIterator->getScriptType(str, i);
-if (nType == i18n::ScriptType::COMPLEX)
+if (nType == css::i18n::ScriptType::COMPLEX)
 {
 return true;
 }


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

2022-12-04 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 00bf67a99dcdb1549401f0b656e872e5c9762dc5
Author: Kevin Suo 
AuthorDate: Sat Dec 3 19:54:59 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Dec 4 14:56:40 2022 +

tdf#147246 sdext: font name returned by font descriptor may be...

... e.g. "NotoSerifCJKjp-Regular-VKana".

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

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index da506d9ceef8..e3e1c3aa8d04 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -630,6 +630,10 @@ void LineParser::readFont()
 aResult.familyName = aResult.familyName.copy(7, 
aResult.familyName.getLength() - 7);
 parseFontFamilyName(aResult);
 }
+if (aResult.familyName.endsWithIgnoreAsciiCase("-VKana"))
+{
+parseFontFamilyName(aResult);
+}
 
 // Font weight
 if (aFontReadResult.GetWeight() == WEIGHT_THIN)


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

2022-12-04 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/genericelements.hxx   |5 +
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |   20 +++-
 sdext/source/pdfimport/tree/genericelements.cxx  |   15 ++-
 3 files changed, 22 insertions(+), 18 deletions(-)

New commits:
commit 842e3b988aca27d7c9f71ce1efc6653271cc3430
Author: Kevin Suo 
AuthorDate: Fri Dec 2 22:53:27 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Dec 4 14:54:34 2022 +

tdf#152083 related: make the isComplex check block as a separate function

This is used to check whether a TextElement is rtl. We will need this
in WriterXmlOptimizer::optimizeTextElements() as well, in a separate commit.

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

diff --git a/sdext/source/pdfimport/inc/genericelements.hxx 
b/sdext/source/pdfimport/inc/genericelements.hxx
index 1fec2e6f4042..37b448d2b613 100644
--- a/sdext/source/pdfimport/inc/genericelements.hxx
+++ b/sdext/source/pdfimport/inc/genericelements.hxx
@@ -25,12 +25,15 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
 
+using namespace com::sun::star;
+
 namespace pdfi
 {
 class XmlEmitter;
@@ -309,6 +312,8 @@ namespace pdfi
 static std::shared_ptr createDocumentElement()
 { return std::make_shared(); }
 };
+
+bool isComplex(const uno::Reference& rBreakIterator, 
TextElement* const pTextElem);
 }
 
 #endif
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 64aca46ce18b..b94a302a5583 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -682,17 +682,10 @@ void DrawXmlOptimizer::optimizeTextElements(Element& 
rParent)
 if( pCur )
 {
 TextElement* pNext = (*next)->dynCastAsTextElement();
-bool isComplex = false;
-OUString str(pCur->Text.toString());
-for(int i=0; i< str.getLength(); i++)
-{
-sal_Int16 nType = GetBreakIterator()->getScriptType( str, i );
-if (nType == css::i18n::ScriptType::COMPLEX)
-isComplex = true;
-}
+OUString str;
 bool bPara = strspn("ParagraphElement", typeid(rParent).name());
 ParagraphElement* pPara = 
dynamic_cast(&rParent);
-if (bPara && pPara && isComplex)
+if (bPara && pPara && isComplex(GetBreakIterator(), pCur))
 pPara->bRtl = true;
 if( pNext )
 {
@@ -756,14 +749,7 @@ void DrawXmlOptimizer::optimizeTextElements(Element& 
rParent)
 pCur->Text.append( pNext->Text );
 }
 
-str = pCur->Text.toString();
-for(int i=0; i< str.getLength(); i++)
-{
-sal_Int16 nType = GetBreakIterator()->getScriptType( 
str, i );
-if (nType == css::i18n::ScriptType::COMPLEX)
-isComplex = true;
-}
-if (bPara && pPara && isComplex)
+if (bPara && pPara && isComplex(GetBreakIterator(), pCur))
 pPara->bRtl = true;
 // append eventual children to current element
 // and clear children (else the children just
diff --git a/sdext/source/pdfimport/tree/genericelements.cxx 
b/sdext/source/pdfimport/tree/genericelements.cxx
index 7f751e18ba5c..c3c816aecdf2 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -22,7 +22,8 @@
 #include 
 #include 
 
-
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -430,6 +431,18 @@ void DocumentElement::visitedBy( ElementTreeVisitor&   
   rV
 rVisitor.visit(*this, rParentIt);
 }
 
+bool isComplex(const uno::Reference& rBreakIterator, 
TextElement* const pTextElem) {
+OUString str(pTextElem->Text.toString());
+for(int i=0; i< str.getLength(); i++)
+{
+sal_Int16 nType = rBreakIterator->getScriptType(str, i);
+if (nType == i18n::ScriptType::COMPLEX)
+{
+return true;
+}
+}
+return false;
+}
 
 }
 


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

2022-12-03 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |2 +-
 sdext/source/pdfimport/tree/writertreevisiting.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d423e18de7c48df359d2d2d1b5b8f5cceac4d96a
Author: Kevin Suo 
AuthorDate: Sat Dec 3 18:43:02 2022 +0800
Commit: Noel Grandin 
CommitDate: Sat Dec 3 14:07:03 2022 +

tdf#147246 sdext.pdfimport: "font-family-asia" -> "font-family-asian"

This was a typo which causes the asian font in pdf (e.g. Chinese)
always shown as the system default font on pdfimport.

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

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 8338ba6dbfde..64aca46ce18b 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -878,7 +878,7 @@ void DrawXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_pt
 // TODO: tdf#143095: use system font name rather than PSName
 SAL_INFO("sdext.pdfimport", "The font used in xml is: " << 
rFont.familyName);
 aFontProps[ "fo:font-family" ] = rFont.familyName;
-aFontProps[ "style:font-family-asia" ] = rFont.familyName;
+aFontProps[ "style:font-family-asian" ] = rFont.familyName;
 aFontProps[ "style:font-family-complex" ] = rFont.familyName;
 
 // bold
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index cc2cee18eb6a..de44dcf711b4 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -976,7 +976,7 @@ void WriterXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_
 // TODO: tdf#143095: use system font name rather than PSName
 SAL_INFO("sdext.pdfimport", "The font used in xml is: " << 
rFont.familyName);
 aFontProps[ "fo:font-family" ] = rFont.familyName;
-aFontProps[ "style:font-family-asia" ] = rFont.familyName;
+aFontProps[ "style:font-family-asian" ] = rFont.familyName;
 aFontProps[ "style:font-family-complex" ] = rFont.familyName;
 
 // bold


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

2022-12-01 Thread Daniel Lohmann (via logerrit)
 sdext/source/presenter/PresenterScreen.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 9db4f60bfc5aa90a9062e429a07889b60ae99e9c
Author: Daniel Lohmann 
AuthorDate: Sun Nov 27 19:54:15 2022 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Thu Dec 1 10:53:32 2022 +0100

tdf#92717 Presenter screen on one monitor

If the presenter screen should be shown as normal window (not a
full screen window) the presenter screen can also be shown on one
monitor, as then the presenter screen can be minimized.

This is a follow up to a15bcda0e21be04bec424172192f2416b7f52422

Change-Id: I6fd19aa120a0b0e894b156b4bd10059741f91dc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143355
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Samuel Mehrbrodt 

diff --git a/sdext/source/presenter/PresenterScreen.cxx 
b/sdext/source/presenter/PresenterScreen.cxx
index c4f2cda50f3e..cf24a26f7bf1 100644
--- a/sdext/source/presenter/PresenterScreen.cxx
+++ b/sdext/source/presenter/PresenterScreen.cxx
@@ -465,17 +465,19 @@ sal_Int32 PresenterScreen::GetPresenterScreenNumber (
 // There is either only one screen or the full screen
 // presentation spans all available screens.  The presenter
 // screen is shown only when a special flag in the configuration
-// is set.
+// is set or when the presenter screen will be shown as
+// non-full screen window
 Reference xContext (mxContextWeak);
 PresenterConfigurationAccess aConfiguration (
 xContext,
 "/org.openoffice.Office.PresenterScreen/",
 PresenterConfigurationAccess::READ_ONLY);
 bool bStartAlways (false);
+bool bPresenterScreenFullScreen = 
isPresenterScreenFullScreen(xContext);
 if (aConfiguration.GetConfigurationNode(
 "Presenter/StartAlways") >>= bStartAlways)
 {
-if (bStartAlways)
+if (bStartAlways || !bPresenterScreenFullScreen)
 return GetPresenterScreenFromScreen(nScreenNumber);
 }
 return -1;


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

2022-11-27 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cea9ca3b77ef7f8f11c3eae0786986028161301c
Author: Caolán McNamara 
AuthorDate: Sun Nov 27 16:23:10 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Nov 27 20:14:07 2022 +0100

cid#982469 Unchecked dynamic_cast

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

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 2356ddc254c4..2e56bb449662 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -706,7 +706,7 @@ void DrawXmlOptimizer::optimizeTextElements(Element& 
rParent)
 )
 {
 pCur->updateGeometryWith( pNext );
-if (pPara->bRtl)
+if (pPara && pPara->bRtl)
 {
 // Tdf#152083: If RTL, reverse the text in pNext so 
that its correct order is
 // restored when the combined text is reversed in 
DrawXmlEmitter::visit.


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

2022-11-25 Thread Xisco Fauli (via logerrit)
 dev/null |binary
 1 file changed

New commits:
commit 9206895999f36a8199862912afe0ca91462e914a
Author: Xisco Fauli 
AuthorDate: Fri Nov 25 10:22:08 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 15:18:05 2022 +0100

sdext: remove unused document

it was added in bc48dbe08db537f41e42839a0493317298606413
"sdext.pdfimport: Use string() in xpath for testTdf104597_textrun"
for no reason

Change-Id: I58abed336cb4c8ca5cfe488f81fbf2332ff43c34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143278
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git 
a/sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf 
b/sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf
deleted file mode 100644
index 635004c2e302..
Binary files 
a/sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf and 
/dev/null differ


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

2022-11-24 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/tests.cxx|   11 ++---
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |   46 ++-
 2 files changed, 49 insertions(+), 8 deletions(-)

New commits:
commit 3a2f0e4772e7b4646dd518b33aeafb6fd7025179
Author: Kevin Suo 
AuthorDate: Sun Nov 20 00:10:14 2022 +0800
Commit: Noel Grandin 
CommitDate: Fri Nov 25 08:44:02 2022 +0100

Resolves tdf#152083: Ligatures are incorrectly reversed in Draw pdf import

For the string "بسم الله الرحمن الرحیم", the xpdfimport generates the 
following drawChar tokens:
drawChar 438.50 723.30 446.744000 723.30 1.00 0.00 
0.00 1.00 12.00 م
drawChar 446.696000 723.30 450.908000 723.30 1.00 0.00 
0.00 1.00 12.00 ی
drawChar 450.896000 723.30 458.804000 723.30 1.00 0.00 
0.00 1.00 12.00 ح
drawChar 458.792000 723.30 463.784000 723.30 1.00 0.00 
0.00 1.00 12.00 ر
drawChar 463.688000 723.30 467.048000 723.30 1.00 0.00 
0.00 1.00 12.00 ل
drawChar 467.072000 723.30 469.964000 723.30 1.00 0.00 
0.00 1.00 12.00 ا
drawChar 469.964000 723.30 473.708000 723.30 1.00 0.00 
0.00 1.00 12.00
drawChar 473.756000 723.30 482.78 723.30 1.00 0.00 
0.00 1.00 12.00 ن
drawChar 482.756000 723.30 490.028000 723.30 1.00 0.00 
0.00 1.00 12.00 م
drawChar 490.04 723.30 497.948000 723.30 1.00 0.00 
0.00 1.00 12.00 ح
drawChar 497.936000 723.30 502.928000 723.30 1.00 0.00 
0.00 1.00 12.00 ر
drawChar 502.928000 723.30 506.288000 723.30 1.00 0.00 
0.00 1.00 12.00 ل
drawChar 506.312000 723.30 509.204000 723.30 1.00 0.00 
0.00 1.00 12.00 ا
drawChar 509.108000 723.30 512.852000 723.30 1.00 0.00 
0.00 1.00 12.00
drawChar 512.90 723.30 527.216000 723.30 1.00 0.00 
0.00 1.00 12.00 الله
drawChar 527.204000 723.30 530.948000 723.30 1.00 0.00 
0.00 1.00 12.00
drawChar 530.996000 723.30 539.24 723.30 1.00 0.00 
0.00 1.00 12.00 م
drawChar 539.288000 723.30 552.02 723.30 1.00 0.00 
0.00 1.00 12.00 س
drawChar 551.888000 723.30 555.236000 723.30 1.00 0.00 
0.00 1.00 12.00 ب

Previously, all the above are combined to a single text frame in 
DrawXmlOptimizer::optimizeTextElements,
and then the text in the text frame is reversed (commit 
69e9925ded584113e52f84ef0ed7c224079fa061, and
further improved by commit 50d73574b6c3d71f9a539c895a15d6fcda22390b).

The problem is that, the single token "الله" was already in correct order. 
Thus when it is reversed
together with others, the order for itself would be wrong. Fix this by 
doing a pre-reverse.

The space char needs special treatment, as observed in 
tdf104597_textrun.pdf.

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

diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index c199c2cc4547..7c10c85b29a5 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -798,15 +798,14 @@ namespace
 // Test for امُ عَلَيْكَ
 OString xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 14821.958333 
2159.23861112778)']/draw:text-box/text:p/text:span)";
 OUString sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم 
َعَلْيَك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"امُ 
عَلَيَْك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
 
-// Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
+// Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the 
امُ عَلَيَْك which is in the 2nd frame (from left to right)
 // thus these two frames together appear as ٱلسََّل امُ عَلَيْكَ 
in Draw‬.
 // FIXME: Should be ٱلسَّلَامُ عَلَيْكَ (i.e. the two text frames 
should be merged into one so that the ل and the ا will show as لَا rather than 
ل ا)
-// Note: this is commented due to ٱلسََّل is currently shown as 
ٱلَّسَل and will be fixed in a separate commit.
-//xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']

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

2022-11-20 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf |binary
 sdext/source/pdfimport/test/tests.cxx|   54 
+-
 2 files changed, 28 insertions(+), 26 deletions(-)

New commits:
commit bc48dbe08db537f41e42839a0493317298606413
Author: Kevin Suo 
AuthorDate: Sat Nov 19 19:01:04 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Nov 20 12:00:08 2022 +0100

sdext.pdfimport: Use string() in xpath for testTdf104597_textrun

...and remove the TODO comments.

Also, comment out the test for string ٱلسََّل which is related to 
tdf#152083 and will be fixed in a separate commit.

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

diff --git 
a/sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf 
b/sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf
new file mode 100644
index ..635004c2e302
Binary files /dev/null and 
b/sdext/source/pdfimport/test/testdocs/testTdf152083_rtl-ligatures.pdf differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 786815941445..c199c2cc4547 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -796,28 +796,33 @@ namespace
 xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
 
 // Test for امُ عَلَيْكَ
-// TODO: How to get the "عَلَيْكَ" in xpath, as shown after the 
 tag?
-OString xpath = 
"//draw:frame[@draw:transform='matrix(917. 0 0 917. 
14821.958333 2159.23861112778)']/draw:text-box/text:p/text:span";
-OUString sContent = getXPathContent(pXmlDoc, xpath); // 
u"\nا\nُ\nم\n"
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم"), 
sContent.replaceAll("\n", ""));
-
-// Test for ٱلَّسَل‬ . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
-// thus these two frames together appear as ٱلَّسَل امُ عَلَيْكَ 
in Draw‬.
-xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']/draw:text-box/text:p/text:span";
+OString xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 14821.958333 
2159.23861112778)']/draw:text-box/text:p/text:span)";
+OUString sContent = getXPathContent(pXmlDoc, xpath);
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم 
َعَلْيَك"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
+
+// Test for ٱلسََّل . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
+// thus these two frames together appear as ٱلسََّل امُ عَلَيْكَ 
in Draw‬.
+// FIXME: Should be ٱلسَّلَامُ عَلَيْكَ (i.e. the two text frames 
should be merged into one so that the ل and the ا will show as لَا rather than 
ل ا)
+// Note: this is commented due to ٱلسََّل is currently shown as 
ٱلَّسَل and will be fixed in a separate commit.
+//xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']/draw:text-box/text:p/text:span)";
+//sContent = getXPathContent(pXmlDoc, xpath);
+//CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"ٱلسََّل"), sContent.replaceAll("\n\n", " ").replaceAll("\n", ""));
+
+// Test for "LibreOffice RTL"
+xpath = 
"string(//draw:frame[@draw:transform='matrix(917. 0 0 
917. 12779.375 5121.79583335)']/draw:text-box/text:p/text:span)";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"ٱلَّسَل"), sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice RTL"), sContent.replaceAll("\n\n", " ").replaceAll("\n", 
""));
 
-// Test for "LibreOffice LTR"
-// TODO: How to get the "LTR" as shown after the  tag?
-xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 12779.375 5121.79583335)']/draw:text-box/text:p/text:span";
+// Test for "LibreOffice LTR (test)"
+xpath = 
"string(//draw:frame[last()-1]/draw:text-box/text:p/text:span[last()])";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice"), sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice LTR (test)"), sContent.replaceAll("\n\n", " 
").replaceAll("\n", ""));
 
 /* Test for Chinese

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

2022-11-07 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/testSpace.pdf |binary
 sdext/source/pdfimport/test/tests.cxx  |   38 +
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   28 +--
 3 files changed, 63 insertions(+), 3 deletions(-)

New commits:
commit c2e2997f452b93b400d541c2d0b2ee396a889007
Author: Kevin Suo 
AuthorDate: Wed Oct 19 19:08:27 2022 +0800
Commit: Noel Grandin 
CommitDate: Tue Nov 8 08:40:29 2022 +0100

sdext.pdfimport - Wirter: add handling for continuous space characters

This was done for Draw in sdext/source/pdfimport/tree/drawtreevisiting.cxx,
but was not done for Writer. Without this, continuous spaces in PDF will
show only one space on pdfimport using the Writer pdfimport filter.

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

diff --git a/sdext/source/pdfimport/test/testdocs/testSpace.pdf 
b/sdext/source/pdfimport/test/testdocs/testSpace.pdf
new file mode 100644
index ..3c94f31ea15b
Binary files /dev/null and b/sdext/source/pdfimport/test/testdocs/testSpace.pdf 
differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 71661ae9e6d5..786815941445 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -841,6 +841,43 @@ namespace
 #endif
 }
 
+void testSpaces()
+{
+#if HAVE_FEATURE_POPPLER
+rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory());
+
+OString aOutput;
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/testSpace.pdf"),
+new OutputWrapString(aOutput),
+nullptr);
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
+
+// Space test: there are 10 spaces, each space is expressed as a 
,
+// thus the 10th text:s should exist and the attribute "text:c" 
should be "1".
+OString xpath = 
"//draw:frame[@draw:z-index='1'][1]/draw:text-box/text:p/text:span/text:s[10]";
+OUString  sContent = getXPath(pXmlDoc, xpath, "c");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString("1"), 
sContent);
+
+// Tab test: there are 10 tabs. Text before and after the tabs are 
shown in different draw frames.
+// With the Liberation Serif font, the horizontal position of the 
first frame is 20.03mm and the
+// second frame is 94.12mm.
+xpath = "//draw:frame[@draw:z-index='2'][1]";
+sContent = getXPath(pXmlDoc, xpath, "transform");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString("translate( 20.03mm 25.05mm )"), sContent);
+xpath = "//draw:frame[@draw:z-index='3'][1]";
+sContent = getXPath(pXmlDoc, xpath, "transform");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString("translate( 94.12mm 25.05mm )"), sContent);
+
+// Non-breaking space test: there are 10 NBSpaces, which are 
treated as the same as normal space in PDF,
+// thus each is expressed as a .
+// The 10th text:s should exist and the attribute "text:c" should 
be "1".
+xpath = 
"//draw:frame[@draw:z-index='4'][1]/draw:text-box/text:p/text:span/text:s[10]";
+sContent = getXPath(pXmlDoc, xpath, "c");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString("1"), 
sContent);
+#endif
+}
+
 CPPUNIT_TEST_SUITE(PDFITest);
 CPPUNIT_TEST(testXPDFParser);
 CPPUNIT_TEST(testOdfWriterExport);
@@ -853,6 +890,7 @@ namespace
 CPPUNIT_TEST(testTdf78427_FontWeight_MyraidProSemibold);
 CPPUNIT_TEST(testTdf143959_nameFromFontFile);
 CPPUNIT_TEST(testTdf104597_textrun);
+CPPUNIT_TEST(testSpaces);
 CPPUNIT_TEST_SUITE_END();
 };
 
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index deabf365088b..510689be1588 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -81,7 +81,11 @@ void WriterXmlEmitter::visit( TextElement& elem, const 
std::list< std::unique_pt
 if( elem.Text.isEmpty() )
 return;
 
-PropertyMap aProps;
+PropertyMap aProps = {};
+const sal_Unicode strSpace = 0x0020;
+const sal_Unicode strNbSpace = 0x00A0;
+const sal_Unicode tabSpace = 0x0009;
+
 if( elem.StyleId != -1 )
 {
 aProps[ OUString( "text:style-name" ) ] =
@@ -111,8 +115,26 @@ void WriterXmlEmitter::visit( TextElement& elem, const 
std::list< std::unique_pt
 str = ::comphelper::string::reverseString(s

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

2022-11-06 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/writertreevisiting.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9ea9d3ccc0f8e4833e745d9655b61d42d6d8fe83
Author: Kevin Suo 
AuthorDate: Sun Oct 23 19:10:29 2022 +0800
Commit: Noel Grandin 
CommitDate: Sun Nov 6 12:43:07 2022 +0100

sdext.pdfimport Writer: Do not visit DrawElement twice in WriterXmlEmitter

Discovered when working on commit f6004e1c457ddab5e0c91e6159875d25130b108a.

To reproduce, you can print the content of aOutput2 above the line:

https://opengrok.libreoffice.org/xref/core/sdext/source/pdfimport/test/tests.cxx?r=f6004e1c#836,
and then you get the xml content as shown in:
https://bugs.documentfoundation.org/attachment.cgi?id=183217,
in which you can see that there are duplicated draw:frame(s) with identical 
draw:z-index.

To dig into the problem, you may take a look at the following code block:

1for( const auto& rxChild : elem.Children )
2{
3PageElement* pPage = dynamic_cast(rxChild.get());
4if( pPage )
5{
6for( auto child_it = pPage->Children.begin(); child_it != 
pPage->Children.end(); ++child_it )
7{
8if( dynamic_cast(child_it->get()) != nullptr 
)
9(*child_it)->visitedBy( *this, child_it );
10   }
11   }
12   }
13
14   for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
15   {
16   if( dynamic_cast(it->get()) != nullptr )
17   (*it)->visitedBy( *this, it );
18   }

In the for loop in lines 1:12:
* "elem" is a "DocumentElement" which is derived from "Element". It's 
childen are PageElement(s).
* "pPage" is a "PageElement" which is also derived from "Element". It's 
childen are DrawElement(s).
* "child_it", as in the for loop in lines 6:10, is a "DrawElement" which is 
derived from
"GraphicalElement", whereas "GraphicalElement" is derived from "Element".
In this block, the code goes through each of the pages and visit the 
DrawElements there.

The code in lines 14:18 seems to assume that, a DrawElement, in addition to 
be a child of
PageElement, may also be a child of DocumentElement. See the comment in 
souce code.
Yes, it may be. For such DrawElement(s), the visiting is done in lines 
14:18 separately.

Note that The above code uses dynamic_cast to determine whether a node is a 
DrawElement or not.

The problem is that, in determining whether the node during the 2nd 
visiting is a DrawElement,
it accidently used "== nullptr". This may be an inadvertent error. If the 
dynamic_cast is a nullprt,
then it is not a DrawElement and the visiting should not be done there.

Resolve this by using "!= nullptr" in the second dynamic_cast checking.

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

diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 2ece5307bd53..deabf365088b 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -382,7 +382,7 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const 
std::list< std::uniqu
 // only DrawElement types
 for( auto it = elem.Children.begin(); it != elem.Children.end(); ++it )
 {
-if( dynamic_cast(it->get()) == nullptr )
+if( dynamic_cast(it->get()) != nullptr )
 (*it)->visitedBy( *this, it );
 }
 


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

2022-10-24 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/tests.cxx |   28 +++-
 1 file changed, 11 insertions(+), 17 deletions(-)

New commits:
commit 8ae0ce1bfa9fe6fa7fa54bafb5541c3f78d9e9b5
Author: Kevin Suo 
AuthorDate: Fri Oct 21 00:40:19 2022 +0800
Commit: Noel Grandin 
CommitDate: Mon Oct 24 09:13:11 2022 +0200

sdext.pdfimport: refactor this unit test and active it for Windows

This unit test was disabled for Windows build in commit 
fc45e54be6ba5d4685ae4ef3c3ea696fc99cccd4,
due to the "crashes on the windows jenkins boxes".

In this patch, I:
1. Rename the test name to show its purpose for easier reading;
2. Test the whole string all at once using xpath, rather than use indexOf().
   This way we can not only test the existance of the characters, but also
   the order they appear.
3. Activate it for Windows build and hope it passes on Jenkins.
4. Remove the std::cout debug code, and use CPPUNIT_ASSERT_EQUAL_MESSAGE
   instead, so that the xml content (i.e. aOutput) is only shown when the
   assertion fails.
5. Move the test document to testdocs directory.

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

diff --git a/sdext/source/pdfimport/test/testTdf141709.pdf 
b/sdext/source/pdfimport/test/testdocs/testTdf141709_chinesechar.pdf
similarity index 100%
rename from sdext/source/pdfimport/test/testTdf141709.pdf
rename to sdext/source/pdfimport/test/testdocs/testTdf141709_chinesechar.pdf
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 7cff15a36d0f..71661ae9e6d5 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -556,32 +556,26 @@ namespace
 #endif
 }
 
-void testTdf141709()
+void testTdf141709_chinesechar()
 {
 // this test crashes on the windows jenkins boxes, but no-one can catch it 
locally
-#if HAVE_FEATURE_POPPLER && !defined(_WIN32)
+#if HAVE_FEATURE_POPPLER
 rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
 xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
 
 OString aOutput;
 CPPUNIT_ASSERT_MESSAGE("Exporting to ODF",
-
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testTdf141709.pdf"),
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/testTdf141709_chinesechar.pdf"),
 new OutputWrapString(aOutput),
 nullptr));
-std::cout << aOutput << std::endl;
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
 // This ensures that the imported text contains all of the 
characters
-CPPUNIT_ASSERT(aOutput.indexOf("敏") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("捷") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("的") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("狐") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("狸") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("跨") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("过") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("慵") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("懒") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("的") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("狗") != -1);
-CPPUNIT_ASSERT(aOutput.indexOf("。") != -1);
+OString xpath = 
"//draw:frame[@draw:z-index='3'][1]/draw:text-box/text:p/text:span[1]";
+OUString  sContent = getXPathContent(pXmlDoc, 
xpath).replaceAll("\n", "");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"敏捷的狐狸跨过慵懒的"), sContent);
+xpath = 
"//draw:frame[@draw:z-index='4'][1]/draw:text-box/text:p/text:span[1]";
+sContent = getXPathContent(pXmlDoc, xpath).replaceAll("\n", "");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"狗。"), 
sContent);
 #endif
 }
 
@@ -854,7 +848,7 @@ namespace
 CPPUNIT_TEST(testTdf96993);
 CPPUNIT_TEST(testTdf98421);
 CPPUNIT_TEST(testTdf105536);
-CPPUNIT_TEST(testTdf141709);
+CPPUNIT_TEST(testTdf141709_chinesechar);
 CPPUNIT_TEST(testTdf78427_FontFeatures);
 CPPUNIT_TEST(testTdf78427_FontWeight_MyraidProSemibold);
 CPPUNIT_TEST(testTdf143959_nameFromFontFile);


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

2022-10-19 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/tests.cxx  |   30 ++---
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   46 +++--
 sdext/source/pdfimport/tree/writertreevisiting.hxx |4 +
 3 files changed, 70 insertions(+), 10 deletions(-)

New commits:
commit f6004e1c457ddab5e0c91e6159875d25130b108a
Author: Kevin Suo 
AuthorDate: Sat Oct 15 19:43:54 2022 +0800
Commit: Thorsten Behrens 
CommitDate: Wed Oct 19 21:34:13 2022 +0200

tdf#151546: RTL text is reversed (Writer pdfimport)

This is a followup to commit 69e9925ded584113e52f84ef0ed7c224079fa061
for the fix of tdf#104597.

The Writer pdf import filter code is similar than the Draw part.
However, many fixes to the Draw part was not done in the Writer part 
historically.

This patch ports the fix of text run in the Draw part to the Writer
part. There is a todo related to continuous spaces issue which should
be fixed separately.

Also use CPPUNIT_ASSERT_EQUAL_MESSAGE for the output of xml content
instread of using std::cout, in case of unit test failure.

Change-Id: Id013700524750e6e5283d85eeab72d8075f16f1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141420
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 25c12a23901c..7cff15a36d0f 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -799,36 +799,54 @@ namespace
 new OutputWrapString(aOutput),
 nullptr));
 
-// std::cout << aOutput << std::endl;
 xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
 
 // Test for امُ عَلَيْكَ
 // TODO: How to get the "عَلَيْكَ" in xpath, as shown after the 
 tag?
 OString xpath = 
"//draw:frame[@draw:transform='matrix(917. 0 0 917. 
14821.958333 2159.23861112778)']/draw:text-box/text:p/text:span";
 OUString sContent = getXPathContent(pXmlDoc, xpath); // 
u"\nا\nُ\nم\n"
-CPPUNIT_ASSERT_EQUAL(OUString(u"اُم"), sContent.replaceAll("\n", 
""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString(u"اُم"), 
sContent.replaceAll("\n", ""));
 
 // Test for ٱلَّسَل‬ . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
 // thus these two frames together appear as ٱلَّسَل امُ عَلَيْكَ 
in Draw‬.
 xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17420.17 
2159.23861112778)']/draw:text-box/text:p/text:span";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL(OUString(u"ٱلَّسَل"), 
sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"ٱلَّسَل"), sContent.replaceAll("\n", ""));
 
 // Test for "LibreOffice LTR"
 // TODO: How to get the "LTR" as shown after the  tag?
 xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 12779.375 5121.79583335)']/draw:text-box/text:p/text:span";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL(OUString(u"LibreOffice"), 
sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"LibreOffice"), sContent.replaceAll("\n", ""));
 
 /* Test for Chinese characters */
 // Use last() instead of matrix below, because the matrix may be 
different on different OS due to fallback of Chinese fonts.
 xpath = "//draw:frame[last()]/draw:text-box/text:p/text:span";
 sContent = getXPathContent(pXmlDoc, xpath);
-CPPUNIT_ASSERT_EQUAL(OUString(u"中文测试,中文"), 
sContent.replaceAll("\n", ""));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), 
OUString(u"中文测试,中文"), sContent.replaceAll("\n", ""));
+
+// Test pdf text run in the Writer PDF import filter
+xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory());
+OString aOutput2;
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf"),
+new OutputWrapString(aOutput2),
+nullptr);
+// FIXME: the same draw:frame is duplicated in the xml output,
+// e.g. there are two draw:frame with draw:z-index="3" with the 
same content.
+xmlDocUniquePtr pXmlDoc2(xmlParseDoc(reinterpret_cast(aOutput2.getStr(;
+xpath = 
"//draw:frame[@draw:z-index='3'][1]/draw:text-box/text:p/text:span";
+sContent = getXPathContent(pXmlDoc2, xpath).replaceAll("\n", "");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput2.getStr(), 
OUString(u"ٱلَّسَل"), sCon

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

2022-10-13 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf |binary
 sdext/source/pdfimport/test/tests.cxx  |   44 +
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   17 +
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |   18 -
 4 files changed, 48 insertions(+), 31 deletions(-)

New commits:
commit 69e9925ded584113e52f84ef0ed7c224079fa061
Author: Kevin Suo 
AuthorDate: Tue Oct 11 10:04:16 2022 +0800
Commit: Thorsten Behrens 
CommitDate: Thu Oct 13 21:38:12 2022 +0200

sdext.pdfimport: resolves tdf#104597: RTL script text runs are reversed

For the simple Arabic string: ٱلسَّلَامُ عَلَيْك, the xpdfimport binary 
generates the
follwing (drawchar) sequences:
كَ
يْ
لَ
عَ
مُ
ا
لَ
سَّ
ل
ٱ
(i.e., in reversed order, one character by one character).

Before this patch, after pdfimport the text shows up as لَسَّلٱ كَيْلَعَ 
مُا, which is reversed.

It was surposed to combine these characters into text frames in
DrawXmlOptimizer::optimizeTextElements(Element& rParent) 
(sdext/source/pdfimport/\
tree/drawtreevisiting.cxx:677), but actually it was not combined 
successfully there.
The single characters were then passed to 
sdext/source/pdfimport/tree/drawtreevisiting\
.cxx:105, one by one, in the hope that the strings could be mirrored. The 
mirroring
failed, because one single character, even after mirroring, always equals 
itself.

The DrawXmlOptimizer::optimizeTextElements failed to combine the characters 
into
one text frame, because the condition:
(rCurGC.Transformation == rNextGC.Transformation || notTransformed(rNextGC))
would never be true, as at least its horizontal position is different. A 
further analysis
indicates that we do not need to check the transformation here at all, as 
this is an
optimizer for a TextElement and in case a character is transformed then it 
would already
be in a different draw element (thus will never be combined with this 
TextElement).

After the fix of DrawXmlOptimizer::optimizeTextElements which now 
successfully
combines the characters, there is another issue in the old 
PDFIProcessor::mirrorString
function. It seems to mirror the characters within a word, but if a string 
contains
two words, then the two words are not successfully switched (e.g. for 
string "abc def"
it produces "cba fed" rather than "fed cba"),  which is not suitable for
the case of RTL which requires all the characters been reversed. Fix this 
by using
comphelper::string::reverseString.

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

diff --git a/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf 
b/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf
new file mode 100644
index ..dcee96aa3169
Binary files /dev/null and 
b/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 193ec2227620..25c12a23901c 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -786,6 +787,48 @@ namespace
 #endif
 }
 
+void testTdf104597_textrun()
+{
+#if HAVE_FEATURE_POPPLER
+rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
+
+OString aOutput;
+CPPUNIT_ASSERT_MESSAGE("Converting PDF to ODF XML",
+
xAdaptor->odfConvert(m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/tdf104597_textrun.pdf"),
+new OutputWrapString(aOutput),
+nullptr));
+
+// std::cout << aOutput << std::endl;
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
+
+// Test for امُ عَلَيْكَ
+// TODO: How to get the "عَلَيْكَ" in xpath, as shown after the 
 tag?
+OString xpath = 
"//draw:frame[@draw:transform='matrix(917. 0 0 917. 
14821.958333 2159.23861112778)']/draw:text-box/text:p/text:span";
+OUString sContent = getXPathContent(pXmlDoc, xpath); // 
u"\nا\nُ\nم\n"
+CPPUNIT_ASSERT_EQUAL(OUString(u"اُم"), sContent.replaceAll("\n", 
""));
+
+// Test for ٱلَّسَل‬ . It appears in the 3rd frame, i.e. after the 
امُ عَلَيْكَ which is in the 2nd frame (from left to right)
+// thus these two frames together appear as ٱلَّسَل امُ عَلَيْكَ 
in Draw‬.
+xpath = "//draw:frame[@draw:transform='matrix(917. 0 0 
917. 17

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

2022-09-13 Thread Sam James (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit b7d63694985bbb1cf86eb71769feadb28ce68c17
Author: Sam James 
AuthorDate: Fri Sep 2 04:31:18 2022 +0100
Commit: Michael Stahl 
CommitDate: Tue Sep 13 12:32:58 2022 +0200

Fix build with Poppler 22.09.0

With Poppler 22.09.0, LO fails to build with:
```

/var/tmp/portage/app-office/libreoffice-7.3.5.2/work/libreoffice-7.3.5.2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:682:36:
 error: too many arguments to function call, expected single argument 'start', 
have 3 arguments
state->getLineDash(&dashArray, &arrayLen, &startOffset);
~~ ^~~
/usr/include/poppler/GfxState.h:1506:32: note: 'getLineDash' declared here
const std::vector &getLineDash(double *start)
   ^
1 error generated.
```

Poppler changed the getLineDash interface:
```
-void getLineDash(double **dash, int *length, double *start)
+const std::vector &getLineDash(double *start)
```

Signed-off-by: Sam James 
Change-Id: I29e18f20d7650a7fcac1bc8ab4aaa04aaa2ab8fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139249
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index f12478cb2f4d..3ad139b65fa3 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -678,8 +678,15 @@ void PDFOutDev::updateLineDash(GfxState *state)
 return;
 assert(state);
 
-double* dashArray; int arrayLen; double startOffset;
+int arrayLen; double startOffset;
+#if POPPLER_CHECK_VERSION(22, 9, 0)
+const std::vector &dash = state->getLineDash(&startOffset);
+const double* dashArray = dash.data();
+arrayLen = dash.size();
+#else
+double* dashArray;
 state->getLineDash(&dashArray, &arrayLen, &startOffset);
+#endif
 
 printf( "updateLineDash" );
 if( arrayLen && dashArray )


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

2022-08-16 Thread Caolán McNamara (via logerrit)
 sdext/source/presenter/PresenterSlideSorter.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4c511ac7d7a006d9a62a3685f3a962bb321017bd
Author: Caolán McNamara 
AuthorDate: Tue Aug 16 09:12:12 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 16 17:37:14 2022 +0200

cid#1500417 Dereference after null check

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

diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx 
b/sdext/source/presenter/PresenterSlideSorter.cxx
index 441688fb8a6c..ef33a4dde634 100644
--- a/sdext/source/presenter/PresenterSlideSorter.cxx
+++ b/sdext/source/presenter/PresenterSlideSorter.cxx
@@ -1819,7 +1819,7 @@ void 
PresenterSlideSorter::CurrentSlideFrameRenderer::PaintCurrentSlideFrame (
 rxCanvas,
 xClip,
 rSlideBoundingBox.X + rSlideBoundingBox.Width,
-rSlideBoundingBox.Y - mpTopLeft->mnHeight);
+rSlideBoundingBox.Y - mpTopRight->mnHeight);
 }
 if (mpBottomLeft)
 {


[Libreoffice-commits] core.git: sdext/source svx/source xmloff/source

2022-07-14 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |   25 +++
 svx/source/unodraw/unoshape.cxx  |3 +-
 xmloff/source/draw/ximpshap.cxx  |5 ++--
 3 files changed, 22 insertions(+), 11 deletions(-)

New commits:
commit e00225bc7744abd365f1cc7133d43026e9438f13
Author: Noel Grandin 
AuthorDate: Thu Jul 14 14:33:21 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Jul 14 19:12:33 2022 +0200

elide some temporary OUStrings

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

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index dfdec02539db..51ef5f232d85 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -188,21 +188,30 @@ void DrawXmlEmitter::fillFrameProps( DrawElement&   
rElem,
  bool   bWasTransformed
  )
 {
-rProps[ "draw:z-index" ] = OUString::number( rElem.ZOrder );
-rProps[ "draw:style-name"] = rEmitContext.rStyles.getStyleName( 
rElem.StyleId );
+static constexpr OUStringLiteral sDrawZIndex = u"draw:z-index";
+static constexpr OUStringLiteral sDrawStyleName = u"draw:style-name";
+static constexpr OUStringLiteral sDrawTextStyleName = 
u"draw:text-style-name";
+static constexpr OUStringLiteral sSvgX = u"svg:x";
+static constexpr OUStringLiteral sSvgY = u"svg:y";
+static constexpr OUStringLiteral sSvgWidth = u"svg:width";
+static constexpr OUStringLiteral sSvgHeight = u"svg:height";
+static constexpr OUStringLiteral sDrawTransform = u"draw:transform";
+
+rProps[ sDrawZIndex ] = OUString::number( rElem.ZOrder );
+rProps[ sDrawStyleName ] = rEmitContext.rStyles.getStyleName( 
rElem.StyleId );
 
 if (rElem.IsForText)
-rProps["draw:text-style-name"] = 
rEmitContext.rStyles.getStyleName(rElem.TextStyleId);
+rProps[ sDrawTextStyleName ] = 
rEmitContext.rStyles.getStyleName(rElem.TextStyleId);
 
 const GraphicsContext& rGC =
 rEmitContext.rProcessor.getGraphicsContext( rElem.GCId );
 
 if (bWasTransformed)
 {
-rProps[ "svg:x" ]   = convertPixelToUnitString(rElem.x);
-rProps[ "svg:y" ]   = convertPixelToUnitString(rElem.y);
-rProps[ "svg:width" ]   = convertPixelToUnitString(rElem.w);
-rProps[ "svg:height" ]  = convertPixelToUnitString(rElem.h);
+rProps[ sSvgX ]   = convertPixelToUnitString(rElem.x);
+rProps[ sSvgY ]   = convertPixelToUnitString(rElem.y);
+rProps[ sSvgWidth ]   = convertPixelToUnitString(rElem.w);
+rProps[ sSvgHeight ]  = convertPixelToUnitString(rElem.h);
 }
 else
 {
@@ -236,7 +245,7 @@ void DrawXmlEmitter::fillFrameProps( DrawElement&   
rElem,
 aBuf.append(mat.get(1, 2));
 aBuf.append(")");
 
-rProps["draw:transform"] = aBuf.makeStringAndClear();
+rProps[ sDrawTransform ] = aBuf.makeStringAndClear();
 }
 }
 
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 2280402dcb76..e559fe8b4b9f 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -143,8 +143,9 @@ namespace {
 class ShapePositionProvider : public PropertyValueProvider
 {
 public:
+static constexpr OUStringLiteral sPosition = u"Position";
 explicit ShapePositionProvider( SvxShape& _shape )
-:PropertyValueProvider( _shape, "Position" )
+:PropertyValueProvider( _shape, sPosition )
 {
 }
 
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 22c302205e02..2dc2e33fb91c 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -707,8 +707,9 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = 
true */)
 // SwTextBoxHelper::syncProperty, which indirectly calls 
SwTextBoxHelper::isTextBox)
 uno::Reference xPropertySetInfo
 = xPropSet->getPropertySetInfo();
-if (xPropertySetInfo->hasPropertyByName("TextBox"))
-xPropSet->setPropertyValue("TextBox", uno::Any(mbTextBox));
+static constexpr OUStringLiteral sTextBox = u"TextBox";
+if (xPropertySetInfo->hasPropertyByName(sTextBox))
+xPropSet->setPropertyValue(sTextBox, uno::Any(mbTextBox));
 
 // if this is an auto style, set its properties
 if(bAutoStyle && pDocStyle)


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

2022-07-14 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/inc/pdfihelper.hxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit bcb1620b3e4929df1d06d57b4769650422fff16e
Author: Noel Grandin 
AuthorDate: Thu Jul 14 09:43:22 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Jul 14 18:02:22 2022 +0200

speed up loading PDF file

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

diff --git a/sdext/source/pdfimport/inc/pdfihelper.hxx 
b/sdext/source/pdfimport/inc/pdfihelper.hxx
index 6b663b203e62..c6be1a6ba73e 100644
--- a/sdext/source/pdfimport/inc/pdfihelper.hxx
+++ b/sdext/source/pdfimport/inc/pdfihelper.hxx
@@ -64,9 +64,12 @@ namespace pdfi
 return fMM;
 }
 
+/// round to 2 decimal places
 inline double convPx2mmPrec2( double fPix )
 {
-return rtl_math_round( convPx2mm( fPix ), 2, 
rtl_math_RoundingMode_Floor );
+constexpr double px2mm = 25.4/PDFI_OUTDEV_RESOLUTION;
+double mm = fPix * ( px2mm * 100);
+return std::floor(mm) / 100;
 }
 
 /// Convert color to "#FEFEFE" color notation


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

2022-07-12 Thread Andras Timar (via logerrit)
 sdext/source/pdfimport/test/tests.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 5e1ab6a203843f98966956e706c888fd1f89e284
Author: Andras Timar 
AuthorDate: Mon Jul 11 23:38:00 2022 +0200
Commit: Andras Timar 
CommitDate: Tue Jul 12 09:08:12 2022 +0200

sdext: these tests won't run without poppler

Change-Id: I61deb7d5271bf87ac1bb3aad54c430ace8fd3f9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136975
Tested-by: Jenkins
Reviewed-by: Andras Timar 

diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index 77d98999d0d3..193ec2227620 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -586,6 +586,7 @@ namespace
 
 void testTdf78427_FontFeatures()
 {
+#if HAVE_FEATURE_POPPLER
 rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
 xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
 
@@ -712,10 +713,12 @@ namespace
 assertXPath(pXmlDoc, xpath, "font-weight", "normal");
 assertXPathNoAttribute(pXmlDoc, xpath, "font-style");
 assertXPath(pXmlDoc, xpath, "text-outline", "true");
+#endif
 }
 
 void testTdf78427_FontWeight_MyraidProSemibold() // Related to 
attachment 155937.
 {
+#if HAVE_FEATURE_POPPLER
 rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
 xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
 
@@ -745,10 +748,12 @@ namespace
 "\"]/style:text-properties";
 // the font-weight and font-style should be 300 (Light)
 assertXPath(pXmlDoc, xpath, "font-weight", "300");
+#endif
 }
 
 void testTdf143959_nameFromFontFile()
 {
+#if HAVE_FEATURE_POPPLER
 rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
 xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
 
@@ -778,6 +783,7 @@ namespace
  getXPath(pXmlDoc, xpath, 
"font-family").replaceAll(u" ", u""));
 CPPUNIT_ASSERT_EQUAL(OUString("bold"),
  getXPath(pXmlDoc, xpath, "font-weight"));
+#endif
 }
 
 CPPUNIT_TEST_SUITE(PDFITest);


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

2022-06-30 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/inc/genericelements.hxx |7 +++
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   14 +++---
 sdext/source/pdfimport/tree/genericelements.cxx|   14 +++---
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |6 +++---
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   12 ++--
 5 files changed, 30 insertions(+), 23 deletions(-)

New commits:
commit 3fe18ba1b0be041f66124324e96d9cb6d56ff5ce
Author: Noel Grandin 
AuthorDate: Wed Jun 29 20:49:53 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 1 08:16:49 2022 +0200

tdf#137544 reduce cost of dynamic_cast

casting to TextElement is very hot here

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

diff --git a/sdext/source/pdfimport/inc/genericelements.hxx 
b/sdext/source/pdfimport/inc/genericelements.hxx
index 63325213f59a..1fec2e6f4042 100644
--- a/sdext/source/pdfimport/inc/genericelements.hxx
+++ b/sdext/source/pdfimport/inc/genericelements.hxx
@@ -92,6 +92,10 @@ namespace pdfi
 /// Union element geometry with given element
 void updateGeometryWith( const Element* pMergeFrom );
 
+/// To avoid some dynamic_cast cost
+virtual const TextElement* dynCastAsTextElement() const { return 
nullptr; }
+virtual TextElement* dynCastAsTextElement() { return nullptr; }
+
 #if OSL_DEBUG_LEVEL > 0
 // xxx refact TODO: move code to visitor
 virtual void emitStructure( int nLevel );
@@ -175,6 +179,9 @@ namespace pdfi
 public:
 virtual void visitedBy( ElementTreeVisitor&, const std::list< 
std::unique_ptr >::const_iterator& ) override;
 
+virtual const TextElement* dynCastAsTextElement() const override { 
return this; }
+virtual TextElement* dynCastAsTextElement() override { return this; }
+
 OUStringBuffer Text;
 sal_Int32   FontId;
 };
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index ffc27c65f56c..dfdec02539db 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -492,7 +492,7 @@ void DrawXmlOptimizer::visit( PageElement& elem, const 
std::list< std::unique_pt
 nCurLineElements = 0;
 for( const auto& rxChild : pCurPara->Children )
 {
-TextElement* pTestText = 
dynamic_cast(rxChild.get());
+TextElement* pTestText = rxChild->dynCastAsTextElement();
 if( pTestText )
 {
 fCurLineHeight = (fCurLineHeight*double(nCurLineElements) 
+ pTestText->h)/double(nCurLineElements+1);
@@ -526,12 +526,12 @@ void DrawXmlOptimizer::visit( PageElement& elem, const 
std::list< std::unique_pt
 // or perhaps the draw element begins a new paragraph
 else if( next_page_element != elem.Children.end() )
 {
-TextElement* pText = 
dynamic_cast(next_page_element->get());
+TextElement* pText = 
(*next_page_element)->dynCastAsTextElement();
 if( ! pText )
 {
 ParagraphElement* pPara = 
dynamic_cast(next_page_element->get());
 if( pPara && ! pPara->Children.empty() )
-pText = 
dynamic_cast(pPara->Children.front().get());
+pText = 
pPara->Children.front()->dynCastAsTextElement();
 }
 if( pText && // check there is a text
 pDraw->h < pText->h*1.5 && // and it is approx the same 
height
@@ -560,9 +560,9 @@ void DrawXmlOptimizer::visit( PageElement& elem, const 
std::list< std::unique_pt
 }
 }
 
-TextElement* pText = dynamic_cast(page_element->get());
+TextElement* pText = (*page_element)->dynCastAsTextElement();
 if( ! pText && pLink && ! pLink->Children.empty() )
-pText = dynamic_cast(pLink->Children.front().get());
+pText = pLink->Children.front()->dynCastAsTextElement();
 if( pText )
 {
 Element* pGeo = pLink ? static_cast(pLink) :
@@ -671,11 +671,11 @@ void DrawXmlOptimizer::optimizeTextElements(Element& 
rParent)
 while( next != rParent.Children.end() )
 {
 bool bConcat = false;
-TextElement* pCur = dynamic_cast(it->get());
+TextElement* pCur = (*it)->dynCastAsTextElement();
 
 if( pCur )
 {
-TextElement* pNext = dynamic_cast(next->get());
+TextElement* pNext = (*next)->dynCastAsTextElement();
 bool isComplex = false;
 OUString str(pCur->Text.toString());
 for(int i=0; i< str.getLength(); i++)
diff --git a/sdext/source/pdfimport/tree/genericelements.cxx 
b/sdext/source/pdfimport/tree/

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

2022-06-29 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/tree/genericelements.cxx |   17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit eefba50f5908d535bce81b5b0d3d883715b6575e
Author: Noel Grandin 
AuthorDate: Wed Jun 29 16:36:16 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 29 22:10:27 2022 +0200

tdf#137544 reduce work in sdext::PageElement::resolveUnderlines

when opening complex pdf

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

diff --git a/sdext/source/pdfimport/tree/genericelements.cxx 
b/sdext/source/pdfimport/tree/genericelements.cxx
index f4dee87c71cb..2eb789616b30 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -332,6 +332,14 @@ void PageElement::resolveUnderlines( PDFIProcessor const & 
rProc )
 // FIXME: currently the algorithm used is quadratic
 // this could be solved by some sorting beforehand
 
+std::vector textAndHypers;
+textAndHypers.reserve(Children.size());
+for (auto const & p : Children)
+{
+if (dynamic_cast< TextElement* >(p.get()) || 
dynamic_cast(p.get()))
+textAndHypers.push_back(p.get());
+}
+
 auto poly_it = Children.begin();
 while( poly_it != Children.end() )
 {
@@ -372,9 +380,8 @@ void PageElement::resolveUnderlines( PDFIProcessor const & 
rProc )
 u_y = r_x; r_x = l_x; l_x = u_y;
 }
 u_y = aPoly.getB2DPoint(0).getY();
-for( const auto& rxChild : Children )
+for( Element* pEle : textAndHypers )
 {
-Element* pEle = rxChild.get();
 if( pEle->y <= u_y && pEle->y + pEle->h*1.1 >= u_y )
 {
 // first: is the element underlined completely ?
@@ -394,13 +401,13 @@ void PageElement::resolveUnderlines( PDFIProcessor const 
& rProc )
 pText->FontId = rProc.getFontId( aAttr );
 }
 }
-else if( dynamic_cast< HyperlinkElement* >(pEle) )
+else // must be HyperlinkElement
 bRemovePoly = true;
 }
 // second: hyperlinks may be larger than their underline
 // since they are just arbitrary rectangles in the action 
definition
-else if( dynamic_cast< HyperlinkElement* >(pEle) != nullptr &&
- l_x >= pEle->x && r_x <= pEle->x+pEle->w )
+else if( l_x >= pEle->x && r_x <= pEle->x+pEle->w &&
+dynamic_cast< HyperlinkElement* >(pEle) != nullptr )
 {
 bRemovePoly = true;
 }


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

2022-06-24 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/filterdet.cxx |5 -
 sdext/source/pdfimport/filterdet.hxx |4 
 sdext/source/pdfimport/inc/contentsink.hxx   |8 -
 sdext/source/pdfimport/inc/pdfparse.hxx  |   13 +-
 sdext/source/pdfimport/odf/odfemitter.cxx|7 -
 sdext/source/pdfimport/pdfparse/pdfparse.cxx |5 -
 sdext/source/pdfimport/sax/saxattrlist.hxx   |5 -
 sdext/source/presenter/PresenterAccessibility.cxx|   27 +++---
 sdext/source/presenter/PresenterAccessibility.hxx|4 
 sdext/source/presenter/PresenterBitmapContainer.cxx  |   25 ++---
 sdext/source/presenter/PresenterBitmapContainer.hxx  |   12 +-
 sdext/source/presenter/PresenterButton.cxx   |   25 ++---
 sdext/source/presenter/PresenterButton.hxx   |   12 +-
 sdext/source/presenter/PresenterController.cxx   |9 +-
 sdext/source/presenter/PresenterController.hxx   |4 
 sdext/source/presenter/PresenterCurrentSlideObserver.cxx |6 -
 sdext/source/presenter/PresenterCurrentSlideObserver.hxx |2 
 sdext/source/presenter/PresenterFrameworkObserver.cxx|5 -
 sdext/source/presenter/PresenterFrameworkObserver.hxx|2 
 sdext/source/presenter/PresenterHelpView.cxx |   11 +-
 sdext/source/presenter/PresenterHelpView.hxx |2 
 sdext/source/presenter/PresenterPaintManager.cxx |9 +-
 sdext/source/presenter/PresenterPaintManager.hxx |4 
 sdext/source/presenter/PresenterPaneBase.cxx |5 -
 sdext/source/presenter/PresenterPaneBase.hxx |2 
 sdext/source/presenter/PresenterPaneBorderPainter.cxx|7 -
 sdext/source/presenter/PresenterPaneFactory.cxx  |5 -
 sdext/source/presenter/PresenterPaneFactory.hxx  |2 
 sdext/source/presenter/PresenterProtocolHandler.cxx  |   67 +++
 sdext/source/presenter/PresenterScreen.cxx   |   17 ++-
 sdext/source/presenter/PresenterScreen.hxx   |2 
 sdext/source/presenter/PresenterScrollBar.cxx|   15 +--
 sdext/source/presenter/PresenterScrollBar.hxx|4 
 sdext/source/presenter/PresenterSlideShowView.cxx|   13 +-
 sdext/source/presenter/PresenterSlideShowView.hxx|6 -
 sdext/source/presenter/PresenterSlideSorter.cxx  |   13 +-
 sdext/source/presenter/PresenterSpritePane.cxx   |1 
 sdext/source/presenter/PresenterTextView.cxx |   13 +-
 sdext/source/presenter/PresenterTextView.hxx |   10 +-
 sdext/source/presenter/PresenterTheme.cxx|   15 +--
 sdext/source/presenter/PresenterTheme.hxx|4 
 sdext/source/presenter/PresenterTimer.cxx|7 -
 sdext/source/presenter/PresenterToolBar.cxx  |   35 ---
 sdext/source/presenter/PresenterToolBar.hxx  |6 -
 sdext/source/presenter/PresenterViewFactory.cxx  |5 -
 sdext/source/presenter/PresenterViewFactory.hxx  |2 
 sdext/source/presenter/PresenterWindowManager.cxx|9 +-
 sdext/source/presenter/PresenterWindowManager.hxx|4 
 48 files changed, 252 insertions(+), 223 deletions(-)

New commits:
commit 6c28906ff6b3cc2fc306d927010cf730e7ef5fbc
Author: Noel Grandin 
AuthorDate: Fri Jun 24 15:56:32 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 24 18:24:19 2022 +0200

clang-tidy modernize-pass-by-value in sdext

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

diff --git a/sdext/source/pdfimport/filterdet.cxx 
b/sdext/source/pdfimport/filterdet.cxx
index 18751a00490a..0f22b1e256b6 100644
--- a/sdext/source/pdfimport/filterdet.cxx
+++ b/sdext/source/pdfimport/filterdet.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 using namespace com::sun::star;
@@ -182,9 +183,9 @@ unsigned int FileEmitContext::readOrigBytes( unsigned int 
nOrigOffset, unsigned
 }
 
 
-PDFDetector::PDFDetector( const uno::Reference< uno::XComponentContext >& 
xContext) :
+PDFDetector::PDFDetector( uno::Reference< uno::XComponentContext > xContext) :
 PDFDetectorBase( m_aMutex ),
-m_xContext( xContext )
+m_xContext(std::move( xContext ))
 {}
 
 // XExtendedFilterDetection
diff --git a/sdext/source/pdfimport/filterdet.hxx 
b/sdext/source/pdfimport/filterdet.hxx
index 6c7d58ca048c..c5f8b0d58772 100644
--- a/sdext/source/pdfimport/filterdet.hxx
+++ b/sdext/source/pdfimport/filterdet.hxx
@@ -42,8 +42,8 @@ private:
 css::uno::XComponentContext > m_xContext;
 
 public:
-explicit PDFDetector( const css::uno::Reference<
-css::uno::XComponentContext >& xContext );
+explicit PDFDetector( css::uno::Reference<
+css::uno::X

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

2022-06-24 Thread Nathan Pratta Teodosio (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit ad1ffc62e40c2409b610dfff25a8483b1f2556ad
Author: Nathan Pratta Teodosio 
AuthorDate: Tue Jun 21 08:47:14 2022 -0300
Commit: Michael Stahl 
CommitDate: Fri Jun 24 11:12:53 2022 +0200

Follow-up for Poppler 22.06 update

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

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index d9efa39d8a54..f12478cb2f4d 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -476,10 +476,10 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, const GfxState* st
 // we must write byte count to stdout before
 #if POPPLER_CHECK_VERSION(22, 6, 0)
 std::optional> pBuf = 
gfxFont->readEmbFontFile( m_pDoc->getXRef() );
-nSize = pBuf->size();
-if ( nSize > 0 )
+if ( pBuf )
 {
 aNewFont.isEmbedded = true;
+nSize = pBuf->size();
 }
 #else
 char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
@@ -503,7 +503,8 @@ void PDFOutDev::writeFontFile( GfxFont* gfxFont ) const
 int nSize = 0;
 #if POPPLER_CHECK_VERSION(22, 6, 0)
 std::optional> pBuf = gfxFont->readEmbFontFile( 
m_pDoc->getXRef() );
-nSize = pBuf->size();
+if ( pBuf )
+nSize = pBuf->size();
 if ( nSize == 0 )
 return;
 #else


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

2022-06-23 Thread Nathan Pratta Teodosio (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   29 ++
 sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx|   10 ++
 2 files changed, 39 insertions(+)

New commits:
commit 0d0469b4302dfe95b016a6f04b145834b79d5ed3
Author: Nathan Pratta Teodosio 
AuthorDate: Tue Jun 21 08:47:14 2022 -0300
Commit: Michael Stahl 
CommitDate: Thu Jun 23 14:29:13 2022 +0200

Update for Poppler 22.06

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

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 02b6fe6a1b9e..d9efa39d8a54 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -474,12 +474,21 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, const GfxState* st
 {
 // TODO(P3): Unfortunately, need to read stream twice, since
 // we must write byte count to stdout before
+#if POPPLER_CHECK_VERSION(22, 6, 0)
+std::optional> pBuf = 
gfxFont->readEmbFontFile( m_pDoc->getXRef() );
+nSize = pBuf->size();
+if ( nSize > 0 )
+{
+aNewFont.isEmbedded = true;
+}
+#else
 char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
 if( pBuf )
 {
 aNewFont.isEmbedded = true;
 gfree(pBuf);
 }
+#endif
 }
 
 m_aFontMap[ nNewId ] = aNewFont;
@@ -492,13 +501,28 @@ void PDFOutDev::writeFontFile( GfxFont* gfxFont ) const
 return;
 
 int nSize = 0;
+#if POPPLER_CHECK_VERSION(22, 6, 0)
+std::optional> pBuf = gfxFont->readEmbFontFile( 
m_pDoc->getXRef() );
+nSize = pBuf->size();
+if ( nSize == 0 )
+return;
+#else
 char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
 if( !pBuf )
 return;
+#endif
 
 // ---sync point--- see SYNC STREAMS above
 fflush(stdout);
 
+#if POPPLER_CHECK_VERSION(22, 6, 0)
+if( fwrite(pBuf->data(), sizeof(*pBuf->data()), nSize, g_binary_out) != 
static_cast(nSize) )
+{
+exit(1); // error
+}
+// ---sync point--- see SYNC STREAMS above
+fflush(g_binary_out);
+#else
 if( fwrite(pBuf, sizeof(char), nSize, g_binary_out) != 
static_cast(nSize) )
 {
 gfree(pBuf);
@@ -507,6 +531,7 @@ void PDFOutDev::writeFontFile( GfxFont* gfxFont ) const
 // ---sync point--- see SYNC STREAMS above
 fflush(g_binary_out);
 gfree(pBuf);
+#endif
 }
 
 #if POPPLER_CHECK_VERSION(0, 83, 0)
@@ -759,7 +784,11 @@ void PDFOutDev::updateFont(GfxState *state)
 {
 assert(state);
 
+#if POPPLER_CHECK_VERSION(22, 6, 0)
+GfxFont *gfxFont = state->getFont().get();
+#else
 GfxFont *gfxFont = state->getFont();
+#endif
 if( !gfxFont )
 return;
 
diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
index ad6320139473..e924547e9357 100644
--- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
@@ -138,6 +138,15 @@ int main(int argc, char **argv)
 _setmode( _fileno( g_binary_out ), _O_BINARY );
 #endif
 
+#if POPPLER_CHECK_VERSION(22, 6, 0)
+PDFDoc aDoc( std::make_unique(pFileName),
+ std::optional(pOwnerPasswordStr),
+ std::optional(pUserPasswordStr) );
+
+PDFDoc aErrDoc( std::make_unique(pErrFileName),
+ std::optional(pOwnerPasswordStr),
+ std::optional(pUserPasswordStr) );
+#else
 PDFDoc aDoc( pFileName,
  pOwnerPasswordStr,
  pUserPasswordStr );
@@ -145,6 +154,7 @@ int main(int argc, char **argv)
 PDFDoc aErrDoc( pErrFileName,
  pOwnerPasswordStr,
  pUserPasswordStr );
+#endif
 
 // Check various permissions for aDoc.
 PDFDoc &rDoc = aDoc.isOk()? aDoc: aErrDoc;


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

2022-05-26 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/test/tests.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit fc45e54be6ba5d4685ae4ef3c3ea696fc99cccd4
Author: Noel Grandin 
AuthorDate: Thu May 26 12:21:29 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu May 26 14:28:54 2022 +0200

disable this sdext test on windows for now

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

diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index c8c3b9e28a8f..77d98999d0d3 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -557,7 +557,8 @@ namespace
 
 void testTdf141709()
 {
-#if HAVE_FEATURE_POPPLER
+// this test crashes on the windows jenkins boxes, but no-one can catch it 
locally
+#if HAVE_FEATURE_POPPLER && !defined(_WIN32)
 rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
 xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
 


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

2022-05-03 Thread Stephan Bergmann (via logerrit)
 sdext/source/pdfimport/misc/pwdinteract.cxx |4 ++--
 sdext/source/pdfimport/wrapper/wrapper.cxx  |6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit b0f42b588f52268b8cfad527ba76fdbd125ea5ea
Author: Stephan Bergmann 
AuthorDate: Tue May 3 23:22:21 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 4 08:10:52 2022 +0200

Just use Any ctor instead of makeAny in sdext

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

diff --git a/sdext/source/pdfimport/misc/pwdinteract.cxx 
b/sdext/source/pdfimport/misc/pwdinteract.cxx
index b80f6a60237e..79ef78181600 100644
--- a/sdext/source/pdfimport/misc/pwdinteract.cxx
+++ b/sdext/source/pdfimport/misc/pwdinteract.cxx
@@ -73,7 +73,7 @@ private:
 
 PDFPasswordRequest::PDFPasswordRequest( bool bFirstTry, const OUString& rName 
) :
 m_aRequest(
-uno::makeAny(
+uno::Any(
 task::DocumentPasswordRequest(
 OUString(), uno::Reference< uno::XInterface >(),
 task::InteractionClassification_QUERY,
@@ -127,7 +127,7 @@ private:
 virtual ~UnsupportedEncryptionFormatRequest() override {}
 
 virtual uno::Any SAL_CALL getRequest() override {
-return uno::makeAny(
+return uno::Any(
 task::ErrorCodeRequest(
 OUString(), uno::Reference< uno::XInterface >(),
 sal_uInt32(ERRCODE_IO_WRONGVERSION)));
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 891839f6b977..62eeea5c5376 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -717,9 +717,9 @@ uno::Sequence 
LineParser::readImageImpl()
 uno::UNO_QUERY_THROW );
 
 uno::Sequence aSequence( 
comphelper::InitPropertySequence({
-{ "URL", uno::makeAny(aFileName) },
-{ "InputStream", uno::makeAny( xDataStream ) },
-{ "InputSequence", uno::makeAny(aDataSequence) }
+{ "URL", uno::Any(aFileName) },
+{ "InputStream", uno::Any( xDataStream ) },
+{ "InputSequence", uno::Any(aDataSequence) }
 }));
 
 return aSequence;


[Libreoffice-commits] core.git: sdext/source sd/inc sd/IwyuFilter_sd.yaml sd/qa sd/source

2022-02-21 Thread Gabor Kelemen (via logerrit)
 sd/IwyuFilter_sd.yaml |   13 +
 sd/inc/family.hrc |1 +
 sd/inc/helpids.h  |2 ++
 sd/inc/pageformatpanel.hrc|2 ++
 sd/inc/sdcommands.h   |2 ++
 sd/inc/strings.hxx|2 ++
 sd/qa/unit/PNGExportTests.cxx |4 
 sd/qa/unit/export-tests-ooxml2.cxx|4 ++--
 sd/qa/unit/export-tests-ooxml3.cxx|3 +--
 sd/qa/unit/export-tests.cxx   |1 -
 sd/qa/unit/import-tests.cxx   |2 --
 sd/qa/unit/misc-tests.cxx |2 --
 sd/qa/unit/tiledrendering/CallbackRecorder.hxx|4 
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |4 
 sd/qa/unit/uiimpress.cxx  |1 -
 sd/source/core/CustomAnimationEffect.cxx  |2 --
 sd/source/core/CustomAnimationPreset.cxx  |3 ---
 sd/source/core/TransitionPreset.cxx   |1 -
 sd/source/filter/eppt/eppt.cxx|2 +-
 sd/source/filter/eppt/epptso.cxx  |2 +-
 sd/source/filter/eppt/pptx-epptooxml.cxx  |1 -
 sd/source/filter/xml/sdxmlwrp.cxx |1 -
 sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx |1 -
 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx |1 -
 sd/source/ui/animations/CustomAnimationList.cxx   |1 -
 sd/source/ui/animations/CustomAnimationPane.cxx   |3 ---
 sd/source/ui/animations/SlideTransitionPane.cxx   |2 --
 sd/source/ui/annotations/annotationmanager.cxx|4 
 sd/source/ui/annotations/annotationmanagerimpl.hxx|1 +
 sd/source/ui/annotations/annotationtag.hxx|2 ++
 sd/source/ui/annotations/annotationwindow.hxx |1 -
 sd/source/ui/app/scalectrl.cxx|2 +-
 sd/source/ui/app/sdmod.cxx|1 -
 sd/source/ui/controller/slidelayoutcontroller.cxx |1 -
 sd/source/ui/dlg/PhotoAlbumDialog.cxx |1 -
 sd/source/ui/dlg/tpaction.cxx |1 -
 sd/source/ui/framework/factories/ViewShellWrapper.cxx |1 -
 sd/source/ui/func/fubullet.cxx|1 -
 sd/source/ui/func/fucon3d.cxx |1 -
 sd/source/ui/func/fuinsert.cxx|3 ---
 sd/source/ui/func/fuline.cxx  |1 -
 sd/source/ui/func/fumorph.cxx |1 -
 sd/source/ui/inc/framework/ModuleController.hxx   |1 -
 sd/source/ui/inc/tpaction.hxx |1 +
 sd/source/ui/inc/unokywds.hxx |1 +
 sd/source/ui/presenter/PresenterTextView.cxx  |1 -
 sd/source/ui/remotecontrol/BluetoothServer.cxx|1 -
 sd/source/ui/remotecontrol/Communicator.cxx   |1 -
 sd/source/ui/remotecontrol/DiscoveryService.cxx   |2 --
 sd/source/ui/remotecontrol/ImagePreparer.cxx  |1 -
 sd/source/ui/sidebar/DocumentHelper.hxx   |4 +++-
 sd/source/ui/sidebar/LayoutMenu.cxx   |2 --
 sd/source/ui/sidebar/MasterPagesSelector.cxx  |2 --
 sd/source/ui/sidebar/NavigatorWrapper.hxx |1 -
 sd/source/ui/sidebar/SlideBackground.hxx  |2 ++
 sd/source/ui/slideshow/slideshowimpl.cxx  |4 
 sd/source/ui/slideshow/slideshowviewimpl.cxx  |1 -
 sd/source/ui/slidesorter/controller/SlsClipboard.cxx  |1 -
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx|1 -
 sd/source/ui/tools/GraphicSizeCheck.cxx   |2 +-
 sd/source/ui/unoidl/SdUnoDrawView.cxx |1 -
 sd/source/ui/unoidl/unolayer.cxx  |4 +++-
 sd/source/ui/unoidl/unomodel.cxx  |1 -
 sd/source/ui/unoidl/unoobj.cxx|1 -
 sd/source/ui/view/MediaObjectBar.cxx  |1 -
 sd/source/ui/view/drviews1.cxx|1 -
 sd/source/ui/view/drviews3.cxx|1 -
 sd/source/ui/view/drviews7.cxx|2 --
 sd/source/ui/view/drviews8.cxx|1 -
 sd/source/ui/view/drviews9.cxx|1 -
 sd/source/ui/view/drviewsd.cxx|1 -
 sd/source/ui/view/sdview.cxx  |4 +++-
 sd/source/ui/view/sdview4.cxx

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

2022-02-20 Thread Deep17 (via logerrit)
 sdext/source/presenter/PresenterSpritePane.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 6aec296589f9e1fb35443fc1cdbe5e8ea50d100b
Author: Deep17 
AuthorDate: Sat Feb 19 22:30:10 2022 -0500
Commit: Ilmari Lauhakangas 
CommitDate: Mon Feb 21 07:28:54 2022 +0100

tdf#143148 Use pragma once instead of include guards

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

diff --git a/sdext/source/presenter/PresenterSpritePane.hxx 
b/sdext/source/presenter/PresenterSpritePane.hxx
index 377d5fa7898e..1c2c923b942a 100644
--- a/sdext/source/presenter/PresenterSpritePane.hxx
+++ b/sdext/source/presenter/PresenterSpritePane.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSPRITEPANE_HXX
-#define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSPRITEPANE_HXX
+#pragma once
 
 #include "PresenterPaneBase.hxx"
 #include "PresenterSprite.hxx"
@@ -77,6 +76,4 @@ private:
 
 } // end of namespace ::sd::presenter
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2022-02-17 Thread Stephan Bergmann (via logerrit)
 sdext/source/pdfimport/tree/imagecontainer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 59ac648a1482d9422b8f279bcb284a214032f5cf
Author: Stephan Bergmann 
AuthorDate: Thu Feb 17 12:07:48 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Feb 17 13:23:56 2022 +0100

Parameter should apparently be of type sal_Int32

It was like this ever since 969aac0edf437ec0cad0baadfde46188c4822161
"INTEGRATION: CWS pdf25", but the single caller of encodeBase64 passes a
sal_Int32 value, and all use of i_nBufferLength in encodeBase64 are in
sal_Int32-based computations.

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

diff --git a/sdext/source/pdfimport/tree/imagecontainer.cxx 
b/sdext/source/pdfimport/tree/imagecontainer.cxx
index bedbcd73b020..9754e9134a50 100644
--- a/sdext/source/pdfimport/tree/imagecontainer.cxx
+++ b/sdext/source/pdfimport/tree/imagecontainer.cxx
@@ -43,7 +43,7 @@ const char aBase64EncodeTable[] =
   'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
   '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
 
-OUString encodeBase64( const sal_Int8* i_pBuffer, const sal_uInt32 
i_nBufferLength )
+OUString encodeBase64( const sal_Int8* i_pBuffer, const sal_Int32 
i_nBufferLength )
 {
 OUStringBuffer aBuf( (i_nBufferLength+1) * 4 / 3 );
 const sal_Int32 nRemain(i_nBufferLength%3);


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

2022-02-03 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/wrapper.hxx |   12 
 sdext/source/pdfimport/wrapper/wrapper.cxx |   26 +-
 2 files changed, 37 insertions(+), 1 deletion(-)

New commits:
commit bcf10015c5d12d363d0be9f6da25092c83112692
Author: Kevin Suo 
AuthorDate: Sat Jan 29 21:44:36 2022 +0800
Commit: Noel Grandin 
CommitDate: Fri Feb 4 07:44:18 2022 +0100

sdext.pdfimport tdf#137128: Recognize more font name and weight...

...values from the embeded 'PS' font names.

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

diff --git a/sdext/source/pdfimport/inc/wrapper.hxx 
b/sdext/source/pdfimport/inc/wrapper.hxx
index 9f25e1b7290b..94cc2b24327d 100644
--- a/sdext/source/pdfimport/inc/wrapper.hxx
+++ b/sdext/source/pdfimport/inc/wrapper.hxx
@@ -58,16 +58,28 @@ namespace pdfi
 // and they are checked from the suffix, thus the order matters.
 // e.g. for "TimesNewRomanPS-BoldItalic", to get "TimesNewRoman", you 
should
 //  first have "Italic", and then "Bold", then "-", and then "PS".
+"-VKana",
 "MT",
 "PS",
 "PSMT",
 "Regular",
+"Normal",
+"Book",
+"Medium",
+"ExtraBold",
+"UltraBold",
+"ExtraLight",
+"UltraLight",
 "Bold",
+"Heavy",
+"Black",
 "Italic",
 "Oblique",
 "Bold", //BoldItalic, BoldOblique
 "Light",
+"Thin",
 "Semibold",
+"-Roman",
 "Reg",
 "VKana",
 "-",
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 0560826d5727..cfa256f0acfa 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -492,7 +492,15 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 {
 rResult.familyName = 
rResult.familyName.replaceAll(fontAttributesSuffix, "");
 SAL_INFO("sdext.pdfimport", rResult.familyName);
-if (fontAttributesSuffix == u"Bold")
+if (fontAttributesSuffix == u"Heavy" || fontAttributesSuffix == 
u"Black")
+{
+rResult.fontWeight = u"900";
+}
+else if (fontAttributesSuffix == u"ExtraBold" || 
fontAttributesSuffix == u"UltraBold")
+{
+rResult.fontWeight = u"800";
+}
+else if (fontAttributesSuffix == u"Bold")
 {
 rResult.fontWeight = u"bold";
 }
@@ -500,10 +508,26 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 {
 rResult.fontWeight = u"600";
 }
+else if (fontAttributesSuffix == u"Medium")
+{
+rResult.fontWeight = u"500";
+}
+else if (fontAttributesSuffix == u"Normal" || fontAttributesSuffix 
== u"Regular" || fontAttributesSuffix == u"Book")
+{
+rResult.fontWeight = u"400";
+}
 else if (fontAttributesSuffix == u"Light")
 {
 rResult.fontWeight = u"300";
 }
+else if (fontAttributesSuffix == u"ExtraLight" || 
fontAttributesSuffix == u"UltraLight")
+{
+rResult.fontWeight = u"200";
+}
+else if (fontAttributesSuffix == u"Thin")
+{
+rResult.fontWeight = u"100";
+}
 
 if ( (fontAttributesSuffix == "Italic") or (fontAttributesSuffix 
== "Oblique") )
 {


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

2022-02-03 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/genericelements.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 2f605009907166d509ccd1dcb6385e5cd456e3e4
Author: Kevin Suo 
AuthorDate: Mon Jul 12 09:11:15 2021 +0800
Commit: Noel Grandin 
CommitDate: Fri Feb 4 07:43:42 2022 +0100

sdext.pdfimport: these SAL_WARN should be SAL_INFO

SAL_WARN should be some message which showns where the program
runs abnormally. Normal debugging output code should be SAL_INFO,
and if you have set it to SAL_WARN for easy debugging you should
set it back to SAL_INFO or delete those lines when submit.
Otherwise our dbgutil terminal will be flood with unrelated
messages

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

diff --git a/sdext/source/pdfimport/tree/genericelements.cxx 
b/sdext/source/pdfimport/tree/genericelements.cxx
index b02e2c0a727d..2c394c973bf0 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -156,8 +156,8 @@ void PolyPolyElement::visitedBy( ElementTreeVisitor&
  rV
 #if OSL_DEBUG_LEVEL > 0
 void PolyPolyElement::emitStructure( int nLevel)
 {
-SAL_WARN( "sdext", std::string(nLevel, ' ') << "<" << typeid( *this 
).name() << " " << this << ">" );
-SAL_WARN( "sdext", "path=" );
+SAL_INFO( "sdext", std::string(nLevel, ' ') << "<" << typeid( *this 
).name() << " " << this << ">" );
+SAL_INFO( "sdext", "path=" );
 int nPoly = PolyPoly.count();
 for( int i = 0; i < nPoly; i++ )
 {
@@ -169,11 +169,11 @@ void PolyPolyElement::emitStructure( int nLevel)
 basegfx::B2DPoint aPoint = aPoly.getB2DPoint( n );
 buff.append( " (" + OUString::number(aPoint.getX()) + "," + 
OUString::number(aPoint.getY()) + ")");
 }
-SAL_WARN( "sdext", "" << buff.makeStringAndClear() );
+SAL_INFO( "sdext", "" << buff.makeStringAndClear() );
 }
 for (auto const& child : Children)
 child->emitStructure( nLevel+1 );
-SAL_WARN( "sdext", std::string(nLevel, ' ') << "");
+SAL_INFO( "sdext", std::string(nLevel, ' ') << "");
 }
 #endif
 


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

2021-12-09 Thread Caolán McNamara (via logerrit)
 sdext/source/minimizer/impoptimizer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1aa57f44c0d37ef23551943a64211dea17903873
Author: Caolán McNamara 
AuthorDate: Thu Dec 9 11:31:18 2021 +
Commit: Caolán McNamara 
CommitDate: Thu Dec 9 14:50:12 2021 +0100

change use of wrong slot id to name of correct command

slot was introduced with

commit 27452a082237065ac4cf475c8398241907164b2c
Date:   Wed Oct 10 14:32:04 2007 +

INTEGRATION: CWS pppopt02 (1.24.74); FILE MERGED
2007/09/28 14:52:06 sj 1.24.74.1: added slot to be able to clear the 
undomanager

as 27115, but got renumbered to 27118 with

commit 35fe915b7cf508356a88897d520b89fc986407fb
Date:   Wed Jun 10 15:47:52 2015 +0200

Fix sd ID conflicts and duplicates

using its name is verified to call the expected handler for it

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

diff --git a/sdext/source/minimizer/impoptimizer.cxx 
b/sdext/source/minimizer/impoptimizer.cxx
index cf8b875ebe21..7de159177979 100644
--- a/sdext/source/minimizer/impoptimizer.cxx
+++ b/sdext/source/minimizer/impoptimizer.cxx
@@ -658,7 +658,7 @@ void ImpOptimizer::Optimize( const Sequence< PropertyValue 
>& rArguments )
 Reference< XFrame > xFrame( xSelf.is() ? xSelf : mxInformationDialog );
 if ( xFrame.is() )
 {
-DispatchURL( mxContext, "slot:27115", xFrame );
+DispatchURL(mxContext, ".uno:ClearUndoStack", xFrame);
 }
 }
 


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

2021-10-22 Thread Julien Nabet (via logerrit)
 sdext/source/presenter/PresenterCanvasHelper.cxx  |7 +++
 sdext/source/presenter/PresenterWindowManager.cxx |6 ++
 2 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 86430b76d5833d85f54ccfdbf933162b59a261d9
Author: Julien Nabet 
AuthorDate: Fri Oct 22 18:16:43 2021 +0200
Commit: Julien Nabet 
CommitDate: Fri Oct 22 19:17:50 2021 +0200

Revert part of "Simplify vector initialization in sdext"

since it needs 2 allocations instead of one

This partially reverts commit d64a6e2245169e5e4a3f8bc5388b4fff4984e5f4 .

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

diff --git a/sdext/source/presenter/PresenterCanvasHelper.cxx 
b/sdext/source/presenter/PresenterCanvasHelper.cxx
index 697a84d0a8ec..8381f8d5aabd 100644
--- a/sdext/source/presenter/PresenterCanvasHelper.cxx
+++ b/sdext/source/presenter/PresenterCanvasHelper.cxx
@@ -71,11 +71,10 @@ void PresenterCanvasHelper::PaintRectangle (
 return;
 
 // Create a clip polypolygon that has the content box as hole.
-::std::vector aRectangles
-{
-PresenterGeometryHelper::Intersection(rRepaintBox, rOuterBoundingBox)
-};
+::std::vector aRectangles;
 aRectangles.reserve(2);
+aRectangles.push_back(
+PresenterGeometryHelper::Intersection(rRepaintBox, rOuterBoundingBox));
 if (rContentBoundingBox.Width > 0 && rContentBoundingBox.Height > 0)
 aRectangles.push_back(
 PresenterGeometryHelper::Intersection(rRepaintBox, 
rContentBoundingBox));
diff --git a/sdext/source/presenter/PresenterWindowManager.cxx 
b/sdext/source/presenter/PresenterWindowManager.cxx
index 9a541842286d..24115fa52523 100644
--- a/sdext/source/presenter/PresenterWindowManager.cxx
+++ b/sdext/source/presenter/PresenterWindowManager.cxx
@@ -989,11 +989,9 @@ Reference 
PresenterWindowManager::CreateClipPolyPolyg
 // Create a clip polygon that includes the whole update area but has the
 // content windows as holes.
 const sal_Int32 nPaneCount (mpPaneContainer->maPanes.size());
-::std::vector aRectangles
-{
-mxParentWindow->getPosSize()
-};
+::std::vector aRectangles;
 aRectangles.reserve(1+nPaneCount);
+aRectangles.push_back(mxParentWindow->getPosSize());
 for (const auto& pDescriptor : mpPaneContainer->maPanes)
 {
 if ( ! pDescriptor->mbIsActive)


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

2021-10-11 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   28 ++---
 sdext/source/pdfimport/tree/style.cxx  |8 +++---
 sdext/source/pdfimport/tree/style.hxx  |6 ++--
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   28 ++---
 4 files changed, 35 insertions(+), 35 deletions(-)

New commits:
commit 2c596b694a641de1b18afb1e9a5b843df638af24
Author: Noel Grandin 
AuthorDate: Mon Oct 11 18:52:02 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 12 08:30:14 2021 +0200

loplugin:moveparam in sdext

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

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 436f9f532c20..ffc27c65f56c 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -767,7 +767,7 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const 
std::list< std::uniqu
 {
 PropertyMap props;
 FillDashStyleProps(props, rGC.DashArray, scale);
-StyleContainer::Style style("draw:stroke-dash", props);
+StyleContainer::Style style("draw:stroke-dash", std::move(props));
 
 aGCProps[ "draw:stroke" ] = "dash";
 aGCProps[ "draw:stroke-dash" ] =
@@ -800,8 +800,8 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const 
std::list< std::uniqu
 aGCProps[ "draw:fill" ] = "none";
 }
 
-StyleContainer::Style aStyle( "style:style", aProps );
-StyleContainer::Style aSubStyle( "style:graphic-properties", aGCProps );
+StyleContainer::Style aStyle( "style:style", std::move(aProps) );
+StyleContainer::Style aSubStyle( "style:graphic-properties", 
std::move(aGCProps) );
 aStyle.SubStyles.push_back( &aSubStyle );
 
 elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
@@ -877,8 +877,8 @@ void DrawXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_pt
 aFontProps[ "style:text-scale" ] = getPercentString(textScale);
 }
 
-StyleContainer::Style aStyle( "style:style", aProps );
-StyleContainer::Style aSubStyle( "style:text-properties", aFontProps );
+StyleContainer::Style aStyle( "style:style", std::move(aProps) );
+StyleContainer::Style aSubStyle( "style:text-properties", 
std::move(aFontProps) );
 aStyle.SubStyles.push_back( &aSubStyle );
 elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
 }
@@ -899,8 +899,8 @@ void DrawXmlFinalizer::visit( ParagraphElement& elem, const 
std::list< std::uniq
 else
 aParProps[ "style:writing-mode"]= "lr-tb";
 
-StyleContainer::Style aStyle( "style:style", aProps );
-StyleContainer::Style aSubStyle( "style:paragraph-properties", aParProps );
+StyleContainer::Style aStyle( "style:style", std::move(aProps) );
+StyleContainer::Style aSubStyle( "style:paragraph-properties", 
std::move(aParProps) );
 aStyle.SubStyles.push_back( &aSubStyle );
 
 elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
@@ -931,8 +931,8 @@ void DrawXmlFinalizer::visit( FrameElement& elem, const 
std::list< std::unique_p
 aGCProps[ "fo:padding-right" ]   = "0cm";
 aGCProps[ "fo:padding-bottom" ]  = "0cm";
 
-StyleContainer::Style style1( "style:style", props1 );
-StyleContainer::Style subStyle1( "style:graphic-properties", aGCProps );
+StyleContainer::Style style1( "style:style", std::move(props1) );
+StyleContainer::Style subStyle1( "style:graphic-properties", 
std::move(aGCProps) );
 style1.SubStyles.push_back(&subStyle1);
 
 elem.StyleId = m_rStyleContainer.getStyleId(style1);
@@ -945,8 +945,8 @@ void DrawXmlFinalizer::visit( FrameElement& elem, const 
std::list< std::unique_p
 PropertyMap textProps;
 SetFontsizeProperties(textProps, elem.FontSize);
 
-StyleContainer::Style style2("style:style", props2);
-StyleContainer::Style subStyle2("style:text-properties", textProps);
+StyleContainer::Style style2("style:style", std::move(props2));
+StyleContainer::Style subStyle2("style:text-properties", 
std::move(textProps));
 style2.SubStyles.push_back(&subStyle2);
 elem.TextStyleId = m_rStyleContainer.getStyleId(style2);
 }
@@ -1039,8 +1039,8 @@ void DrawXmlFinalizer::visit( PageElement& elem, const 
std::list< std::unique_pt
 aPageLayoutProps[ "style:print-orientation" ]= elem.w < elem.h ? 
std::u16string_view(u"portrait") : std::u16string_view(u"landscape");
 aPageLayoutProps[ "style:writing-mode" ]= "lr-tb";
 
-StyleContainer::Style aStyle( "style:page-layout", aPageProps);
-StyleContainer::Style aSubStyle( "style:page-layout-properties", 
aPageLayoutProps);
+StyleContainer::Style aStyle( "style:page-layout", std::mov

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

2021-10-11 Thread Stephan Bergmann (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 57ffa96d413df2712b15355f49294e564bd0d996
Author: Stephan Bergmann 
AuthorDate: Mon Oct 11 12:11:40 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Oct 11 13:38:25 2021 +0200

Fix font weight comparisons

...after 2d486bac81e06c64d13c647f35d3f4affbeb183e "tdf#143959 
sdext.pdfimport:
call vcl::Font::identifyFont directly" changed the left-hand sides from
aFontDescriptor.Weight of type float to aFontReadResult.GetWeight() of type
FontWeight from include/tools/fontenum.hxx.  (Diagnosed as

> sdext/source/pdfimport/wrapper/wrapper.cxx:624:45: error: comparison of 
enumeration type 'FontWeight' with floating-point type 'float' is deprecated 
[-Werror,-Wdeprecated-enum-float-conversion]
>   if (aFontReadResult.GetWeight() == 
com::sun::star::awt::FontWeight::THIN)
>   ~~~ ^  
~

in a --with-latest-c++ build.)

Change-Id: I0c661fc27eefa478808f796ffb9a7586e1e671c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123375
Reviewed-by: Kevin Suo 
Reviewed-by: Stephan Bergmann 
Tested-by: Jenkins

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 4d1f328d6f34..3553a588802c 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -621,22 +621,22 @@ void LineParser::readFont()
 }
 
 // Font weight
-if (aFontReadResult.GetWeight() == 
com::sun::star::awt::FontWeight::THIN)
+if (aFontReadResult.GetWeight() == WEIGHT_THIN)
 aResult.fontWeight = u"100";
-else if (aFontReadResult.GetWeight() == 
com::sun::star::awt::FontWeight::ULTRALIGHT)
+else if (aFontReadResult.GetWeight() == WEIGHT_ULTRALIGHT)
 aResult.fontWeight = u"200";
-else if (aFontReadResult.GetWeight() == 
com::sun::star::awt::FontWeight::LIGHT)
+else if (aFontReadResult.GetWeight() == WEIGHT_LIGHT)
 aResult.fontWeight = u"300";
-else if (aFontReadResult.GetWeight() == 
com::sun::star::awt::FontWeight::SEMILIGHT)
+else if (aFontReadResult.GetWeight() == WEIGHT_SEMILIGHT)
 aResult.fontWeight = u"350";
 // no need to check "normal" here as this is default in 
nFontWeight above
-else if (aFontReadResult.GetWeight() == 
com::sun::star::awt::FontWeight::SEMIBOLD)
+else if (aFontReadResult.GetWeight() == WEIGHT_SEMIBOLD)
 aResult.fontWeight = u"600";
-else if (aFontReadResult.GetWeight() == 
com::sun::star::awt::FontWeight::BOLD)
+else if (aFontReadResult.GetWeight() == WEIGHT_BOLD)
 aResult.fontWeight = u"bold";
-else if (aFontReadResult.GetWeight() == 
com::sun::star::awt::FontWeight::ULTRABOLD)
+else if (aFontReadResult.GetWeight() == WEIGHT_ULTRABOLD)
 aResult.fontWeight = u"800";
-else if (aFontReadResult.GetWeight() == 
com::sun::star::awt::FontWeight::BLACK)
+else if (aFontReadResult.GetWeight() == WEIGHT_BLACK)
 aResult.fontWeight = u"900";
 SAL_INFO("sdext.pdfimport", aResult.fontWeight);
 


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

2021-10-11 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |  113 +++--
 1 file changed, 46 insertions(+), 67 deletions(-)

New commits:
commit 2d486bac81e06c64d13c647f35d3f4affbeb183e
Author: Kevin Suo 
AuthorDate: Mon Oct 11 12:29:00 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Oct 11 09:08:37 2021 +0200

tdf#143959 sdext.pdfimport: call vcl::Font::identifyFont directly

Previously the unittest testTdf143959_nameFromFontFile did not
fail even if the fixing code in wrapper.cxx is removed.
That was because the "if (xHolder.is())" condition is always false
in the unittest run, which suggests that the calling of
com.sun.star.awt.FontIdentificator through the uno did not work
in some circumstances. See comments in:
https://gerrit.libreoffice.org/c/core/+/120815

In this patch, we call the vcl::Font::identifyFont directly rather
than through the uno calling. This is proven to work in both the
manual and unittest running.

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

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 4de5a8516297..4d1f328d6f34 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -484,14 +484,14 @@ e.g., TimesNewRoman -> Times New Roman
 */
 void LineParser::parseFontFamilyName( FontAttributes& rResult )
 {
-SAL_WARN("sdext.pdfimport", "Processing " << rResult.familyName << " ---");
+SAL_INFO("sdext.pdfimport", "Processing " << rResult.familyName << " ---");
 rResult.familyName = rResult.familyName.trim();
 for (const OUString& fontAttributesSuffix: fontAttributesSuffixes)
 {
 if ( rResult.familyName.endsWith(fontAttributesSuffix) )
 {
 rResult.familyName = 
rResult.familyName.replaceAll(fontAttributesSuffix, "");
-SAL_WARN("sdext.pdfimport", rResult.familyName);
+SAL_INFO("sdext.pdfimport", rResult.familyName);
 if (fontAttributesSuffix == u"Bold")
 {
 rResult.fontWeight = u"bold";
@@ -579,7 +579,7 @@ void LineParser::readFont()
 sFontWeight = u"800";
 else if (nFontWeight == 9) // W900, Black
 sFontWeight = u"900";
-SAL_WARN("sdext.pdfimport", "Font weight passed from xpdfimport is: " << 
sFontWeight);
+SAL_INFO("sdext.pdfimport", "Font weight passed from xpdfimport is: " << 
sFontWeight);
 
 FontAttributes aResult( OStringToOUString( aFontName, 
RTL_TEXTENCODING_UTF8 ),
 sFontWeight,
@@ -602,79 +602,58 @@ void LineParser::readFont()
 uno::Sequence aFontFile(nFileLen);
 readBinaryData(aFontFile);  // Read fontFile.
 
-uno::Sequence aArgs(1);
-awt::FontDescriptor aFontDescriptor;
-aArgs[0] <<= aFontFile;
+vcl::Font aFontReadResult = 
vcl::Font::identifyFont(aFontFile.getArray(), nFileLen);
+SAL_INFO("sdext.pdfimport", "familyName: " << 
aFontReadResult.GetFamilyName());
 
-try
+if (!aFontReadResult.GetFamilyName().isEmpty()) // font detection 
successful
 {
-uno::Reference xHolder(
-
m_parser.m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, 
m_parser.m_xContext),
-uno::UNO_QUERY);
-if (xHolder.is())
-{
-uno::Any aFontReadResult(xHolder->getMaterial());
-aFontReadResult >>= aFontDescriptor;
-if (!aFontDescriptor.Name.isEmpty())
-{
-// Family name
-aResult.familyName = aFontDescriptor.Name;
-SAL_INFO("sdext.pdfimport", aResult.familyName);
-// tdf#143959: there are cases when the family name 
returned by font descriptor
-// is like "AA+TimesNewRoman,Bold". In this case, use 
the font name
-// determined by parseFontFamilyName instead, but still 
determine the font
-// attributes (bold italic etc) from the font descriptor.
-if (aResult.familyName.getLength() > 7 and 
aResult.familyName.indexOf(u"+", 6) == 6)
-{
-aResult.familyName = aResult.familyName.copy(7, 
aResult.familyName.getLength() - 7);
-parseFontFamilyName(aResult);
-}
-
-// Font weight
-if (aFontDescriptor.Weight == 
com::sun::star::awt::FontWeight::THIN)
-aResult.fontWeight = u"100";
-else if (aFontDescriptor.Weight == 
com::sun::star::awt::FontWeight::ULTRALIGHT)
-aResult.fontWeight = u"

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

2021-10-11 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/contentsink.hxx |   
12 -
 sdext/source/pdfimport/inc/pdfihelper.hxx  |   
 2 
 sdext/source/pdfimport/inc/wrapper.hxx |   
 1 
 sdext/source/pdfimport/test/testdocs/tdf78427-MyraidPro-Semibold-Light.pdf 
|binary
 sdext/source/pdfimport/test/tests.cxx  |   
65 +--
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   
 9 -
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |   
 4 
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   
20 +-
 sdext/source/pdfimport/wrapper/wrapper.cxx |   
88 --
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx  |   
 4 
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx  |   
12 -
 11 files changed, 158 insertions(+), 59 deletions(-)

New commits:
commit 4eef83dc4a8879f21ee6c98226510ac728bc317a
Author: Kevin Suo 
AuthorDate: Sun Oct 10 21:25:58 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Oct 11 09:07:59 2021 +0200

sdext.pdfimport tdf#78427: Add support for more Font Weight features

...e.g. Thin, Extra-Light, Light, Semi-Bold, Bold, Extra-Bold and Black.

Previously the xpdfimport code passes the isBold value which is bool value.
sdext.pdfimport accepted this value from the xpdfimport output and check
whether a font is bold or not. However, there are many other FontWeight
features more than a "bold".

This patch changes the isBold to the GfxFont::Weight type, and changed the
sdext.pdfimport isBold bool type (in FontAttributes) to an OUString 
fontWeight.
The value for the fontWeight is set according to the GfxFont::Weight passed
by xpdfimport, and then this fontWeight is passed to the ODF xml generation
stage and used there directly.

Now the Semibold and Light (as shown in the unittest file) can be currectly
handled. However, for other weights the parseFontFamilyName still need to
be updated, but before doing that I plan to refector this function as the
current logic is very difficult for maintennance.

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

diff --git a/sdext/source/pdfimport/inc/contentsink.hxx 
b/sdext/source/pdfimport/inc/contentsink.hxx
index dbe1b0e08808..9d016a7e2a3e 100644
--- a/sdext/source/pdfimport/inc/contentsink.hxx
+++ b/sdext/source/pdfimport/inc/contentsink.hxx
@@ -48,14 +48,14 @@ namespace pdfi
 {
 struct FontAttributes
 {
-FontAttributes( const OUString& familyName_,
-bool isBold_,
+FontAttributes( const OUString&  familyName_,
+const OUString&  sFontWeight,
 bool isItalic_,
 bool isUnderline_,
 double   size_,
 double   ascent_) :
 familyName(familyName_),
-isBold(isBold_),
+fontWeight(sFontWeight),
 isItalic(isItalic_),
 isUnderline(isUnderline_),
 isOutline(false),
@@ -65,7 +65,7 @@ namespace pdfi
 
 FontAttributes() :
 familyName(),
-isBold(false),
+fontWeight(u"normal"),
 isItalic(false),
 isUnderline(false),
 isOutline(false),
@@ -74,7 +74,7 @@ namespace pdfi
 {}
 
 OUStringfamilyName;
-boolisBold;
+OUStringfontWeight;
 boolisItalic;
 boolisUnderline;
 boolisOutline;
@@ -84,7 +84,7 @@ namespace pdfi
 bool operator==(const FontAttributes& rFont) const
 {
 return familyName == rFont.familyName &&
-!isBold == !rFont.isBold &&
+fontWeight == rFont.fontWeight &&
 !isItalic == !rFont.isItalic &&
 !isUnderline == !rFont.isUnderline &&
 !isOutline == !rFont.isOutline &&
diff --git a/sdext/source/pdfimport/inc/pdfihelper.hxx 
b/sdext/source/pdfimport/inc/pdfihelper.hxx
index aa3a22bd2b67..6b663b203e62 100644
--- a/sdext/source/pdfimport/inc/pdfihelper.hxx
+++ b/sdext/source/pdfimport/inc/pdfihelper.hxx
@@ -82,7 +82,7 @@ namespace pdfi
 {
 std::size_t seed = 0;
 o3tl::hash_combine(seed, rFont.familyName.hashCode());
-o3tl::hash_combine(seed, rFont.isBold);
+o3tl::hash_combine(seed, rFont.fontWeight);
 o3tl::hash_combine(seed, rFont.isItalic);
 o3tl::hash_combine(seed, rFont.isUnderline

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

2021-09-12 Thread Rico Tzschichholz (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit bc1b7491436146c3c4b2b69a46bd0cd37bbbecce
Author: Rico Tzschichholz 
AuthorDate: Sat Sep 11 12:09:40 2021 +0200
Commit: Caolán McNamara 
CommitDate: Sun Sep 12 12:50:18 2021 +0200

allow build with poppler <= 0.71

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

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 9cd2c55cee21..5d6ce90bc44c 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -435,7 +435,12 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, const GfxState* st
 #if POPPLER_CHECK_VERSION(20, 12, 0)
 std::string familyName = gfxFont->getNameWithoutSubsetTag();
 #else
+#if POPPLER_CHECK_VERSION(0, 71, 0) // GooString::toStr()
 std::string familyName = gfxFont->getName()->toStr();
+#else
+const GooString* gooString = gfxFont->getName();
+std::string familyName = std::string(gooString->getCString(), 
gooString->getLength());
+#endif
 if (familyName.length() > 7 && familyName.at(6) == '+')
 {
 familyName = familyName.substr(7);


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

2021-09-02 Thread Noel Grandin (via logerrit)
 sd/source/core/cusshow.cxx  |  
  4 -
 sd/source/filter/eppt/pptx-epptooxml.cxx|  
  1 
 sd/source/filter/eppt/pptx-text.cxx |  
 11 ---
 sd/source/filter/html/htmlex.cxx|  
  1 
 sd/source/ui/accessibility/AccessibleSlideSorterView.cxx|  
  1 
 sd/source/ui/animations/CustomAnimationList.cxx |  
  1 
 sd/source/ui/animations/CustomAnimationPane.cxx |  
  1 
 sd/source/ui/animations/SlideTransitionPane.cxx |  
  4 -
 sd/source/ui/animations/motionpathtag.cxx   |  
  5 -
 sd/source/ui/app/sdmod1.cxx |  
  3 
 sd/source/ui/app/sdxfer.cxx |  
  1 
 sd/source/ui/dlg/PaneShells.cxx |  
  2 
 sd/source/ui/dlg/TemplateScanner.cxx|  
  8 --
 sd/source/ui/framework/configuration/ChangeRequestQueueProcessor.cxx|  
  5 -
 sd/source/ui/framework/configuration/ConfigurationClassifier.cxx|  
  4 -
 sd/source/ui/framework/configuration/ConfigurationController.cxx|  
  2 
 sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx |  
  3 
 sd/source/ui/framework/configuration/ConfigurationUpdater.cxx   |  
  5 -
 sd/source/ui/framework/configuration/ResourceFactoryManager.cxx |  
  6 -
 sd/source/ui/framework/configuration/ResourceId.cxx |  
 20 +
 sd/source/ui/framework/factories/BasicPaneFactory.cxx   |  
  1 
 sd/source/ui/framework/factories/BasicToolBarFactory.cxx|  
  4 -
 sd/source/ui/framework/factories/BasicViewFactory.cxx   |  
  1 
 sd/source/ui/framework/module/CenterViewFocusModule.cxx |  
  1 
 sd/source/ui/framework/module/ModuleController.cxx  |  
  1 
 sd/source/ui/framework/module/ShellStackGuard.cxx   |  
  2 
 sd/source/ui/framework/module/SlideSorterModule.cxx |  
  2 
 sd/source/ui/framework/module/ToolBarModule.cxx |  
  2 
 sd/source/ui/framework/module/ViewTabBarModule.cxx  |  
  1 
 sd/source/ui/framework/tools/FrameworkHelper.cxx|  
  6 -
 sd/source/ui/presenter/PresenterCanvas.cxx  |  
  1 
 sd/source/ui/presenter/PresenterPreviewCache.cxx|  
  7 --
 sd/source/ui/presenter/PresenterTextView.cxx|  
  8 --
 sd/source/ui/presenter/SlideRenderer.cxx|  
  3 
 sd/source/ui/remotecontrol/BufferedStreamSocket.cxx |  
  3 
 sd/source/ui/remotecontrol/Server.cxx   |  
  4 -
 sd/source/ui/remotecontrol/Transmitter.cxx  |  
  6 -
 sd/source/ui/sidebar/MasterPageContainer.cxx|  
 14 
 sd/source/ui/sidebar/MasterPageContainerFiller.cxx  |  
  1 
 sd/source/ui/sidebar/MasterPageContainerProviders.cxx   |  
  3 
 sd/source/ui/sidebar/MasterPageContainerQueue.cxx   |  
  1 
 sd/source/ui/sidebar/MasterPageDescriptor.cxx   |  
  2 
 sd/source/ui/sidebar/MasterPagesSelector.cxx|  
  4 -
 sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx|  
  4 -
 sd/source/ui/sidebar/SlideBackground.cxx|  
  6 -
 sd/source/ui/slideshow/slideshowviewimpl.cxx|  
  1 
 sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx   |  
  9 --
 sd/source/ui/slidesorter/cache/SlsGenericPageCache.cxx  |  
  4 -
 sd/source/ui/slidesorter/cache/SlsQueueProcessor.cxx|  
  5 -
 sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx  |  
  3 
 sd/source/ui/slidesorter/controller/SlideSorterController.cxx   |  
 10 --
 sd/source/ui/slidesorter/controller/SlsAnimationFunction.cxx|  
  1 
 sd/source/ui/slidesorter/controller/SlsAnimator.cxx |  
  3 
 sd/source/ui/slidesorter/controller/SlsClipboard.cxx|  
  3 
 sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx  |  
  4 -
 sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx|  
  2 
 sd/source/ui/slidesorter/controller/SlsListener.cxx |  
  5 -
 sd/source/ui/slidesorter/controller/SlsPageSelector.cxx 

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

2021-08-22 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/test/testdocs/testTdf143959.pdf |binary
 sdext/source/pdfimport/test/tests.cxx  |   34 +
 sdext/source/pdfimport/wrapper/wrapper.cxx |9 
 3 files changed, 43 insertions(+)

New commits:
commit a1759769804a7f3b9895b481229d497a9eb4c70a
Author: Kevin Suo 
AuthorDate: Sat Aug 21 17:37:52 2021 +0800
Commit: Noel Grandin 
CommitDate: Sun Aug 22 10:29:50 2021 +0200

tdf#143959 sdext.pdfimport: fix font name with subtag

as returned by the font descriptor when reading the font file.

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

diff --git a/sdext/source/pdfimport/test/testdocs/testTdf143959.pdf 
b/sdext/source/pdfimport/test/testdocs/testTdf143959.pdf
new file mode 100644
index ..594e734a5629
Binary files /dev/null and 
b/sdext/source/pdfimport/test/testdocs/testTdf143959.pdf differ
diff --git a/sdext/source/pdfimport/test/tests.cxx 
b/sdext/source/pdfimport/test/tests.cxx
index cb8416d71b21..f47fa459a03c 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -710,6 +710,39 @@ namespace
 assertXPath(pXmlDoc, xpath, "text-outline", "true");
 }
 
+void testTdf143959_nameFromFontFile()
+{
+rtl::Reference xAdaptor(new 
pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
+
+OString aOutput;
+CPPUNIT_ASSERT_MESSAGE("Converting PDF to ODF XML",
+   xAdaptor->odfConvert( 
m_directories.getURLFromSrc(u"/sdext/source/pdfimport/test/testdocs/testTdf143959.pdf"),
+new 
OutputWrapString(aOutput),
+nullptr ));
+
+//std::cout << aOutput << std::endl;
+xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast(aOutput.getStr(;
+
+/* Test for the 1st text paragraph */
+OUString styleName = getXPath(pXmlDoc, 
"//draw:frame[2]//text:span[1]", "style-name");
+OString xpath = 
"//office:automatic-styles/style:style[@style:name=\"" +
+OUStringToOString(styleName,  RTL_TEXTENCODING_UTF8) +
+"\"]/style:text-properties";
+CPPUNIT_ASSERT_EQUAL(OUString("TimesNewRoman"),
+ getXPath(pXmlDoc, xpath, 
"font-family").replaceAll(u" ", u""));
+
+/* Test for the "TOTAL ESTA HOJA USD" paragraph" */
+styleName = getXPath(pXmlDoc, 
"//draw:frame[last()-1]//text:span[1]", "style-name");
+xpath = "//office:automatic-styles/style:style[@style:name=\"" +
+OUStringToOString(styleName,  RTL_TEXTENCODING_UTF8) +
+"\"]/style:text-properties";
+CPPUNIT_ASSERT_EQUAL(OUString("TimesNewRoman"),
+ getXPath(pXmlDoc, xpath, 
"font-family").replaceAll(u" ", u""));
+CPPUNIT_ASSERT_EQUAL(OUString("bold"),
+ getXPath(pXmlDoc, xpath, "font-weight"));
+}
+
 CPPUNIT_TEST_SUITE(PDFITest);
 CPPUNIT_TEST(testXPDFParser);
 CPPUNIT_TEST(testOdfWriterExport);
@@ -719,6 +752,7 @@ namespace
 CPPUNIT_TEST(testTdf105536);
 CPPUNIT_TEST(testTdf141709);
 CPPUNIT_TEST(testFontFeatures);
+CPPUNIT_TEST(testTdf143959_nameFromFontFile);
 CPPUNIT_TEST_SUITE_END();
 };
 
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 7cf30241c5ee..2efdab6f8553 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -584,6 +584,15 @@ void LineParser::readFont()
 if (!aFontDescriptor.Name.isEmpty())
 {
 aResult.familyName = aFontDescriptor.Name;
+// tdf#143959: there are cases when the family name 
returned by font descriptor
+// is like "AA+TimesNewRoman,Bold". In this case, use 
the font name
+// determined by parseFontFamilyName instead, but still 
determine the font
+// attributes (bold italic etc) from the font descriptor.
+if (aResult.familyName.getLength() > 7 and 
aResult.familyName.indexOf(u"+", 6) == 6)
+{
+aResult.familyName = aResult.familyName.copy(7, 
aResult.familyName.getLength() - 7);
+parseFontFamilyName(aResult);
+}
 aResult.isBold = (aFontDescriptor.Weight > 100.0);
 aResult.isItalic = (aFontDescriptor.Slant == 
awt::FontSlant_OBLIQUE ||
 

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

2021-08-20 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit fc7fbbd8ba089570c93917eedf1de0512cc0ba3b
Author: Caolán McNamara 
AuthorDate: Fri Aug 20 08:47:23 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 20 11:11:57 2021 +0200

allow build with poppler <= 0.82

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

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 54caf6728133..74740233d467 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -458,7 +458,11 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, const GfxState* st
 
 aNewFont.isBold= gfxFont->isBold();
 aNewFont.isItalic  = gfxFont->isItalic();
+#if POPPLER_CHECK_VERSION(0, 83, 0) // const added to getTransformedFontSize
 aNewFont.size  = state->getTransformedFontSize();
+#else
+aNewFont.size  = 
const_cast(state)->getTransformedFontSize();
+#endif
 aNewFont.isUnderline   = false;
 
 if( gfxFont->getType() == fontTrueType || gfxFont->getType() == fontType1 )


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

2021-08-10 Thread Yildiray (via logerrit)
 sdext/source/pdfimport/filterdet.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit ab0bb71280999ef7c11c341f5269ea98019fe4c3
Author: Yildiray 
AuthorDate: Tue Aug 10 18:32:25 2021 +0300
Commit: Ilmari Lauhakangas 
CommitDate: Tue Aug 10 22:05:40 2021 +0200

tdf#143148 Use pragma once in sdext

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

diff --git a/sdext/source/pdfimport/filterdet.hxx 
b/sdext/source/pdfimport/filterdet.hxx
index 6ed195d3bb03..6c7d58ca048c 100644
--- a/sdext/source/pdfimport/filterdet.hxx
+++ b/sdext/source/pdfimport/filterdet.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_FILTERDET_HXX
-#define INCLUDED_SDEXT_SOURCE_PDFIMPORT_FILTERDET_HXX
+#pragma once
 
 #include 
 #include 
@@ -100,6 +99,4 @@ bool checkDocChecksum( const OUString& rInPDFFileURL,
 
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2021-07-26 Thread Andrea Gelmini (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit dd43ed8610f2d3e4c90d4bfd8a6ab3c736e5b4b8
Author: Andrea Gelmini 
AuthorDate: Mon Jul 26 17:56:32 2021 +0200
Commit: Julien Nabet 
CommitDate: Mon Jul 26 18:04:41 2021 +0200

Fix typos

Change-Id: If0c2b0df62d2f307ceaef0ea961a0ff221ba5e65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119520
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index ffa29b1f7b7b..7cf30241c5ee 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -556,11 +556,11 @@ void LineParser::readFont()
 /* The above font attributes (fontName, bold, italic) are based on
xpdf line output and may not be reliable. To get correct attributes,
we do the following:
-1. Read the embeded font file and determine the attributes based on the
+1. Read the embedded font file and determine the attributes based on the
font file.
 2. If we failed to read the font file, or empty result is returned, then
determine the font attributes from the font name.
-3. If all these attemps have failed, then use a fallback font.
+3. If all these attempts have failed, then use a fallback font.
 */
 if (nFileLen > 0)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-25 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx|   97 +++---
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |5 
 2 files changed, 89 insertions(+), 13 deletions(-)

New commits:
commit 2ee3d4076481262c1e3014dc9341cdf3d1922ff7
Author: Kevin Suo 
AuthorDate: Sat Jul 17 14:25:45 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Jul 26 08:28:20 2021 +0200

sdext.pdfimport: Restore to read font file for the determination...

of font attributes, as suggested by Mike Kaganski in
https://gerrit.libreoffice.org/c/core/+/118977.

This partially reverts da59686672fd2bc98f8cb28d5f04dc978b50ac13
but did some modification of the previous code with some
explanationary comments.

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

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index e22fe0aeca72..ffa29b1f7b7b 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -503,25 +504,36 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 
 void LineParser::readFont()
 {
-OString aFontName;
+/*
+xpdf line is like (separated by space):
+updateFont  
  
+updateFont 14   100  0 
1200.00   23068TimesNewRomanPSMT
+
+If nEmbedSize > 0, then a fontFile is followed as a stream.
+*/
+
+OStringaFontName;
 sal_Int64  nFontID;
 sal_Int32  nIsEmbedded, nIsBold, nIsItalic, nIsUnderline, nFileLen;
 double nSize;
 
-readInt64(nFontID);
-readInt32(nIsEmbedded);
-readInt32(nIsBold);
-readInt32(nIsItalic);
-readInt32(nIsUnderline);
-readDouble(nSize);
-readInt32(nFileLen);
+readInt64(nFontID); // read FontID
+readInt32(nIsEmbedded); // read isEmbedded
+readInt32(nIsBold); // read isBold
+readInt32(nIsItalic);   // read isItalic
+readInt32(nIsUnderline);// read isUnderline
+readDouble(nSize);  // read TransformedFontSize
+readInt32(nFileLen);// read nEmbedSize
 
 nSize = nSize < 0.0 ? -nSize : nSize;
-aFontName = lcl_unescapeLineFeeds( m_aLine.subView( m_nCharIndex ) );
+// Read FontName. From the current position to the end (any white spaces 
will be included).
+aFontName = lcl_unescapeLineFeeds(m_aLine.subView(m_nCharIndex));
 
 // name gobbles up rest of line
 m_nCharIndex = std::string_view::npos;
 
+// Check if this font is already in our font map list.
+// If yes, update the font size and skip.
 Parser::FontMapType::const_iterator pFont( 
m_parser.m_aFontMap.find(nFontID) );
 if( pFont != m_parser.m_aFontMap.end() )
 {
@@ -534,16 +546,75 @@ void LineParser::readFont()
 }
 
 // yet unknown font - get info and add to map
-FontAttributes aResult( OStringToOUString( aFontName,
-RTL_TEXTENCODING_UTF8 ),
+FontAttributes aResult( OStringToOUString( aFontName, 
RTL_TEXTENCODING_UTF8 ),
 nIsBold != 0,
 nIsItalic != 0,
 nIsUnderline != 0,
 nSize,
 1.0);
 
-// extract textual attributes (bold, italic in the name, etc.)
-parseFontFamilyName(aResult);
+/* The above font attributes (fontName, bold, italic) are based on
+   xpdf line output and may not be reliable. To get correct attributes,
+   we do the following:
+1. Read the embeded font file and determine the attributes based on the
+   font file.
+2. If we failed to read the font file, or empty result is returned, then
+   determine the font attributes from the font name.
+3. If all these attemps have failed, then use a fallback font.
+*/
+if (nFileLen > 0)
+{
+uno::Sequence aFontFile(nFileLen);
+readBinaryData(aFontFile);  // Read fontFile.
+
+uno::Sequence aArgs(1);
+awt::FontDescriptor aFontDescriptor;
+aArgs[0] <<= aFontFile;
+
+try
+{
+uno::Reference xHolder(
+
m_parser.m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+"com.sun.star.awt.FontIdentificator", aArgs, 
m_parser.m_xContext),
+uno::UNO_QUERY);
+if (xHolder.is())
+{
+uno::Any aFontReadResult(xHolder->getMaterial());
+aFontReadResult >>= aFontDescriptor;
+if (!aFontDescriptor.Name.isEmpty())
+{
+aResult.familyName = aFontDescriptor.Name;
+aResult.isBold = (aFontDescripto

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

2021-07-18 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit c85557c924ee83f9a29c07520c83d308ff5a4c79
Author: Caolán McNamara 
AuthorDate: Sun Jul 18 14:35:58 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jul 18 16:47:29 2021 +0200

poppler 0.73 doesn't have GooString::append(const std::string&)

don't know what version is appeared in

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

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index bc313f76ecc4..9ffece584347 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -444,7 +444,11 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, GfxState* state )
 if( familyName != "" )
 {
 aNewFont.familyName.clear();
+#if POPPLER_CHECK_VERSION(0, 74, 0) // at least 0.73 doesn't have 
GooString::append(const std::string&)
 aNewFont.familyName.append( familyName );
+#else
+aNewFont.familyName.append( familyName.c_str() );
+#endif
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-16 Thread Andrea Gelmini (via logerrit)
 sd/qa/unit/export-tests-ooxml3.cxx  |2 +-
 sdext/source/pdfimport/inc/wrapper.hxx  |2 +-
 sw/qa/extras/rtfexport/rtfexport.cxx|2 +-
 sw/qa/uitest/writer_tests7/tdf134452.py |2 +-
 sw/source/core/doc/DocumentContentOperationsManager.cxx |2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 1ae182f2503199f86ed9ec5690ca41e4b7213a91
Author: Andrea Gelmini 
AuthorDate: Fri Jul 16 15:47:24 2021 +0200
Commit: Julien Nabet 
CommitDate: Fri Jul 16 19:11:58 2021 +0200

Fix typos

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

diff --git a/sd/qa/unit/export-tests-ooxml3.cxx 
b/sd/qa/unit/export-tests-ooxml3.cxx
index 597783d85a70..359b5215860b 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -1787,7 +1787,7 @@ void SdOOXMLExportTest3::testTdf143315()
 
 xmlDocUniquePtr pXml = parseExport(tmpfile, "ppt/slides/slide1.xml");
 
-// Without the fix in place, whis would have failed with
+// Without the fix in place, this would have failed with
 // - Expected:
 // - Actual  : 216000
 // - In , XPath 
'/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr' unexpected 'marL' attribute
diff --git a/sdext/source/pdfimport/inc/wrapper.hxx 
b/sdext/source/pdfimport/inc/wrapper.hxx
index 12476a01aa1c..f8682299600c 100644
--- a/sdext/source/pdfimport/inc/wrapper.hxx
+++ b/sdext/source/pdfimport/inc/wrapper.hxx
@@ -65,7 +65,7 @@ namespace pdfi
 "Bold",
 "Italic",
 "Oblique",
-"Bold", //BoldItalic, BoldObique
+"Bold", //BoldItalic, BoldOblique
 "Light",
 "Reg",
 "VKana",
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 326c63a3cbae..0676e524376b 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1224,7 +1224,7 @@ DECLARE_RTFEXPORT_TEST(testPgndec, "pgndec.rtf")
 style::NumberingType::ARABIC,
 getProperty(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
 
-// tdf#82111 ensure a pargraph exists before a section break.
+// tdf#82111 ensure a paragraph exists before a section break.
 // This was only two paragraphs, and both page number fields were in one 
para on page 2 ("11").
 getParagraph(2, "1");
 CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
diff --git a/sw/qa/uitest/writer_tests7/tdf134452.py 
b/sw/qa/uitest/writer_tests7/tdf134452.py
index ce13e8db2270..bffb6f3bba14 100644
--- a/sw/qa/uitest/writer_tests7/tdf134452.py
+++ b/sw/qa/uitest/writer_tests7/tdf134452.py
@@ -34,7 +34,7 @@ class tdf134452(UITestCase):
 self.assertEqual("true", 
get_state_as_dict(xpagestyle)["Selected"])
 
 #applying table style on the table
-#without the fix, break and pageDesc properties would be overriden 
and lost
+#without the fix, break and pageDesc properties would be 
overridden and lost
 document = self.ui_test.get_component()
 tables = document.getTextTables()
 tables[0].setPropertyValue("TableTemplateName", "Box List Red")
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index ef0c4c1f3648..f7e88c891ee8 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2208,7 +2208,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& 
rPaM, SwPosition& rPos,
 SwTextNode* pSrcNd = rPaM.GetPoint()->nNode.GetNode().GetTextNode();
 bool bCorrSavePam = pSrcNd && pStt->nNode != pEnd->nNode;
 
-// If one ore more TextNodes are moved, SwNodes::Move will do a SplitNode.
+// If one or more TextNodes are moved, SwNodes::Move will do a SplitNode.
 // However, this does not update the cursor. So we create a TextNode to 
keep
 // updating the indices. After the Move the Node is optionally deleted.
 SwTextNode * pTNd = rPos.nNode.GetNode().GetTextNode();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-16 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 07087041610ca8351d764c838ae07fa58f3bdf9e
Author: Kevin Suo 
AuthorDate: Thu Jul 15 12:56:43 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 16 09:06:47 2021 +0200

restore compatibility with older popplers

with poppler 20.09:


/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:
 In member function 'int
 pdfi::PDFOutDev::parseFont(long long int, GfxFont*, 
GfxState*) const':

/home/rene/LibreOffice/git/libreoffice-7-2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx:438:39:
 error: 'class
 GfxFont' has no member named 'getNameWithoutSubsetTag'


https://www.google.com/search?q=getNameWithoutSubsetTag&oq=getNameWithoutSubsetTag&aqs=chrome..69i57.784j0j7&sourceid=chrome&ie=UTF-8
 suggests it was added in 20.12

Change-Id: I4eacd2d740cb689ff9b3c6cab59376e01b1ba162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118977
Tested-by: René Engelhard 
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index d8b73f621a09..bc313f76ecc4 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -432,10 +432,15 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, GfxState* state )
 FontAttributes aNewFont;
 int nSize = 0;
 
-#if POPPLER_CHECK_VERSION(0, 64, 0)
-const
-#endif
+#if POPPLER_CHECK_VERSION(20, 12, 0)
 std::string familyName = gfxFont->getNameWithoutSubsetTag();
+#else
+std::string familyName = gfxFont->getName()->toStr();
+if (familyName.length() > 7 && familyName.at(6) == '+')
+{
+familyName = familyName.substr(7);
+}
+#endif
 if( familyName != "" )
 {
 aNewFont.familyName.clear();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-14 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit b1ca6d3aae3b75ec3e5c1ef17d582bcec01fc7eb
Author: Kevin Suo 
AuthorDate: Wed Jul 14 09:44:30 2021 +0800
Commit: Noel Grandin 
CommitDate: Wed Jul 14 18:53:44 2021 +0200

sdext.pdfimport:  and  don't have "text:style-name" 
attribute

Per OpenDocument specs:
* The  element only has a "text:c" attribute.
* The  element only has a text:tab-ref attribute.

seen in the SAL_WARN message:
warn:xmloff:221658:221658:xmloff/source/text/txtparai.cxx:137: unknown 
attribute urn:oasis:names:tc:opendocument:xmlns:text:1.0 text:style-name 
value=text13
...

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

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 69f70001f6d6..d5ce02ad89bf 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -126,6 +126,7 @@ void DrawXmlEmitter::visit( TextElement& elem, const 
std::list< std::unique_ptr<
 
 m_rEmitContext.rEmitter.beginTag( "text:span", aProps );
 
+aProps = {};
 for(int i=0; i< elem.Text.getLength(); i++)
 {
 OUString strToken=  str.copy(i,1) ;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-14 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/wrapper.hxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 6a1de4f74e2510029313771d2751b6cd59141acf
Author: Kevin Suo 
AuthorDate: Tue Jul 13 15:13:45 2021 +0800
Commit: Noel Grandin 
CommitDate: Wed Jul 14 18:22:20 2021 +0200

tdf#78427 sdext.pdfimport: more bold/italic/Oblique fixes

e.g. the PDF in tdf#107812.
Also added notes to the fontAttributesSuffixes list.

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

diff --git a/sdext/source/pdfimport/inc/wrapper.hxx 
b/sdext/source/pdfimport/inc/wrapper.hxx
index 918f976ee817..12476a01aa1c 100644
--- a/sdext/source/pdfimport/inc/wrapper.hxx
+++ b/sdext/source/pdfimport/inc/wrapper.hxx
@@ -54,21 +54,25 @@ namespace pdfi
 const OUString&rFilterOptions );
 
 const OUString fontAttributesSuffixes[] = {
+// Note: for performance consideration, each one listed here is 
evaluated once,
+// and they are checked from the suffix, thus the order matters.
+// e.g. for "TimesNewRomanPS-BoldItalic", to get "TimesNewRoman", you 
should
+//  first have "Italic", and then "Bold", then "-", and then "PS".
 "MT",
 "PS",
 "PSMT",
 "Regular",
 "Bold",
 "Italic",
-"Bold",
 "Oblique",
+"Bold", //BoldItalic, BoldObique
 "Light",
 "Reg",
 "VKana",
 "-",
 ",",
 ";",
-"PS",
+"PS", // e.g. TimesNewRomanPS-BoldMT
 };
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-14 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |   15 ++-
 sdext/source/pdfimport/tree/pdfiprocessor.cxx  |   15 ++-
 sdext/source/pdfimport/tree/writertreevisiting.cxx |   28 +
 3 files changed, 41 insertions(+), 17 deletions(-)

New commits:
commit fe28633ee6edc5986220c934dfb04aa7b0d065ad
Author: Kevin Suo 
AuthorDate: Wed Jun 30 18:17:36 2021 +0800
Commit: Noel Grandin 
CommitDate: Wed Jul 14 09:07:09 2021 +0200

tdf81484 Draw and Writer pdf import: SimSun bold font is shown as "outline"

Case 1: As discussed in the bug report, SimSun does not have a
 "bold" font. In PDF it uses fill+stroke rendering mode (i.e.,
 Text Render Mode is 2), see CoreTextStyle::CoreTextStyle, as a
 faux bold (fake bold) feature. For faux bold, the text render
 fill color is the same as the stroke color.

Case 2: Also, it is noted that if you apply real "outline"
 characters in Writer and export to PDF, on Draw PDF import
 the text render mode is also 2, but the text render fill color
 is different than the stroke color.
 However, I would argue that for this case on PDF export Writer
 should set the render mode as 1, not 2, per PDF specs, which is
 another issue to be improved.

The old code treated all these two cases as "outline".

This patch:
1) treats render mode 2 as faux bold if the stroke color is the
 same as the fill color; and
2) still treat it as outline if the fill color and stroke color
 are different.

This way, the real outline remains as outline characters while
 the faux bold (fake bold) becomes bold again on pdf import.

This patch Also fixed some incorrect use of 
 attributes per OpenDocument specification.

This patch depends on change-ID I50a510ab9e5483f859ea2a767ea977ea3f065a2e
 which guesses the bold/italic if the font indentifaction had failed
 for whatever reason.

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

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index ebce9efc896b..69f70001f6d6 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -16,8 +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 .
  */
-
-
+#include 
 #include 
 #include 
 #include 
@@ -828,23 +827,28 @@ void DrawXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_pt
 PropertyMap aFontProps;
 
 // family name
+// TODO: tdf#143095: use system font name rather than PSName
+SAL_INFO("sdext.pdfimport", "The font used in xml is: " << 
rFont.familyName);
 aFontProps[ "fo:font-family" ] = rFont.familyName;
+aFontProps[ "style:font-family-asia" ] = rFont.familyName;
 aFontProps[ "style:font-family-complex" ] = rFont.familyName;
 
 // bold
 if( rFont.isBold )
 {
 aFontProps[ "fo:font-weight" ] = "bold";
-aFontProps[ "fo:font-weight-asian" ]   = "bold";
+aFontProps[ "style:font-weight-asian" ]   = "bold";
 aFontProps[ "style:font-weight-complex" ] = "bold";
 }
+
 // italic
 if( rFont.isItalic )
 {
 aFontProps[ "fo:font-style" ] = "italic";
-aFontProps[ "fo:font-style-asian" ]   = "italic";
+aFontProps[ "style:font-style-asian" ]   = "italic";
 aFontProps[ "style:font-style-complex" ] = "italic";
 }
+
 // underline
 if( rFont.isUnderline )
 {
@@ -852,11 +856,10 @@ void DrawXmlFinalizer::visit( TextElement& elem, const 
std::list< std::unique_pt
 aFontProps[ "style:text-underline-width" ]  = "auto";
 aFontProps[ "style:text-underline-color" ]  = "font-color";
 }
+
 // outline
 if( rFont.isOutline )
-{
 aFontProps[ "style:text-outline" ]  = "true";
-}
 
 // size
 SetFontsizeProperties(aFontProps, rFont.size);
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx 
b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index ed2eaf6510b9..d63ab04e97fd 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -147,7 +147,20 @@ void PDFIProcessor::setFont( const FontAttributes& i_rFont 
)
 FontAttributes aChangedFont( i_rFont );
 GraphicsContext& rGC=getCurrentContext();
 // for text render modes, please see PDF reference manual
-aChangedFont.isOutline = ( (rGC.TextRenderMode == 1) || (rGC. 
TextRenderMode == 2) );
+if (rGC.TextRenderMode == 1)
+{
+aChangedFont.isOutline = true;
+}
+else if (rGC.TextRenderMode == 2)
+{
+// tdf#81484: faux bold is represented as "stroke+fill" (while using 
the sa

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

2021-07-12 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/inc/wrapper.hxx |   18 +++
 sdext/source/pdfimport/wrapper/wrapper.cxx |  147 +
 2 files changed, 46 insertions(+), 119 deletions(-)

New commits:
commit cffd97193f7468f770368559d5a5c58bd0bb2327
Author: Kevin Suo 
AuthorDate: Sun Jul 11 14:49:54 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Jul 12 20:21:49 2021 +0200

tdf#78427 sdext.pdfimport: refactor the conversion of font family names

Simplify the code and hopefully improves performance.

The previous code used a long for loop within which it used many duplicated 
parseFontRemoveSuffix. That for loop was simply intended to remove the font 
family name suffixes. However, the rResult.familyName is a OUString and this 
type already has the function of removing suffixes which is more efficient.
Also, defined a list of suffixes to be removed in the header file. New 
suffixes can be easily added to this list.

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

diff --git a/sdext/source/pdfimport/inc/wrapper.hxx 
b/sdext/source/pdfimport/inc/wrapper.hxx
index 68e383de6a1a..918f976ee817 100644
--- a/sdext/source/pdfimport/inc/wrapper.hxx
+++ b/sdext/source/pdfimport/inc/wrapper.hxx
@@ -52,6 +52,24 @@ namespace pdfi
 const css::uno::Reference<
   css::uno::XComponentContext >&
xContext,
 const OUString&rFilterOptions );
+
+const OUString fontAttributesSuffixes[] = {
+"MT",
+"PS",
+"PSMT",
+"Regular",
+"Bold",
+"Italic",
+"Bold",
+"Oblique",
+"Light",
+"Reg",
+"VKana",
+"-",
+",",
+";",
+"PS",
+};
 }
 
 #endif // INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_WRAPPER_HXX
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index ae4903526c65..e22fe0aeca72 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -165,20 +165,14 @@ public:
 };
 
 class LineParser {
-Parser & m_parser;
-OString   m_aLine;
+Parser  & m_parser;
+OString m_aLine;
 
-static sal_Int32 parseFontCheckForString(const sal_Unicode* pCopy, 
sal_Int32 nCopyLen,
-  const char* pAttrib, sal_Int32 
nAttribLen,
-  FontAttributes& rResult, bool bItalic, 
bool bBold);
-static sal_Int32 parseFontRemoveSuffix(const sal_Unicode* pCopy, sal_Int32 
nCopyLen,
-  const char* pAttrib, sal_Int32 nAttribLen);
-static void  parseFontFamilyName( FontAttributes& aResult );
-
-void   readInt32( sal_Int32& o_Value );
-void   readInt64( sal_Int64& o_Value );
-void   readDouble( double& o_Value );
-void   readBinaryData( uno::Sequence& rBuf );
+static void parseFontFamilyName( FontAttributes& aResult );
+voidreadInt32( sal_Int32& o_Value );
+voidreadInt64( sal_Int64& o_Value );
+voidreadDouble( double& o_Value );
+voidreadBinaryData( uno::Sequence& rBuf );
 
 uno::Sequence readImageImpl();
 
@@ -477,119 +471,34 @@ rendering::ARGBColor LineParser::readColor()
 return aRes;
 }
 
-sal_Int32 LineParser::parseFontCheckForString(
-const sal_Unicode* pCopy, sal_Int32 nCopyLen,
-const char* pAttrib, sal_Int32 nAttribLen,
-FontAttributes& rResult, bool bItalic, bool bBold)
-{
-if (nCopyLen < nAttribLen)
-return 0;
-for (sal_Int32 i = 0; i < nAttribLen; ++i)
-{
-sal_uInt32 nCode = pAttrib[i];
-if (rtl::toAsciiLowerCase(pCopy[i]) != nCode
-&& rtl::toAsciiUpperCase(pCopy[i]) != nCode)
-return 0;
-}
-rResult.isItalic |= bItalic;
-rResult.isBold |= bBold;
-return nAttribLen;
-}
-
-sal_Int32 LineParser::parseFontRemoveSuffix(
-const sal_Unicode* pCopy, sal_Int32 nCopyLen,
-const char* pAttrib, sal_Int32 nAttribLen)
-{
-if (nCopyLen < nAttribLen)
-return 0;
-for (sal_Int32 i = 0; i < nAttribLen; ++i)
-if ( pCopy[nCopyLen - nAttribLen + i] != pAttrib[i] )
-return 0;
-return nAttribLen;
-}
+/* Parse and convert the font family name (passed from xpdfimport) to correct 
font names
+e.g. TimesNewRomanPSMT-> TimesNewRoman
+  TimesNewRomanPS-BoldMT   -> TimesNewRoman
+  TimesNewRomanPS-BoldItalicMT -> TimesNewRoman
+During the conversion, also apply the font features (bold italic etc) to the 
result.
 
+TODO: Further convert the font names to real font names in the system rather 
than the PS names.
+e.g., TimesNewRoman -> Times New Roman
+*/
 void LineParser::parseFontFamilyName( FontAttribu

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

2021-07-12 Thread Kevin Suo (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx|   52 --
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |9 +--
 2 files changed, 3 insertions(+), 58 deletions(-)

New commits:
commit da59686672fd2bc98f8cb28d5f04dc978b50ac13
Author: Kevin Suo 
AuthorDate: Sat Jul 10 11:47:39 2021 +0800
Commit: Noel Grandin 
CommitDate: Mon Jul 12 10:57:27 2021 +0200

tdf#78427 sdext.pdfimport: No need to read a font file for the purpose of...

...determining the bold/italic/underline etc.

The purpose for reading a font file is that in case the font attributes 
determined by the xpdfimport process is not enough, then we use the lo core 
font classes which read in the font file and then determine whether it is bold, 
italic etc.
However, while this works in some cases, it does not work in many cases 
when the font file was actually a subset and a toUnicode map is followed in the 
PDF, see tdf#78427.
In addition, in case the information collected from the xpdfimport process 
is enough, there is no need to read the font file.

This commit removes the read of font file part. Also, this commit uses 
gfxFont->getNameWithoutSubsetTag() to get the font name with the subset tags 
removed, thus simplified the code in wrapper.cxx while also improves performace 
as the remove of subset tags is only run when the font is a subset (the 
previous code did this for all the font names).

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

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 2221f1ebe33f..ae4903526c65 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -514,12 +514,6 @@ void LineParser::parseFontFamilyName( FontAttributes& 
rResult )
 
 const sal_Unicode* pCopy = rResult.familyName.getStr();
 sal_Int32 nLen = rResult.familyName.getLength();
-// parse out truetype subsets (e.g. BA+Thorndale)
-if( nLen > 8 && pCopy[6] == '+' )
-{
-pCopy += 7;
-nLen -= 7;
-}
 
 // TODO: Looks like this block needs to be refactored
 while( nLen )
@@ -641,52 +635,6 @@ void LineParser::readFont()
 
 // extract textual attributes (bold, italic in the name, etc.)
 parseFontFamilyName(aResult);
-// need to read font file?
-if( nFileLen )
-{
-uno::Sequence aFontFile(nFileLen);
-readBinaryData( aFontFile );
-
-awt::FontDescriptor aFD;
-uno::Sequence< uno::Any > aArgs(1);
-aArgs[0] <<= aFontFile;
-
-try
-{
-uno::Reference< beans::XMaterialHolder > xMat(
-
m_parser.m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-"com.sun.star.awt.FontIdentificator", aArgs, 
m_parser.m_xContext ),
-uno::UNO_QUERY );
-if( xMat.is() )
-{
-uno::Any aRes( xMat->getMaterial() );
-if( aRes >>= aFD )
-{
-if (!aFD.Name.isEmpty())
-{
-aResult.familyName = aFD.Name;
-parseFontFamilyName(aResult);
-}
-aResult.isBold  = (aFD.Weight > 100.0);
-aResult.isItalic= (aFD.Slant == awt::FontSlant_OBLIQUE 
||
-   aFD.Slant == awt::FontSlant_ITALIC 
);
-aResult.isUnderline = false;
-aResult.size= 0;
-}
-}
-}
-catch( uno::Exception& )
-{
-}
-
-if( aResult.familyName.isEmpty() )
-{
-// last fallback
-aResult.familyName  = "Arial";
-aResult.isUnderline = false;
-}
-
-}
 
 if (!m_parser.m_xDev)
 m_parser.m_xDev.disposeAndReset(VclPtr::Create());
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 16ad04bf660a..d8b73f621a09 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -435,11 +435,11 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* 
gfxFont, GfxState* state )
 #if POPPLER_CHECK_VERSION(0, 64, 0)
 const
 #endif
-GooString* pFamily = gfxFont->getName();
-if( pFamily )
+std::string familyName = gfxFont->getNameWithoutSubsetTag();
+if( familyName != "" )
 {
 aNewFont.familyName.clear();
-aNewFont.familyName.append( gfxFont->getName() );
+aNewFont.familyName.append( familyName );
 }
 else
 {
@@ -786,9 +786,6 @@ void PDFOutDev::updateFont(GfxState *state)
 aEsc.data() );
 }
 printf( "\n"

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

2021-06-09 Thread Julien Nabet (via logerrit)
 sdext/source/presenter/PresenterGeometryHelper.cxx |   44 -
 sdext/source/presenter/PresenterSlideShowView.cxx  |   27 ++--
 sdext/source/presenter/PresenterWindowManager.cxx  |   27 ++--
 3 files changed, 55 insertions(+), 43 deletions(-)

New commits:
commit da44de883f205736fffeacc148c32dcfd638ad66
Author: Julien Nabet 
AuthorDate: Wed Jun 9 19:02:52 2021 +0200
Commit: Julien Nabet 
CommitDate: Wed Jun 9 21:27:29 2021 +0200

Simplify Sequences initializations (sdext)

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

diff --git a/sdext/source/presenter/PresenterGeometryHelper.cxx 
b/sdext/source/presenter/PresenterGeometryHelper.cxx
index 3d59f259ea7b..67a81d63c766 100644
--- a/sdext/source/presenter/PresenterGeometryHelper.cxx
+++ b/sdext/source/presenter/PresenterGeometryHelper.cxx
@@ -21,6 +21,8 @@
 
 #include 
 #include 
+#include 
+
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -183,12 +185,15 @@ Reference 
PresenterGeometryHelper::CreatePolygon(
 if ( ! rxDevice.is())
 return nullptr;
 
-Sequence > aPoints(1);
-aPoints[0] = Sequence(4);
-aPoints[0][0] = geometry::RealPoint2D(rBox.X, rBox.Y);
-aPoints[0][1] = geometry::RealPoint2D(rBox.X, rBox.Y+rBox.Height);
-aPoints[0][2] = geometry::RealPoint2D(rBox.X+rBox.Width, 
rBox.Y+rBox.Height);
-aPoints[0][3] = geometry::RealPoint2D(rBox.X+rBox.Width, rBox.Y);
+Sequence > aPoints
+{
+{
+{ o3tl::narrowing(rBox.X), o3tl::narrowing(rBox.Y) 
},
+{ o3tl::narrowing(rBox.X), 
o3tl::narrowing(rBox.Y+rBox.Height) },
+{ o3tl::narrowing(rBox.X+rBox.Width), 
o3tl::narrowing(rBox.Y+rBox.Height) },
+{ o3tl::narrowing(rBox.X+rBox.Width), 
o3tl::narrowing(rBox.Y) }
+}
+};
 Reference xPolygon (
 rxDevice->createCompatibleLinePolyPolygon(aPoints));
 if (xPolygon.is())
@@ -204,12 +209,15 @@ Reference 
PresenterGeometryHelper::CreatePolygon(
 if ( ! rxDevice.is())
 return nullptr;
 
-Sequence > aPoints(1);
-aPoints[0] = Sequence(4);
-aPoints[0][0] = geometry::RealPoint2D(rBox.X1, rBox.Y1);
-aPoints[0][1] = geometry::RealPoint2D(rBox.X1, rBox.Y2);
-aPoints[0][2] = geometry::RealPoint2D(rBox.X2, rBox.Y2);
-aPoints[0][3] = geometry::RealPoint2D(rBox.X2, rBox.Y1);
+Sequence > aPoints
+{
+{
+{ rBox.X1, rBox.Y1 },
+{ rBox.X1, rBox.Y2 },
+{ rBox.X2, rBox.Y2 },
+{ rBox.X2, rBox.Y1 }
+}
+};
 Reference xPolygon (
 rxDevice->createCompatibleLinePolyPolygon(aPoints));
 if (xPolygon.is())
@@ -230,11 +238,13 @@ Reference 
PresenterGeometryHelper::CreatePolygon(
 for (sal_Int32 nIndex=0; nIndex(4);
-aPoints[nIndex][0] = geometry::RealPoint2D(rBox.X, rBox.Y);
-aPoints[nIndex][1] = geometry::RealPoint2D(rBox.X, rBox.Y+rBox.Height);
-aPoints[nIndex][2] = geometry::RealPoint2D(rBox.X+rBox.Width, 
rBox.Y+rBox.Height);
-aPoints[nIndex][3] = geometry::RealPoint2D(rBox.X+rBox.Width, rBox.Y);
+aPoints[nIndex] = Sequence
+{
+{ o3tl::narrowing(rBox.X), o3tl::narrowing(rBox.Y) 
},
+{ o3tl::narrowing(rBox.X), 
o3tl::narrowing(rBox.Y+rBox.Height) },
+{ o3tl::narrowing(rBox.X+rBox.Width), 
o3tl::narrowing(rBox.Y+rBox.Height) },
+{ o3tl::narrowing(rBox.X+rBox.Width), 
o3tl::narrowing(rBox.Y) }
+};
 }
 
 Reference xPolygon (
diff --git a/sdext/source/presenter/PresenterSlideShowView.cxx 
b/sdext/source/presenter/PresenterSlideShowView.cxx
index 7ad4bc207645..26239c0b2642 100644
--- a/sdext/source/presenter/PresenterSlideShowView.cxx
+++ b/sdext/source/presenter/PresenterSlideShowView.cxx
@@ -666,20 +666,21 @@ void PresenterSlideShowView::PaintOuterWindow (const 
awt::Rectangle& rRepaintBox
 Reference xBackgroundBitmap 
(mpBackground->GetNormalBitmap());
 if (xBackgroundBitmap.is())
 {
-Sequence aTextures (1);
 const geometry::IntegerSize2D 
aBitmapSize(xBackgroundBitmap->getSize());
-aTextures[0] = rendering::Texture (
-geometry::AffineMatrix2D(
-aBitmapSize.Width,0,0,
-0,aBitmapSize.Height,0),
-1,
-0,
-xBackgroundBitmap,
-nullptr,
-nullptr,
-rendering::StrokeAttributes(),
-rendering::TexturingMode::REPEAT,
-rendering::TexturingMode::REPEAT);
+Sequence aTextures
+{
+{
+geometry::AffineMatrix2D( aBitmapSize.Width,0,0, 
0,aBitmapSize.Height,0),
+1,
+0,
+xBackgroundBitmap,
+nullptr,
+nullptr,
+rendering::StrokeAttributes(),
+ 

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

2021-05-31 Thread Arnaud Versini (via logerrit)
 sdext/source/minimizer/pppoptimizertoken.cxx |9 +
 sdext/source/pdfimport/misc/pwdinteract.cxx  |   11 ++-
 2 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit d220fc00c2c3d7a2a24fd762599d1bfcc27f34d5
Author: Arnaud Versini 
AuthorDate: Sun May 30 19:32:41 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon May 31 15:21:39 2021 +0200

sdext : use std::mutex when possible

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

diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx 
b/sdext/source/minimizer/pppoptimizertoken.cxx
index 9a5c2eac9a62..9130621ff762 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -19,16 +19,17 @@
 
 
 #include "pppoptimizertoken.hxx"
-#include 
+
 #include 
 #include 
 #include 
+#include 
 
 typedef std::unordered_map< const char*, PPPOptimizerTokenEnum, 
rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
 static TypeNameHashMap* pHashMap = nullptr;
-static ::osl::Mutex& getHashMapMutex()
+static std::mutex& getHashMapMutex()
 {
-static osl::Mutex s_aHashMapProtection;
+static std::mutex s_aHashMapProtection;
 return s_aHashMapProtection;
 }
 
@@ -166,7 +167,7 @@ PPPOptimizerTokenEnum TKGet( const OUString& rToken )
 {
 if ( !pHashMap )
 {   // init hash map
-::osl::MutexGuard aGuard( getHashMapMutex() );
+std::lock_guard aGuard( getHashMapMutex() );
 if ( !pHashMap )
 {
 TypeNameHashMap* pH = new TypeNameHashMap;
diff --git a/sdext/source/pdfimport/misc/pwdinteract.cxx 
b/sdext/source/pdfimport/misc/pwdinteract.cxx
index 4179795cc073..9885a6606a54 100644
--- a/sdext/source/pdfimport/misc/pwdinteract.cxx
+++ b/sdext/source/pdfimport/misc/pwdinteract.cxx
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -44,7 +45,7 @@ class PDFPasswordRequest:
 task::XInteractionRequest, task::XInteractionPassword >
 {
 private:
-mutable osl::Mutexm_aMutex;
+mutable std::mutexm_aMutex;
 uno::Any  m_aRequest;
 OUString m_aPassword;
 bool  m_bSelected;
@@ -65,7 +66,7 @@ public:
 // XInteractionContinuation
 virtual void SAL_CALL select() override;
 
-bool isSelected() const { osl::MutexGuard const guard( m_aMutex ); return 
m_bSelected; }
+bool isSelected() const { std::scoped_lock const guard( m_aMutex ); return 
m_bSelected; }
 
 private:
 virtual ~PDFPasswordRequest() override {}
@@ -98,21 +99,21 @@ uno::Sequence< uno::Reference< 
task::XInteractionContinuation > > PDFPasswordReq
 
 void PDFPasswordRequest::setPassword( const OUString& rPwd )
 {
-osl::MutexGuard const guard( m_aMutex );
+std::scoped_lock const guard( m_aMutex );
 
 m_aPassword = rPwd;
 }
 
 OUString PDFPasswordRequest::getPassword()
 {
-osl::MutexGuard const guard( m_aMutex );
+std::scoped_lock const guard( m_aMutex );
 
 return m_aPassword;
 }
 
 void PDFPasswordRequest::select()
 {
-osl::MutexGuard const guard( m_aMutex );
+std::scoped_lock const guard( m_aMutex );
 
 m_bSelected = true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-21 Thread Stephan Bergmann (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 12362fc496102b344dedef0a6ba130ba80b94149
Author: Stephan Bergmann 
AuthorDate: Fri May 21 13:38:32 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Fri May 21 14:50:14 2021 +0200

LineParser::readNextToken gets called with m_nCharIndex==npos after all

eca89ece45ede76605a6102c94b3b67e1f8ff5aa "Replace rtl_string_getTokenView 
with
o3tl::getToken" had erroneously assumed (from a succeeding `make check`) 
that
the only problematic call to o3tl::getToken with position==npos would be 
the one
in LineParser::readPath (and which had been addressed in that commit).

But e.g. loading ooo29794-4.pdf from the crash test corpus would also run 
into
that situation via LineParser::readNextToken,

> 
warn:legacy.osl:3090875:3090875:sdext/source/pdfimport/wrapper/wrapper.cxx:259: 
insufficient input
> soffice.bin: include/o3tl/string_view.hxx:34: std::string_view 
o3tl::getToken(std::string_view, char, std::size_t &): Assertion `position <= 
sv.size()' failed.

> #3  0x77a67a16 in __GI___assert_fail (assertion=0x7fffb39ea58c 
"position <= sv.size()", file=0x7fffb39f2a7f "include/o3tl/string_view.hxx", 
line=34, function=0x7fffb39ef3a9 "std::string_view 
o3tl::getToken(std::string_view, char, std::size_t &)")
> #4  0x7fffb3b60131 in o3tl::getToken(std::basic_string_view >, char, unsigned long&) (sv="eoClipPath", delimiter=32 
' ', position=@0x7fff29e0: 18446744073709551615) at 
include/o3tl/string_view.hxx:34
> #5  0x7fffb3b5aa9f in pdfi::(anonymous 
namespace)::LineParser::readNextToken() (this=0x7fff29d0) at 
sdext/source/pdfimport/wrapper/wrapper.cxx:260
> #6  0x7fffb3b5b2fa in pdfi::(anonymous 
namespace)::LineParser::readPath() (this=0x7fff29d0) at 
sdext/source/pdfimport/wrapper/wrapper.cxx:323
> #7  0x7fffb3b59eb3 in pdfi::(anonymous 
namespace)::Parser::parseLine(rtl::OString const&) (this=0x7fff2d28, 
rLine="eoClipPath") at sdext/source/pdfimport/wrapper/wrapper.cxx:859
[...]

so better guard there.

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

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 78fb9cd0b331..2221f1ebe33f 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -256,7 +256,10 @@ OString lcl_unescapeLineFeeds(std::string_view i_rStr)
 
 std::string_view LineParser::readNextToken()
 {
-OSL_PRECOND(m_nCharIndex!=std::string_view::npos,"insufficient input");
+if (m_nCharIndex == std::string_view::npos) {
+SAL_WARN("sdext.pdfimport", "insufficient input");
+return {};
+}
 return o3tl::getToken(m_aLine,' ',m_nCharIndex);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-18 Thread Stephan Bergmann (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 66b4852551aa1838009fac72dc6453bf94de2dd8
Author: Stephan Bergmann 
AuthorDate: Tue May 18 10:23:06 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 18 13:38:21 2021 +0200

Use some more std::string_view

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

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index f2439a5bb83c..9bd803d0348f 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -210,10 +210,10 @@ public:
 characters are encoded as pairs of characters: '\\' 'n', resp.
 '\\' 'r'. This function converts them back to '\n', resp. '\r'.
   */
-OString lcl_unescapeLineFeeds(const OString& i_rStr)
+OString lcl_unescapeLineFeeds(std::string_view i_rStr)
 {
-const size_t nOrigLen(sal::static_int_cast(i_rStr.getLength()));
-const char* const pOrig(i_rStr.getStr());
+const size_t nOrigLen(i_rStr.size());
+const char* const pOrig(i_rStr.data());
 std::unique_ptr pBuffer(new char[nOrigLen + 1]);
 
 const char* pRead(pOrig);
@@ -316,7 +316,7 @@ void LineParser::readBinaryData( uno::Sequence& 
rBuf )
 
 uno::Reference LineParser::readPath()
 {
-const OString aSubPathMarker( "subpath" );
+static const std::string_view aSubPathMarker( "subpath" );
 
 if( readNextToken() != aSubPathMarker )
 OSL_PRECOND(false, "broken path");
@@ -332,7 +332,7 @@ uno::Reference 
LineParser::readPath()
 
 sal_Int32 nContiguousControlPoints(0);
 sal_Int32 nDummy=m_nCharIndex;
-OString aCurrToken( m_aLine.getToken(0,' ',nDummy) );
+std::string_view aCurrToken( m_aLine.getTokenView(0,' ',nDummy) );
 
 while( m_nCharIndex != -1 && aCurrToken != aSubPathMarker )
 {
@@ -366,7 +366,7 @@ uno::Reference 
LineParser::readPath()
 
 // one token look-ahead (new subpath or more points?
 nDummy=m_nCharIndex;
-aCurrToken = m_aLine.getToken(0,' ',nDummy);
+aCurrToken = m_aLine.getTokenView(0,' ',nDummy);
 }
 
 aResult.append( aSubPath );
@@ -397,7 +397,7 @@ void LineParser::readChar()
 OString aChars;
 
 if (m_nCharIndex != -1)
-aChars = lcl_unescapeLineFeeds( m_aLine.copy( m_nCharIndex ) );
+aChars = lcl_unescapeLineFeeds( m_aLine.subView( m_nCharIndex ) );
 
 // chars gobble up rest of line
 m_nCharIndex = -1;
@@ -610,7 +610,7 @@ void LineParser::readFont()
 readInt32(nFileLen);
 
 nSize = nSize < 0.0 ? -nSize : nSize;
-aFontName = lcl_unescapeLineFeeds( m_aLine.copy( m_nCharIndex ) );
+aFontName = lcl_unescapeLineFeeds( m_aLine.subView( m_nCharIndex ) );
 
 // name gobbles up rest of line
 m_nCharIndex = -1;
@@ -790,7 +790,7 @@ void LineParser::readLink()
 
 m_parser.m_pSink->hyperLink( aBounds,
 OStringToOUString( lcl_unescapeLineFeeds(
-m_aLine.copy(m_nCharIndex) ),
+m_aLine.subView(m_nCharIndex) ),
 RTL_TEXTENCODING_UTF8 ) );
 // name gobbles up rest of line
 m_nCharIndex = -1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-05-18 Thread Stephan Bergmann (via logerrit)
 sdext/source/pdfimport/wrapper/wrapper.cxx |  226 +++--
 1 file changed, 117 insertions(+), 109 deletions(-)

New commits:
commit f80c4bfab668f9f72495526fa438f33b11ccaa7a
Author: Stephan Bergmann 
AuthorDate: Tue May 18 09:11:18 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 18 12:30:16 2021 +0200

Move per-Parser::parseLine state into its own LineParser class

(together with the member functions that operate on that state).  That 
reveals
that Parser::m_nNextToken was always 0 when used, so can be removed.

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

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx 
b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 953d437ab5e2..5672249c3e15 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -138,6 +138,8 @@ enum parseKey {
 
 class Parser
 {
+friend class LineParser;
+
 typedef std::unordered_map< sal_Int64,
FontAttributes > FontMapType;
 
@@ -145,20 +147,48 @@ class Parser
 const uno::Reference m_xContext;
 const ContentSinkSharedPtr   m_pSink;
 const oslFileHandle  m_pErr;
-OString   m_aLine;
 FontMapType  m_aFontMap;
-sal_Int32m_nNextToken;
-sal_Int32m_nCharIndex;
 
+public:
+Parser( const ContentSinkSharedPtr&   rSink,
+oslFileHandle pErr,
+const uno::Reference& xContext ) :
+m_xContext(xContext),
+m_pSink(rSink),
+m_pErr(pErr),
+m_aFontMap(101)
+{}
+
+void parseLine( const OString& rLine );
+};
+
+class LineParser {
+Parser & m_parser;
+OString   m_aLine;
+
+static sal_Int32 parseFontCheckForString(const sal_Unicode* pCopy, 
sal_Int32 nCopyLen,
+  const char* pAttrib, sal_Int32 
nAttribLen,
+  FontAttributes& rResult, bool bItalic, 
bool bBold);
+static sal_Int32 parseFontRemoveSuffix(const sal_Unicode* pCopy, sal_Int32 
nCopyLen,
+  const char* pAttrib, sal_Int32 nAttribLen);
+static void  parseFontFamilyName( FontAttributes& aResult );
 
-std::string_view readNextToken();
 void   readInt32( sal_Int32& o_Value );
-sal_Int32  readInt32();
 void   readInt64( sal_Int64& o_Value );
 void   readDouble( double& o_Value );
-double readDouble();
 void   readBinaryData( uno::Sequence& rBuf );
 
+uno::Sequence readImageImpl();
+
+public:
+sal_Int32m_nCharIndex = 0;
+
+LineParser(Parser & parser, OString const & line): m_parser(parser), 
m_aLine(line) {}
+
+std::string_view readNextToken();
+sal_Int32  readInt32();
+double readDouble();
+
 uno::Reference readPath();
 
 void readChar();
@@ -167,35 +197,13 @@ class Parser
 void readLineJoin();
 void readTransformation();
 rendering::ARGBColor readColor();
-static void  parseFontFamilyName( FontAttributes& aResult );
 void readFont();
-uno::Sequence readImageImpl();
 
 void readImage();
 void readMask();
 void readLink();
 void readMaskedImage();
 void readSoftMaskedImage();
-static sal_Int32 parseFontCheckForString(const sal_Unicode* pCopy, 
sal_Int32 nCopyLen,
-  const char* pAttrib, sal_Int32 
nAttribLen,
-  FontAttributes& rResult, bool bItalic, 
bool bBold);
-static sal_Int32 parseFontRemoveSuffix(const sal_Unicode* pCopy, sal_Int32 
nCopyLen,
-  const char* pAttrib, sal_Int32 nAttribLen);
-
-public:
-Parser( const ContentSinkSharedPtr&   rSink,
-oslFileHandle pErr,
-const uno::Reference& xContext ) :
-m_xContext(xContext),
-m_pSink(rSink),
-m_pErr(pErr),
-m_aLine(),
-m_aFontMap(101),
-m_nNextToken(-1),
-m_nCharIndex(-1)
-{}
-
-void parseLine( const OString& rLine );
 };
 
 /** Unescapes line-ending characters in input string. These
@@ -244,45 +252,45 @@ OString lcl_unescapeLineFeeds(const OString& i_rStr)
 return aResult;
 }
 
-std::string_view Parser::readNextToken()
+std::string_view LineParser::readNextToken()
 {
 OSL_PRECOND(m_nCharIndex!=-1,"insufficient input");
-

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

2021-05-07 Thread Arnaud Versini (via logerrit)
 sdext/source/presenter/PresenterTimer.cxx |   29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

New commits:
commit b30170661fb3a87d6b0491d748b8eb0d8f3dc99e
Author: Arnaud Versini 
AuthorDate: Mon Apr 19 10:50:06 2021 +0200
Commit: Arnaud Versini 
CommitDate: Fri May 7 15:52:16 2021 +0200

presenter : use std::mutex

Change-Id: I53e081fd6c52fc040b29fad18dc3a758310f943a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114259
Tested-by: Jenkins
Reviewed-by: Arnaud Versini 

diff --git a/sdext/source/presenter/PresenterTimer.cxx 
b/sdext/source/presenter/PresenterTimer.cxx
index 196feeba62ef..f46fcd288ee0 100644
--- a/sdext/source/presenter/PresenterTimer.cxx
+++ b/sdext/source/presenter/PresenterTimer.cxx
@@ -28,6 +28,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 using namespace ::com::sun::star;
@@ -99,14 +100,14 @@ public:
 
 private:
 static std::shared_ptr mpInstance;
-static ::osl::Mutex maInstanceMutex;
+static std::mutex maInstanceMutex;
 std::shared_ptr mpLateDestroy; // for clean exit
 static sal_Int32 mnTaskId;
 
-::osl::Mutex maTaskContainerMutex;
+std::mutex maTaskContainerMutex;
 typedef ::std::set TaskContainer;
 TaskContainer maScheduledTasks;
-::osl::Mutex maCurrentTaskMutex;
+std::mutex maCurrentTaskMutex;
 SharedTimerTask mpCurrentTask;
 ::osl::Condition m_Shutdown;
 
@@ -177,13 +178,13 @@ void PresenterTimer::CancelTask (const sal_Int32 nTaskId)
 //= TimerScheduler 
 
 std::shared_ptr TimerScheduler::mpInstance;
-::osl::Mutex TimerScheduler::maInstanceMutex;
+std::mutex TimerScheduler::maInstanceMutex;
 sal_Int32 TimerScheduler::mnTaskId = PresenterTimer::NotAValidTaskId;
 
 std::shared_ptr TimerScheduler::Instance(
 uno::Reference const& xContext)
 {
-::osl::MutexGuard aGuard (maInstanceMutex);
+std::lock_guard aGuard (maInstanceMutex);
 if (mpInstance == nullptr)
 {
 if (!xContext.is())
@@ -225,7 +226,7 @@ void TimerScheduler::ScheduleTask (const SharedTimerTask& 
rpTask)
 return;
 
 {
-osl::MutexGuard aTaskGuard (maTaskContainerMutex);
+std::lock_guard aTaskGuard (maTaskContainerMutex);
 maScheduledTasks.insert(rpTask);
 }
 }
@@ -236,7 +237,7 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId)
 // task ids.  Therefore we have to do a linear search for the task to
 // cancel.
 {
-::osl::MutexGuard aGuard (maTaskContainerMutex);
+std::lock_guard aGuard (maTaskContainerMutex);
 auto iTask = std::find_if(maScheduledTasks.begin(), 
maScheduledTasks.end(),
 [nTaskId](const SharedTimerTask& rxTask) { return rxTask->mnTaskId 
== nTaskId; });
 if (iTask != maScheduledTasks.end())
@@ -247,7 +248,7 @@ void TimerScheduler::CancelTask (const sal_Int32 nTaskId)
 // processed.  Mark it with a flag that a) prevents a repeating task
 // from being scheduled again and b) tries to prevent its execution.
 {
-::osl::MutexGuard aGuard (maCurrentTaskMutex);
+std::lock_guard aGuard (maCurrentTaskMutex);
 if (mpCurrentTask
 && mpCurrentTask->mnTaskId == nTaskId)
 mpCurrentTask->mbIsCanceled = true;
@@ -265,12 +266,12 @@ void TimerScheduler::NotifyTermination()
 }
 
 {
-::osl::MutexGuard aGuard(pInstance->maTaskContainerMutex);
+std::lock_guard aGuard(pInstance->maTaskContainerMutex);
 pInstance->maScheduledTasks.clear();
 }
 
 {
-::osl::MutexGuard aGuard(pInstance->maCurrentTaskMutex);
+std::lock_guard aGuard(pInstance->maCurrentTaskMutex);
 if (pInstance->mpCurrentTask)
 {
 pInstance->mpCurrentTask->mbIsCanceled = true;
@@ -302,7 +303,7 @@ void SAL_CALL TimerScheduler::run()
 SharedTimerTask pTask;
 sal_Int64 nDifference = 0;
 {
-::osl::MutexGuard aGuard (maTaskContainerMutex);
+std::lock_guard aGuard (maTaskContainerMutex);
 
 // There are no more scheduled task.  Leave this loop, function and
 // live of the TimerScheduler.
@@ -321,7 +322,7 @@ void SAL_CALL TimerScheduler::run()
 
 // Acquire a reference to the current task.
 {
-::osl::MutexGuard aGuard (maCurrentTaskMutex);
+std::lock_guard aGuard (maCurrentTaskMutex);
 mpCurrentTask = pTask;
 }
 
@@ -355,13 +356,13 @@ void SAL_CALL TimerScheduler::run()
 
 // Release reference to the current task.
 {
-::osl::MutexGuard aGuard (maCurrentTaskMutex);
+std::lock_guard aGuard (maCurrentTaskMutex);
 mpCurrentTask.reset();
 }
 }
 
 // While holding maInstanceMutex
-osl::Guard< osl::Mutex > aInstance( maInstanceMutex );
+std::lock_guard aInstance( maInstanceMutex );
 mpLateDestroy = mpInstance;
 

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

2021-03-21 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/pdfparse/pdfentries.cxx   |1 +
 sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 23316f2ef210960f22cba225be3d74e29b3182f4
Author: Caolán McNamara 
AuthorDate: Sun Mar 21 15:07:22 2021 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 21 20:48:56 2021 +0100

cid#1474243 Uninitialized scalar variable

and

cid#1473901 Uninitialized scalar variable

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

diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx 
b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index 0789268372e4..1e4c861df8dc 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -727,6 +727,7 @@ static void unzipToBuffer( char* pBegin, unsigned int nLen,
 z_stream aZStr;
 aZStr.next_in   = reinterpret_cast(pBegin);
 aZStr.avail_in  = nLen;
+aZStr.total_out = aZStr.total_in = 0;
 aZStr.zalloc= nullptr;
 aZStr.zfree = nullptr;
 aZStr.opaque= nullptr;
diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
index 39a1df6f4a76..a6390f0157e9 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
@@ -82,6 +82,7 @@ sal_uInt32 PngHelper::deflateBuffer( const Output_t* i_pBuf, 
size_t i_nLen, Outp
 aStream.zalloc  = Z_NULL;
 aStream.zfree   = Z_NULL;
 aStream.opaque  = Z_NULL;
+aStream.total_out = aStream.total_in = 0;
 if (Z_OK != deflateInit(&aStream, Z_BEST_COMPRESSION))
 return 0;
 aStream.avail_in = uInt(i_nLen);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-03-20 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 55a96efaacd2e932c7616f6a6072f794266f5948
Author: Caolán McNamara 
AuthorDate: Fri Mar 19 15:54:31 2021 +
Commit: Caolán McNamara 
CommitDate: Sat Mar 20 13:45:01 2021 +0100

cid#1474176 Unchecked return value from library

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

diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
index 5131838a996b..39a1df6f4a76 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
@@ -82,7 +82,8 @@ sal_uInt32 PngHelper::deflateBuffer( const Output_t* i_pBuf, 
size_t i_nLen, Outp
 aStream.zalloc  = Z_NULL;
 aStream.zfree   = Z_NULL;
 aStream.opaque  = Z_NULL;
-deflateInit( &aStream, Z_BEST_COMPRESSION );
+if (Z_OK != deflateInit(&aStream, Z_BEST_COMPRESSION))
+return 0;
 aStream.avail_in = uInt(i_nLen);
 aStream.next_in = const_cast(i_pBuf);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-02-21 Thread Noel (via logerrit)
 sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx  |2 
 sd/source/ui/accessibility/AccessibleSlideSorterView.cxx|2 
 sd/source/ui/framework/configuration/Configuration.cxx  |4 -
 sd/source/ui/slidesorter/controller/SlsClipboard.cxx|8 +--
 sd/source/ui/slidesorter/controller/SlsTransferableData.cxx |4 -
 sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx |2 
 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx |6 --
 sd/source/ui/unoidl/unopage.cxx |   16 +++---
 sd/source/ui/unoidl/unosrch.cxx |2 
 sd/source/ui/view/drviews5.cxx  |6 --
 sd/source/ui/view/outlnvsh.cxx  |6 --
 sd/source/ui/view/sdview2.cxx   |   23 
--
 sdext/source/pdfimport/pdfiadaptor.cxx  |   13 +++--
 13 files changed, 41 insertions(+), 53 deletions(-)

New commits:
commit 8f231fc5df201c45d16bce0b4b17f727842b2121
Author: Noel 
AuthorDate: Sun Feb 21 12:32:12 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Feb 21 16:13:06 2021 +0100

loplugin:refcounting in sd

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

diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx 
b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
index a8c81225130b..fde0cd953677 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
@@ -188,7 +188,7 @@ Reference SAL_CALL
 {
 ThrowIfDisposed();
 const SolarMutexGuard aSolarGuard;
-::utl::AccessibleStateSetHelper* pStateSet = new 
::utl::AccessibleStateSetHelper();
+rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new 
::utl::AccessibleStateSetHelper();
 
 if (mxParent.is())
 {
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx 
b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index ee663f2fbb1a..3ce13b899ef9 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -285,7 +285,7 @@ Reference SAL_CALL
 {
 ThrowIfDisposed();
 const SolarMutexGuard aSolarGuard;
-::utl::AccessibleStateSetHelper* pStateSet = new 
::utl::AccessibleStateSetHelper();
+rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new 
::utl::AccessibleStateSetHelper();
 
 pStateSet->AddState(AccessibleStateType::FOCUSABLE);
 pStateSet->AddState(AccessibleStateType::SELECTABLE);
diff --git a/sd/source/ui/framework/configuration/Configuration.cxx 
b/sd/source/ui/framework/configuration/Configuration.cxx
index 53bbaa339316..f155e0992e68 100644
--- a/sd/source/ui/framework/configuration/Configuration.cxx
+++ b/sd/source/ui/framework/configuration/Configuration.cxx
@@ -182,12 +182,10 @@ Reference SAL_CALL 
Configuration::createClone()
 ::osl::MutexGuard aGuard (maMutex);
 ThrowIfDisposed();
 
-Configuration* pConfiguration = new Configuration(
+return new Configuration(
 mxBroadcaster,
 mbBroadcastRequestEvents,
 *mpResourceContainer);
-
-return Reference(pConfiguration);
 }
 
 //- XNamed 
diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx 
b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
index 25e2aaea7b56..c7f333a5f0b9 100644
--- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -429,17 +429,17 @@ void Clipboard::CreateSlideTransferable (
 return;
 
 mrSlideSorter.GetView().BrkAction();
-SdTransferable* pTransferable = TransferableData::CreateTransferable (
+rtl::Reference pTransferable = 
TransferableData::CreateTransferable (
 pDocument,
 dynamic_cast(mrSlideSorter.GetViewShell()),
 aRepresentatives);
 
 if (bDrag)
-SD_MOD()->pTransferDrag = pTransferable;
+SD_MOD()->pTransferDrag = pTransferable.get();
 else
-SD_MOD()->pTransferClip = pTransferable;
+SD_MOD()->pTransferClip = pTransferable.get();
 
-pDocument->CreatingDataObj (pTransferable);
+pDocument->CreatingDataObj (pTransferable.get());
 pTransferable->SetWorkDocument(pDocument->AllocSdDrawDocument());
 std::unique_ptr pObjDesc(new 
TransferableObjectDescriptor);
 pTransferable->GetWorkDocument()->GetDocSh()
diff --git a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx 
b/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx
index b340642553cc..2aac76fe0600 100644
--- a/sd/source/ui/slidesorter/controller/SlsTransferableData.cxx
+++ b/sd/source/ui/slidesorter/controller

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

2021-02-18 Thread Noel (via logerrit)
 sdext/source/pdfimport/misc/pwdinteract.cxx |2 +-
 sdext/source/presenter/PresenterAccessibility.cxx   |8 
 sdext/source/presenter/PresenterProtocolHandler.cxx |2 +-
 sdext/source/presenter/PresenterToolBar.cxx |6 +++---
 sdext/source/presenter/PresenterViewFactory.cxx |2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 6cb2365511e23abd22f76cda76981222b81efdc4
Author: Noel 
AuthorDate: Wed Feb 17 18:23:31 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 18 09:13:48 2021 +0100

loplugin:referencecasting in sdext

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

diff --git a/sdext/source/pdfimport/misc/pwdinteract.cxx 
b/sdext/source/pdfimport/misc/pwdinteract.cxx
index 4eb7e7d96281..4179795cc073 100644
--- a/sdext/source/pdfimport/misc/pwdinteract.cxx
+++ b/sdext/source/pdfimport/misc/pwdinteract.cxx
@@ -161,7 +161,7 @@ bool getPassword( const uno::Reference< 
task::XInteractionHandler >& xHandler,
 new PDFPasswordRequest( bFirstTry, rDocName ) );
 try
 {
-xHandler->handle( xReq.get() );
+xHandler->handle( xReq );
 }
 catch( uno::Exception& )
 {
diff --git a/sdext/source/presenter/PresenterAccessibility.cxx 
b/sdext/source/presenter/PresenterAccessibility.cxx
index 936c75df35f7..768f4717a48d 100644
--- a/sdext/source/presenter/PresenterAccessibility.cxx
+++ b/sdext/source/presenter/PresenterAccessibility.cxx
@@ -617,7 +617,7 @@ void PresenterAccessible::UpdateAccessibilityHierarchy (
 mxNotesContentWindow,
 mxNotesBorderWindow,
 rpNotesTextView);
-mpAccessibleConsole->AddChild(mpAccessibleNotes.get());
+mpAccessibleConsole->AddChild(mpAccessibleNotes);
 }
 }
 
@@ -809,7 +809,7 @@ Reference SAL_CALL
 if (nIndex<0 || nIndex>=sal_Int32(maChildren.size()))
 throw lang::IndexOutOfBoundsException("invalid child index", 
static_cast(this));
 
-return Reference(maChildren[nIndex].get());
+return maChildren[nIndex];
 }
 
 Reference SAL_CALL
@@ -1367,7 +1367,7 @@ Reference SAL_CALL
 }
 }
 
-return Reference(pSet.get());
+return pSet;
 }
 
 //- XAccessibleText ---
@@ -1684,7 +1684,7 @@ rtl::Reference 
AccessibleNotes::Create (
 pObject->UpdateStateSet();
 pObject->SetWindow(rxContentWindow, rxBorderWindow);
 
-return 
rtl::Reference(pObject.get());
+return pObject;
 }
 
 void AccessibleNotes::SetTextView (
diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx 
b/sdext/source/presenter/PresenterProtocolHandler.cxx
index ff2cf4f251c5..0ee967ffe063 100644
--- a/sdext/source/presenter/PresenterProtocolHandler.cxx
+++ b/sdext/source/presenter/PresenterProtocolHandler.cxx
@@ -340,7 +340,7 @@ Reference 
PresenterProtocolHandler::Dispatch::Create (
 {
 ::rtl::Reference pDispatch (new Dispatch (rsURLPath, 
rpPresenterController));
 if (pDispatch->mpCommand != nullptr)
-return Reference(pDispatch.get());
+return pDispatch;
 else
 return nullptr;
 }
diff --git a/sdext/source/presenter/PresenterToolBar.cxx 
b/sdext/source/presenter/PresenterToolBar.cxx
index db679d94d4ee..1c70661879df 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -1403,7 +1403,7 @@ namespace {
 {
 ::rtl::Reference pElement (new Button(rpToolBar));
 pElement->Initialize();
-return ::rtl::Reference(pElement.get());
+return pElement;
 }
 
 Button::Button (
@@ -1765,7 +1765,7 @@ void TimeLabel::ConnectToTimer()
 {
 ::rtl::Reference pElement(new CurrentTimeLabel(rpToolBar));
 pElement->ConnectToTimer();
-return ::rtl::Reference(pElement.get());
+return pElement;
 }
 
 CurrentTimeLabel::~CurrentTimeLabel()
@@ -1802,7 +1802,7 @@ void CurrentTimeLabel::SetModes (
 {
 ::rtl::Reference pElement(new PresentationTimeLabel(rpToolBar));
 pElement->ConnectToTimer();
-return ::rtl::Reference(pElement.get());
+return pElement;
 }
 
 PresentationTimeLabel::~PresentationTimeLabel()
diff --git a/sdext/source/presenter/PresenterViewFactory.cxx 
b/sdext/source/presenter/PresenterViewFactory.cxx
index 6a59a32935d7..01b40d6e2ab8 100644
--- a/sdext/source/presenter/PresenterViewFactory.cxx
+++ b/sdext/source/presenter/PresenterViewFactory.cxx
@@ -355,7 +355,7 @@ Reference PresenterViewFactory::CreateSlideShowView(
 Reference(mxControllerWeak),
 mpPresenterController));
 pShowView->LateInit();
-xView.set(pShowView.get());
+xView = pShowView;
 }
 catch (RuntimeException&)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinf

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

2021-01-24 Thread Dr. David Alan Gilbert (via logerrit)
 sdext/source/presenter/PresenterSlideSorter.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 4e55bf7553fd90639769184e7027f275d31ca0b1
Author: Dr. David Alan Gilbert 
AuthorDate: Sun Jan 24 02:57:52 2021 +
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jan 25 07:54:37 2021 +0100

PresenterSlideSorter::mouseMoved: Merge identical if

cppchecker spotted a pair of neighbouring if's with identical
conditions; merge them.

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

diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx 
b/sdext/source/presenter/PresenterSlideSorter.cxx
index e87cb442df25..1f8adc555693 100644
--- a/sdext/source/presenter/PresenterSlideSorter.cxx
+++ b/sdext/source/presenter/PresenterSlideSorter.cxx
@@ -541,11 +541,9 @@ void SAL_CALL PresenterSlideSorter::mouseMoved (const 
css::awt::MouseEvent& rEve
 const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y);
 sal_Int32 nSlideIndex (mpLayout->GetSlideIndexForPosition(aPosition));
 
-if (nSlideIndex < 0)
-mnSlideIndexMousePressed = -1;
-
 if (nSlideIndex < 0)
 {
+mnSlideIndexMousePressed = -1;
 mpMouseOverManager->SetSlide(nSlideIndex, awt::Rectangle(0,0,0,0));
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-01-13 Thread Stephan Bergmann (via logerrit)
 sdext/source/pdfimport/pdfparse/pdfparse.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 58a61c0b85d8e1f08922a3ccedfa6101f4bf587a
Author: Stephan Bergmann 
AuthorDate: Wed Jan 13 14:32:24 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Jan 13 17:53:38 2021 +0100

Silence Boost bind deprecation warning

> In file included from sdext/source/pdfimport/pdfparse/pdfparse.cxx:35:
> In file included from external/boost/include/boost/bind.hpp:30:
> workdir/UnpackedTarball/boost/boost/bind.hpp:36:1: warning: The practice 
of declaring the Bind placeholders (_1, _2, ...) in the global namespace is 
deprecated. Please use  + using namespace 
boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the 
current behavior. [-W#pragma-messages]
> BOOST_PRAGMA_MESSAGE(
> ^

since e0f1b5bd94550835c639efda4e4c9a801c78dbe9 "Upgrade external/boost to 
latest
Boost 1.75.0".  boost/bind/bind.hpp and boost::placeholders appear to date 
back
to before our Boost 1.66 baseline.

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

diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx 
b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
index e61d900885ea..ef0bfaea65f4 100644
--- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
@@ -32,7 +32,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
@@ -143,6 +143,8 @@ public:
 {
 explicit definition( const PDFGrammar& rSelf )
 {
+using namespace boost::placeholders;
+
 PDFGrammar* pSelf = const_cast< PDFGrammar* 
>( &rSelf );
 
 // workaround workshop compiler: comment_p doesn't work
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sdext/source solenv/clang-format

2020-11-21 Thread Philipp Hofer (via logerrit)
 sdext/source/minimizer/pppoptimizer.cxx|9 -
 sdext/source/minimizer/pppoptimizer.hxx|3 +--
 sdext/source/minimizer/pppoptimizertoken.hxx   |4 ++--
 sdext/source/presenter/PresenterHelper.hxx |   22 +++---
 sdext/source/presenter/PresenterPane.hxx   |   24 +++-
 sdext/source/presenter/PresenterSprite.hxx |   12 +---
 sdext/source/presenter/PresenterSpritePane.hxx |   21 ++---
 sdext/source/presenter/PresenterUIPainter.hxx  |   15 ++-
 solenv/clang-format/excludelist|8 
 9 files changed, 50 insertions(+), 68 deletions(-)

New commits:
commit a9bce41c64bda648be2609a0dc4aea728fa8ec77
Author: Philipp Hofer 
AuthorDate: Thu Nov 12 13:14:32 2020 +0100
Commit: Christian Lohmaier 
CommitDate: Sun Nov 22 01:56:27 2020 +0100

tdf#123936 Formatting files in module sdext with clang-format

Change-Id: Ibfed67a0f772ea0c02bf0e7267e9ed46517e2018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105704
Reviewed-by: Christian Lohmaier 
Tested-by: Jenkins

diff --git a/sdext/source/minimizer/pppoptimizer.cxx 
b/sdext/source/minimizer/pppoptimizer.cxx
index 4d21ca3aabc9..c869f72187f6 100644
--- a/sdext/source/minimizer/pppoptimizer.cxx
+++ b/sdext/source/minimizer/pppoptimizer.cxx
@@ -17,19 +17,18 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include "pppoptimizer.hxx"
 #include 
 
 // returning filesize, on error zero is returned
-sal_Int64 PPPOptimizer::GetFileSize( const OUString& rURL )
+sal_Int64 PPPOptimizer::GetFileSize(const OUString& rURL)
 {
 sal_Int64 nFileSize = 0;
 osl::DirectoryItem aItem;
-if ( osl::DirectoryItem::get( rURL, aItem ) == osl::FileBase::E_None )
+if (osl::DirectoryItem::get(rURL, aItem) == osl::FileBase::E_None)
 {
-osl::FileStatus aStatus( osl_FileStatus_Mask_FileSize );
-if ( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None )
+osl::FileStatus aStatus(osl_FileStatus_Mask_FileSize);
+if (aItem.getFileStatus(aStatus) == osl::FileBase::E_None)
 {
 nFileSize = aStatus.getFileSize();
 }
diff --git a/sdext/source/minimizer/pppoptimizer.hxx 
b/sdext/source/minimizer/pppoptimizer.hxx
index cf1e5e0f244b..60b191a7bd07 100644
--- a/sdext/source/minimizer/pppoptimizer.hxx
+++ b/sdext/source/minimizer/pppoptimizer.hxx
@@ -22,10 +22,9 @@
 
 #include 
 
-
 struct PPPOptimizer
 {
-static sal_Int64 GetFileSize( const OUString& rURL );
+static sal_Int64 GetFileSize(const OUString& rURL);
 };
 
 #endif // INCLUDED_SDEXT_SOURCE_MINIMIZER_PPPOPTIMIZER_HXX
diff --git a/sdext/source/minimizer/pppoptimizertoken.hxx 
b/sdext/source/minimizer/pppoptimizertoken.hxx
index 8f83e8dd8f8e..d0ae65ed74ab 100644
--- a/sdext/source/minimizer/pppoptimizertoken.hxx
+++ b/sdext/source/minimizer/pppoptimizertoken.hxx
@@ -140,8 +140,8 @@ enum PPPOptimizerTokenEnum
 TK_NotFound
 };
 
-PPPOptimizerTokenEnum TKGet( const OUString& );
-OUString TKGet( const PPPOptimizerTokenEnum );
+PPPOptimizerTokenEnum TKGet(const OUString&);
+OUString TKGet(const PPPOptimizerTokenEnum);
 
 #endif
 
diff --git a/sdext/source/presenter/PresenterHelper.hxx 
b/sdext/source/presenter/PresenterHelper.hxx
index 6704844d730c..7f4387c163bd 100644
--- a/sdext/source/presenter/PresenterHelper.hxx
+++ b/sdext/source/presenter/PresenterHelper.hxx
@@ -23,23 +23,23 @@
 #include 
 #include 
 
-namespace sdext::presenter {
-
+namespace sdext::presenter
+{
 /** Collection of helper functions that do not fit in anywhere else.
 Provide access to frequently used strings of the drawing framework.
 */
 namespace PresenterHelper
 {
-extern const OUString msCenterPaneURL;
-extern const OUString msFullScreenPaneURL;
+extern const OUString msCenterPaneURL;
+extern const OUString msFullScreenPaneURL;
 
-/** Return the slide show controller of a running presentation that has
-the same document as the given framework controller.
-@return
-When no presentation is running this method returns an empty 
reference.
-*/
-css::uno::Reference 
GetSlideShowController (
-const css::uno::Reference& rxController);
+/** Return the slide show controller of a running presentation that has
+the same document as the given framework controller.
+@return
+When no presentation is running this method returns an empty reference.
+*/
+css::uno::Reference
+GetSlideShowController(const css::uno::Reference& 
rxController);
 }
 
 } // end of namespace presenter
diff --git a/sdext/source/presenter/PresenterPane.hxx 
b/sdext/source/presenter/PresenterPane.hxx
index 62b1941695d6..2a057229f802 100644
--- a/sdext/source/presenter/PresenterPane.hxx
+++ b/sdext/source/presenter/PresenterPane.hxx
@@ -25,8 +25,8 @@
 #include 
 #include 
 
-namespace sdext::presenter {
-
+namespace sdext::presenter
+{
 /** Pane used by the presenter sc

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

2020-10-13 Thread Michael Stahl (via logerrit)
 sdext/source/presenter/PresenterAccessibility.cxx |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 2cb54449b4fc9e908aae0a44f808d82b8e83acfc
Author: Michael Stahl 
AuthorDate: Mon Oct 12 12:19:55 2020 +0200
Commit: Michael Stahl 
CommitDate: Tue Oct 13 10:46:46 2020 +0200

sdext: fix use-after-free on global AccessibleFocusManager

The problem is that the destructor of the vector maFocusableObjects
ends up dispose()-ing every element, which calls back into
AccessibleFocusManager to remove the element from the vector, which
invokes its destructor a 2nd time.

Move it to the stack so it doesn't double-free itself.

ERROR: AddressSanitizer: heap-use-after-free on address 0x612001571c00 at 
pc 0x7fc5e723ca72 bp 0x7fffbaa8d6d0 sp 0x7fffbaa8d6c8
READ of size 1 at 0x612001571c00 thread T0
#0 0x7fc5e723ca71 in cppu::WeakComponentImplHelperBase::release() 
cppuhelper/source/implbase.cxx:84:9
#1 0x7fc595211b27 in 
cppu::PartialWeakComponentImplHelper::release() 
include/cppuhelper/compbase.hxx:86:36
#2 0x7fc5952093e4 in 
rtl::Reference::~Reference()
 include/rtl/ref.hxx:113:22
#3 0x7fc59522acd4 in void 
std::_Destroy
 >(rtl::Reference*) 
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/stl_construct.h:140:19

0x612001571c00 is located 64 bytes inside of 312-byte region 
[0x612001571bc0,0x612001571cf8)
freed by thread T0 here:
#0 0x4be997 in free (instdir/program/soffice.bin+0x4be997)
#1 0x7fc5ea2a5104 in rtl_freeMemory sal/rtl/alloc_global.cxx:51:5
#2 0x7fc5952097f4 in cppu::WeakComponentImplHelperBase::operator 
delete(void*) include/cppuhelper/compbase_ex.hxx:66:11
#3 0x7fc595211e07 in 
sdext::presenter::PresenterAccessible::AccessibleObject::~AccessibleObject() 
sdext/source/presenter/PresenterAccessibility.cxx:67:28
#4 0x7fc5e74a11b4 in cppu::OWeakObject::release() 
cppuhelper/source/weak.cxx:233:9
#5 0x7fc5e723cb05 in cppu::WeakComponentImplHelperBase::release() 
cppuhelper/source/implbase.cxx:86:18
#6 0x7fc595211b27 in 
cppu::PartialWeakComponentImplHelper::release() 
include/cppuhelper/compbase.hxx:86:36
#7 0x7fc5e7194115 in 
com::sun::star::uno::Reference::~Reference() 
include/com/sun/star/uno/Reference.hxx:110:22
#8 0x7fc5e71f3944 in com::sun::star::lang::EventObject::~EventObject() 
workdir/UnoApiHeadersTarget/udkapi/comprehensive/com/sun/star/lang/EventObject.hdl:18:27
#9 0x7fc5e723d395 in cppu::WeakComponentImplHelperBase::dispose() 
cppuhelper/source/implbase.cxx:118:5
#10 0x7fc595211e27 in 
cppu::PartialWeakComponentImplHelper::dispose() 
include/cppuhelper/compbase.hxx:90:36
#11 0x7fc5e723c6e9 in cppu::WeakComponentImplHelperBase::release() 
cppuhelper/source/implbase.cxx:79:13
#12 0x7fc595211b27 in 
cppu::PartialWeakComponentImplHelper::release() 
include/cppuhelper/compbase.hxx:86:36
#13 0x7fc5952093e4 in 
rtl::Reference::~Reference()
 include/rtl/ref.hxx:113:22
#14 0x7fc59522acd4 in void 
std::_Destroy
 >(rtl::Reference*) 
/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/bits/stl_construct.h:140:19

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

diff --git a/sdext/source/presenter/PresenterAccessibility.cxx 
b/sdext/source/presenter/PresenterAccessibility.cxx
index 951a18c5fca5..936c75df35f7 100644
--- a/sdext/source/presenter/PresenterAccessibility.cxx
+++ b/sdext/source/presenter/PresenterAccessibility.cxx
@@ -451,9 +451,12 @@ public:
 
 void FocusObject (const 
::rtl::Reference& rpObject);
 
+~AccessibleFocusManager();
+
 private:
 static std::shared_ptr mpInstance;
 ::std::vector > 
maFocusableObjects;
+bool m_isInDtor = false;
 
 AccessibleFocusManager();
 };
@@ -1810,10 +1813,18 @@ std::shared_ptr const & 
AccessibleFocusManager::Instance
 }
 
 AccessibleFocusManager::AccessibleFocusManager()
-: maFocusableObjects()
 {
 }
 
+AccessibleFocusManager::~AccessibleFocusManager()
+{
+// copy member to stack, then drop it - otherwise will get use-after-free
+// from AccessibleObject::disposing(), it will call ~Reference *twice*
+auto const temp(std::move(maFocusableObjects));
+(void) temp;
+m_isInDtor = true;
+}
+
 void AccessibleFocusManager::AddFocusableObject (
 const ::rtl::Reference& rpObject)
 {
@@ -1833,7 +1844,7 @@ void AccessibleFocusManager::RemoveFocusableObject (
 maFocusableObjects.erase(iObject);
 else
 {
-OSL_ASSERT(iObject!=maFocusableObjects.end());
+OSL_ASSERT(m_isInDtor); // in dtor, was removed already
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.or

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

2020-08-29 Thread Andrea Gelmini (via logerrit)
 sdext/source/presenter/PresenterButton.cxx |6 +++---
 sdext/source/presenter/PresenterButton.hxx |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 19588a1f947c5b3bb3f3fc6d5f4f34e4aee5998f
Author: Andrea Gelmini 
AuthorDate: Fri Aug 28 13:02:21 2020 +0200
Commit: Noel Grandin 
CommitDate: Sat Aug 29 11:33:26 2020 +0200

Fix typo in code

It passed "make check" on Linux

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

diff --git a/sdext/source/presenter/PresenterButton.cxx 
b/sdext/source/presenter/PresenterButton.cxx
index 2f1a7767a57d..329ff8399064 100644
--- a/sdext/source/presenter/PresenterButton.cxx
+++ b/sdext/source/presenter/PresenterButton.cxx
@@ -419,7 +419,7 @@ void PresenterButton::SetupButtonBitmaps()
 
 Reference PresenterButton::GetConfigurationProperties (
 const css::uno::Reference& rxComponentContext,
-const OUString& rsConfgurationName)
+const OUString& rsConfigurationName)
 {
 PresenterConfigurationAccess aConfiguration (
 rxComponentContext,
@@ -430,10 +430,10 @@ Reference 
PresenterButton::GetConfigurationProperties (
 Reference(
 
aConfiguration.GetConfigurationNode("PresenterScreenSettings/Buttons"),
 UNO_QUERY),
-[&rsConfgurationName](OUString const&, 
uno::Reference const& xProps) -> bool
+[&rsConfigurationName](OUString const&, 
uno::Reference const& xProps) -> bool
 {
 return PresenterConfigurationAccess::IsStringPropertyEqual(
-rsConfgurationName, "Name", xProps);
+rsConfigurationName, "Name", xProps);
 }),
 UNO_QUERY);
 }
diff --git a/sdext/source/presenter/PresenterButton.hxx 
b/sdext/source/presenter/PresenterButton.hxx
index 07125f71ee73..f722e7da1c52 100644
--- a/sdext/source/presenter/PresenterButton.hxx
+++ b/sdext/source/presenter/PresenterButton.hxx
@@ -125,7 +125,7 @@ private:
 void SetupButtonBitmaps();
 static css::uno::Reference 
GetConfigurationProperties (
 const css::uno::Reference& 
rxComponentContext,
-const OUString& rsConfgurationName);
+const OUString& rsConfigurationName);
 
 /// @throws css::lang::DisposedException
 void ThrowIfDisposed() const;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-29 Thread Stephan Bergmann (via logerrit)
 sdext/source/minimizer/informationdialog.cxx   |2 +-
 sdext/source/minimizer/optimizerdialogcontrols.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d784e711c102f204552c3c816636da01b1085f61
Author: Stephan Bergmann 
AuthorDate: Thu Aug 27 19:22:54 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Aug 29 09:27:47 2020 +0200

Directly use OUStringBuffer::indexOf

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

diff --git a/sdext/source/minimizer/informationdialog.cxx 
b/sdext/source/minimizer/informationdialog.cxx
index d4a489c56079..8ab6ddfbd8cf 100644
--- a/sdext/source/minimizer/informationdialog.cxx
+++ b/sdext/source/minimizer/informationdialog.cxx
@@ -191,7 +191,7 @@ static OUString ImpValueOfInMB( sal_Int64 rVal )
 fVal /= ( 1 << 20 );
 fVal += 0.05;
 OUStringBuffer aVal( OUString::number( fVal ) );
-sal_Int32 nX( OUString( aVal.getStr() ).indexOf( '.' ) );
+sal_Int32 nX( aVal.indexOf( '.' ) );
 if ( nX > 0 )
 aVal.setLength( nX + 2 );
 return aVal.makeStringAndClear();
diff --git a/sdext/source/minimizer/optimizerdialogcontrols.cxx 
b/sdext/source/minimizer/optimizerdialogcontrols.cxx
index a7e139c33f24..13fe926dd36e 100644
--- a/sdext/source/minimizer/optimizerdialogcontrols.cxx
+++ b/sdext/source/minimizer/optimizerdialogcontrols.cxx
@@ -581,7 +581,7 @@ static OUString ImpValueOfInMB( sal_Int64 rVal, sal_Unicode 
nSeparator )
 fVal /= ( 1 << 20 );
 fVal += 0.05;
 OUStringBuffer aVal( OUString::number( fVal ) );
-sal_Int32 nX( OUString( aVal.getStr() ).indexOf( '.' ) );
+sal_Int32 nX( aVal.indexOf( '.' ) );
 if ( nX >= 0 )
 {
 aVal.setLength( nX + 2 );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-28 Thread Stephan Bergmann (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 8029d316d89a6a4ca612e136697532d0accc22fb
Author: Stephan Bergmann 
AuthorDate: Thu Aug 27 19:05:52 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Aug 29 08:13:33 2020 +0200

Simplify OUStringBuffer to OUString conversion

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

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 305470101cec..387da6947c68 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -102,7 +102,7 @@ void DrawXmlEmitter::visit( TextElement& elem, const 
std::list< std::unique_ptr<
 m_rEmitContext.rStyles.getStyleName( elem.StyleId );
 }
 
-OUString str(elem.Text.getStr());
+OUString str(elem.Text.toString());
 
 // Check for RTL
 bool isRTL = false;
@@ -676,7 +676,7 @@ void DrawXmlOptimizer::optimizeTextElements(Element& 
rParent)
 {
 TextElement* pNext = dynamic_cast(next->get());
 bool isComplex = false;
-OUString str(pCur->Text.getStr());
+OUString str(pCur->Text.toString());
 for(int i=0; i< str.getLength(); i++)
 {
 sal_Int16 nType = GetBreakIterator()->getScriptType( str, i );
@@ -708,7 +708,7 @@ void DrawXmlOptimizer::optimizeTextElements(Element& 
rParent)
 // append text to current element
 pCur->Text.append( pNext->Text );
 
-str = pCur->Text.getStr();
+str = pCur->Text.toString();
 for(int i=0; i< str.getLength(); i++)
 {
 sal_Int16 nType = GetBreakIterator()->getScriptType( 
str, i );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-21 Thread Andrea Gelmini (via logerrit)
 sdext/source/presenter/PresenterPaneContainer.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d0d87244eefc19e6ea6762a029b6ced036faec90
Author: Andrea Gelmini 
AuthorDate: Thu Aug 20 13:12:51 2020 +0200
Commit: Julien Nabet 
CommitDate: Fri Aug 21 18:18:12 2020 +0200

Fix typo in code

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

diff --git a/sdext/source/presenter/PresenterPaneContainer.hxx 
b/sdext/source/presenter/PresenterPaneContainer.hxx
index 65c6bddb7e0b..136c25690b16 100644
--- a/sdext/source/presenter/PresenterPaneContainer.hxx
+++ b/sdext/source/presenter/PresenterPaneContainer.hxx
@@ -100,7 +100,7 @@ public:
 const OUString& rsTitle,
 const OUString& rsAccessibleTitle,
 const bool bIsOpaque,
-const ViewInitializationFunction& rViewIntialization);
+const ViewInitializationFunction& rViewInitialization);
 
 SharedPaneDescriptor StorePane (
 const rtl::Reference& rxPane);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-18 Thread Noel Grandin (via logerrit)
 sdext/source/minimizer/optimizerdialogcontrols.cxx |   45 -
 1 file changed, 10 insertions(+), 35 deletions(-)

New commits:
commit 73f9d308337ce54d724f46e96e6505c45f445f26
Author: Noel Grandin 
AuthorDate: Tue Aug 18 16:01:19 2020 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 18 18:17:35 2020 +0200

remove dead code

since
commit e22c431e24b4a83ddc928f7703b13a9a109c1b8e
Date:   Fri May 11 13:01:25 2007 +
initial version
found by loplugin:unusedvarsglobal

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

diff --git a/sdext/source/minimizer/optimizerdialogcontrols.cxx 
b/sdext/source/minimizer/optimizerdialogcontrols.cxx
index 5c6ad0dd4cb4..a7e139c33f24 100644
--- a/sdext/source/minimizer/optimizerdialogcontrols.cxx
+++ b/sdext/source/minimizer/optimizerdialogcontrols.cxx
@@ -638,7 +638,6 @@ void OptimizerDialog::UpdateControlStatesPage4()
 
 // taking care of deleted slides
 sal_Int32 nDeletedSlides = 0;
-OUString aCustomShowName;
 if ( getControlProperty( "CheckBox3Pg3", "State" ) >>= nInt16 )
 {
 if ( nInt16 )
@@ -661,44 +660,20 @@ void OptimizerDialog::UpdateControlStatesPage4()
 }
 }
 }
-if ( !aCustomShowName.isEmpty() )
-{
-std::vector< Reference< XDrawPage > > vNonUsedPageList;
-PageCollector::CollectNonCustomShowPages( mxController->getModel(), 
aCustomShowName, vNonUsedPageList );
-nDeletedSlides += vNonUsedPageList.size();
-}
 if ( GetConfigProperty( TK_DeleteHiddenSlides, false ) )
 {
-if ( !aCustomShowName.isEmpty() )
-{
-std::vector< Reference< XDrawPage > > vUsedPageList;
-PageCollector::CollectCustomShowPages( mxController->getModel(), 
aCustomShowName, vUsedPageList );
-for( const auto& rxPage : vUsedPageList )
-{
-Reference< XPropertySet > xPropSet( rxPage, UNO_QUERY_THROW );
-bool bVisible = true;
-if ( xPropSet->getPropertyValue( "Visible" ) >>= bVisible )
-{
-if (!bVisible )
-nDeletedSlides++;
-}
-}
-}
-else
+Reference< XDrawPagesSupplier > xDrawPagesSupplier( 
mxController->getModel(), UNO_QUERY_THROW );
+Reference< XDrawPages > xDrawPages( 
xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
+for( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
 {
-Reference< XDrawPagesSupplier > xDrawPagesSupplier( 
mxController->getModel(), UNO_QUERY_THROW );
-Reference< XDrawPages > xDrawPages( 
xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
-for( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
-{
-Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), 
UNO_QUERY_THROW );
-Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY_THROW 
);
+Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), 
UNO_QUERY_THROW );
+Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY_THROW );
 
-bool bVisible = true;
-if ( xPropSet->getPropertyValue( "Visible" ) >>= bVisible )
-{
-if (!bVisible )
-nDeletedSlides++;
-}
+bool bVisible = true;
+if ( xPropSet->getPropertyValue( "Visible" ) >>= bVisible )
+{
+if (!bVisible )
+nDeletedSlides++;
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-08-16 Thread Mike Kaganski (via logerrit)
 sdext/source/minimizer/fileopendialog.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 99c6c89deed41457d35c382fc7d6a4cd5191f7d7
Author: Mike Kaganski 
AuthorDate: Sun Aug 16 18:58:48 2020 +0300
Commit: Mike Kaganski 
CommitDate: Sun Aug 16 20:08:15 2020 +0200

tdf#135342: filter list must include extensions

Regression after commit a0dcc8f78061d22d925f31ef8d03ca751ad6dc19.
The commit had added extensions to the filter names sent to file
dialog, but kept internal list of filter names aFilterEntryList
without extensions. Then dialog returned the chosen filter's name
in the form it was sent there, i.e. with extension; and that name
couldn't be found in aFilterEntryList.

So let's keep aFilterEntryList synchronized with the UI names in
the dialog.

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

diff --git a/sdext/source/minimizer/fileopendialog.cxx 
b/sdext/source/minimizer/fileopendialog.cxx
index 68f25f77900a..aab29c03907b 100644
--- a/sdext/source/minimizer/fileopendialog.cxx
+++ b/sdext/source/minimizer/fileopendialog.cxx
@@ -106,7 +106,7 @@ FileOpenDialog::FileOpenDialog( const Reference< 
XComponentContext >& rxContext
 Reference< XNameAccess > xTypes( 
rxContext->getServiceManager()->createInstanceWithContext(
 "com.sun.star.document.TypeDetection", rxContext ), UNO_QUERY_THROW );
 
-for( const auto& rFilterEntry : aFilterEntryList )
+for (auto& rFilterEntry : aFilterEntryList)
 {
 Sequence< PropertyValue > aTypeProperties;
 try
@@ -120,10 +120,12 @@ FileOpenDialog::FileOpenDialog( const Reference< 
XComponentContext >& rxContext
 pProp->Value >>= aExtensions;
 if ( aExtensions.hasElements() )
 {
-// The filter title must be formed in the same way it is
-// currently done in the internal implementation:
+// The filter title must be formed in the same way it is 
currently done in the
+// internal implementation (see 
sfx2::appendFiltersForSave). And we will look
+// for the same string returned from the dialog, so save 
it to maUIName:
 OUString aTitle(
 rFilterEntry.maUIName + " (." + aExtensions[0] + ")");
+rFilterEntry.maUIName = aTitle;
 OUString aFilter("*." + aExtensions[0]);
 mxFilePicker->appendFilter(aTitle, aFilter);
 if ( rFilterEntry.maFlags & 0x100 )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-12 Thread Srijan Bhatia (via logerrit)
 sdext/source/presenter/PresenterToolBar.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit ffe503b62f9a508285ed06ef977f91604130579a
Author: Srijan Bhatia 
AuthorDate: Sun Jul 12 20:29:28 2020 +0530
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Jul 13 00:35:02 2020 +0200

tdf#90978 add gap between the exit button and the right edge of the toolbar

Change-Id: I703f3bd21101daeaa58ce1c0659e275335f26727
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98601
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sdext/source/presenter/PresenterToolBar.cxx 
b/sdext/source/presenter/PresenterToolBar.cxx
index e3f2d6da7cba..4f700339dc5a 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -718,6 +718,9 @@ void PresenterToolBar::Layout (
 nGapCount += maElementContainer.size()-1;
 }
 
+// Done to introduce gap between the end of the toolbar and the last button
+aTotalSize.Width += gnGapSize/2;
+
 // Calculate the minimal size so that the window size of the tool bar
 // can be adapted accordingly.
 maMinimalSize = aTotalSize;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-01 Thread Stephan Bergmann (via logerrit)
 sdext/source/minimizer/pppoptimizertoken.cxx|2 -
 sdext/source/minimizer/pppoptimizeruno.cxx  |2 -
 sdext/source/pdfimport/pdfparse/pdfentries.cxx  |2 -
 sdext/source/pdfimport/tree/imagecontainer.cxx  |2 -
 sdext/source/presenter/PresenterButton.cxx  |4 +-
 sdext/source/presenter/PresenterComponent.cxx   |2 -
 sdext/source/presenter/PresenterHelpView.cxx|6 ++--
 sdext/source/presenter/PresenterNotesView.cxx   |6 ++--
 sdext/source/presenter/PresenterScrollBar.cxx   |2 -
 sdext/source/presenter/PresenterSlideSorter.cxx |   36 
 sdext/source/presenter/PresenterTextView.cxx|2 -
 sdext/source/presenter/PresenterToolBar.cxx |2 -
 12 files changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 434391237010c94d54d89ad7f2ecef3638a772a0
Author: Stephan Bergmann 
AuthorDate: Wed Jul 1 21:31:12 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jul 2 07:09:33 2020 +0200

Upcoming improved loplugin:staticanonymous -> redundantstatic: sdext

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

diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx 
b/sdext/source/minimizer/pppoptimizertoken.cxx
index 255654838880..9a5c2eac9a62 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -42,7 +42,7 @@ struct TokenTable
 
 }
 
-static const TokenTable pTokenTableArray[] =
+const TokenTable pTokenTableArray[] =
 {
 { "rdmNavi",TK_rdmNavi },
 { "btnNavBack", TK_btnNavBack },
diff --git a/sdext/source/minimizer/pppoptimizeruno.cxx 
b/sdext/source/minimizer/pppoptimizeruno.cxx
index d972ab716060..da8745ef2c71 100644
--- a/sdext/source/minimizer/pppoptimizeruno.cxx
+++ b/sdext/source/minimizer/pppoptimizeruno.cxx
@@ -24,7 +24,7 @@
 namespace
 {
 
-static cppu::ImplementationEntry const services[] = {
+cppu::ImplementationEntry const services[] = {
 { &PPPOptimizerDialog_createInstance,
   &PPPOptimizerDialog_getImplementationName,
   &PPPOptimizerDialog_getSupportedServiceNames,
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx 
b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index f8e24addeacb..e7fa4d511982 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -1093,7 +1093,7 @@ bool PDFFile::decrypt( const sal_uInt8* pInBuffer, 
sal_uInt32 nLen, sal_uInt8* p
 return aErr == rtl_Cipher_E_None;
 }
 
-static const sal_uInt8 nPadString[32] =
+const sal_uInt8 nPadString[32] =
 {
 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 
0xFF, 0xFA, 0x01, 0x08,
 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 
0x64, 0x53, 0x69, 0x7A
diff --git a/sdext/source/pdfimport/tree/imagecontainer.cxx 
b/sdext/source/pdfimport/tree/imagecontainer.cxx
index 2be33dcede42..087849d6b5dc 100644
--- a/sdext/source/pdfimport/tree/imagecontainer.cxx
+++ b/sdext/source/pdfimport/tree/imagecontainer.cxx
@@ -36,7 +36,7 @@ namespace pdfi
 namespace
 {
 
-static const char aBase64EncodeTable[] =
+const char aBase64EncodeTable[] =
 { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
   'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
   'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
diff --git a/sdext/source/presenter/PresenterButton.cxx 
b/sdext/source/presenter/PresenterButton.cxx
index 6c053a40e2ce..2f1a7767a57d 100644
--- a/sdext/source/presenter/PresenterButton.cxx
+++ b/sdext/source/presenter/PresenterButton.cxx
@@ -34,8 +34,8 @@ using namespace ::com::sun::star::uno;
 
 namespace sdext::presenter {
 
-const static double gnHorizontalBorder (15);
-const static double gnVerticalBorder (5);
+const double gnHorizontalBorder (15);
+const double gnVerticalBorder (5);
 
 ::rtl::Reference PresenterButton::Create (
 const css::uno::Reference& rxComponentContext,
diff --git a/sdext/source/presenter/PresenterComponent.cxx 
b/sdext/source/presenter/PresenterComponent.cxx
index 943270928d9e..4d882526002d 100644
--- a/sdext/source/presenter/PresenterComponent.cxx
+++ b/sdext/source/presenter/PresenterComponent.cxx
@@ -30,7 +30,7 @@ using namespace osl;
 
 namespace sdext::presenter {
 
-static const struct ImplementationEntry gServiceEntries[] =
+const struct ImplementationEntry gServiceEntries[] =
 {
 {
 PresenterProtocolHandler::Create,
diff --git a/sdext/source/presenter/PresenterHelpView.cxx 
b/sdext/source/presenter/PresenterHelpView.cxx
index 3b7cfc4979b6..18fcb3d3c21b 100644
--- a/sdext/source/presenter/PresenterHelpView.cxx
+++ b/sdext/source/presenter/PresenterHelpView.cxx
@@ -41,9 +41,9 @@ using ::std::vector;
 namespace sdext::presenter {
 
 namespace {
-const static sal_Int32 gnHorizontalGap (20);
-const sta

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

2020-06-27 Thread Srijan Bhatia (via logerrit)
 sdext/source/presenter/PresenterToolBar.cxx |   25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

New commits:
commit d53a4f126e9d3ec0a63684d4c7af3108f352791c
Author: Srijan Bhatia 
AuthorDate: Thu Jun 25 20:21:48 2020 +0530
Commit: Heiko Tietze 
CommitDate: Sun Jun 28 08:20:48 2020 +0200

tdf#128964 fix shifting of icons when the pause/resume button changes

Added a property that specifies width of the button in the presenter 
toolbar.

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

diff --git a/sdext/source/presenter/PresenterToolBar.cxx 
b/sdext/source/presenter/PresenterToolBar.cxx
index a0a57c6d8b44..bd69a262ee59 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -1459,9 +1459,24 @@ awt::Size Button::CreateBoundingSize (
 return awt::Size();
 
 geometry::RealRectangle2D aTextBBox 
(mpMode->maText.GetBoundingBox(rxCanvas));
+
+// tdf#128964 This ensures that if the text of a button changes due to a 
change in
+// the state of the button the other buttons of the toolbar do not move. 
The button is
+// allotted the maximum size so that it doesn't resize during a change of 
state.
+geometry::RealRectangle2D aTextBBoxNormal 
(mpNormal->maText.GetBoundingBox(rxCanvas));
+geometry::RealRectangle2D aTextBBoxMouseOver 
(mpMouseOver->maText.GetBoundingBox(rxCanvas));
+geometry::RealRectangle2D aTextBBoxSelected 
(mpSelected->maText.GetBoundingBox(rxCanvas));
+geometry::RealRectangle2D aTextBBoxDisabled 
(mpDisabled->maText.GetBoundingBox(rxCanvas));
+geometry::RealRectangle2D aTextBBoxMouseOverSelected 
(mpMouseOverSelected->maText.GetBoundingBox(rxCanvas));
+std::vector widths;
+widths.push_back(sal::static_int_cast(0.5 + aTextBBoxNormal.X2 
- aTextBBoxNormal.X1));
+widths.push_back(sal::static_int_cast(0.5 + 
aTextBBoxMouseOver.X2 - aTextBBoxMouseOver.X1));
+widths.push_back(sal::static_int_cast(0.5 + 
aTextBBoxSelected.X2 - aTextBBoxSelected.X1));
+widths.push_back(sal::static_int_cast(0.5 + 
aTextBBoxDisabled.X2 - aTextBBoxDisabled.X1));
+widths.push_back(sal::static_int_cast(0.5 + 
aTextBBoxMouseOverSelected.X2 - aTextBBoxMouseOverSelected.X1));
+
 const sal_Int32 nGap (5);
 sal_Int32 nTextHeight (sal::static_int_cast(0.5 + aTextBBox.Y2 
- aTextBBox.Y1));
-sal_Int32 nTextWidth (sal::static_int_cast(0.5 + aTextBBox.X2 - 
aTextBBox.X1));
 Reference xBitmap;
 if (mpMode->mpIcon)
 xBitmap = mpMode->mpIcon->GetNormalBitmap();
@@ -1469,11 +1484,13 @@ awt::Size Button::CreateBoundingSize (
 {
 geometry::IntegerSize2D aSize (xBitmap->getSize());
 return awt::Size(
-::std::max(aSize.Width, sal_Int32(0.5 + aTextBBox.X2 - 
aTextBBox.X1)),
-aSize.Height+ nGap + nTextHeight);
+::std::max(aSize.Width, *std::max_element(widths.begin(), 
widths.end())),
+aSize.Height + nGap + nTextHeight);
 }
 else
-return awt::Size(nTextWidth,nTextHeight);
+{
+return awt::Size(*std::max_element(widths.begin(), widths.end()), 
nTextHeight);
+}
 }
 
 void Button::PaintIcon (
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-18 Thread Martin Whitaker (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit b42ab78fb871924896b3cc38a7b2f1257151f711
Author: Martin Whitaker 
AuthorDate: Fri May 8 21:47:25 2020 +0200
Commit: Tomáš Chvátal 
CommitDate: Thu Jun 18 15:07:37 2020 +0200

tdf#131353: Fix build with poppler 0.86.0

Change-Id: I89b4635a6a3e3a5522172d6f4c3f14e6c14994b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93789
Tested-by: René Engelhard 
Tested-by: Jenkins
Reviewed-by: Tomáš Chvátal 

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index e9c2a407c279..16ad04bf660a 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -563,7 +563,9 @@ void PDFOutDev::processLink(Link* link, Catalog*)
 if (!(pAction && pAction->getKind() == actionURI))
 return;
 
-#if POPPLER_CHECK_VERSION(0, 72, 0)
+#if POPPLER_CHECK_VERSION(0, 86, 0)
+const char* pURI = static_cast(pAction)->getURI().c_str();
+#elif POPPLER_CHECK_VERSION(0, 72, 0)
 const char* pURI = static_cast(pAction)->getURI()->c_str();
 #else
 const char* pURI = static_cast(pAction)->getURI()->getCString();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-05 Thread Stephan Bergmann (via logerrit)
 sdext/source/minimizer/impoptimizer.cxx|3 +--
 sdext/source/minimizer/optimizerdialog.cxx |4 +---
 sdext/source/minimizer/optimizerdialogcontrols.cxx |   12 
 sdext/source/minimizer/unodialog.cxx   |6 ++
 sdext/source/pdfimport/odf/odfemitter.cxx  |3 +--
 sdext/source/presenter/PresenterTheme.cxx  |3 +--
 6 files changed, 10 insertions(+), 21 deletions(-)

New commits:
commit 41541c2c1b07cf6d48a3ea2986edcb0bb465e6db
Author: Stephan Bergmann 
AuthorDate: Fri Jun 5 07:36:44 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 5 10:46:44 2020 +0200

Upcoming loplugin:elidestringvar: sdext

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

diff --git a/sdext/source/minimizer/impoptimizer.cxx 
b/sdext/source/minimizer/impoptimizer.cxx
index c3ad75e68f8f..d3cf48a8a458 100644
--- a/sdext/source/minimizer/impoptimizer.cxx
+++ b/sdext/source/minimizer/impoptimizer.cxx
@@ -668,8 +668,7 @@ void ImpOptimizer::Optimize( const Sequence< PropertyValue 
>& rArguments )
 Reference< XFrame > xFrame( xSelf.is() ? xSelf : mxInformationDialog );
 if ( xFrame.is() )
 {
-const OUString sSlot( "slot:27115"  );
-DispatchURL( mxContext, sSlot, xFrame );
+DispatchURL( mxContext, "slot:27115", xFrame );
 }
 }
 
diff --git a/sdext/source/minimizer/optimizerdialog.cxx 
b/sdext/source/minimizer/optimizerdialog.cxx
index 407bf3939299..536b70974b71 100644
--- a/sdext/source/minimizer/optimizerdialog.cxx
+++ b/sdext/source/minimizer/optimizerdialog.cxx
@@ -120,9 +120,7 @@ void OptimizerDialog::InitRoadmap()
 InsertRoadmapItem( 3, getString( STR_OLE_OBJECTS ), 
ITEM_ID_OLE_OPTIMIZATION );
 InsertRoadmapItem( 4, getString( STR_SUMMARY ), ITEM_ID_SUMMARY );
 
-OUString const sURL("private:graphicrepository/" 
BMP_PRESENTATION_MINIMIZER);
-
-xPropertySet->setPropertyValue( "ImageURL", Any( sURL ) );
+xPropertySet->setPropertyValue( "ImageURL", Any( 
OUString("private:graphicrepository/" BMP_PRESENTATION_MINIMIZER) ) );
 xPropertySet->setPropertyValue( "Activated", Any( true ) );
 xPropertySet->setPropertyValue( "Complete", Any( true ) );
 xPropertySet->setPropertyValue( "CurrentItemID", Any( 
sal_Int16(ITEM_ID_INTRODUCTION) ) );
diff --git a/sdext/source/minimizer/optimizerdialogcontrols.cxx 
b/sdext/source/minimizer/optimizerdialogcontrols.cxx
index 75dff5fb6e02..5c6ad0dd4cb4 100644
--- a/sdext/source/minimizer/optimizerdialogcontrols.cxx
+++ b/sdext/source/minimizer/optimizerdialogcontrols.cxx
@@ -557,9 +557,8 @@ void OptimizerDialog::InitPage3()
 Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), 
UNO_QUERY_THROW );
 for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
 {
-const OUString sOLE2Shape( "com.sun.star.drawing.OLE2Shape"  );
 Reference< XShape > xShape( xShapes->getByIndex( j ), 
UNO_QUERY_THROW );
-if ( xShape->getShapeType() == sOLE2Shape )
+if ( xShape->getShapeType() == "com.sun.star.drawing.OLE2Shape" )
 nOLECount++;
 }
 }
@@ -678,8 +677,7 @@ void OptimizerDialog::UpdateControlStatesPage4()
 {
 Reference< XPropertySet > xPropSet( rxPage, UNO_QUERY_THROW );
 bool bVisible = true;
-const OUString sVisible( "Visible"  );
-if ( xPropSet->getPropertyValue( sVisible ) >>= bVisible )
+if ( xPropSet->getPropertyValue( "Visible" ) >>= bVisible )
 {
 if (!bVisible )
 nDeletedSlides++;
@@ -696,8 +694,7 @@ void OptimizerDialog::UpdateControlStatesPage4()
 Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY_THROW 
);
 
 bool bVisible = true;
-const OUString sVisible( "Visible"  );
-if ( xPropSet->getPropertyValue( sVisible ) >>= bVisible )
+if ( xPropSet->getPropertyValue( "Visible" ) >>= bVisible )
 {
 if (!bVisible )
 nDeletedSlides++;
@@ -763,9 +760,8 @@ void OptimizerDialog::UpdateControlStatesPage4()
 Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), 
UNO_QUERY_THROW );
 for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
 {
-const OUString sOLE2Shape( "com.sun.star.drawing.OLE2Shape"  );
 Reference< XShape > xShape( xShapes->getByIndex( j ), 
UNO_QUERY_THROW );
-if ( xShape->getShapeType() == sOLE2Shape )
+if ( xShape->getShapeType() == 
"com.sun.star.drawing.OLE2Shape" )
 nOLEReplacements++;
 }
 }
diff --git a/sdext/sourc

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

2020-05-10 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/inc/contentsink.hxx   |   33 +++
 sdext/source/pdfimport/inc/odfemitter.hxx|5 --
 sdext/source/pdfimport/inc/pdfihelper.hxx|3 -
 sdext/source/pdfimport/inc/saxemitter.hxx|6 --
 sdext/source/pdfimport/inc/wrapper.hxx   |4 -
 sdext/source/presenter/PresenterAccessibility.hxx|4 -
 sdext/source/presenter/PresenterBitmapContainer.hxx  |4 -
 sdext/source/presenter/PresenterButton.hxx   |4 -
 sdext/source/presenter/PresenterCanvasHelper.hxx |4 -
 sdext/source/presenter/PresenterConfigurationAccess.hxx  |4 -
 sdext/source/presenter/PresenterController.hxx   |4 -
 sdext/source/presenter/PresenterCurrentSlideObserver.hxx |4 -
 sdext/source/presenter/PresenterFrameworkObserver.hxx|4 -
 sdext/source/presenter/PresenterGeometryHelper.hxx   |4 -
 sdext/source/presenter/PresenterHelpView.hxx |4 -
 sdext/source/presenter/PresenterHelper.hxx   |4 -
 sdext/source/presenter/PresenterNotesView.hxx|4 -
 sdext/source/presenter/PresenterPaintManager.hxx |4 -
 sdext/source/presenter/PresenterPane.hxx |4 -
 sdext/source/presenter/PresenterPaneBase.hxx |4 -
 sdext/source/presenter/PresenterPaneBorderPainter.hxx|4 -
 sdext/source/presenter/PresenterPaneContainer.hxx|4 -
 sdext/source/presenter/PresenterPaneFactory.hxx  |4 -
 sdext/source/presenter/PresenterProtocolHandler.hxx  |4 -
 sdext/source/presenter/PresenterScreen.hxx   |4 -
 sdext/source/presenter/PresenterScrollBar.hxx|4 -
 sdext/source/presenter/PresenterSlidePreview.hxx |4 -
 sdext/source/presenter/PresenterSlideShowView.hxx|4 -
 sdext/source/presenter/PresenterSlideSorter.hxx  |4 -
 sdext/source/presenter/PresenterSprite.hxx   |4 -
 sdext/source/presenter/PresenterSpritePane.hxx   |4 -
 sdext/source/presenter/PresenterTextView.hxx |4 -
 sdext/source/presenter/PresenterTheme.hxx|4 -
 sdext/source/presenter/PresenterTimer.hxx|8 +--
 sdext/source/presenter/PresenterToolBar.hxx  |4 -
 sdext/source/presenter/PresenterUIPainter.hxx|4 -
 sdext/source/presenter/PresenterViewFactory.hxx  |4 -
 sdext/source/presenter/PresenterWindowManager.hxx|4 -
 38 files changed, 89 insertions(+), 98 deletions(-)

New commits:
commit 70a235dd558d64b4107f690ea089ea59d173d5d3
Author: Noel Grandin 
AuthorDate: Sat May 9 20:07:44 2020 +0200
Commit: Noel Grandin 
CommitDate: Sun May 10 09:07:43 2020 +0200

compact namespace in sdext

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

diff --git a/sdext/source/pdfimport/inc/contentsink.hxx 
b/sdext/source/pdfimport/inc/contentsink.hxx
index 0b25fcc74268..dbe1b0e08808 100644
--- a/sdext/source/pdfimport/inc/contentsink.hxx
+++ b/sdext/source/pdfimport/inc/contentsink.hxx
@@ -25,23 +25,24 @@
 #include 
 #include 
 
-namespace com { namespace sun { namespace star {
-namespace rendering
-{
-class  XPolyPolygon2D;
-}
-namespace geometry
-{
-struct Matrix2D;
-struct AffineMatrix2D;
-struct RealRectangle2D;
-struct RealPoint2D;
-struct RealSize2D;
+namespace com::sun::star {
+namespace rendering
+{
+class  XPolyPolygon2D;
+}
+namespace geometry
+{
+struct Matrix2D;
+struct AffineMatrix2D;
+struct RealRectangle2D;
+struct RealPoint2D;
+struct RealSize2D;
+}
+namespace beans
+{
+struct PropertyValue;
+}
 }
-namespace beans
-{
-struct PropertyValue;
-} } } }
 
 namespace pdfi
 {
diff --git a/sdext/source/pdfimport/inc/odfemitter.hxx 
b/sdext/source/pdfimport/inc/odfemitter.hxx
index 2a18c30cd051..97111c2991ac 100644
--- a/sdext/source/pdfimport/inc/odfemitter.hxx
+++ b/sdext/source/pdfimport/inc/odfemitter.hxx
@@ -23,10 +23,7 @@
 #include "xmlemitter.hxx"
 #include 
 
-namespace com { namespace sun { namespace star { namespace io
-{
-class XOutputStream;
-} } } }
+namespace com::sun::star::io { class XOutputStream; }
 
 namespace pdfi
 {
diff --git a/sdext/source/pdfimport/inc/pdfihelper.hxx 
b/sdext/source/pdfimport/inc/pdfihelper.hxx
index b32d439c42d4..ad5ffa80f6b3 100644
--- a/sdext/source/pdfimport/inc/pdfihelper.hxx
+++ b/sdext/source/pdfimport/inc/pdfihelper.hxx
@@ -37,8 +37,7 @@
 // virtual resolution of the PDF OutputDev in dpi
 #define PDFI_OUTDEV_RESOLUTION 7200
 
-namespace com { namespace sun { namespace star { namespace task
-{ class XInteractionHandler; 
+namespace com::sun::star::task { class XInteractionHandler; }
 
 namespace pdfi
 {

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

2020-03-12 Thread Noel Grandin (via logerrit)
 sdext/source/minimizer/graphiccollector.hxx   |8 
 sdext/source/minimizer/informationdialog.hxx  |6 +++---
 sdext/source/minimizer/pppoptimizertoken.cxx  |2 +-
 sdext/source/pdfimport/inc/genericelements.hxx|6 +++---
 sdext/source/pdfimport/inc/pdfiprocessor.hxx  |6 +++---
 sdext/source/pdfimport/inc/pdfparse.hxx   |   18 +-
 sdext/source/pdfimport/misc/pwdinteract.cxx   |2 +-
 sdext/source/pdfimport/sax/saxattrlist.hxx|4 ++--
 sdext/source/pdfimport/services.cxx   |2 +-
 sdext/source/pdfimport/tree/style.hxx |6 +++---
 sdext/source/presenter/PresenterPaneBorderPainter.cxx |2 +-
 sdext/source/presenter/PresenterProtocolHandler.cxx   |6 +++---
 sdext/source/presenter/PresenterScrollBar.hxx |2 +-
 sdext/source/presenter/PresenterTextView.hxx  |   10 +-
 sdext/source/presenter/PresenterTheme.cxx |2 +-
 sdext/source/presenter/PresenterTimer.cxx |2 +-
 16 files changed, 42 insertions(+), 42 deletions(-)

New commits:
commit 6aff77cb30e7c73109684a72ccddf7a28605afcb
Author: Noel Grandin 
AuthorDate: Thu Mar 12 09:36:30 2020 +0200
Commit: Noel Grandin 
CommitDate: Thu Mar 12 09:34:21 2020 +0100

Revert "loplugin:constfields in sdext"

This reverts commit 565746cf861c407ae222b2284d8525b4e9a62d94.

Now that we know that making fields has negative side effects
like disabling assignment operator generation.

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

diff --git a/sdext/source/minimizer/graphiccollector.hxx 
b/sdext/source/minimizer/graphiccollector.hxx
index a83e272fe291..f989a95ad39c 100644
--- a/sdext/source/minimizer/graphiccollector.hxx
+++ b/sdext/source/minimizer/graphiccollector.hxx
@@ -33,11 +33,11 @@
 
 struct GraphicSettings
 {
-bool constmbJPEGCompression;
-sal_Int32 const   mnJPEGQuality;
+boolmbJPEGCompression;
+sal_Int32   mnJPEGQuality;
 boolmbRemoveCropArea;
-sal_Int32 const   mnImageResolution;
-bool constmbEmbedLinkedGraphics;
+sal_Int32   mnImageResolution;
+boolmbEmbedLinkedGraphics;
 
 GraphicSettings( bool bJPEGCompression, sal_Int32 nJPEGQuality, bool 
bRemoveCropArea,
 sal_Int32 nImageResolution, bool bEmbedLinkedGraphics )
diff --git a/sdext/source/minimizer/informationdialog.hxx 
b/sdext/source/minimizer/informationdialog.hxx
index 274e159895bc..761a40e01e7e 100644
--- a/sdext/source/minimizer/informationdialog.hxx
+++ b/sdext/source/minimizer/informationdialog.hxx
@@ -57,9 +57,9 @@ private:
 
 void InitDialog();
 
-sal_Int64 const mnSourceSize;
-sal_Int64 const mnDestSize;
-sal_Int64 const mnApproxSize;
+sal_Int64 mnSourceSize;
+sal_Int64 mnDestSize;
+sal_Int64 mnApproxSize;
 bool& mrbOpenNewDocument;
 const OUString& maSaveAsURL;
 };
diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx 
b/sdext/source/minimizer/pppoptimizertoken.cxx
index d4d4c99c4ba5..255654838880 100644
--- a/sdext/source/minimizer/pppoptimizertoken.cxx
+++ b/sdext/source/minimizer/pppoptimizertoken.cxx
@@ -37,7 +37,7 @@ namespace {
 struct TokenTable
 {
 const char* pS;
-PPPOptimizerTokenEnum const pE;
+PPPOptimizerTokenEnum   pE;
 };
 
 }
diff --git a/sdext/source/pdfimport/inc/genericelements.hxx 
b/sdext/source/pdfimport/inc/genericelements.hxx
index 177533501f3f..d29540036f07 100644
--- a/sdext/source/pdfimport/inc/genericelements.hxx
+++ b/sdext/source/pdfimport/inc/genericelements.hxx
@@ -122,7 +122,7 @@ namespace pdfi
 public:
 virtual void visitedBy( ElementTreeVisitor&, const std::list< 
std::unique_ptr >::const_iterator& ) override;
 
-OUString const URI;
+OUString URI;
 };
 
 struct GraphicalElement : public Element
@@ -234,7 +234,7 @@ namespace pdfi
 public:
 virtual void visitedBy( ElementTreeVisitor&, const std::list< 
std::unique_ptr >::const_iterator& ) override;
 
-ImageId const Image;
+ImageId Image;
 };
 
 struct PageElement : public Element
@@ -257,7 +257,7 @@ namespace pdfi
 void resolveFontStyles( PDFIProcessor const & rProc );
 void resolveUnderlines( PDFIProcessor const & rProc );
 
-sal_Int32 const PageNumber;
+sal_Int32  PageNumber;
 ListElementHyperlinks; // contains not yet realized links on this 
page
 double TopMargin;
 double BottomMargin;
diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx 
b/sdext/source/pdfimport/inc/pdfiprocessor.hxx
index 9e08d6a6a765..3305f0bf715e 100644
--- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx
+++ b/sdext/source/pdfimport/inc/pdfip

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

2020-02-04 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/inc/pdfiprocessor.hxx  |   12 
 sdext/source/pdfimport/tree/pdfiprocessor.cxx |   21 -
 2 files changed, 16 insertions(+), 17 deletions(-)

New commits:
commit 55c724b93dfd4c9a1afb10d60fbc2d7a9a66cf61
Author: Caolán McNamara 
AuthorDate: Wed Jan 29 12:44:52 2020 +
Commit: Caolán McNamara 
CommitDate: Tue Feb 4 10:33:04 2020 +0100

replace boost::bimap in sdext pdfimport

the error message with boost 1.69 and gcc 10 is so ungodly its easier to 
throw
bimap out and use something simpler

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

diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx 
b/sdext/source/pdfimport/inc/pdfiprocessor.hxx
index 89f9d601b7b0..9e08d6a6a765 100644
--- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx
+++ b/sdext/source/pdfimport/inc/pdfiprocessor.hxx
@@ -37,9 +37,6 @@
 #include "treevisitorfactory.hxx"
 #include "genericelements.hxx"
 
-#include 
-#include 
-
 namespace pdfi
 {
 
@@ -160,10 +157,8 @@ namespace pdfi
 typedef std::unordered_map IdToFontMap;
 typedef std::unordered_map 
FontToIdMap;
 
-typedef boost::bimaps::bimap<
- boost::bimaps::unordered_set_of,
- boost::bimaps::unordered_set_of
-> GCToIdBiMap;
+typedef std::unordered_map IdToGCMap;
+typedef std::unordered_map GCToIdMap;
 
 typedef std::vector GraphicsContextStack;
 
@@ -178,7 +173,8 @@ namespace pdfi
 
 GraphicsContextStack   m_aGCStack;
 sal_Int32  m_nNextGCId;
-GCToIdBiMapm_aGCToId;
+IdToGCMap  m_aIdToGC;
+GCToIdMap  m_aGCToId;
 
 ImageContainer m_aImages;
 
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx 
b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index c6baa7fee8b2..ed2eaf6510b9 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -54,6 +54,7 @@ namespace pdfi
 m_aFontToId(),
 m_aGCStack(),
 m_nNextGCId( 1 ),
+m_aIdToGC(),
 m_aGCToId(),
 m_aImages(),
 m_nPages(0),
@@ -65,12 +66,13 @@ namespace pdfi
 aDefFont.isBold = false;
 aDefFont.isItalic   = false;
 aDefFont.size   = 10*PDFI_OUTDEV_RESOLUTION/72;
-m_aIdToFont[ 0 ]= aDefFont;
-m_aFontToId[ aDefFont ] = 0;
+m_aIdToFont.insert({0, aDefFont});
+m_aFontToId.insert({aDefFont, 0});
 
 GraphicsContext aDefGC;
 m_aGCStack.push_back( aDefGC );
-m_aGCToId.insert(GCToIdBiMap::relation(aDefGC, 0));
+m_aGCToId.insert({aDefGC, 0});
+m_aIdToGC.insert({0, aDefGC});
 }
 
 void PDFIProcessor::setPageNum( sal_Int32 nPages )
@@ -468,12 +470,13 @@ const FontAttributes& PDFIProcessor::getFont( sal_Int32 
nFontId ) const
 sal_Int32 PDFIProcessor::getGCId( const GraphicsContext& rGC )
 {
 sal_Int32 nGCId = 0;
-auto it = m_aGCToId.left.find( rGC );
-if( it != m_aGCToId.left.end() )
+auto it = m_aGCToId.find( rGC );
+if( it != m_aGCToId.end() )
 nGCId = it->second;
 else
 {
-m_aGCToId.insert(GCToIdBiMap::relation(rGC, m_nNextGCId));
+m_aGCToId.insert({rGC, m_nNextGCId});
+m_aIdToGC.insert({m_nNextGCId, rGC});
 nGCId = m_nNextGCId;
 m_nNextGCId++;
 }
@@ -483,9 +486,9 @@ sal_Int32 PDFIProcessor::getGCId( const GraphicsContext& 
rGC )
 
 const GraphicsContext& PDFIProcessor::getGraphicsContext( sal_Int32 nGCId ) 
const
 {
-auto it = m_aGCToId.right.find( nGCId );
-if( it == m_aGCToId.right.end() )
-it = m_aGCToId.right.find( 0 );
+auto it = m_aIdToGC.find( nGCId );
+if( it == m_aIdToGC.end() )
+it = m_aIdToGC.find( 0 );
 return it->second;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-24 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/odf/odfemitter.cxx |2 +-
 sdext/source/pdfimport/sax/emitcontext.cxx|2 +-
 sdext/source/pdfimport/tree/treevisitorfactory.cxx|6 +++---
 sdext/source/presenter/PresenterBitmapContainer.cxx   |2 +-
 sdext/source/presenter/PresenterController.cxx|6 +++---
 sdext/source/presenter/PresenterHelpView.cxx  |2 +-
 sdext/source/presenter/PresenterNotesView.cxx |8 
 sdext/source/presenter/PresenterPaneBorderPainter.cxx |4 ++--
 sdext/source/presenter/PresenterPaneContainer.cxx |2 +-
 sdext/source/presenter/PresenterScrollBar.cxx |6 +++---
 sdext/source/presenter/PresenterSlidePreview.cxx  |4 ++--
 sdext/source/presenter/PresenterSlideSorter.cxx   |6 +++---
 sdext/source/presenter/PresenterSpritePane.cxx|2 +-
 sdext/source/presenter/PresenterTextView.cxx  |6 +++---
 sdext/source/presenter/PresenterTheme.cxx |   10 +-
 sdext/source/presenter/PresenterToolBar.cxx   |   14 +++---
 16 files changed, 41 insertions(+), 41 deletions(-)

New commits:
commit 3e4cad1f4b4a6a07b516a0d205d642a985e17484
Author: Noel Grandin 
AuthorDate: Fri Jan 24 12:04:55 2020 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 24 12:54:18 2020 +0100

loplugin:makeshared in sdext

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

diff --git a/sdext/source/pdfimport/odf/odfemitter.cxx 
b/sdext/source/pdfimport/odf/odfemitter.cxx
index 95d083ab9439..817b9ca933a6 100644
--- a/sdext/source/pdfimport/odf/odfemitter.cxx
+++ b/sdext/source/pdfimport/odf/odfemitter.cxx
@@ -116,7 +116,7 @@ void OdfEmitter::endTag( const char* pTag )
 
 XmlEmitterSharedPtr createOdfEmitter( const uno::Reference& 
xOut )
 {
-return XmlEmitterSharedPtr(new OdfEmitter(xOut));
+return std::make_shared(xOut);
 }
 
 }
diff --git a/sdext/source/pdfimport/sax/emitcontext.cxx 
b/sdext/source/pdfimport/sax/emitcontext.cxx
index c880bed6c33f..80c459c7d82e 100644
--- a/sdext/source/pdfimport/sax/emitcontext.cxx
+++ b/sdext/source/pdfimport/sax/emitcontext.cxx
@@ -171,7 +171,7 @@ void SaxEmitter::endTag( const char* pTag )
 
 XmlEmitterSharedPtr createSaxEmitter( const uno::Reference< 
xml::sax::XDocumentHandler >& xDocHdl )
 {
-return XmlEmitterSharedPtr(new SaxEmitter(xDocHdl));
+return std::make_shared(xDocHdl);
 }
 
 }
diff --git a/sdext/source/pdfimport/tree/treevisitorfactory.cxx 
b/sdext/source/pdfimport/tree/treevisitorfactory.cxx
index 6131014e92bd..495bf0bcb4c6 100644
--- a/sdext/source/pdfimport/tree/treevisitorfactory.cxx
+++ b/sdext/source/pdfimport/tree/treevisitorfactory.cxx
@@ -96,15 +96,15 @@ namespace pdfi
 
 TreeVisitorFactorySharedPtr createWriterTreeVisitorFactory()
 {
-return TreeVisitorFactorySharedPtr(new WriterTreeVisitorFactory());
+return std::make_shared();
 }
 TreeVisitorFactorySharedPtr createImpressTreeVisitorFactory()
 {
-return TreeVisitorFactorySharedPtr(new ImpressTreeVisitorFactory());
+return std::make_shared();
 }
 TreeVisitorFactorySharedPtr createDrawTreeVisitorFactory()
 {
-return TreeVisitorFactorySharedPtr(new DrawTreeVisitorFactory());
+return std::make_shared();
 }
 }
 
diff --git a/sdext/source/presenter/PresenterBitmapContainer.cxx 
b/sdext/source/presenter/PresenterBitmapContainer.cxx
index ea2ff23a8759..5fecfe01ca1b 100644
--- a/sdext/source/presenter/PresenterBitmapContainer.cxx
+++ b/sdext/source/presenter/PresenterBitmapContainer.cxx
@@ -193,7 +193,7 @@ std::shared_ptr 
PresenterBitmapConta
 OSL_ASSERT(rxCanvas.is());
 OSL_ASSERT(rxPresenterHelper.is());
 
-SharedBitmapDescriptor pBitmap (new BitmapDescriptor(rpDefault));
+SharedBitmapDescriptor pBitmap = 
std::make_shared(rpDefault);
 
 if ( ! rxProperties.is())
 return pBitmap;
diff --git a/sdext/source/presenter/PresenterController.cxx 
b/sdext/source/presenter/PresenterController.cxx
index b26dfc2fb3af..d2aad85c86cf 100644
--- a/sdext/source/presenter/PresenterController.cxx
+++ b/sdext/source/presenter/PresenterController.cxx
@@ -105,7 +105,7 @@ PresenterController::PresenterController (
   mpTheme(),
   mxMainWindow(),
   mpPaneBorderPainter(),
-  mpCanvasHelper(new PresenterCanvasHelper()),
+  mpCanvasHelper(std::make_shared()),
   mxPresenterHelper(),
   mpPaintManager(),
   mnPendingSlideNumber(-1),
@@ -1068,7 +1068,7 @@ void PresenterController::InitializeMainPane (const 
Reference& rxPane)
 if (xPane2.is())
 xPane2->setVisible(true);
 
-mpPaintManager.reset(new PresenterPaintManager(mxMainWindow, 
mxPresenterHelper, mpPaneContainer));
+mpPaintManager = std::make_shared(mxMainWindow, 
mxPresenterHelper, mpPaneContainer);
 
 mxCanvas.set(rxPane->getCanva

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

2019-11-01 Thread Samuel Mehrbrodt (via logerrit)
 sdext/source/presenter/PresenterWindowManager.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 8eba06afac375db28022d320d19943d8a129c436
Author: Samuel Mehrbrodt 
AuthorDate: Thu Oct 31 11:53:00 2019 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Fri Nov 1 09:01:15 2019 +0100

tdf#127921 Don't change slides when clicking in Slide sorter view

Change-Id: I21dfe232234d29dd110771a9edf9d4b9b0f6d53b
Reviewed-on: https://gerrit.libreoffice.org/81833
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sdext/source/presenter/PresenterWindowManager.cxx 
b/sdext/source/presenter/PresenterWindowManager.cxx
index f9d22ca0a548..5f04037c04a5 100644
--- a/sdext/source/presenter/PresenterWindowManager.cxx
+++ b/sdext/source/presenter/PresenterWindowManager.cxx
@@ -273,7 +273,8 @@ void SAL_CALL PresenterWindowManager::windowPaint (const 
awt::PaintEvent& rEvent
 
 void SAL_CALL PresenterWindowManager::mousePressed (const 
css::awt::MouseEvent&)
 {
-mbIsMouseClickPending = true;
+if (!mbIsSlideSorterActive) // tdf#127921
+mbIsMouseClickPending = true;
 }
 
 void SAL_CALL PresenterWindowManager::mouseReleased (const 
css::awt::MouseEvent& rEvent)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-29 Thread Samuel Mehrbrodt (via logerrit)
 sdext/source/presenter/PresenterController.cxx |9 -
 sdext/source/presenter/PresenterController.hxx |9 +
 2 files changed, 1 insertion(+), 17 deletions(-)

New commits:
commit 93a641d291adf86491cc68ac64f4f614c937183a
Author: Samuel Mehrbrodt 
AuthorDate: Tue Oct 29 09:55:11 2019 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Tue Oct 29 13:20:10 2019 +0100

Remove unused XMouseMotionListener from PresenterController

Change-Id: I0b29f3dc300f71b13bc5c7844f1bcf34591dba19
Reviewed-on: https://gerrit.libreoffice.org/81651
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sdext/source/presenter/PresenterController.cxx 
b/sdext/source/presenter/PresenterController.cxx
index fae3506d48bf..ef2301b2eb4f 100644
--- a/sdext/source/presenter/PresenterController.cxx
+++ b/sdext/source/presenter/PresenterController.cxx
@@ -206,7 +206,6 @@ void PresenterController::disposing()
 {
 mxMainWindow->removeKeyListener(this);
 mxMainWindow->removeMouseListener(this);
-mxMainWindow->removeMouseMotionListener(this);
 mxMainWindow = nullptr;
 }
 if (mxConfigurationController.is())
@@ -1045,13 +1044,6 @@ void SAL_CALL PresenterController::mouseEntered (const 
css::awt::MouseEvent&) {}
 
 void SAL_CALL PresenterController::mouseExited (const css::awt::MouseEvent&) {}
 
-//- XMouseMotionListener --
-
-void SAL_CALL PresenterController::mouseMoved (const css::awt::MouseEvent&) {}
-
-void SAL_CALL PresenterController::mouseDragged (const css::awt::MouseEvent&) 
{}
-
-
 void PresenterController::InitializeMainPane (const Reference& rxPane)
 {
 if ( ! rxPane.is())
@@ -1078,7 +1070,6 @@ void PresenterController::InitializeMainPane (const 
Reference& rxPane)
 {
 mxMainWindow->addKeyListener(this);
 mxMainWindow->addMouseListener(this);
-mxMainWindow->addMouseMotionListener(this);
 }
 Reference xPane2 (rxPane, UNO_QUERY);
 if (xPane2.is())
diff --git a/sdext/source/presenter/PresenterController.hxx 
b/sdext/source/presenter/PresenterController.hxx
index 3151e386c262..93ee99c197bf 100644
--- a/sdext/source/presenter/PresenterController.hxx
+++ b/sdext/source/presenter/PresenterController.hxx
@@ -60,8 +60,7 @@ typedef ::cppu::WeakComponentImplHelper <
 css::drawing::framework::XConfigurationChangeListener,
 css::frame::XFrameActionListener,
 css::awt::XKeyListener,
-css::awt::XMouseListener,
-css::awt::XMouseMotionListener
+css::awt::XMouseListener
 > PresenterControllerInterfaceBase;
 
 /// Represents an element in the toolbar that shows the time elapsed since the 
presentation started.
@@ -170,12 +169,6 @@ public:
 
 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) 
override;
 
-// XMouseMotionListener
-
-virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) 
override;
-
-virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) 
override;
-
 private:
 typedef 
::std::map,rtl::Reference
 > InstanceContainer;
 static InstanceContainer maInstances;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-29 Thread Samuel Mehrbrodt (via logerrit)
 sdext/source/presenter/PresenterController.cxx |8 
 sdext/source/presenter/PresenterController.hxx |6 --
 2 files changed, 14 deletions(-)

New commits:
commit 6f9156d14cce0c629ecdc18aff086ee00a7f510f
Author: Samuel Mehrbrodt 
AuthorDate: Tue Oct 29 09:54:09 2019 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Tue Oct 29 11:11:21 2019 +0100

Remove unused XFocusListener from PresenterController

Change-Id: If953ae5cbe74d918d435c9f90189a9f228181ccc
Reviewed-on: https://gerrit.libreoffice.org/81650
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sdext/source/presenter/PresenterController.cxx 
b/sdext/source/presenter/PresenterController.cxx
index 5c438eb32eb0..fae3506d48bf 100644
--- a/sdext/source/presenter/PresenterController.cxx
+++ b/sdext/source/presenter/PresenterController.cxx
@@ -205,7 +205,6 @@ void PresenterController::disposing()
 if (mxMainWindow.is())
 {
 mxMainWindow->removeKeyListener(this);
-mxMainWindow->removeFocusListener(this);
 mxMainWindow->removeMouseListener(this);
 mxMainWindow->removeMouseMotionListener(this);
 mxMainWindow = nullptr;
@@ -1032,12 +1031,6 @@ void PresenterController::HandleNumericKeyPress (
 }
 }
 
-//- XFocusListener 
-
-void SAL_CALL PresenterController::focusGained (const css::awt::FocusEvent&) {}
-
-void SAL_CALL PresenterController::focusLost (const css::awt::FocusEvent&) {}
-
 //- XMouseListener 
 
 void SAL_CALL PresenterController::mousePressed (const css::awt::MouseEvent&)
@@ -1084,7 +1077,6 @@ void PresenterController::InitializeMainPane (const 
Reference& rxPane)
 if (mxMainWindow.is())
 {
 mxMainWindow->addKeyListener(this);
-mxMainWindow->addFocusListener(this);
 mxMainWindow->addMouseListener(this);
 mxMainWindow->addMouseMotionListener(this);
 }
diff --git a/sdext/source/presenter/PresenterController.hxx 
b/sdext/source/presenter/PresenterController.hxx
index a561e738061b..3151e386c262 100644
--- a/sdext/source/presenter/PresenterController.hxx
+++ b/sdext/source/presenter/PresenterController.hxx
@@ -60,7 +60,6 @@ typedef ::cppu::WeakComponentImplHelper <
 css::drawing::framework::XConfigurationChangeListener,
 css::frame::XFrameActionListener,
 css::awt::XKeyListener,
-css::awt::XFocusListener,
 css::awt::XMouseListener,
 css::awt::XMouseMotionListener
 > PresenterControllerInterfaceBase;
@@ -161,11 +160,6 @@ public:
 virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) 
override;
 virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) 
override;
 
-// XFocusListener
-
-virtual void SAL_CALL focusGained (const css::awt::FocusEvent& rEvent) 
override;
-virtual void SAL_CALL focusLost (const css::awt::FocusEvent& rEvent) 
override;
-
 // XMouseListener
 
 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) 
override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-29 Thread Samuel Mehrbrodt (via logerrit)
 sdext/source/presenter/PresenterButton.cxx |   14 --
 sdext/source/presenter/PresenterButton.hxx |9 +
 2 files changed, 1 insertion(+), 22 deletions(-)

New commits:
commit ca77ba6d9c28e82d6e63f9cd19794ce678accae2
Author: Samuel Mehrbrodt 
AuthorDate: Mon Oct 28 19:05:00 2019 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Tue Oct 29 10:26:44 2019 +0100

Remove unused XMouseMotionListener from PresenterButton

Change-Id: I2ee99fa24fa949aedcd8d94fff68449441b9da6d
Reviewed-on: https://gerrit.libreoffice.org/81646
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sdext/source/presenter/PresenterButton.cxx 
b/sdext/source/presenter/PresenterButton.cxx
index 9632cb78945b..725cda10c0bc 100644
--- a/sdext/source/presenter/PresenterButton.cxx
+++ b/sdext/source/presenter/PresenterButton.cxx
@@ -132,7 +132,6 @@ PresenterButton::PresenterButton (
 mxWindow->setVisible(true);
 mxWindow->addPaintListener(this);
 mxWindow->addMouseListener(this);
-mxWindow->addMouseMotionListener(this);
 }
 catch (RuntimeException&)
 {
@@ -157,7 +156,6 @@ void SAL_CALL PresenterButton::disposing()
 {
 mxWindow->removePaintListener(this);
 mxWindow->removeMouseListener(this);
-mxWindow->removeMouseMotionListener(this);
 Reference xComponent = mxWindow;
 mxWindow = nullptr;
 if (xComponent.is())
@@ -291,18 +289,6 @@ void SAL_CALL PresenterButton::mouseExited (const 
css::awt::MouseEvent&)
 Invalidate();
 }
 
-//- XMouseMotionListener --
-
-void SAL_CALL PresenterButton::mouseMoved (const css::awt::MouseEvent&)
-{
-ThrowIfDisposed();
-}
-
-void SAL_CALL PresenterButton::mouseDragged (const css::awt::MouseEvent&)
-{
-ThrowIfDisposed();
-}
-
 //- lang::XEventListener --
 
 void SAL_CALL PresenterButton::disposing (const css::lang::EventObject& rEvent)
diff --git a/sdext/source/presenter/PresenterButton.hxx 
b/sdext/source/presenter/PresenterButton.hxx
index 03ad7cfea363..9f6a01a6a712 100644
--- a/sdext/source/presenter/PresenterButton.hxx
+++ b/sdext/source/presenter/PresenterButton.hxx
@@ -40,8 +40,7 @@ class PresenterController;
 
 typedef ::cppu::WeakComponentImplHelper <
 css::awt::XPaintListener,
-css::awt::XMouseListener,
-css::awt::XMouseMotionListener
+css::awt::XMouseListener
 > PresenterButtonInterfaceBase;
 
 /** Button for the presenter screen.  It displays a text surrounded by a
@@ -85,12 +84,6 @@ public:
 
 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) 
override;
 
-// XMouseMotionListener
-
-virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) 
override;
-
-virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) 
override;
-
 // lang::XEventListener
 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) 
override;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-29 Thread Samuel Mehrbrodt (via logerrit)
 sdext/source/presenter/PresenterButton.cxx |   24 
 sdext/source/presenter/PresenterButton.hxx |   11 ---
 2 files changed, 35 deletions(-)

New commits:
commit 37cbd4f5d6335186244022392c2bc60f3db27be0
Author: Samuel Mehrbrodt 
AuthorDate: Mon Oct 28 19:00:05 2019 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Tue Oct 29 10:13:32 2019 +0100

Remove unused XWindowListener from PresenterButton

Change-Id: I98da5679e108f3684243ce4cca03ad54b9fee84a
Reviewed-on: https://gerrit.libreoffice.org/81645
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sdext/source/presenter/PresenterButton.cxx 
b/sdext/source/presenter/PresenterButton.cxx
index 961e4ff5b425..9632cb78945b 100644
--- a/sdext/source/presenter/PresenterButton.cxx
+++ b/sdext/source/presenter/PresenterButton.cxx
@@ -130,7 +130,6 @@ PresenterButton::PresenterButton (
 xPeer->setBackground(0xff00);
 
 mxWindow->setVisible(true);
-mxWindow->addWindowListener(this);
 mxWindow->addPaintListener(this);
 mxWindow->addMouseListener(this);
 mxWindow->addMouseMotionListener(this);
@@ -156,7 +155,6 @@ void SAL_CALL PresenterButton::disposing()
 
 if (mxWindow.is())
 {
-mxWindow->removeWindowListener(this);
 mxWindow->removePaintListener(this);
 mxWindow->removeMouseListener(this);
 mxWindow->removeMouseMotionListener(this);
@@ -225,28 +223,6 @@ css::geometry::IntegerSize2D const & 
PresenterButton::GetSize()
 return maButtonSize;
 }
 
-//- XWindowListener ---
-
-void SAL_CALL PresenterButton::windowResized (const css::awt::WindowEvent&)
-{
-ThrowIfDisposed();
-}
-
-void SAL_CALL PresenterButton::windowMoved (const css::awt::WindowEvent&)
-{
-ThrowIfDisposed();
-}
-
-void SAL_CALL PresenterButton::windowShown (const css::lang::EventObject&)
-{
-ThrowIfDisposed();
-}
-
-void SAL_CALL PresenterButton::windowHidden (const css::lang::EventObject&)
-{
-ThrowIfDisposed();
-}
-
 //- XPaintListener 
 
 void SAL_CALL PresenterButton::windowPaint (const css::awt::PaintEvent& rEvent)
diff --git a/sdext/source/presenter/PresenterButton.hxx 
b/sdext/source/presenter/PresenterButton.hxx
index 18a504c20d59..03ad7cfea363 100644
--- a/sdext/source/presenter/PresenterButton.hxx
+++ b/sdext/source/presenter/PresenterButton.hxx
@@ -39,7 +39,6 @@ namespace sdext { namespace presenter {
 class PresenterController;
 
 typedef ::cppu::WeakComponentImplHelper <
-css::awt::XWindowListener,
 css::awt::XPaintListener,
 css::awt::XMouseListener,
 css::awt::XMouseMotionListener
@@ -72,16 +71,6 @@ public:
 const css::uno::Reference& rxParentWindow);
 css::geometry::IntegerSize2D const & GetSize();
 
-// XWindowListener
-
-virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) 
override;
-
-virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) 
override;
-
-virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) 
override;
-
-virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) 
override;
-
 // XPaintListener
 
 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) 
override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-28 Thread Rasmus Thomsen (via logerrit)
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   25 ++
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx |   16 ++-
 2 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 2eadd46ab81058087af95bdfc1fea28fcdb65998
Author: Rasmus Thomsen 
AuthorDate: Sat Oct 26 14:11:35 2019 +0200
Commit: Michael Stahl 
CommitDate: Mon Oct 28 12:23:25 2019 +0100

Fix build with poppler-0.82

Change-Id: I3b6b3faea7986f3e5a6ae4790580d03bc9c955fc
Reviewed-on: https://gerrit.libreoffice.org/81545
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index ce32a4139c45..3ae3bdc503e0 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -863,11 +863,20 @@ void PDFOutDev::eoClip(GfxState *state)
 local offset of character (zero for horizontal writing mode). not
 taken into account for output pos updates. Used for vertical writing.
  */
+
+#if POPPLER_CHECK_VERSION(0, 82, 0)
+void PDFOutDev::drawChar(GfxState *state, double x, double y,
+ double dx, double dy,
+ double originX, double originY,
+ CharCode, int /*nBytes*/, const Unicode *u, int uLen)
+{
+#else
 void PDFOutDev::drawChar(GfxState *state, double x, double y,
  double dx, double dy,
  double originX, double originY,
  CharCode, int /*nBytes*/, Unicode *u, int uLen)
 {
+#endif
 assert(state);
 
 if( u == nullptr )
@@ -979,11 +988,19 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, 
Stream* str,
 writeBinaryBuffer(aBuf);
 }
 
+#if POPPLER_CHECK_VERSION(0, 82, 0)
+void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
+  int width, int height, GfxImageColorMap* colorMap,
+  poppler_bool /*interpolate*/,
+  const int* maskColors, poppler_bool /*inlineImg*/ )
+{
+#else
 void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
   int width, int height, GfxImageColorMap* colorMap,
   poppler_bool /*interpolate*/,
   int* maskColors, poppler_bool /*inlineImg*/ )
 {
+#endif
 if (m_bSkipImages)
 return;
 OutputBuffer aBuf; initBuf(aBuf);
@@ -1004,12 +1021,20 @@ void PDFOutDev::drawImage(GfxState*, Object*, Stream* 
str,
 {
 GfxRGB aMinRGB;
 colorMap->getColorSpace()->getRGB(
+#if POPPLER_CHECK_VERSION(0, 82, 0)
+reinterpret_cast(maskColors),
+#else
 reinterpret_cast(maskColors),
+#endif
 &aMinRGB );
 
 GfxRGB aMaxRGB;
 colorMap->getColorSpace()->getRGB(
+#if POPPLER_CHECK_VERSION(0, 82, 0)
+reinterpret_cast(maskColors)+gfxColorMaxComps,
+#else
 reinterpret_cast(maskColors)+gfxColorMaxComps,
+#endif
 &aMaxRGB );
 
 aMaskBuf.push_back( colToByte(aMinRGB.r) );
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx 
b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
index 1a0c3f0caad1..02f6b59f6f15 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
@@ -232,10 +232,17 @@ namespace pdfi
 virtual void eoClip(GfxState *state) override;
 
 //- text drawing
+#if POPPLER_CHECK_VERSION(0, 82, 0)
+virtual void drawChar(GfxState *state, double x, double y,
+  double dx, double dy,
+  double originX, double originY,
+  CharCode code, int nBytes, const Unicode *u, int 
uLen) override;
+#else
 virtual void drawChar(GfxState *state, double x, double y,
   double dx, double dy,
   double originX, double originY,
   CharCode code, int nBytes, Unicode *u, int uLen) 
override;
+#endif
 #if POPPLER_CHECK_VERSION(0, 64, 0)
 virtual void drawString(GfxState *state, const GooString *s) override;
 #else
@@ -248,10 +255,17 @@ namespace pdfi
int width, int height, poppler_bool invert,
poppler_bool interpolate,
poppler_bool inlineImg) override;
+#if POPPLER_CHECK_VERSION(0, 82, 0)
 virtual void drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height, GfxImageColorMap 
*colorMap,
poppler_bool interpolate,
-   int* maskColors, poppler_bool inlineImg) 
override;
+   const int* maskColors, popple

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

2019-10-18 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/pdfparse/pdfentries.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 9f2ffd3dfd6af9a3e558734138cc155f5dcb8be7
Author: Caolán McNamara 
AuthorDate: Fri Oct 18 09:32:19 2019 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 18 12:50:48 2019 +0200

cid#1448423 silence Wrapper object use after free

Change-Id: I5369a82507845bbe248c35c7faf517ac57f73f67
Reviewed-on: https://gerrit.libreoffice.org/81025
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx 
b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index b9c3c822c45a..ef2d4dc671a5 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -527,13 +527,14 @@ void PDFDict::insertValue( const OString& rName, 
std::unique_ptr pValu
 if( ! pValue )
 eraseValue( rName );
 
-auto pValueTmp = pValue.get();
+PDFEntry* pValueTmp = nullptr;
 std::unordered_map::iterator it = m_aMap.find( rName );
 if( it == m_aMap.end() )
 {
 // new name/value, pair, append it
 m_aSubElements.emplace_back(std::make_unique(rName));
 m_aSubElements.emplace_back( std::move(pValue) );
+pValueTmp = m_aSubElements.back().get();
 }
 else
 {
@@ -543,10 +544,12 @@ void PDFDict::insertValue( const OString& rName, 
std::unique_ptr pValu
 if( m_aSubElements[i].get() == it->second )
 {
 m_aSubElements[i] = std::move(pValue);
+pValueTmp = m_aSubElements[i].get();
 bFound = true;
 break;
 }
 }
+assert(pValueTmp);
 m_aMap[ rName ] = pValueTmp;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: sdext/source sfx2/source

2019-08-20 Thread Noel Grandin (via logerrit)
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |2 -
 sdext/source/pdfimport/tree/genericelements.cxx|2 -
 sdext/source/pdfimport/tree/writertreevisiting.cxx |6 ++---
 sfx2/source/appl/appserv.cxx   |4 +--
 sfx2/source/appl/linkmgr2.cxx  |2 -
 sfx2/source/appl/newhelp.cxx   |4 +--
 sfx2/source/appl/workwin.cxx   |   10 -
 sfx2/source/bastyp/fltfnc.cxx  |   22 ++---
 sfx2/source/control/templatelocalview.cxx  |4 +--
 sfx2/source/dialog/dinfdlg.cxx |   10 -
 sfx2/source/doc/Metadatable.cxx|2 -
 sfx2/source/doc/doctemplates.cxx   |4 +--
 sfx2/source/doc/templatedlg.cxx|2 -
 sfx2/source/sidebar/Deck.cxx   |2 -
 sfx2/source/sidebar/ResourceManager.cxx|4 +--
 15 files changed, 40 insertions(+), 40 deletions(-)

New commits:
commit 8d54827762e2a6702a16b67724a6a5f393d72598
Author: Noel Grandin 
AuthorDate: Tue Aug 20 14:01:10 2019 +0200
Commit: Noel Grandin 
CommitDate: Tue Aug 20 15:32:08 2019 +0200

loplugin:constvars in sdext..sfx2

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

diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx 
b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 07e615f693b1..3985d07fdeb8 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -490,7 +490,7 @@ void DrawXmlOptimizer::visit( PageElement& elem, const 
std::list< std::unique_pt
 // adjust line height and text items
 fCurLineHeight = 0.0;
 nCurLineElements = 0;
-for( auto& rxChild : pCurPara->Children )
+for( const auto& rxChild : pCurPara->Children )
 {
 TextElement* pTestText = 
dynamic_cast(rxChild.get());
 if( pTestText )
diff --git a/sdext/source/pdfimport/tree/genericelements.cxx 
b/sdext/source/pdfimport/tree/genericelements.cxx
index 152366d6b4bf..c26f0f816222 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -375,7 +375,7 @@ void PageElement::resolveUnderlines( PDFIProcessor const & 
rProc )
 u_y = r_x; r_x = l_x; l_x = u_y;
 }
 u_y = aPoly.getB2DPoint(0).getY();
-for( auto& rxChild : Children )
+for( const auto& rxChild : Children )
 {
 Element* pEle = rxChild.get();
 if( pEle->y <= u_y && pEle->y + pEle->h*1.1 >= u_y )
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 1025d3fb74c0..4d089b3d3230 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -321,7 +321,7 @@ void WriterXmlEmitter::visit( DocumentElement& elem, const 
std::list< std::uniqu
 m_rEmitContext.rEmitter.beginTag( "office:body", PropertyMap() );
 m_rEmitContext.rEmitter.beginTag( "office:text", PropertyMap() );
 
-for( auto& rxChild : elem.Children )
+for( const auto& rxChild : elem.Children )
 {
 PageElement* pPage = dynamic_cast(rxChild.get());
 if( pPage )
@@ -505,7 +505,7 @@ void WriterXmlOptimizer::visit( PageElement& elem, const 
std::list< std::unique_
 // adjust line height and text items
 fCurLineHeight = 0.0;
 nCurLineElements = 0;
-for( auto& rxChild : pCurPara->Children )
+for( const auto& rxChild : pCurPara->Children )
 {
 TextElement* pTestText = 
dynamic_cast(rxChild.get());
 if( pTestText )
@@ -1085,7 +1085,7 @@ void WriterXmlFinalizer::visit( PageElement& elem, const 
std::list< std::unique_
 elem.RightMargin = 0;
 // first element should be a paragraph
 ParagraphElement* pFirstPara = nullptr;
-for( auto& rxChild : elem.Children )
+for( const auto& rxChild : elem.Children )
 {
 if( dynamic_cast( rxChild.get() ) )
 {
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index fc936519f8a5..423518605fee 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -925,13 +925,13 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 }
 
 // Show toolbars
-for ( OUString& rName : aMandatoryToolbars )
+for ( const OUString& rName : 
std::as_const(aMandatoryToolbars) )
 {
 xLayoutManager->createElement( rName );
 xLayoutManager->showElement( rName );
 }
 
-   

[Libreoffice-commits] core.git: sdext/source sd/source sd/uiconfig sfx2/source

2019-08-12 Thread Andrea Gelmini (via logerrit)
 sd/source/ui/view/outlnvsh.cxx |2 +-
 sd/source/ui/view/outlview.cxx |4 ++--
 sd/source/ui/view/sdview4.cxx  |2 +-
 sd/source/ui/view/sdwindow.cxx |2 +-
 sd/uiconfig/simpress/ui/notebookbar_groupedbar_full.ui |2 +-
 sdext/source/pdfimport/inc/genericelements.hxx |2 +-
 sdext/source/pdfimport/tree/drawtreevisiting.cxx   |2 +-
 sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx |2 +-
 sdext/source/presenter/PresenterViewFactory.cxx|2 +-
 sfx2/source/doc/printhelper.cxx|2 +-
 10 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 7aef9ab8e81a7ccbdcc6042c49a972ee631d936e
Author: Andrea Gelmini 
AuthorDate: Sun Aug 11 18:33:24 2019 +0200
Commit: Julien Nabet 
CommitDate: Mon Aug 12 10:24:52 2019 +0200

Fix typos

Change-Id: I35cebe0e3f2a69872884d41d84ec9113bc5b484e
Reviewed-on: https://gerrit.libreoffice.org/77287
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 279872ba9382..235890e7870e 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -964,7 +964,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
 }
 else
 {
-// check if the object is in edit, than its 
temporarely not empty
+// check if the object is in edit, then if it's 
temporarily not empty
 SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( 
pObj );
 if( pTextObj )
 {
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index b05d86d1dbd2..a99e7ebec393 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -1189,14 +1189,14 @@ SdPage* OutlineView::GetPageForParagraph( Paragraph* 
pPara )
 Paragraph* OutlineView::GetParagraphForPage( ::Outliner const & rOutl, SdPage 
const * pPage )
 {
 // get the number of paragraphs with ident 0 we need to skip before
-// we finde the actual page
+// we find the actual page
 sal_uInt32 nPagesToSkip = (pPage->GetPageNum() - 1) >> 1;
 
 sal_Int32 nParaPos = 0;
 Paragraph* pPara = rOutl.GetParagraph( 0 );
 while( pPara )
 {
-// if this paragraph is a page ...
+// if this paragraph is a page...
 if( ::Outliner::HasParaFlag(pPara,ParaFlag::ISPAGE) )
 {
 // see if we already skipped enough pages
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 030468fd8271..3c5f8cd6760b 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -83,7 +83,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, 
sal_Int8& rAction,
 SdrEndTextEdit();
 mnAction = rAction;
 
-// Is there a object at the position rPos?
+// Is there an object at the position rPos?
 SdrGrafObj* pNewGrafObj = nullptr;
 SdrPageView*pPV = GetSdrPageView();
 SdrObject*  pPickObj = pObj;
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index fa355dfea869..236a6e4b6d7d 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -81,7 +81,7 @@ Window::Window(vcl::Window* pParent)
 aMap.SetMapUnit(MapUnit::Map100thMM);
 SetMapMode(aMap);
 
-// whit it, the vcl::WindowColor is used in the slide mode
+// with it, the vcl::WindowColor is used in the slide mode
 SetBackground( Wallpaper( 
GetSettings().GetStyleSettings().GetWindowColor() ) );
 
 // adjust contrast mode initially
diff --git a/sd/uiconfig/simpress/ui/notebookbar_groupedbar_full.ui 
b/sd/uiconfig/simpress/ui/notebookbar_groupedbar_full.ui
index 49d21f886c00..2210b4e86b20 100644
--- a/sd/uiconfig/simpress/ui/notebookbar_groupedbar_full.ui
+++ b/sd/uiconfig/simpress/ui/notebookbar_groupedbar_full.ui
@@ -4355,7 +4355,7 @@
   
 
 
-  
+  
 
   
   
diff --git a/sdext/source/pdfimport/inc/genericelements.hxx 
b/sdext/source/pdfimport/inc/genericelements.hxx
index 4c75053d97d7..ff8f4a368285 100644
--- a/sdext/source/pdfimport/inc/genericelements.hxx
+++ b/sdext/source/pdfimport/inc/genericelements.hxx
@@ -94,7 +94,7 @@ namespace pdfi
 void updateGeometryWith( const Element* pMergeFrom );
 
 #if OSL_DEBUG_LEVEL > 0
-// xxx refac TODO: move code to visitor
+// xxx refact TODO: move code to visitor
 virtual void emitStructure( int nLevel );
 #endif
 /** el must be a valid dereferenceable it

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

2019-07-23 Thread Caolán McNamara (via logerrit)
 sdext/source/pdfimport/tree/writertreevisiting.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 00dfa1f2f06bcba5dcd67e8955f9a78b95f16632
Author: Caolán McNamara 
AuthorDate: Mon Jul 22 12:15:28 2019 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 23 10:19:51 2019 +0200

cid#1448446 Unchecked dynamic_cast

Change-Id: I888ca249e0e9551c74611dcfb8ba7c7c1dc36880
Reviewed-on: https://gerrit.libreoffice.org/76133
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx 
b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 6c0325019c9a..b84e5f2fcb07 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -694,8 +694,8 @@ void WriterXmlOptimizer::checkHeaderAndFooter( PageElement& 
rElem )
 if (rit == rElem.Children.rend())
 return;
 
-ParagraphElement* pPara = dynamic_cast(rit->get());
-if( !(pPara->y > rElem.h*0.85 && pPara->isSingleLined( m_rProcessor )) )
+ParagraphElement& rPara = dynamic_cast(*rit->get());
+if( !(rPara.y > rElem.h*0.85 && rPara.isSingleLined( m_rProcessor )) )
 return;
 
 std::list< std::unique_ptr >::reverse_iterator next_it = rit;
@@ -704,10 +704,10 @@ void WriterXmlOptimizer::checkHeaderAndFooter( 
PageElement& rElem )
 {
 pNextPara = dynamic_cast(next_it->get());
 }
-if( pNextPara && pNextPara->y < pPara->y-pPara->h*2 )
+if( pNextPara && pNextPara->y < rPara.y-rPara.h*2 )
 {
 rElem.FooterElement = std::move(*rit);
-pPara->Parent = nullptr;
+rPara.Parent = nullptr;
 rElem.Children.erase( std::next(rit).base() );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

  1   2   3   >