sdext/qa/unit/pdfimport.cxx | 110 ++++++++++----------- sdext/source/pdfimport/filterdet.cxx | 4 sdext/source/pdfimport/pdfparse/pdfentries.cxx | 26 ++-- sdext/source/pdfimport/test/pdfunzip.cxx | 10 - sdext/source/pdfimport/tree/drawtreevisiting.cxx | 28 ++--- sdext/source/pdfimport/tree/style.cxx | 2 sdext/source/pdfimport/tree/writertreevisiting.cxx | 30 ++--- 7 files changed, 105 insertions(+), 105 deletions(-)
New commits: commit 9407c1f96aaea4bd2751301a6d7ee262bef89b74 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Nov 19 17:31:13 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Nov 19 20:37:56 2023 +0100 Extended loplugin:ostr: sdext Change-Id: If4e8ccf288846fc768b3e035706a8bd0b2207f4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159678 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sdext/qa/unit/pdfimport.cxx b/sdext/qa/unit/pdfimport.cxx index 8a65dff940ee..60840702e636 100644 --- a/sdext/qa/unit/pdfimport.cxx +++ b/sdext/qa/unit/pdfimport.cxx @@ -565,7 +565,7 @@ namespace nullptr)); xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast<xmlChar const *>(aOutput.getStr()))); // This ensures that the imported text contains all of the characters - OString xpath = "//draw:frame[@draw:z-index='3'][1]/draw:text-box/text:p/text:span[1]"; + OString xpath = "//draw:frame[@draw:z-index='3'][1]/draw:text-box/text:p/text:span[1]"_ostr; OUString sContent = getXPathContent(pXmlDoc, xpath).replaceAll("\n", ""); CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), u"敏捷的狐狸跨过慵懒的"_ustr, sContent); xpath = "//draw:frame[@draw:z-index='4'][1]/draw:text-box/text:p/text:span[1]"; @@ -593,116 +593,116 @@ namespace //CPPUNIT_ASSERT(pXmlDoc); /* Test for the 1st paragraph */ - OUString styleName = getXPath(pXmlDoc, "//draw:frame[1]//text:span[1]", "style-name"); + OUString styleName = getXPath(pXmlDoc, "//draw:frame[1]//text:span[1]"_ostr, "style-name"_ostr); OString xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font-weight and font-style should be normal - assertXPath(pXmlDoc, xpath, "font-weight", "normal"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "normal"); + assertXPathNoAttribute(pXmlDoc, xpath, "font-style"_ostr); /* Test for the 2nd paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[2]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[2]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // there should be a font-weight="bold", but no font-style italic - assertXPath(pXmlDoc, xpath, "font-weight", "bold"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "bold"); + assertXPathNoAttribute(pXmlDoc, xpath, "font-style"_ostr); /* Test for the 3rd paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[3]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[3]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // there should be a font-style="italic", but no font-weight bold - assertXPath(pXmlDoc, xpath, "font-weight", "normal"); - assertXPath(pXmlDoc, xpath, "font-style", "italic"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "normal"); + assertXPath(pXmlDoc, xpath, "font-style"_ostr, "italic"); /* Test for the 4th paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[4]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[4]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // there should be both font-style="italic" and font-weight="bold" - assertXPath(pXmlDoc, xpath, "font-weight", "bold"); - assertXPath(pXmlDoc, xpath, "font-style", "italic"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "bold"); + assertXPath(pXmlDoc, xpath, "font-style"_ostr, "italic"); /* Test for the 5th paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[5]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[5]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font should be Arial and font-weight="bold", no font-style - assertXPath(pXmlDoc, xpath, "font-family", "Arial"); - assertXPath(pXmlDoc, xpath, "font-weight", "bold"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); + assertXPath(pXmlDoc, xpath, "font-family"_ostr, "Arial"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "bold"); + assertXPathNoAttribute(pXmlDoc, xpath, "font-style"_ostr); /* Test for the 6th paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[6]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[6]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font should be Arial without font-weight and font-style - assertXPath(pXmlDoc, xpath, "font-family", "Arial"); - assertXPath(pXmlDoc, xpath, "font-weight", "normal"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); + assertXPath(pXmlDoc, xpath, "font-family"_ostr, "Arial"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "normal"); + assertXPathNoAttribute(pXmlDoc, xpath, "font-style"_ostr); /* Test for the 7th paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[7]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[7]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font should be SimSun without font-weight and font-style - assertXPath(pXmlDoc, xpath, "font-family", "SimSun"); // TODO: tdf#143095 use localized font name rather than PS name - assertXPath(pXmlDoc, xpath, "font-weight", "normal"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); + assertXPath(pXmlDoc, xpath, "font-family"_ostr, "SimSun"); // TODO: tdf#143095 use localized font name rather than PS name + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "normal"); + assertXPathNoAttribute(pXmlDoc, xpath, "font-style"_ostr); /* Test for the 8th paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[8]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[8]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font should be SimSun and font-weight="bold", no font-style italic - assertXPath(pXmlDoc, xpath, "font-family", "SimSun"); - assertXPath(pXmlDoc, xpath, "font-weight", "bold"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); + assertXPath(pXmlDoc, xpath, "font-family"_ostr, "SimSun"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "bold"); + assertXPathNoAttribute(pXmlDoc, xpath, "font-style"_ostr); /* Test for the 9th paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[9]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[9]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font should be SimSun, font-weight should be "normal", font-style="italic" - assertXPath(pXmlDoc, xpath, "font-family", "SimSun"); - assertXPath(pXmlDoc, xpath, "font-weight", "normal"); + assertXPath(pXmlDoc, xpath, "font-family"_ostr, "SimSun"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "normal"); // FIXME and remove the below comment: // the chinese chars are shown in pdf as faux italic (fake italic). It is currencly imported wrongly as normal font style. // See tdf#78427 for how the faux bold problem was handled. Faux italic may be handled using the transformation pattern. // assertXPath(pXmlDoc, xpath, "font-style", "italic"); /* Test for the 10th paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[10]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[10]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font should be SimSun font-weight="bold" and font-style="italic" - assertXPath(pXmlDoc, xpath, "font-family", "SimSun"); - assertXPath(pXmlDoc, xpath, "font-weight", "bold"); + assertXPath(pXmlDoc, xpath, "font-family"_ostr, "SimSun"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "bold"); // FIXME: faux italic, see above // assertXPath(pXmlDoc, xpath, "font-style", "italic"); /* Test for the 11th paragraph */ - styleName = getXPath(pXmlDoc, "//draw:frame[11]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[11]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font should be SimSun and there should be style:text-outline="true" // (i.e., the real "outline" font rather than faux bold / fake bold) - assertXPath(pXmlDoc, xpath, "font-family", "SimSun"); - assertXPath(pXmlDoc, xpath, "font-weight", "normal"); - assertXPathNoAttribute(pXmlDoc, xpath, "font-style"); - assertXPath(pXmlDoc, xpath, "text-outline", "true"); + assertXPath(pXmlDoc, xpath, "font-family"_ostr, "SimSun"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "normal"); + assertXPathNoAttribute(pXmlDoc, xpath, "font-style"_ostr); + assertXPath(pXmlDoc, xpath, "text-outline"_ostr, "true"); #endif } @@ -724,20 +724,20 @@ namespace //CPPUNIT_ASSERT(pXmlDoc); // The for the 1st frame */ - OUString styleName = getXPath(pXmlDoc, "//draw:frame[1]//text:span[1]", "style-name"); + OUString styleName = getXPath(pXmlDoc, "//draw:frame[1]//text:span[1]"_ostr, "style-name"_ostr); OString xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font-weight and font-style should be 600 (Semibold) - assertXPath(pXmlDoc, xpath, "font-weight", "600"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "600"); // The for the 2nd frame */ - styleName = getXPath(pXmlDoc, "//draw:frame[2]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[2]//text:span[1]"_ostr, "style-name"_ostr); xpath = "//office:automatic-styles/style:style[@style:name=\"" + OUStringToOString(styleName, RTL_TEXTENCODING_UTF8) + "\"]/style:text-properties"; // the font-weight and font-style should be 300 (Light) - assertXPath(pXmlDoc, xpath, "font-weight", "300"); + assertXPath(pXmlDoc, xpath, "font-weight"_ostr, "300"); #endif } @@ -757,22 +757,22 @@ namespace xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast<xmlChar const *>(aOutput.getStr()))); /* Test for the 1st text paragraph */ - OUString styleName = getXPath(pXmlDoc, "//draw:frame[2]//text:span[1]", "style-name"); + OUString styleName = getXPath(pXmlDoc, "//draw:frame[2]//text:span[1]"_ostr, "style-name"_ostr); 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"")); + getXPath(pXmlDoc, xpath, "font-family"_ostr).replaceAll(u" ", u"")); /* Test for the "TOTAL ESTA HOJA USD" paragraph" */ - styleName = getXPath(pXmlDoc, "//draw:frame[last()-1]//text:span[1]", "style-name"); + styleName = getXPath(pXmlDoc, "//draw:frame[last()-1]//text:span[1]"_ostr, "style-name"_ostr); 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"")); + getXPath(pXmlDoc, xpath, "font-family"_ostr).replaceAll(u" ", u"")); CPPUNIT_ASSERT_EQUAL(OUString("bold"), - getXPath(pXmlDoc, xpath, "font-weight")); + getXPath(pXmlDoc, xpath, "font-weight"_ostr)); #endif } @@ -791,7 +791,7 @@ namespace xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast<xmlChar const *>(aOutput.getStr()))); // Test for امُ عَلَيْكَ - OString xpath = "string(//draw:frame[@draw:transform='matrix(917.222222222222 0 0 917.222222222222 14821.9583333333 2159.23861112778)']/draw:text-box/text:p/text:span)"; + OString xpath = "string(//draw:frame[@draw:transform='matrix(917.222222222222 0 0 917.222222222222 14821.9583333333 2159.23861112778)']/draw:text-box/text:p/text:span)"_ostr; OUString sContent = getXPathContent(pXmlDoc, xpath); CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), u"امُ عَلَيَْك"_ustr, sContent.replaceAll("\n\n", " ").replaceAll("\n", "")); @@ -851,25 +851,25 @@ namespace // Space test: there are 10 spaces, each space is expressed as a <text:s text:c="1" ...>, // 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"); + OString xpath = "//draw:frame[@draw:z-index='1'][1]/draw:text-box/text:p/text:span/text:s[10]"_ostr; + OUString sContent = getXPath(pXmlDoc, xpath, "c"_ostr); 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"); + sContent = getXPath(pXmlDoc, xpath, "transform"_ostr); 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"); + sContent = getXPath(pXmlDoc, xpath, "transform"_ostr); 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 <text:s text:c="1" ...>. // 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"); + sContent = getXPath(pXmlDoc, xpath, "c"_ostr); CPPUNIT_ASSERT_EQUAL_MESSAGE(aOutput.getStr(), OUString("1"), sContent); #endif } diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx index 5f6392e18983..e8d2e11d30ba 100644 --- a/sdext/source/pdfimport/filterdet.cxx +++ b/sdext/source/pdfimport/filterdet.cxx @@ -578,7 +578,7 @@ uno::Reference< io::XStream > getAdditionalStream( const OUString& if( pTrailer && pTrailer->m_pDict ) { // search document checksum entry - auto chk = pTrailer->m_pDict->m_aMap.find( "DocChecksum" ); + auto chk = pTrailer->m_pDict->m_aMap.find( "DocChecksum"_ostr ); if( chk == pTrailer->m_pDict->m_aMap.end() ) { SAL_INFO( "sdext.pdfimport", "no DocChecksum entry" ); @@ -592,7 +592,7 @@ uno::Reference< io::XStream > getAdditionalStream( const OUString& } // search for AdditionalStreams entry - auto add_stream = pTrailer->m_pDict->m_aMap.find( "AdditionalStreams" ); + auto add_stream = pTrailer->m_pDict->m_aMap.find( "AdditionalStreams"_ostr ); if( add_stream == pTrailer->m_pDict->m_aMap.end() ) { SAL_INFO( "sdext.pdfimport", "no AdditionalStreams entry" ); diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index b1b7d9f86a58..03f4537080d7 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -624,7 +624,7 @@ unsigned int PDFStream::getDictLength( const PDFContainer* pContainer ) const return 0; // find /Length entry, can either be a direct or indirect number object std::unordered_map<OString,PDFEntry*>::const_iterator it = - m_pDict->m_aMap.find( "Length" ); + m_pDict->m_aMap.find( "Length"_ostr ); if( it == m_pDict->m_aMap.end() ) return 0; PDFNumber* pNum = dynamic_cast<PDFNumber*>(it->second); @@ -673,7 +673,7 @@ bool PDFObject::getDeflatedStream( std::unique_ptr<char[]>& rpStream, unsigned i } // is there a filter entry ? std::unordered_map<OString,PDFEntry*>::const_iterator it = - m_pStream->m_pDict->m_aMap.find( "Filter" ); + m_pStream->m_pDict->m_aMap.find( "Filter"_ostr ); if( it != m_pStream->m_pDict->m_aMap.end() ) { PDFName* pFilter = dynamic_cast<PDFName*>(it->second); @@ -842,13 +842,13 @@ bool PDFObject::emit( EmitContext& rWriteContext ) const std::unique_ptr<PDFObject> pClone(static_cast<PDFObject*>(clone())); // set length in the dictionary to new stream length std::unique_ptr<PDFNumber> pNewLen(new PDFNumber( double(nOutBytes) )); - pClone->m_pStream->m_pDict->insertValue( "Length", std::move(pNewLen) ); + pClone->m_pStream->m_pDict->insertValue( "Length"_ostr, std::move(pNewLen) ); if( bDeflate && rWriteContext.m_bDeflate ) { // delete flatedecode filter std::unordered_map<OString,PDFEntry*>::const_iterator it = - pClone->m_pStream->m_pDict->m_aMap.find( "Filter" ); + pClone->m_pStream->m_pDict->m_aMap.find( "Filter"_ostr ); if( it != pClone->m_pStream->m_pDict->m_aMap.end() ) { PDFName* pFilter = dynamic_cast<PDFName*>(it->second); @@ -1288,7 +1288,7 @@ PDFFileImplData* PDFFile::impl_getData() const if( pTrailer && pTrailer->m_pDict ) { // search doc id - PDFDict::Map::iterator doc_id = pTrailer->m_pDict->m_aMap.find( "ID" ); + PDFDict::Map::iterator doc_id = pTrailer->m_pDict->m_aMap.find( "ID"_ostr ); if( doc_id != pTrailer->m_pDict->m_aMap.end() ) { PDFArray* pArr = dynamic_cast<PDFArray*>(doc_id->second); @@ -1307,7 +1307,7 @@ PDFFileImplData* PDFFile::impl_getData() const } // search Encrypt entry PDFDict::Map::iterator enc = - pTrailer->m_pDict->m_aMap.find( "Encrypt" ); + pTrailer->m_pDict->m_aMap.find( "Encrypt"_ostr ); if( enc != pTrailer->m_pDict->m_aMap.end() ) { PDFDict* pDict = dynamic_cast<PDFDict*>(enc->second); @@ -1323,13 +1323,13 @@ PDFFileImplData* PDFFile::impl_getData() const } if( pDict ) { - PDFDict::Map::iterator filter = pDict->m_aMap.find( "Filter" ); - PDFDict::Map::iterator version = pDict->m_aMap.find( "V" ); - PDFDict::Map::iterator len = pDict->m_aMap.find( "Length" ); - PDFDict::Map::iterator o_ent = pDict->m_aMap.find( "O" ); - PDFDict::Map::iterator u_ent = pDict->m_aMap.find( "U" ); - PDFDict::Map::iterator r_ent = pDict->m_aMap.find( "R" ); - PDFDict::Map::iterator p_ent = pDict->m_aMap.find( "P" ); + PDFDict::Map::iterator filter = pDict->m_aMap.find( "Filter"_ostr ); + PDFDict::Map::iterator version = pDict->m_aMap.find( "V"_ostr ); + PDFDict::Map::iterator len = pDict->m_aMap.find( "Length"_ostr ); + PDFDict::Map::iterator o_ent = pDict->m_aMap.find( "O"_ostr ); + PDFDict::Map::iterator u_ent = pDict->m_aMap.find( "U"_ostr ); + PDFDict::Map::iterator r_ent = pDict->m_aMap.find( "R"_ostr ); + PDFDict::Map::iterator p_ent = pDict->m_aMap.find( "P"_ostr ); if( filter != pDict->m_aMap.end() ) { m_pData->m_bIsEncrypted = true; diff --git a/sdext/source/pdfimport/test/pdfunzip.cxx b/sdext/source/pdfimport/test/pdfunzip.cxx index c4d5b6bc0b71..b9bf3a62f14f 100644 --- a/sdext/source/pdfimport/test/pdfunzip.cxx +++ b/sdext/source/pdfimport/test/pdfunzip.cxx @@ -302,7 +302,7 @@ static int write_addStreams( const char* pInFile, const char* pOutFile, PDFFile* if( pTrailer && pTrailer->m_pDict ) { // search for AdditionalStreams entry - auto add_stream = pTrailer->m_pDict->m_aMap.find( "AdditionalStreams" ); + auto add_stream = pTrailer->m_pDict->m_aMap.find( "AdditionalStreams"_ostr ); if( add_stream != pTrailer->m_pDict->m_aMap.end() ) { PDFArray* pStreams = dynamic_cast<PDFArray*>(add_stream->second); @@ -328,7 +328,7 @@ static int write_fonts( const char* i_pInFile, const char* i_pOutFile, PDFFile* continue; std::unordered_map<OString,PDFEntry*>::iterator map_it = - pDict->m_aMap.find( "Type" ); + pDict->m_aMap.find( "Type"_ostr ); if( map_it == pDict->m_aMap.end() ) continue; @@ -340,7 +340,7 @@ static int write_fonts( const char* i_pInFile, const char* i_pOutFile, PDFFile* // the font name will be helpful, also there must be one in // a font descriptor - map_it = pDict->m_aMap.find( "FontName" ); + map_it = pDict->m_aMap.find( "FontName"_ostr ); if( map_it == pDict->m_aMap.end() ) continue; pName = dynamic_cast<PDFName*>(map_it->second); @@ -351,7 +351,7 @@ static int write_fonts( const char* i_pInFile, const char* i_pOutFile, PDFFile* PDFObjectRef* pStreamRef = nullptr; const char* pFileType = nullptr; // we have a font descriptor, try for a type 1 font - map_it = pDict->m_aMap.find( "FontFile" ); + map_it = pDict->m_aMap.find( "FontFile"_ostr ); if( map_it != pDict->m_aMap.end() ) { pStreamRef = dynamic_cast<PDFObjectRef*>(map_it->second); @@ -362,7 +362,7 @@ static int write_fonts( const char* i_pInFile, const char* i_pOutFile, PDFFile* // perhaps it's a truetype file ? if( ! pStreamRef ) { - map_it = pDict->m_aMap.find( "FontFile2" ); + map_it = pDict->m_aMap.find( "FontFile2"_ostr ); if( map_it != pDict->m_aMap.end() ) { pStreamRef = dynamic_cast<PDFObjectRef*>(map_it->second); diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index 58a55451a379..5aae54415800 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -797,7 +797,7 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::uniqu { PropertyMap props; FillDashStyleProps(props, rGC.DashArray, scale); - StyleContainer::Style style("draw:stroke-dash", std::move(props)); + StyleContainer::Style style("draw:stroke-dash"_ostr, std::move(props)); aGCProps[ "draw:stroke" ] = "dash"; aGCProps[ "draw:stroke-dash" ] = @@ -830,8 +830,8 @@ void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::uniqu aGCProps[ "draw:fill" ] = "none"; } - StyleContainer::Style aStyle( "style:style", std::move(aProps) ); - StyleContainer::Style aSubStyle( "style:graphic-properties", std::move(aGCProps) ); + StyleContainer::Style aStyle( "style:style"_ostr, std::move(aProps) ); + StyleContainer::Style aSubStyle( "style:graphic-properties"_ostr, std::move(aGCProps) ); aStyle.SubStyles.push_back( &aSubStyle ); elem.StyleId = m_rStyleContainer.getStyleId( aStyle ); @@ -907,8 +907,8 @@ void DrawXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_pt aFontProps[ "style:text-scale" ] = getPercentString(textScale); } - StyleContainer::Style aStyle( "style:style", std::move(aProps) ); - StyleContainer::Style aSubStyle( "style:text-properties", std::move(aFontProps) ); + StyleContainer::Style aStyle( "style:style"_ostr, std::move(aProps) ); + StyleContainer::Style aSubStyle( "style:text-properties"_ostr, std::move(aFontProps) ); aStyle.SubStyles.push_back( &aSubStyle ); elem.StyleId = m_rStyleContainer.getStyleId( aStyle ); } @@ -929,8 +929,8 @@ void DrawXmlFinalizer::visit( ParagraphElement& elem, const std::list< std::uniq else aParProps[ "style:writing-mode"] = "lr-tb"; - StyleContainer::Style aStyle( "style:style", std::move(aProps) ); - StyleContainer::Style aSubStyle( "style:paragraph-properties", std::move(aParProps) ); + StyleContainer::Style aStyle( "style:style"_ostr, std::move(aProps) ); + StyleContainer::Style aSubStyle( "style:paragraph-properties"_ostr, std::move(aParProps) ); aStyle.SubStyles.push_back( &aSubStyle ); elem.StyleId = m_rStyleContainer.getStyleId( aStyle ); @@ -961,8 +961,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", std::move(props1) ); - StyleContainer::Style subStyle1( "style:graphic-properties", std::move(aGCProps) ); + StyleContainer::Style style1( "style:style"_ostr, std::move(props1) ); + StyleContainer::Style subStyle1( "style:graphic-properties"_ostr, std::move(aGCProps) ); style1.SubStyles.push_back(&subStyle1); elem.StyleId = m_rStyleContainer.getStyleId(style1); @@ -975,8 +975,8 @@ void DrawXmlFinalizer::visit( FrameElement& elem, const std::list< std::unique_p PropertyMap textProps; SetFontsizeProperties(textProps, elem.FontSize); - StyleContainer::Style style2("style:style", std::move(props2)); - StyleContainer::Style subStyle2("style:text-properties", std::move(textProps)); + StyleContainer::Style style2("style:style"_ostr, std::move(props2)); + StyleContainer::Style subStyle2("style:text-properties"_ostr, std::move(textProps)); style2.SubStyles.push_back(&subStyle2); elem.TextStyleId = m_rStyleContainer.getStyleId(style2); } @@ -1069,8 +1069,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", std::move(aPageProps)); - StyleContainer::Style aSubStyle( "style:page-layout-properties", std::move(aPageLayoutProps)); + StyleContainer::Style aStyle( "style:page-layout"_ostr, std::move(aPageProps)); + StyleContainer::Style aSubStyle( "style:page-layout-properties"_ostr, std::move(aPageLayoutProps)); aStyle.SubStyles.push_back(&aSubStyle); sal_Int32 nPageStyle = m_rStyleContainer.impl_getStyleId( aStyle, false ); @@ -1078,7 +1078,7 @@ void DrawXmlFinalizer::visit( PageElement& elem, const std::list< std::unique_pt OUString aMasterPageLayoutName = m_rStyleContainer.getStyleName( nPageStyle ); aPageProps[ "style:page-layout-name" ] = aMasterPageLayoutName; - StyleContainer::Style aMPStyle( "style:master-page", std::move(aPageProps)); + StyleContainer::Style aMPStyle( "style:master-page"_ostr, std::move(aPageProps)); elem.StyleId = m_rStyleContainer.impl_getStyleId( aMPStyle,false ); diff --git a/sdext/source/pdfimport/tree/style.cxx b/sdext/source/pdfimport/tree/style.cxx index fe93f2d7ed29..3f1d20eb4244 100644 --- a/sdext/source/pdfimport/tree/style.cxx +++ b/sdext/source/pdfimport/tree/style.cxx @@ -79,7 +79,7 @@ sal_Int32 StyleContainer::getStandardStyleId( std::string_view rName ) aProps[ "style:family" ] = OStringToOUString( rName, RTL_TEXTENCODING_UTF8 ); aProps[ "style:name" ] = "standard"; - Style aStyle( "style:style", std::move(aProps) ); + Style aStyle( "style:style"_ostr, std::move(aProps) ); return getStyleId( aStyle ); } diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index 98d2c9572b9b..7941f7d35709 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -977,7 +977,7 @@ void WriterXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::uni { PropertyMap props; FillDashStyleProps(props, rGC.DashArray, scale); - StyleContainer::Style style("draw:stroke-dash", std::move(props)); + StyleContainer::Style style("draw:stroke-dash"_ostr, std::move(props)); aGCProps[ "draw:stroke" ] = "dash"; aGCProps[ "draw:stroke-dash" ] = @@ -1006,8 +1006,8 @@ void WriterXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::uni aGCProps[ "draw:fill" ] = "none"; } - StyleContainer::Style aStyle( "style:style", std::move(aProps) ); - StyleContainer::Style aSubStyle( "style:graphic-properties", std::move(aGCProps) ); + StyleContainer::Style aStyle( "style:style"_ostr, std::move(aProps) ); + StyleContainer::Style aSubStyle( "style:graphic-properties"_ostr, std::move(aGCProps) ); aStyle.SubStyles.push_back( &aSubStyle ); elem.StyleId = m_rStyleContainer.getStyleId( aStyle ); @@ -1067,8 +1067,8 @@ void WriterXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_ const GraphicsContext& rGC = m_rProcessor.getGraphicsContext( elem.GCId ); aFontProps[ "fo:color" ] = getColorString( rFont.isOutline ? rGC.LineColor : rGC.FillColor ); - StyleContainer::Style aStyle( "style:style", std::move(aProps) ); - StyleContainer::Style aSubStyle( "style:text-properties", std::move(aFontProps) ); + StyleContainer::Style aStyle( "style:style"_ostr, std::move(aProps) ); + StyleContainer::Style aSubStyle( "style:text-properties"_ostr, std::move(aFontProps) ); aStyle.SubStyles.push_back( &aSubStyle ); elem.StyleId = m_rStyleContainer.getStyleId( aStyle ); } @@ -1131,8 +1131,8 @@ void WriterXmlFinalizer::visit( ParagraphElement& elem, const std::list< std::un { PropertyMap aProps; aProps[ "style:family" ] = "paragraph"; - StyleContainer::Style aStyle( "style:style", std::move(aProps) ); - StyleContainer::Style aSubStyle( "style:paragraph-properties", std::move(aParaProps) ); + StyleContainer::Style aStyle( "style:style"_ostr, std::move(aProps) ); + StyleContainer::Style aSubStyle( "style:paragraph-properties"_ostr, std::move(aParaProps) ); aStyle.SubStyles.push_back( &aSubStyle ); elem.StyleId = m_rStyleContainer.getStyleId( aStyle ); } @@ -1160,8 +1160,8 @@ void WriterXmlFinalizer::visit( FrameElement& elem, const std::list< std::unique aGCProps[ "fo:padding-right" ] = "0cm"; aGCProps[ "fo:padding-bottom" ] = "0cm"; - StyleContainer::Style aStyle( "style:style", std::move(aProps) ); - StyleContainer::Style aSubStyle( "style:graphic-properties", std::move(aGCProps) ); + StyleContainer::Style aStyle( "style:style"_ostr, std::move(aProps) ); + StyleContainer::Style aSubStyle( "style:graphic-properties"_ostr, std::move(aGCProps) ); aStyle.SubStyles.push_back( &aSubStyle ); elem.StyleId = m_rStyleContainer.getStyleId( aStyle ); @@ -1191,7 +1191,7 @@ void WriterXmlFinalizer::setFirstOnPage( ParagraphElement& rElem, rElem.StyleId = rStyles.setProperties( rElem.StyleId, std::move(aProps) ); else { - StyleContainer::Style aStyle( "style:style", std::move(aProps) ); + StyleContainer::Style aStyle( "style:style"_ostr, std::move(aProps) ); rElem.StyleId = rStyles.getStyleId( aStyle ); } } @@ -1296,17 +1296,17 @@ void WriterXmlFinalizer::visit( PageElement& elem, const std::list< std::unique_ aPageLayoutProps[ "fo:margin-right" ] = unitMMString( right_margin ); aPageLayoutProps[ "style:writing-mode" ]= "lr-tb"; - StyleContainer::Style aStyle( "style:page-layout", std::move(aPageProps)); - StyleContainer::Style aSubStyle( "style:page-layout-properties", std::move(aPageLayoutProps)); + StyleContainer::Style aStyle( "style:page-layout"_ostr, std::move(aPageProps)); + StyleContainer::Style aSubStyle( "style:page-layout-properties"_ostr, std::move(aPageLayoutProps)); aStyle.SubStyles.push_back(&aSubStyle); sal_Int32 nPageStyle = m_rStyleContainer.impl_getStyleId( aStyle, false ); // create master page OUString aMasterPageLayoutName = m_rStyleContainer.getStyleName( nPageStyle ); aPageProps[ "style:page-layout-name" ] = aMasterPageLayoutName; - StyleContainer::Style aMPStyle( "style:master-page", std::move(aPageProps) ); - StyleContainer::Style aHeaderStyle( "style:header", PropertyMap() ); - StyleContainer::Style aFooterStyle( "style:footer", PropertyMap() ); + StyleContainer::Style aMPStyle( "style:master-page"_ostr, std::move(aPageProps) ); + StyleContainer::Style aHeaderStyle( "style:header"_ostr, PropertyMap() ); + StyleContainer::Style aFooterStyle( "style:footer"_ostr, PropertyMap() ); if( elem.HeaderElement ) { elem.HeaderElement->visitedBy( *this, std::list<std::unique_ptr<Element>>::iterator() );