sd/source/ui/unoidl/unoobj.cxx | 11 +++++++---- sdext/source/pdfimport/wrapper/wrapper.cxx | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-)
New commits: commit ae27500eaf5cd7e0800cfc5d584809dc4e1739cb Author: Noel Grandin <[email protected]> AuthorDate: Wed Jun 29 19:48:17 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Jun 30 08:50:57 2022 +0200 tdf#137544 only construct SdAnimationInfo when we need it Change-Id: I15377a0f32bf4554c8feddc6c6c967002de9dd9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136657 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 6ed6729f9a75..bdd8104bef7c 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -95,7 +95,6 @@ using ::com::sun::star::drawing::XShape; #define WID_ANIMPATH 16 #define WID_IMAGEMAP 17 #define WID_ISANIMATION 18 -#define WID_THAT_NEED_ANIMINFO 19 #define WID_ISEMPTYPRESOBJ 20 #define WID_ISPRESOBJ 21 @@ -421,8 +420,6 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c SdrObject* pObj = mpShape->GetSdrObject(); if( pObj ) { - SdAnimationInfo* pInfo = GetAnimationInfo(pEntry->nWID <= WID_THAT_NEED_ANIMINFO); - switch(pEntry->nWID) { case WID_NAVORDER: @@ -506,19 +503,23 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c if(!(aValue >>= aString)) throw lang::IllegalArgumentException(); + SdAnimationInfo* pInfo = GetAnimationInfo(true); pInfo->SetBookmark( SdDrawPage::getUiNameFromPageApiName( aString ) ); break; } case WID_CLICKACTION: + { + SdAnimationInfo* pInfo = GetAnimationInfo(true); ::cppu::any2enum< presentation::ClickAction >( pInfo->meClickAction, aValue); break; - + } // TODO: WID_PLAYFULL: case WID_SOUNDFILE: { OUString aString; if(!(aValue >>= aString)) throw lang::IllegalArgumentException(); + SdAnimationInfo* pInfo = GetAnimationInfo(true); pInfo->maSoundFile = aString; EffectMigration::UpdateSoundEffect( mpShape, pInfo ); break; @@ -526,6 +527,7 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c case WID_SOUNDON: { + SdAnimationInfo* pInfo = GetAnimationInfo(true); if( !(aValue >>= pInfo->mbSoundOn) ) throw lang::IllegalArgumentException(); EffectMigration::UpdateSoundEffect( mpShape, pInfo ); @@ -537,6 +539,7 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c if(!(aValue >>= nVerb)) throw lang::IllegalArgumentException(); + SdAnimationInfo* pInfo = GetAnimationInfo(true); pInfo->mnVerb = static_cast<sal_uInt16>(nVerb); break; } commit 333e24b347293503f1c3abf8871769191b0c751d Author: Noel Grandin <[email protected]> AuthorDate: Wed Jun 29 19:47:52 2022 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Jun 30 08:50:42 2022 +0200 tdf#137544 slightly improve perf of pdf parsing Change-Id: I05af862137666606e557dc3fabe1c3ea249ee10a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136656 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 1e096ccbc11d..da506d9ceef8 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -156,12 +156,12 @@ public: m_aFontMap(101) {} - void parseLine( const OString& rLine ); + void parseLine( std::string_view aLine ); }; class LineParser { Parser & m_parser; - OString m_aLine; + std::string_view m_aLine; static void parseFontFamilyName( FontAttributes& aResult ); void readInt32( sal_Int32& o_Value ); @@ -174,7 +174,7 @@ class LineParser { public: std::size_t m_nCharIndex = 0; - LineParser(Parser & parser, OString const & line): m_parser(parser), m_aLine(line) {} + LineParser(Parser & parser, std::string_view line): m_parser(parser), m_aLine(line) {} std::string_view readNextToken(); sal_Int32 readInt32(); @@ -384,7 +384,7 @@ void LineParser::readChar() OString aChars; if (m_nCharIndex != std::string_view::npos) - aChars = lcl_unescapeLineFeeds( m_aLine.subView( m_nCharIndex ) ); + aChars = lcl_unescapeLineFeeds( m_aLine.substr( m_nCharIndex ) ); // chars gobble up rest of line m_nCharIndex = std::string_view::npos; @@ -552,7 +552,7 @@ void LineParser::readFont() nSize = nSize < 0.0 ? -nSize : nSize; // Read FontName. From the current position to the end (any white spaces will be included). - aFontName = lcl_unescapeLineFeeds(m_aLine.subView(m_nCharIndex)); + aFontName = lcl_unescapeLineFeeds(m_aLine.substr(m_nCharIndex)); // name gobbles up rest of line m_nCharIndex = std::string_view::npos; @@ -776,7 +776,7 @@ void LineParser::readLink() m_parser.m_pSink->hyperLink( aBounds, OStringToOUString( lcl_unescapeLineFeeds( - m_aLine.subView(m_nCharIndex) ), + m_aLine.substr(m_nCharIndex) ), RTL_TEXTENCODING_UTF8 ) ); // name gobbles up rest of line m_nCharIndex = std::string_view::npos; @@ -809,13 +809,13 @@ void LineParser::readSoftMaskedImage() m_parser.m_pSink->drawAlphaMaskedImage( aImage, aMask ); } -void Parser::parseLine( const OString& rLine ) +void Parser::parseLine( std::string_view aLine ) { OSL_PRECOND( m_pSink, "Invalid sink" ); OSL_PRECOND( m_pErr, "Invalid filehandle" ); OSL_PRECOND( m_xContext.is(), "Invalid service factory" ); - LineParser lp(*this, rLine); + LineParser lp(*this, aLine); const std::string_view rCmd = lp.readNextToken(); const hash_entry* pEntry = PdfKeywordHash::in_word_set( rCmd.data(), rCmd.size() ); @@ -1136,7 +1136,8 @@ bool xpdf_ImportFromFile(const OUString& rURL, if ( line.isEmpty() ) break; - aParser.parseLine(line.makeStringAndClear()); + aParser.parseLine(line); + line.setLength(0); } } }
