diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-11-19 13:22:44 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-11-19 15:23:35 +0100 |
commit | 56c89190a2c717d6c24f2826f3b82ffe41b0ab6e (patch) | |
tree | 33929e7c7177de0bea5a6512bb2b70dfecab5847 /vcl | |
parent | e4d8f186d07aa1999e16abff3381e37b8764e964 (diff) |
Extended loplugin:ostr: vcl
Change-Id: I2a9d5383d1831d8bf61e5280d66556d71fccae52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159666
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
38 files changed, 1648 insertions, 1555 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 030638e06e75..6e611c4f962c 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -396,7 +396,7 @@ public: { std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "show"; + (*pMap)[ACTION_TYPE ""_ostr] = "show"; sendAction(std::move(pMap)); } } @@ -409,7 +409,7 @@ public: { std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "hide"; + (*pMap)[ACTION_TYPE ""_ostr] = "hide"; sendAction(std::move(pMap)); } } @@ -448,7 +448,7 @@ public: { BaseInstanceClass::grab_focus(); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "grab_focus"; + (*pMap)[ACTION_TYPE ""_ostr] = "grab_focus"; sendAction(std::move(pMap)); } diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index f694a5778fe7..def963b0510e 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -300,12 +300,13 @@ void JSDialogNotifyIdle::Invoke() break; case jsdialog::MessageType::Popup: - send(*generatePopupMessage(rMessage.m_pWindow, (*rMessage.m_pData)[PARENT_ID], - (*rMessage.m_pData)[CLOSE_ID])); + send(*generatePopupMessage(rMessage.m_pWindow, + (*rMessage.m_pData)[PARENT_ID ""_ostr], + (*rMessage.m_pData)[CLOSE_ID ""_ostr])); break; case jsdialog::MessageType::PopupClose: - send(*generateClosePopupMessage((*rMessage.m_pData)[WINDOW_ID])); + send(*generateClosePopupMessage((*rMessage.m_pData)[WINDOW_ID ""_ostr])); break; } } @@ -371,8 +372,8 @@ void JSDialogSender::sendPopup(VclPtr<vcl::Window> pWindow, OUString sParentId, return; std::unique_ptr<jsdialog::ActionDataMap> pData = std::make_unique<jsdialog::ActionDataMap>(); - (*pData)[PARENT_ID] = sParentId; - (*pData)[CLOSE_ID] = sCloseId; + (*pData)[PARENT_ID ""_ostr] = sParentId; + (*pData)[CLOSE_ID ""_ostr] = sCloseId; mpIdleNotify->sendMessage(jsdialog::MessageType::Popup, pWindow, std::move(pData)); mpIdleNotify->Start(); } @@ -383,7 +384,7 @@ void JSDialogSender::sendClosePopup(vcl::LOKWindowId nWindowId) return; std::unique_ptr<jsdialog::ActionDataMap> pData = std::make_unique<jsdialog::ActionDataMap>(); - (*pData)[WINDOW_ID] = OUString::number(nWindowId); + (*pData)[WINDOW_ID ""_ostr] = OUString::number(nWindowId); mpIdleNotify->sendMessage(jsdialog::MessageType::PopupClose, nullptr, std::move(pData)); flush(); } @@ -1655,8 +1656,8 @@ void JSComboBox::set_entry_text(const OUString& rText) SalInstanceComboBoxWithEdit::set_entry_text(rText); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "setText"; - (*pMap)["text"] = rText; + (*pMap)[ACTION_TYPE ""_ostr] = "setText"; + (*pMap)["text"_ostr] = rText; sendAction(std::move(pMap)); } @@ -1668,8 +1669,8 @@ void JSComboBox::set_active(int pos) SalInstanceComboBoxWithEdit::set_active(pos); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "select"; - (*pMap)["position"] = OUString::number(pos); + (*pMap)[ACTION_TYPE ""_ostr] = "select"; + (*pMap)["position"_ostr] = OUString::number(pos); sendAction(std::move(pMap)); } @@ -1703,9 +1704,9 @@ void JSComboBox::render_entry(int pos, int dpix, int dpiy) ::comphelper::Base64::encode(aBuffer, aSeq); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "rendered_combobox_entry"; - (*pMap)["pos"] = OUString::number(pos); - (*pMap)["image"] = aBuffer; + (*pMap)[ACTION_TYPE ""_ostr] = "rendered_combobox_entry"; + (*pMap)["pos"_ostr] = OUString::number(pos); + (*pMap)["image"_ostr] = aBuffer; sendAction(std::move(pMap)); } } @@ -1758,8 +1759,8 @@ void JSSpinButton::set_value(sal_Int64 value) SalInstanceSpinButton::set_value(value); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "setText"; - (*pMap)["text"] = OUString::number(m_rFormatter.GetValue()); + (*pMap)[ACTION_TYPE ""_ostr] = "setText"; + (*pMap)["text"_ostr] = OUString::number(m_rFormatter.GetValue()); sendAction(std::move(pMap)); } @@ -2059,8 +2060,8 @@ void JSTreeView::select(int pos) enable_notify_events(); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "select"; - (*pMap)["position"] = OUString::number(pos); + (*pMap)[ACTION_TYPE ""_ostr] = "select"; + (*pMap)["position"_ostr] = OUString::number(pos); sendAction(std::move(pMap)); } @@ -2224,8 +2225,8 @@ void JSIconView::select(int pos) SalInstanceIconView::select(pos); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "select"; - (*pMap)["position"] = OUString::number(pos); + (*pMap)[ACTION_TYPE ""_ostr] = "select"; + (*pMap)["position"_ostr] = OUString::number(pos); sendAction(std::move(pMap)); } diff --git a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx index 945cb6d1c613..13c612e46e05 100644 --- a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx +++ b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx @@ -410,30 +410,30 @@ void GraphicFormatDetectorTest::testMatchArray() int nCheckSize = aString.size(); // Check beginning of the input string - pMatchPointer = vcl::matchArrayWithString(pCompleteStringPointer, nCheckSize, "<?xml"); + pMatchPointer = vcl::matchArrayWithString(pCompleteStringPointer, nCheckSize, "<?xml"_ostr); CPPUNIT_ASSERT(pMatchPointer != nullptr); CPPUNIT_ASSERT_EQUAL(0, int(pMatchPointer - pCompleteStringPointer)); CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer, "<?xml")); // Check middle of the input string - pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "version"); + pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "version"_ostr); CPPUNIT_ASSERT(pMatchPointer != nullptr); CPPUNIT_ASSERT_EQUAL(6, int(pMatchPointer - pCompleteStringPointer)); CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer, "version")); - pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "<svg"); + pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "<svg"_ostr); CPPUNIT_ASSERT(pMatchPointer != nullptr); CPPUNIT_ASSERT_EQUAL(38, int(pMatchPointer - pCompleteStringPointer)); CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer, "<svg")); // Check end of the input string - pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "/svg>"); + pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "/svg>"_ostr); CPPUNIT_ASSERT(pMatchPointer != nullptr); CPPUNIT_ASSERT_EQUAL(119, int(pMatchPointer - pCompleteStringPointer)); CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer, "/svg>")); // Check that non-existing search string - pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "none"); + pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "none"_ostr); CPPUNIT_ASSERT(pMatchPointer == nullptr); } @@ -448,54 +448,61 @@ void GraphicFormatDetectorTest::testCheckArrayForMatchingStrings() bool bResult; // check beginning string - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "<?xml" }); + bResult + = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "<?xml"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check ending string - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "/svg>" }); + bResult + = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "/svg>"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check middle string - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "version" }); + bResult + = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "version"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check beginning and then ending string bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "<?xml", "/svg>" }); + { "<?xml"_ostr, "/svg>"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check ending and then beginning string bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "/svg>", "<?xml" }); + { "/svg>"_ostr, "<?xml"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); // check middle strings bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "version", "<svg" }); + { "version"_ostr, "<svg"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check beginning, middle and ending strings - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "<?xml", "version", "<svg", "/svg>" }); + bResult = vcl::checkArrayForMatchingStrings( + pCompleteStringPointer, nCheckSize, + { "<?xml"_ostr, "version"_ostr, "<svg"_ostr, "/svg>"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check non-existing - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "none" }); + bResult + = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "none"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); // check non-existing on the beginning - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "none", "version", "<svg", "/svg>" }); + bResult = vcl::checkArrayForMatchingStrings( + pCompleteStringPointer, nCheckSize, + { "none"_ostr, "version"_ostr, "<svg"_ostr, "/svg>"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); // check non-existing on the end - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "<?xml", "version", "<svg", "none" }); + bResult = vcl::checkArrayForMatchingStrings( + pCompleteStringPointer, nCheckSize, + { "<?xml"_ostr, "version"_ostr, "<svg"_ostr, "none"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); // check non-existing after the end bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "<?xml", "/svg>", "none" }); + { "<?xml"_ostr, "/svg>"_ostr, "none"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); } diff --git a/vcl/qa/cppunit/PDFDocumentTest.cxx b/vcl/qa/cppunit/PDFDocumentTest.cxx index 88fcdc0a765b..1223eebcbd18 100644 --- a/vcl/qa/cppunit/PDFDocumentTest.cxx +++ b/vcl/qa/cppunit/PDFDocumentTest.cxx @@ -34,25 +34,25 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseBasicPDF) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); - vcl::filter::PDFObjectElement* pTest = pResources->LookupObject("Test"); + vcl::filter::PDFObjectElement* pTest = pResources->LookupObject("Test"_ostr); CPPUNIT_ASSERT(pTest); - vcl::filter::PDFObjectElement* pTestArray1 = pTest->LookupObject("TestArray1"); + vcl::filter::PDFObjectElement* pTestArray1 = pTest->LookupObject("TestArray1"_ostr); CPPUNIT_ASSERT(pTestArray1); { CPPUNIT_ASSERT_EQUAL(size_t(5), pTestArray1->GetArray()->GetElements().size()); } - vcl::filter::PDFObjectElement* pTestArray2 = pTest->LookupObject("TestArray2"); + vcl::filter::PDFObjectElement* pTestArray2 = pTest->LookupObject("TestArray2"_ostr); CPPUNIT_ASSERT(pTestArray2); { CPPUNIT_ASSERT_EQUAL(size_t(2), pTestArray2->GetArray()->GetElements().size()); } - vcl::filter::PDFObjectElement* pTestDictionary = pTest->LookupObject("TestDictionary"); + vcl::filter::PDFObjectElement* pTestDictionary = pTest->LookupObject("TestDictionary"_ostr); { sal_uInt64 nOffset = pTestDictionary->GetDictionaryOffset(); sal_uInt64 nLength = pTestDictionary->GetDictionaryLength(); @@ -63,8 +63,8 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseBasicPDF) OString aString(aBuffer.data()); CPPUNIT_ASSERT_EQUAL( - OString("/TestReference 7 0 R/TestNumber " - "123/TestName/SomeName/TestDictionary<</Key/Value>>/TestArray[1 2 3]"), + "/TestReference 7 0 R/TestNumber " + "123/TestName/SomeName/TestDictionary<</Key/Value>>/TestArray[1 2 3]"_ostr, aString); } @@ -73,85 +73,90 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseBasicPDF) auto const& rItems = pTestDictionary->GetDictionaryItems(); CPPUNIT_ASSERT_EQUAL(size_t(5), rItems.size()); auto* pReference = dynamic_cast<vcl::filter::PDFReferenceElement*>( - pTestDictionary->Lookup("TestReference")); + pTestDictionary->Lookup("TestReference"_ostr)); CPPUNIT_ASSERT(pReference); CPPUNIT_ASSERT_EQUAL(7, pReference->GetObjectValue()); - auto* pNumber - = dynamic_cast<vcl::filter::PDFNumberElement*>(pTestDictionary->Lookup("TestNumber")); + auto* pNumber = dynamic_cast<vcl::filter::PDFNumberElement*>( + pTestDictionary->Lookup("TestNumber"_ostr)); CPPUNIT_ASSERT(pNumber); CPPUNIT_ASSERT_EQUAL(123.0, pNumber->GetValue()); auto* pName - = dynamic_cast<vcl::filter::PDFNameElement*>(pTestDictionary->Lookup("TestName")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pTestDictionary->Lookup("TestName"_ostr)); CPPUNIT_ASSERT(pName); - CPPUNIT_ASSERT_EQUAL(OString("SomeName"), pName->GetValue()); + CPPUNIT_ASSERT_EQUAL("SomeName"_ostr, pName->GetValue()); auto* pDictionary = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pTestDictionary->Lookup("TestDictionary")); + pTestDictionary->Lookup("TestDictionary"_ostr)); CPPUNIT_ASSERT(pDictionary); - auto* pArray - = dynamic_cast<vcl::filter::PDFArrayElement*>(pTestDictionary->Lookup("TestArray")); + auto* pArray = dynamic_cast<vcl::filter::PDFArrayElement*>( + pTestDictionary->Lookup("TestArray"_ostr)); CPPUNIT_ASSERT(pArray); // Check offsets and lengths { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestReference"); + sal_uInt64 nOffset + = pTestDictionary->GetDictionary()->GetKeyOffset("TestReference"_ostr); sal_uInt64 nLength - = pTestDictionary->GetDictionary()->GetKeyValueLength("TestReference"); + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestReference"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestReference 7 0 R"), aString); + CPPUNIT_ASSERT_EQUAL("TestReference 7 0 R"_ostr, aString); } { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestNumber"); - sal_uInt64 nLength = pTestDictionary->GetDictionary()->GetKeyValueLength("TestNumber"); + sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestNumber"_ostr); + sal_uInt64 nLength + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestNumber"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestNumber 123"), aString); + CPPUNIT_ASSERT_EQUAL("TestNumber 123"_ostr, aString); } { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestName"); - sal_uInt64 nLength = pTestDictionary->GetDictionary()->GetKeyValueLength("TestName"); + sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestName"_ostr); + sal_uInt64 nLength + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestName"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestName/SomeName"), aString); + CPPUNIT_ASSERT_EQUAL("TestName/SomeName"_ostr, aString); } { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestDictionary"); + sal_uInt64 nOffset + = pTestDictionary->GetDictionary()->GetKeyOffset("TestDictionary"_ostr); sal_uInt64 nLength - = pTestDictionary->GetDictionary()->GetKeyValueLength("TestDictionary"); + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestDictionary"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestDictionary<</Key/Value>>"), aString); + CPPUNIT_ASSERT_EQUAL("TestDictionary<</Key/Value>>"_ostr, aString); } { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestArray"); - sal_uInt64 nLength = pTestDictionary->GetDictionary()->GetKeyValueLength("TestArray"); + sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestArray"_ostr); + sal_uInt64 nLength + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestArray"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestArray[1 2 3]"), aString); + CPPUNIT_ASSERT_EQUAL("TestArray[1 2 3]"_ostr, aString); } } } @@ -273,7 +278,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseDictionaryWithName) { addObjectElement(aElements, aDocument, 1, 0); addDictionaryElement(aElements); - addNameElement(aElements, "Test"); + addNameElement(aElements, "Test"_ostr); addNumberElement(aElements, 30.0); addEndDictionaryElement(aElements); addEndObjectElement(aElements); @@ -288,7 +293,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseDictionaryWithName) CPPUNIT_ASSERT(pObject->GetDictionary()); CPPUNIT_ASSERT_EQUAL(size_t(1), pObject->GetDictionary()->GetItems().size()); auto& rItems = pObject->GetDictionary()->GetItems(); - auto pNumberElement = dynamic_cast<vcl::filter::PDFNumberElement*>(rItems.at("Test")); + auto pNumberElement = dynamic_cast<vcl::filter::PDFNumberElement*>(rItems.at("Test"_ostr)); CPPUNIT_ASSERT(pNumberElement); CPPUNIT_ASSERT_DOUBLES_EQUAL(30.0, pNumberElement->GetValue(), 1e-4); } @@ -301,21 +306,21 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseDictionaryNested) addObjectElement(aElements, aDocument, 1, 0); addDictionaryElement(aElements); - addNameElement(aElements, "Nested1"); + addNameElement(aElements, "Nested1"_ostr); addDictionaryElement(aElements); { - addNameElement(aElements, "Nested2"); + addNameElement(aElements, "Nested2"_ostr); addDictionaryElement(aElements); { - addNameElement(aElements, "SomeOtherKey"); - addNameElement(aElements, "SomeOtherValue"); + addNameElement(aElements, "SomeOtherKey"_ostr); + addNameElement(aElements, "SomeOtherValue"_ostr); } addEndDictionaryElement(aElements); } addEndDictionaryElement(aElements); - addNameElement(aElements, "SomeOtherKey"); - addNameElement(aElements, "SomeOtherValue"); + addNameElement(aElements, "SomeOtherKey"_ostr); + addNameElement(aElements, "SomeOtherValue"_ostr); addEndObjectElement(aElements); } @@ -328,8 +333,8 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseDictionaryNested) CPPUNIT_ASSERT(pObject->GetDictionary()); CPPUNIT_ASSERT_EQUAL(size_t(2), pObject->GetDictionary()->GetItems().size()); - CPPUNIT_ASSERT(pObject->Lookup("Nested1")); - CPPUNIT_ASSERT(pObject->Lookup("SomeOtherKey")); + CPPUNIT_ASSERT(pObject->Lookup("Nested1"_ostr)); + CPPUNIT_ASSERT(pObject->Lookup("SomeOtherKey"_ostr)); } CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseEmptyArray) @@ -361,7 +366,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayWithSimpleElements) { auto pObjectPtr = addObjectElement(aElements, aDocument, 1, 0); addArrayElement(aElements, pObjectPtr); - addNameElement(aElements, "Test"); + addNameElement(aElements, "Test"_ostr); addNumberElement(aElements, 30.0); addEndArrayElement(aElements); addEndObjectElement(aElements); @@ -434,23 +439,23 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pObjectPtr = addObjectElement(aElements, aDocument, 1, 0); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner1"); - addNameElement(aElements, "Inner2"); + addNameElement(aElements, "Inner1"_ostr); + addNameElement(aElements, "Inner2"_ostr); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner31"); + addNameElement(aElements, "Inner31"_ostr); } addEndArrayElement(aElements); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner41"); - addNameElement(aElements, "Inner42"); + addNameElement(aElements, "Inner41"_ostr); + addNameElement(aElements, "Inner42"_ostr); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner431"); - addNameElement(aElements, "Inner432"); + addNameElement(aElements, "Inner431"_ostr); + addNameElement(aElements, "Inner432"_ostr); } addEndArrayElement(aElements); } @@ -458,10 +463,10 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner51"); + addNameElement(aElements, "Inner51"_ostr); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner521"); + addNameElement(aElements, "Inner521"_ostr); } addEndArrayElement(aElements); } @@ -485,11 +490,11 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pName1 = dynamic_cast<vcl::filter::PDFNameElement*>(pRootArray->GetElement(0)); CPPUNIT_ASSERT(pName1); - CPPUNIT_ASSERT_EQUAL(OString("Inner1"), pName1->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner1"_ostr, pName1->GetValue()); auto pName2 = dynamic_cast<vcl::filter::PDFNameElement*>(pRootArray->GetElement(1)); CPPUNIT_ASSERT(pName2); - CPPUNIT_ASSERT_EQUAL(OString("Inner2"), pName2->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner2"_ostr, pName2->GetValue()); auto pArray3 = dynamic_cast<vcl::filter::PDFArrayElement*>(pRootArray->GetElement(2)); CPPUNIT_ASSERT(pArray3); @@ -497,7 +502,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner31 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray3->GetElement(0)); CPPUNIT_ASSERT(pInner31); - CPPUNIT_ASSERT_EQUAL(OString("Inner31"), pInner31->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner31"_ostr, pInner31->GetValue()); auto pArray4 = dynamic_cast<vcl::filter::PDFArrayElement*>(pRootArray->GetElement(3)); CPPUNIT_ASSERT(pArray4); @@ -505,11 +510,11 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner41 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray4->GetElement(0)); CPPUNIT_ASSERT(pInner41); - CPPUNIT_ASSERT_EQUAL(OString("Inner41"), pInner41->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner41"_ostr, pInner41->GetValue()); auto pInner42 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray4->GetElement(1)); CPPUNIT_ASSERT(pInner42); - CPPUNIT_ASSERT_EQUAL(OString("Inner42"), pInner42->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner42"_ostr, pInner42->GetValue()); auto pArray43 = dynamic_cast<vcl::filter::PDFArrayElement*>(pArray4->GetElement(2)); CPPUNIT_ASSERT(pArray43); @@ -517,11 +522,11 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner431 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray43->GetElement(0)); CPPUNIT_ASSERT(pInner431); - CPPUNIT_ASSERT_EQUAL(OString("Inner431"), pInner431->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner431"_ostr, pInner431->GetValue()); auto pInner432 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray43->GetElement(1)); CPPUNIT_ASSERT(pInner432); - CPPUNIT_ASSERT_EQUAL(OString("Inner432"), pInner432->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner432"_ostr, pInner432->GetValue()); auto pArray5 = dynamic_cast<vcl::filter::PDFArrayElement*>(pRootArray->GetElement(4)); CPPUNIT_ASSERT(pArray5); @@ -529,7 +534,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner51 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray5->GetElement(0)); CPPUNIT_ASSERT(pInner51); - CPPUNIT_ASSERT_EQUAL(OString("Inner51"), pInner51->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner51"_ostr, pInner51->GetValue()); auto pArray52 = dynamic_cast<vcl::filter::PDFArrayElement*>(pArray5->GetElement(1)); CPPUNIT_ASSERT(pArray52); @@ -537,7 +542,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner521 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray52->GetElement(0)); CPPUNIT_ASSERT(pInner521); - CPPUNIT_ASSERT_EQUAL(OString("Inner521"), pInner521->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner521"_ostr, pInner521->GetValue()); } } @@ -549,7 +554,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseTrailer) { addTrailerObjectElement(aElements, aDocument); addDictionaryElement(aElements); - addNameElement(aElements, "Size"); + addNameElement(aElements, "Size"_ostr); addNumberElement(aElements, 11.0); addEndDictionaryElement(aElements); } @@ -573,7 +578,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseTrailerWithReference) { addTrailerObjectElement(aElements, aDocument); addDictionaryElement(aElements); - addNameElement(aElements, "Reference"); + addNameElement(aElements, "Reference"_ostr); auto pNumberElement1 = addNumberElement(aElements, 11.0); auto pNumberElement2 = addNumberElement(aElements, 0.0); addReferenceElement(aElements, aDocument, pNumberElement1, pNumberElement2); @@ -588,7 +593,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseTrailerWithReference) CPPUNIT_ASSERT(pTrailer->GetDictionary()); CPPUNIT_ASSERT_EQUAL(size_t(1), pTrailer->GetDictionary()->GetItems().size()); - auto pElement = pTrailer->Lookup("Reference"); + auto pElement = pTrailer->Lookup("Reference"_ostr); CPPUNIT_ASSERT(pElement); auto pReference = dynamic_cast<vcl::filter::PDFReferenceElement*>(pElement); CPPUNIT_ASSERT(pReference); diff --git a/vcl/qa/cppunit/PDFiumLibraryTest.cxx b/vcl/qa/cppunit/PDFiumLibraryTest.cxx index c933273bc147..966c44a3f568 100644 --- a/vcl/qa/cppunit/PDFiumLibraryTest.cxx +++ b/vcl/qa/cppunit/PDFiumLibraryTest.cxx @@ -396,7 +396,7 @@ void PDFiumLibraryTest::testAnnotationsDifferentTypes() CPPUNIT_ASSERT(pAnnotation); CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Polygon, pAnnotation->getSubType()); CPPUNIT_ASSERT_EQUAL(0, pAnnotation->getObjectCount()); - CPPUNIT_ASSERT_EQUAL(true, pAnnotation->hasKey("Vertices")); + CPPUNIT_ASSERT_EQUAL(true, pAnnotation->hasKey("Vertices"_ostr)); OUString aContentsString = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents); CPPUNIT_ASSERT_EQUAL(OUString("Polygon Text"), aContentsString); auto const& aVertices = pAnnotation->getVertices(); diff --git a/vcl/qa/cppunit/TypeSerializerTest.cxx b/vcl/qa/cppunit/TypeSerializerTest.cxx index 726843e19a03..b27f1c3c822a 100644 --- a/vcl/qa/cppunit/TypeSerializerTest.cxx +++ b/vcl/qa/cppunit/TypeSerializerTest.cxx @@ -336,7 +336,7 @@ void TypeSerializerTest::testGraphic_GDIMetaFile() char aIdCharArray[7] = { 0, 0, 0, 0, 0, 0, 0 }; aMemoryStream.ReadBytes(aIdCharArray, 6); OString sID(aIdCharArray); - CPPUNIT_ASSERT_EQUAL(OString("VCLMTF"), sID); + CPPUNIT_ASSERT_EQUAL("VCLMTF"_ostr, sID); // Read it back aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN); diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 7097c89970d3..dbe7ada758e7 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -145,7 +145,7 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testDictArrayDict) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT(!aPages.empty()); vcl::filter::PDFObjectElement* pPage = aPages[0]; - auto pKey = dynamic_cast<vcl::filter::PDFArrayElement*>(pPage->Lookup("Key")); + auto pKey = dynamic_cast<vcl::filter::PDFArrayElement*>(pPage->Lookup("Key"_ostr)); // Without the accompanying fix in place, this test would have failed, because the value of Key // was a dictionary element, not an array element. @@ -201,7 +201,7 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT(!aPages.empty()); vcl::filter::PDFObjectElement* pPage = aPages[0]; - auto pTest = dynamic_cast<vcl::filter::PDFArrayElement*>(pPage->Lookup("Test")); + auto pTest = dynamic_cast<vcl::filter::PDFArrayElement*>(pPage->Lookup("Test"_ostr)); std::vector<vcl::filter::PDFElement*> aElements = pTest->GetElements(); // Without the accompanying fix in place, this test would have failed with diff --git a/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx index a24f2d324d97..ebce81f9ab0c 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx @@ -81,10 +81,10 @@ void PictFilterTest::testDontClipTooMuch() CPPUNIT_ASSERT (pDoc); - assertXPath(pDoc, "/metafile/clipregion[5]", "top", "0"); - assertXPath(pDoc, "/metafile/clipregion[5]", "left", "0"); - assertXPath(pDoc, "/metafile/clipregion[5]", "bottom", "empty"); - assertXPath(pDoc, "/metafile/clipregion[5]", "right", "empty"); + assertXPath(pDoc, "/metafile/clipregion[5]"_ostr, "top"_ostr, "0"); + assertXPath(pDoc, "/metafile/clipregion[5]"_ostr, "left"_ostr, "0"); + assertXPath(pDoc, "/metafile/clipregion[5]"_ostr, "bottom"_ostr, "empty"); + assertXPath(pDoc, "/metafile/clipregion[5]"_ostr, "right"_ostr, "empty"); } CPPUNIT_TEST_SUITE_REGISTRATION(PictFilterTest); diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index ef317e600ca5..020d5c4c49d1 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -90,10 +90,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106059) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); // The document has one page. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); // The page has one image. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); @@ -102,7 +102,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106059) CPPUNIT_ASSERT(pReferenceXObject); // The image is a reference XObject. // This dictionary key was missing, so the XObject wasn't a reference one. - CPPUNIT_ASSERT(pReferenceXObject->Lookup("Ref")); + CPPUNIT_ASSERT(pReferenceXObject->Lookup("Ref"_ostr)); } /// Tests export of PDF images without reference XObjects. @@ -115,10 +115,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106693) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); // The document has one page. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); // The page has one image. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); @@ -126,29 +126,29 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106693) = pXObjects->LookupObject(pXObjects->GetItems().begin()->first); CPPUNIT_ASSERT(pXObject); // The image is a form XObject. - auto pSubtype = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject->Lookup("Subtype")); + auto pSubtype = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pSubtype->GetValue()); // This failed: UseReferenceXObject was ignored and Ref was always created. - CPPUNIT_ASSERT(!pXObject->Lookup("Ref")); + CPPUNIT_ASSERT(!pXObject->Lookup("Ref"_ostr)); // Assert that the form object refers to an inner form object, not a // bitmap. auto pInnerResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pInnerResources); auto pInnerXObjects = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pInnerResources->LookupElement("XObject")); + pInnerResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pInnerXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pInnerXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pInnerXObject = pInnerXObjects->LookupObject(pInnerXObjects->GetItems().begin()->first); CPPUNIT_ASSERT(pInnerXObject); auto pInnerSubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerXObject->Lookup("Subtype")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerXObject->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pInnerSubtype); // This failed: this was Image (bitmap), not Form (vector). - CPPUNIT_ASSERT_EQUAL(OString("Form"), pInnerSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pInnerSubtype->GetValue()); } /// Tests that text highlight from Impress is not lost. @@ -239,7 +239,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105093) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get page annotations. - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pAnnots->GetElements().size()); auto pAnnotReference @@ -248,23 +248,24 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105093) vcl::filter::PDFObjectElement* pAnnot = pAnnotReference->LookupObject(); CPPUNIT_ASSERT(pAnnot); CPPUNIT_ASSERT_EQUAL( - OString("Annot"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"))->GetValue()); + "Annot"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr))->GetValue()); // Get the Action -> Rendition -> MediaClip -> FileSpec. - auto pAction = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A")); + auto pAction = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAction); - auto pRendition = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAction->LookupElement("R")); + auto pRendition + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAction->LookupElement("R"_ostr)); CPPUNIT_ASSERT(pRendition); auto pMediaClip - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pRendition->LookupElement("C")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pRendition->LookupElement("C"_ostr)); CPPUNIT_ASSERT(pMediaClip); auto pFileSpec - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pMediaClip->LookupElement("D")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pMediaClip->LookupElement("D"_ostr)); CPPUNIT_ASSERT(pFileSpec); // Make sure the filespec refers to an embedded file. // This key was missing, the embedded video was handled as a linked one. - CPPUNIT_ASSERT(pFileSpec->LookupElement("EF")); + CPPUNIT_ASSERT(pFileSpec->LookupElement("EF"_ostr)); } /// Tests export of non-PDF images. @@ -279,7 +280,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106206) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // The page has a stream. - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -293,14 +294,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106206) CPPUNIT_ASSERT(aZCodec.EndCompression()); // Make sure there is an image reference there. - OString aImage("/Im"); + OString aImage("/Im"_ostr); auto pStart = static_cast<const char*>(aUncompressed.GetData()); const char* pEnd = pStart + aUncompressed.GetSize(); auto it = std::search(pStart, pEnd, aImage.getStr(), aImage.getStr() + aImage.getLength()); CPPUNIT_ASSERT(it != pEnd); // And also that it's not an invalid one. - OString aInvalidImage("/Im0"); + OString aInvalidImage("/Im0"_ostr); it = std::search(pStart, pEnd, aInvalidImage.getStr(), aInvalidImage.getStr() + aInvalidImage.getLength()); // This failed, object #0 was referenced. @@ -326,7 +327,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf127217) std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnot = pPdfPage->getAnnotation(0); // Without the fix in place, this test would have failed here - CPPUNIT_ASSERT(!pAnnot->hasKey("DA")); + CPPUNIT_ASSERT(!pAnnot->hasKey("DA"_ostr)); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf109143) @@ -340,10 +341,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf109143) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get access to the only image on the only page. - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -351,7 +352,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf109143) CPPUNIT_ASSERT(pXObject); // Make sure it's re-compressed. - auto pLength = dynamic_cast<vcl::filter::PDFNumberElement*>(pXObject->Lookup("Length")); + auto pLength = dynamic_cast<vcl::filter::PDFNumberElement*>(pXObject->Lookup("Length"_ostr)); CPPUNIT_ASSERT(pLength); int nLength = pLength->GetValue(); // This failed: cropped TIFF-in-JPEG wasn't re-compressed, so crop was @@ -368,10 +369,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972) // Get access to the only form object on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -380,10 +381,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972) // Get access to the only image inside the form object. auto pFormResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pFormResources); auto pImages = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pFormResources->LookupElement("XObject")); + pFormResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pImages); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pImages->GetItems().size()); vcl::filter::PDFObjectElement* pImage @@ -392,10 +393,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972) // Assert resources of the image. auto pImageResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pImage->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pImage->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pImageResources); // This failed: the PDF image had no Font resource. - CPPUNIT_ASSERT(pImageResources->LookupElement("Font")); + CPPUNIT_ASSERT(pImageResources->LookupElement("Font"_ostr)); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972Pdf17) @@ -407,10 +408,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972Pdf17) // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -419,7 +420,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972Pdf17) // Assert that we now attempt to preserve the original PDF data, even if // the original input was PDF >= 1.4. - CPPUNIT_ASSERT(pXObject->Lookup("Resources")); + CPPUNIT_ASSERT(pXObject->Lookup("Resources"_ostr)); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testSofthyphenPos) @@ -477,10 +478,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107013) // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -497,10 +498,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018) // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -509,10 +510,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018) // Get access to the form object inside the image. auto pXObjectResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pXObjectResources); auto pXObjectForms = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pXObjectResources->LookupElement("XObject")); + pXObjectResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pXObjectForms); vcl::filter::PDFObjectElement* pForm = pXObjectForms->LookupObject(pXObjectForms->GetItems().begin()->first); @@ -520,28 +521,29 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018) // Get access to Resources -> Font -> F1 of the form. auto pFormResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pForm->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pForm->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pFormResources); - auto pFonts - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pFormResources->LookupElement("Font")); + auto pFonts = dynamic_cast<vcl::filter::PDFDictionaryElement*>( + pFormResources->LookupElement("Font"_ostr)); CPPUNIT_ASSERT(pFonts); - auto pF1Ref = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFonts->LookupElement("F1")); + auto pF1Ref = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFonts->LookupElement("F1"_ostr)); CPPUNIT_ASSERT(pF1Ref); vcl::filter::PDFObjectElement* pF1 = pF1Ref->LookupObject(); CPPUNIT_ASSERT(pF1); // Check that Foo -> Bar of the font is of type Pages. - auto pFontFoo = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pF1->Lookup("Foo")); + auto pFontFoo = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pF1->Lookup("Foo"_ostr)); CPPUNIT_ASSERT(pFontFoo); - auto pBar = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFontFoo->LookupElement("Bar")); + auto pBar + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFontFoo->LookupElement("Bar"_ostr)); CPPUNIT_ASSERT(pBar); vcl::filter::PDFObjectElement* pObject = pBar->LookupObject(); CPPUNIT_ASSERT(pObject); - auto pName = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pName = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); CPPUNIT_ASSERT(pName); // This was "XObject", reference in a nested dictionary wasn't updated when // copying the page stream of a PDF image. - CPPUNIT_ASSERT_EQUAL(OString("Pages"), pName->GetValue()); + CPPUNIT_ASSERT_EQUAL("Pages"_ostr, pName->GetValue()); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148706) @@ -562,18 +564,18 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148706) CPPUNIT_ASSERT_EQUAL(1, pPdfPage->getAnnotationCount()); std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnot = pPdfPage->getAnnotation(0); - CPPUNIT_ASSERT(pAnnot->hasKey("V")); - CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("V")); - OUString aV = pAnnot->getString("V"); + CPPUNIT_ASSERT(pAnnot->hasKey("V"_ostr)); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("V"_ostr)); + OUString aV = pAnnot->getString("V"_ostr); // Without the fix in place, this test would have failed with // - Expected: 1821.84 // - Actual : CPPUNIT_ASSERT_EQUAL(OUString("1821.84"), aV); - CPPUNIT_ASSERT(pAnnot->hasKey("DV")); - CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("DV")); - OUString aDV = pAnnot->getString("DV"); + CPPUNIT_ASSERT(pAnnot->hasKey("DV"_ostr)); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("DV"_ostr)); + OUString aDV = pAnnot->getString("DV"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("1821.84"), aDV); } @@ -586,10 +588,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089) // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -598,10 +600,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089) // Get access to the form object inside the image. auto pXObjectResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pXObjectResources); auto pXObjectForms = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pXObjectResources->LookupElement("XObject")); + pXObjectResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pXObjectForms); vcl::filter::PDFObjectElement* pForm = pXObjectForms->LookupObject(pXObjectForms->GetItems().begin()->first); @@ -617,7 +619,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089) aZCodec.Decompress(pStream->GetMemory(), aObjectStream); CPPUNIT_ASSERT(aZCodec.EndCompression()); aObjectStream.Seek(0); - OString aHello("Hello"); + OString aHello("Hello"_ostr); auto pStart = static_cast<const char*>(aObjectStream.GetData()); const char* pEnd = pStart + aObjectStream.GetSize(); auto it = std::search(pStart, pEnd, aHello.getStr(), aHello.getStr() + aHello.getLength()); @@ -635,7 +637,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // The page 1 has a stream. - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -677,7 +679,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680_2) for (size_t nPageNr = 0; nPageNr < aPages.size(); nPageNr++) { // Get page contents and stream. - vcl::filter::PDFObjectElement* pContents = aPages[nPageNr]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[nPageNr]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -810,16 +812,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testAlternativeText) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S")); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S"_ostr)); if (pS && pS->GetValue() == "Figure") { - CPPUNIT_ASSERT_EQUAL( - u"This is the text alternative - This is the description"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast<vcl::filter::PDFHexStringElement*>(pObject->Lookup("Alt")))); + CPPUNIT_ASSERT_EQUAL(u"This is the text alternative - This is the description"_ustr, + ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( + *dynamic_cast<vcl::filter::PDFHexStringElement*>( + pObject->Lookup("Alt"_ostr)))); } } } @@ -830,9 +832,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testAlternativeText) auto* pCatalogDictionary = pCatalog->GetDictionary(); CPPUNIT_ASSERT(pCatalogDictionary); auto pLang = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( - pCatalogDictionary->LookupElement("Lang")); + pCatalogDictionary->LookupElement("Lang"_ostr)); CPPUNIT_ASSERT(pLang); - CPPUNIT_ASSERT_EQUAL(OString("en-US"), pLang->GetValue()); + CPPUNIT_ASSERT_EQUAL("en-US"_ostr, pLang->GetValue()); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) @@ -845,7 +847,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pAnnots->GetElements().size()); @@ -855,47 +857,46 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT"_ostr)); if (pType && pType->GetValue() == "Tx") { ++nTextFieldCount; - auto pT = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pObject->Lookup("T")); + auto pT + = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pObject->Lookup("T"_ostr)); CPPUNIT_ASSERT(pT); - auto pAA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("AA")); + auto pAA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("AA"_ostr)); CPPUNIT_ASSERT(pAA); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pAA->GetItems().size()); - auto pF = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAA->LookupElement("F")); + auto pF + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAA->LookupElement("F"_ostr)); CPPUNIT_ASSERT(pF); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pF->GetItems().size()); if (nTextFieldCount == 1) { - CPPUNIT_ASSERT_EQUAL(OString("CurrencyField"), pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("CurrencyField"_ostr, pT->GetValue()); - auto pJS - = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pF->LookupElement("JS")); - CPPUNIT_ASSERT_EQUAL( - OString("AFNumber_Format\\(4, 0, 0, 0, \"\\\\u20ac\",true\\);"), - pJS->GetValue()); + auto pJS = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( + pF->LookupElement("JS"_ostr)); + CPPUNIT_ASSERT_EQUAL("AFNumber_Format\\(4, 0, 0, 0, \"\\\\u20ac\",true\\);"_ostr, + pJS->GetValue()); } else if (nTextFieldCount == 2) { - CPPUNIT_ASSERT_EQUAL(OString("TimeField"), pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("TimeField"_ostr, pT->GetValue()); - auto pJS - = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pF->LookupElement("JS")); - CPPUNIT_ASSERT_EQUAL(OString("AFTime_FormatEx\\(\"h:MM:sstt\"\\);"), - pJS->GetValue()); + auto pJS = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( + pF->LookupElement("JS"_ostr)); + CPPUNIT_ASSERT_EQUAL("AFTime_FormatEx\\(\"h:MM:sstt\"\\);"_ostr, pJS->GetValue()); } else { - CPPUNIT_ASSERT_EQUAL(OString("DateField"), pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("DateField"_ostr, pT->GetValue()); - auto pJS - = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pF->LookupElement("JS")); - CPPUNIT_ASSERT_EQUAL(OString("AFDate_FormatEx\\(\"yy-mm-dd\"\\);"), - pJS->GetValue()); + auto pJS = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( + pF->LookupElement("JS"_ostr)); + CPPUNIT_ASSERT_EQUAL("AFDate_FormatEx\\(\"yy-mm-dd\"\\);"_ostr, pJS->GetValue()); } } } @@ -911,7 +912,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148442) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pAnnots->GetElements().size()); @@ -921,49 +922,51 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148442) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT"_ostr)); if (pType && pType->GetValue() == "Btn") { ++nBtnCount; - auto pT = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pObject->Lookup("T")); + auto pT + = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pObject->Lookup("T"_ostr)); CPPUNIT_ASSERT(pT); - auto pAS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("AS")); + auto pAS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("AS"_ostr)); CPPUNIT_ASSERT(pAS); - auto pAP = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("AP")); + auto pAP = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("AP"_ostr)); CPPUNIT_ASSERT(pAP); - auto pN = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAP->LookupElement("N")); + auto pN + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAP->LookupElement("N"_ostr)); CPPUNIT_ASSERT(pN); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pN->GetItems().size()); if (nBtnCount == 1) { - CPPUNIT_ASSERT_EQUAL(OString("Checkbox1"), pT->GetValue()); - CPPUNIT_ASSERT_EQUAL(OString("Yes"), pAS->GetValue()); - CPPUNIT_ASSERT(!pN->GetItems().count("ref")); - CPPUNIT_ASSERT(pN->GetItems().count("Yes")); - CPPUNIT_ASSERT(pN->GetItems().count("Off")); + CPPUNIT_ASSERT_EQUAL("Checkbox1"_ostr, pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("Yes"_ostr, pAS->GetValue()); + CPPUNIT_ASSERT(!pN->GetItems().count("ref"_ostr)); + CPPUNIT_ASSERT(pN->GetItems().count("Yes"_ostr)); + CPPUNIT_ASSERT(pN->GetItems().count("Off"_ostr)); } else if (nBtnCount == 2) { - CPPUNIT_ASSERT_EQUAL(OString("Checkbox2"), pT->GetValue()); - CPPUNIT_ASSERT_EQUAL(OString("Yes"), pAS->GetValue()); + CPPUNIT_ASSERT_EQUAL("Checkbox2"_ostr, pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("Yes"_ostr, pAS->GetValue()); // Without the fix in place, this test would have failed here - CPPUNIT_ASSERT(pN->GetItems().count("ref")); - CPPUNIT_ASSERT(!pN->GetItems().count("Yes")); - CPPUNIT_ASSERT(pN->GetItems().count("Off")); + CPPUNIT_ASSERT(pN->GetItems().count("ref"_ostr)); + CPPUNIT_ASSERT(!pN->GetItems().count("Yes"_ostr)); + CPPUNIT_ASSERT(pN->GetItems().count("Off"_ostr)); } else { - CPPUNIT_ASSERT_EQUAL(OString("Checkbox3"), pT->GetValue()); - CPPUNIT_ASSERT_EQUAL(OString("Off"), pAS->GetValue()); - CPPUNIT_ASSERT(pN->GetItems().count("ref")); - CPPUNIT_ASSERT(!pN->GetItems().count("Yes")); + CPPUNIT_ASSERT_EQUAL("Checkbox3"_ostr, pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("Off"_ostr, pAS->GetValue()); + CPPUNIT_ASSERT(pN->GetItems().count("ref"_ostr)); + CPPUNIT_ASSERT(!pN->GetItems().count("Yes"_ostr)); // tdf#143612: Without the fix in place, this test would have failed here - CPPUNIT_ASSERT(!pN->GetItems().count("Off")); - CPPUNIT_ASSERT(pN->GetItems().count("refOff")); + CPPUNIT_ASSERT(!pN->GetItems().count("Off"_ostr)); + CPPUNIT_ASSERT(pN->GetItems().count("refOff"_ostr)); } } } @@ -980,7 +983,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf118244_radioButtonGroup) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // There are eight radio buttons. - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL_MESSAGE("# of radio buttons", static_cast<size_t>(8), pAnnots->GetElements().size()); @@ -991,10 +994,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf118244_radioButtonGroup) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT"_ostr)); if (pType && pType->GetValue() == "Btn") { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject->Lookup("Kids")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject->Lookup("Kids"_ostr)); if (pKids) { size_t expectedSize = 2; @@ -1025,11 +1028,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_1) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1065,7 +1068,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_1) "<07> <0066006C>\n" "<08> <006600660069>\n" "<09> <00660066006C>\n" - "endbfchar"); + "endbfchar"_ostr); auto pStart = static_cast<const char*>(aObjectStream.GetData()); const char* pEnd = pStart + aObjectStream.GetSize(); auto it = std::search(pStart, pEnd, aCmap.getStr(), aCmap.getStr() + aCmap.getLength()); @@ -1091,11 +1094,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1120,7 +1123,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2) "<05> <0648>\n" "<06> <06440627>\n" "<07> <0628>\n" - "endbfchar"); + "endbfchar"_ostr); auto pStart = static_cast<const char*>(aObjectStream.GetData()); const char* pEnd = pStart + aObjectStream.GetSize(); auto it = std::search(pStart, pEnd, aCmap.getStr(), aCmap.getStr() + aCmap.getLength()); @@ -1389,17 +1392,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { auto pName - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont"_ostr)); auto aName = pName->GetValue().copy(7); // skip the subset id - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", OString("Amiri-Regular"), - aName); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", "Amiri-Regular"_ostr, aName); - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1434,7 +1436,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1) auto aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get page contents and stream. - auto pContents = aPages[0]->LookupObject("Contents"); + auto pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); auto pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1486,17 +1488,17 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { auto pName - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont"_ostr)); auto aName = pName->GetValue().copy(7); // skip the subset id - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", OString("ReemKufi-Regular"), + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", "ReemKufi-Regular"_ostr, aName); - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1533,7 +1535,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2) auto aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get page contents and stream. - auto pContents = aPages[0]->LookupObject("Contents"); + auto pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); auto pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1589,17 +1591,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_3) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { auto pName - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont"_ostr)); auto aName = pName->GetValue().copy(7); // skip the subset id - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", OString("GentiumBasic"), - aName); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", "GentiumBasic"_ostr, aName); - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1630,7 +1631,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_3) auto aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get page contents and stream. - auto pContents = aPages[0]->LookupObject("Contents"); + auto pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); auto pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1879,7 +1880,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf113143) // The following check used to fail in the past, header was "%PDF-1.5": maMemory.Seek(0); - OString aExpectedHeader("%PDF-1.6"); + OString aExpectedHeader("%PDF-1.6"_ostr); OString aHeader(read_uInt8s_ToOString(maMemory, aExpectedHeader.getLength())); CPPUNIT_ASSERT_EQUAL(aExpectedHeader, aHeader); } @@ -2014,10 +2015,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "Document") { pDocument = pObject1; @@ -2026,7 +2027,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) } CPPUNIT_ASSERT(pDocument); - auto pKidsD = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K")); + auto pKidsD = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD); // assume there are no MCID ref at this level auto pKidsDv = pKidsD->GetElements(); @@ -2034,12 +2035,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD2); auto pObjectD2 = pRefKidD2->LookupObject(); CPPUNIT_ASSERT(pObjectD2); - auto pTypeD2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD2->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD2->GetValue()); - auto pSD2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD2->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Text#20body"), pSD2->GetValue()); + auto pTypeD2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD2->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD2->GetValue()); + auto pSD2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD2->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Text#20body"_ostr, pSD2->GetValue()); - auto pKidsD2 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD2->Lookup("K")); + auto pKidsD2 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD2->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD2); auto pKidsD2v = pKidsD2->GetElements(); auto pRefKidD20 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKidsD2v[0]); @@ -2053,12 +2054,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD22); auto pObjectD22 = pRefKidD22->LookupObject(); CPPUNIT_ASSERT(pObjectD22); - auto pTypeD22 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD22->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD22->GetValue()); - auto pSD22 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD22->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD22->GetValue()); + auto pTypeD22 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD22->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD22->GetValue()); + auto pSD22 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD22->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD22->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD22->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD22->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2073,25 +2074,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2118,12 +2121,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD23); auto pObjectD23 = pRefKidD23->LookupObject(); CPPUNIT_ASSERT(pObjectD23); - auto pTypeD23 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD23->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD23->GetValue()); - auto pSD23 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD23->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD23->GetValue()); + auto pTypeD23 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD23->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD23->GetValue()); + auto pSD23 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD23->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD23->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD23->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD23->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2138,25 +2141,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2182,12 +2187,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD24); auto pObjectD24 = pRefKidD24->LookupObject(); CPPUNIT_ASSERT(pObjectD24); - auto pTypeD24 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD24->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD24->GetValue()); - auto pSD24 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD24->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD24->GetValue()); + auto pTypeD24 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD24->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD24->GetValue()); + auto pSD24 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD24->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD24->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD24->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD24->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2202,25 +2207,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2246,12 +2253,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD25); auto pObjectD25 = pRefKidD25->LookupObject(); CPPUNIT_ASSERT(pObjectD25); - auto pTypeD25 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD25->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD25->GetValue()); - auto pSD25 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD25->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD25->GetValue()); + auto pTypeD25 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD25->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD25->GetValue()); + auto pSD25 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD25->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD25->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD25->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD25->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2266,25 +2273,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2310,12 +2319,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD26); auto pObjectD26 = pRefKidD26->LookupObject(); CPPUNIT_ASSERT(pObjectD26); - auto pTypeD26 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD26->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD26->GetValue()); - auto pSD26 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD26->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD26->GetValue()); + auto pTypeD26 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD26->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD26->GetValue()); + auto pSD26 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD26->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD26->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD26->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD26->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2330,25 +2339,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2375,7 +2386,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(!pRefKidD27); // the problem was that in addition to the 5 links with SE there were 3 more - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), pAnnots->GetElements().size()); } @@ -2404,10 +2415,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "Document") { pDocument = pObject1; @@ -2416,7 +2427,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) } CPPUNIT_ASSERT(pDocument); - auto pKidsD = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K")); + auto pKidsD = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD); // assume there are no MCID ref at this level auto pKidsDv = pKidsD->GetElements(); @@ -2424,12 +2435,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) CPPUNIT_ASSERT(pRefKidD0); auto pObjectD0 = pRefKidD0->LookupObject(); CPPUNIT_ASSERT(pObjectD0); - auto pTypeD0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD0->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD0->GetValue()); - auto pSD0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD0->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pSD0->GetValue()); + auto pTypeD0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD0->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD0->GetValue()); + auto pSD0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD0->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pSD0->GetValue()); - auto pKidsD0 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD0->Lookup("K")); + auto pKidsD0 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD0->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD0); auto pKidsD0v = pKidsD0->GetElements(); @@ -2437,12 +2448,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) CPPUNIT_ASSERT(pRefKidD00); auto pObjectD00 = pRefKidD00->LookupObject(); CPPUNIT_ASSERT(pObjectD00); - auto pTypeD00 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD00->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD00->GetValue()); - auto pSD00 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD00->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD00->GetValue()); + auto pTypeD00 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD00->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD00->GetValue()); + auto pSD00 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD00->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD00->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD00->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD00->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2457,25 +2468,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"https://www.mozilla.org/en-US/firefox/119.0/releasenotes/"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2502,12 +2515,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) CPPUNIT_ASSERT(pRefKidD01); auto pObjectD01 = pRefKidD01->LookupObject(); CPPUNIT_ASSERT(pObjectD01); - auto pTypeD01 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD01->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD01->GetValue()); - auto pSD01 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD01->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD01->GetValue()); + auto pTypeD01 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD01->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD01->GetValue()); + auto pSD01 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD01->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD01->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD01->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD01->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2522,25 +2535,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"https://www.mozilla.org/en-US/firefox/119.0/releasenotes/"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2567,21 +2582,21 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) CPPUNIT_ASSERT(pRefKidD02); auto pObjectD02 = pRefKidD02->LookupObject(); CPPUNIT_ASSERT(pObjectD02); - auto pTypeD02 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD02->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD02->GetValue()); - auto pSD02 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD02->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Figure"), pSD02->GetValue()); + auto pTypeD02 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD02->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD02->GetValue()); + auto pSD02 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD02->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Figure"_ostr, pSD02->GetValue()); auto pRefKidD1 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKidsDv[1]); CPPUNIT_ASSERT(pRefKidD1); auto pObjectD1 = pRefKidD1->LookupObject(); CPPUNIT_ASSERT(pObjectD1); - auto pTypeD1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD1->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD1->GetValue()); - auto pSD1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD1->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pSD1->GetValue()); + auto pTypeD1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD1->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD1->GetValue()); + auto pSD1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD1->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pSD1->GetValue()); - auto pKidsD1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD1->Lookup("K")); + auto pKidsD1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD1->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD1); auto pKidsD1v = pKidsD1->GetElements(); @@ -2589,12 +2604,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) CPPUNIT_ASSERT(pRefKidD10); auto pObjectD10 = pRefKidD10->LookupObject(); CPPUNIT_ASSERT(pObjectD10); - auto pTypeD10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD10->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD10->GetValue()); - auto pSD10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD10->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD10->GetValue()); + auto pTypeD10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD10->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD10->GetValue()); + auto pSD10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD10->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD10->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD10->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD10->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2609,25 +2624,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"https://www.mozilla.org/en-US/firefox/118.0/releasenotes/"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2654,12 +2671,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) CPPUNIT_ASSERT(pRefKidD11); auto pObjectD11 = pRefKidD11->LookupObject(); CPPUNIT_ASSERT(pObjectD11); - auto pTypeD11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD11->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD11->GetValue()); - auto pSD11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD11->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD11->GetValue()); + auto pTypeD11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD11->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD11->GetValue()); + auto pSD11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD11->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD11->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD11->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD11->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2674,25 +2691,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"https://www.mozilla.org/en-US/firefox/118.0/releasenotes/"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2716,7 +2735,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816Link) } // the problem was that in addition to the 4 links with SE there was 1 more - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), pAnnots->GetElements().size()); } diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index f7f2557f0594..8abb9dbe0fc6 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -96,7 +96,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf124272) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // The page has a stream. - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -111,7 +111,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf124272) OString aBitmap("Q q 299.899 782.189 m\n" "55.2 435.889 l 299.899 435.889 l 299.899 782.189 l\n" - "h"); + "h"_ostr); auto pStart = static_cast<const char*>(aUncompressed.GetData()); const char* pEnd = pStart + aUncompressed.GetSize(); @@ -129,10 +129,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf121615) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get access to the only image on the only page. - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -177,10 +177,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf141171) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get access to the only image on the only page. - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -232,10 +232,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf129085) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get access to the only image on the only page. - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); // Without the fix in place, this test would have failed here CPPUNIT_ASSERT(pXObjects); @@ -695,11 +695,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), @@ -717,17 +717,18 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF) { // embedded PDF page 1 vcl::filter::PDFObjectElement* pXObject1 = pXObjects->LookupObject(rIDs[0]); CPPUNIT_ASSERT(pXObject1); - CPPUNIT_ASSERT_EQUAL(OString("Im21"), rIDs[0]); + CPPUNIT_ASSERT_EQUAL("Im21"_ostr, rIDs[0]); - auto pSubtype1 = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject1->Lookup("Subtype")); + auto pSubtype1 + = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject1->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pSubtype1); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pSubtype1->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pSubtype1->GetValue()); auto pXObjectResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject1->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject1->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pXObjectResources); auto pXObjectForms = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pXObjectResources->LookupElement("XObject")); + pXObjectResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pXObjectForms); vcl::filter::PDFObjectElement* pForm = pXObjectForms->LookupObject(pXObjectForms->GetItems().begin()->first); @@ -745,17 +746,18 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF) { // embedded PDF page 2 vcl::filter::PDFObjectElement* pXObject2 = pXObjects->LookupObject(rIDs[1]); CPPUNIT_ASSERT(pXObject2); - CPPUNIT_ASSERT_EQUAL(OString("Im27"), rIDs[1]); + CPPUNIT_ASSERT_EQUAL("Im27"_ostr, rIDs[1]); - auto pSubtype2 = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject2->Lookup("Subtype")); + auto pSubtype2 + = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject2->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pSubtype2); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pSubtype2->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pSubtype2->GetValue()); auto pXObjectResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject2->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject2->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pXObjectResources); auto pXObjectForms = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pXObjectResources->LookupElement("XObject")); + pXObjectResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pXObjectForms); vcl::filter::PDFObjectElement* pForm = pXObjectForms->LookupObject(pXObjectForms->GetItems().begin()->first); @@ -773,17 +775,18 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMultiPagePDF) { // embedded PDF page 3 vcl::filter::PDFObjectElement* pXObject3 = pXObjects->LookupObject(rIDs[2]); CPPUNIT_ASSERT(pXObject3); - CPPUNIT_ASSERT_EQUAL(OString("Im5"), rIDs[2]); + CPPUNIT_ASSERT_EQUAL("Im5"_ostr, rIDs[2]); - auto pSubtype3 = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject3->Lookup("Subtype")); + auto pSubtype3 + = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject3->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pSubtype3); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pSubtype3->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pSubtype3->GetValue()); auto pXObjectResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject3->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject3->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pXObjectResources); auto pXObjectForms = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pXObjectResources->LookupElement("XObject")); + pXObjectResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pXObjectForms); vcl::filter::PDFObjectElement* pForm = pXObjectForms->LookupObject(pXObjectForms->GetItems().begin()->first); @@ -819,9 +822,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormFontName) std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnot = pPdfPage->getAnnotation(0); // Examine the default appearance. - CPPUNIT_ASSERT(pAnnot->hasKey("DA")); - CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("DA")); - OUString aDA = pAnnot->getString("DA"); + CPPUNIT_ASSERT(pAnnot->hasKey("DA"_ostr)); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("DA"_ostr)); + OUString aDA = pAnnot->getString("DA"_ostr); // Without the accompanying fix in place, this test would have failed with: // - Expected: 0 0 0 rg /TiRo 12 Tf @@ -861,11 +864,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReexportPDF) // PAGE 1 { - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); std::vector<OString> rIDs; @@ -880,38 +883,39 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReexportPDF) { // FORM object 1 OString aID = rIDs[0]; - CPPUNIT_ASSERT_EQUAL(OString("Im14"), aID); + CPPUNIT_ASSERT_EQUAL("Im14"_ostr, aID); vcl::filter::PDFObjectElement* pXObject = pXObjects->LookupObject(aID); CPPUNIT_ASSERT(pXObject); - auto pSubtype = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject->Lookup("Subtype")); + auto pSubtype + = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pSubtype->GetValue()); - auto pInnerResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + auto pInnerResources = dynamic_cast<vcl::filter::PDFDictionaryElement*>( + pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pInnerResources); auto pInnerXObjects = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pInnerResources->LookupElement("XObject")); + pInnerResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pInnerXObjects); CPPUNIT_ASSERT_EQUAL(size_t(1), pInnerXObjects->GetItems().size()); OString aInnerObjectID = pInnerXObjects->GetItems().begin()->first; - CPPUNIT_ASSERT_EQUAL(OString("Im15"), aInnerObjectID); + CPPUNIT_ASSERT_EQUAL("Im15"_ostr, aInnerObjectID); vcl::filter::PDFObjectElement* pInnerXObject = pInnerXObjects->LookupObject(aInnerObjectID); CPPUNIT_ASSERT(pInnerXObject); auto pInnerSubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerXObject->Lookup("Subtype")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerXObject->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pInnerSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pInnerSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pInnerSubtype->GetValue()); auto pInnerInnerResources = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pInnerXObject->Lookup("Resources")); + pInnerXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pInnerInnerResources); auto pInnerInnerXObjects = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pInnerInnerResources->LookupElement("XObject")); + pInnerInnerResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pInnerInnerXObjects); CPPUNIT_ASSERT_EQUAL(size_t(2), pInnerInnerXObjects->GetItems().size()); @@ -920,7 +924,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReexportPDF) aBitmapIDs1.push_back(rPair.first); { - CPPUNIT_ASSERT_EQUAL(OString("Im11"), aBitmapIDs1[0]); + CPPUNIT_ASSERT_EQUAL("Im11"_ostr, aBitmapIDs1[0]); auto pRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( pInnerInnerXObjects->LookupElement(aBitmapIDs1[0])); CPPUNIT_ASSERT(pRef); @@ -931,12 +935,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReexportPDF) = pInnerInnerXObjects->LookupObject(aBitmapIDs1[0]); CPPUNIT_ASSERT(pBitmap); auto pBitmapSubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pBitmap->Lookup("Subtype")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pBitmap->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pBitmapSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Image"), pBitmapSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Image"_ostr, pBitmapSubtype->GetValue()); } { - CPPUNIT_ASSERT_EQUAL(OString("Im5"), aBitmapIDs1[1]); + CPPUNIT_ASSERT_EQUAL("Im5"_ostr, aBitmapIDs1[1]); auto pRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( pInnerInnerXObjects->LookupElement(aBitmapIDs1[1])); CPPUNIT_ASSERT(pRef); @@ -947,47 +951,48 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReexportPDF) = pInnerInnerXObjects->LookupObject(aBitmapIDs1[1]); CPPUNIT_ASSERT(pBitmap); auto pBitmapSubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pBitmap->Lookup("Subtype")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pBitmap->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pBitmapSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Image"), pBitmapSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Image"_ostr, pBitmapSubtype->GetValue()); } } { // FORM object 2 OString aID = rIDs[1]; - CPPUNIT_ASSERT_EQUAL(OString("Im5"), aID); + CPPUNIT_ASSERT_EQUAL("Im5"_ostr, aID); vcl::filter::PDFObjectElement* pXObject = pXObjects->LookupObject(aID); CPPUNIT_ASSERT(pXObject); - auto pSubtype = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject->Lookup("Subtype")); + auto pSubtype + = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pSubtype->GetValue()); - auto pInnerResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + auto pInnerResources = dynamic_cast<vcl::filter::PDFDictionaryElement*>( + pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pInnerResources); auto pInnerXObjects = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pInnerResources->LookupElement("XObject")); + pInnerResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pInnerXObjects); CPPUNIT_ASSERT_EQUAL(size_t(1), pInnerXObjects->GetItems().size()); OString aInnerObjectID = pInnerXObjects->GetItems().begin()->first; - CPPUNIT_ASSERT_EQUAL(OString("Im6"), aInnerObjectID); + CPPUNIT_ASSERT_EQUAL("Im6"_ostr, aInnerObjectID); vcl::filter::PDFObjectElement* pInnerXObject = pInnerXObjects->LookupObject(aInnerObjectID); CPPUNIT_ASSERT(pInnerXObject); auto pInnerSubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerXObject->Lookup("Subtype")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerXObject->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pInnerSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pInnerSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pInnerSubtype->GetValue()); auto pInnerInnerResources = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pInnerXObject->Lookup("Resources")); + pInnerXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pInnerInnerResources); auto pInnerInnerXObjects = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pInnerInnerResources->LookupElement("XObject")); + pInnerInnerResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pInnerInnerXObjects); CPPUNIT_ASSERT_EQUAL(size_t(2), pInnerInnerXObjects->GetItems().size()); @@ -996,7 +1001,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReexportPDF) aBitmapIDs2.push_back(rPair.first); { - CPPUNIT_ASSERT_EQUAL(OString("Im11"), aBitmapIDs2[0]); + CPPUNIT_ASSERT_EQUAL("Im11"_ostr, aBitmapIDs2[0]); auto pRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( pInnerInnerXObjects->LookupElement(aBitmapIDs2[0])); CPPUNIT_ASSERT(pRef); @@ -1007,12 +1012,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReexportPDF) = pInnerInnerXObjects->LookupObject(aBitmapIDs2[0]); CPPUNIT_ASSERT(pBitmap); auto pBitmapSubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pBitmap->Lookup("Subtype")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pBitmap->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pBitmapSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Image"), pBitmapSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Image"_ostr, pBitmapSubtype->GetValue()); } { - CPPUNIT_ASSERT_EQUAL(OString("Im5"), aBitmapIDs2[1]); + CPPUNIT_ASSERT_EQUAL("Im5"_ostr, aBitmapIDs2[1]); auto pRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( pInnerInnerXObjects->LookupElement(aBitmapIDs2[1])); CPPUNIT_ASSERT(pRef); @@ -1023,9 +1028,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReexportPDF) = pInnerInnerXObjects->LookupObject(aBitmapIDs2[1]); CPPUNIT_ASSERT(pBitmap); auto pBitmapSubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pBitmap->Lookup("Subtype")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pBitmap->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pBitmapSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Image"), pBitmapSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Image"_ostr, pBitmapSubtype->GetValue()); } } // Ref should point to the same bitmap @@ -1067,20 +1072,20 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testReexportDocumentWithComplexResources) CPPUNIT_ASSERT(pFont); // Check it is the Font object (Type = Font) - auto pName - = dynamic_cast<vcl::filter::PDFNameElement*>(pFont->GetDictionary()->LookupElement("Type")); + auto pName = dynamic_cast<vcl::filter::PDFNameElement*>( + pFont->GetDictionary()->LookupElement("Type"_ostr)); CPPUNIT_ASSERT(pName); - CPPUNIT_ASSERT_EQUAL(OString("Font"), pName->GetValue()); + CPPUNIT_ASSERT_EQUAL("Font"_ostr, pName->GetValue()); // Check BaseFont is what we expect auto pBaseFont = dynamic_cast<vcl::filter::PDFNameElement*>( - pFont->GetDictionary()->LookupElement("BaseFont")); + pFont->GetDictionary()->LookupElement("BaseFont"_ostr)); CPPUNIT_ASSERT(pBaseFont); - CPPUNIT_ASSERT_EQUAL(OString("HOTOMR+Calibri,Italic"), pBaseFont->GetValue()); + CPPUNIT_ASSERT_EQUAL("HOTOMR+Calibri,Italic"_ostr, pBaseFont->GetValue()); // Check and get the W array - auto pWArray - = dynamic_cast<vcl::filter::PDFArrayElement*>(pFont->GetDictionary()->LookupElement("W")); + auto pWArray = dynamic_cast<vcl::filter::PDFArrayElement*>( + pFont->GetDictionary()->LookupElement("W"_ostr)); CPPUNIT_ASSERT(pWArray); CPPUNIT_ASSERT_EQUAL(size_t(26), pWArray->GetElements().size()); @@ -1151,13 +1156,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfUaMetadata) CPPUNIT_ASSERT(pCatalog); auto* pCatalogDictionary = pCatalog->GetDictionary(); CPPUNIT_ASSERT(pCatalogDictionary); - auto* pMetadataObject = pCatalogDictionary->LookupObject("Metadata"); + auto* pMetadataObject = pCatalogDictionary->LookupObject("Metadata"_ostr); CPPUNIT_ASSERT(pMetadataObject); auto* pMetadataDictionary = pMetadataObject->GetDictionary(); - auto* pType - = dynamic_cast<vcl::filter::PDFNameElement*>(pMetadataDictionary->LookupElement("Type")); + auto* pType = dynamic_cast<vcl::filter::PDFNameElement*>( + pMetadataDictionary->LookupElement("Type"_ostr)); CPPUNIT_ASSERT(pType); - CPPUNIT_ASSERT_EQUAL(OString("Metadata"), pType->GetValue()); + CPPUNIT_ASSERT_EQUAL("Metadata"_ostr, pType->GetValue()); auto* pStreamObject = pMetadataObject->GetStream(); CPPUNIT_ASSERT(pStreamObject); @@ -1168,7 +1173,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfUaMetadata) tools::XmlWalker aWalker; CPPUNIT_ASSERT(aWalker.open(&rStream)); - CPPUNIT_ASSERT_EQUAL(OString("xmpmeta"), aWalker.name()); + CPPUNIT_ASSERT_EQUAL("xmpmeta"_ostr, aWalker.name()); bool bPdfUaMarkerFound = false; OString aPdfUaPart; @@ -1207,7 +1212,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfUaMetadata) aWalker.parent(); CPPUNIT_ASSERT(bPdfUaMarkerFound); - CPPUNIT_ASSERT_EQUAL(OString("1"), aPdfUaPart); + CPPUNIT_ASSERT_EQUAL("1"_ostr, aPdfUaPart); } CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf139736) @@ -1228,7 +1233,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf139736) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1335,7 +1340,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf152231) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1409,14 +1414,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf152231) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S")); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S"_ostr)); if (pS && pS->GetValue() == "Standard") { ++nPara; - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids); // one problem was that some StructElem were missing kids CPPUNIT_ASSERT(!pKids->GetElements().empty()); @@ -1448,7 +1453,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf152235) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1540,28 +1545,29 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf149140) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S")); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S"_ostr)); if (pS && pS->GetValue() == "TH") { int nTable(0); - auto pAttrs = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject->Lookup("A")); + auto pAttrs + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAttrs != nullptr); for (const auto& rAttrRef : pAttrs->GetElements()) { auto pAttrDict = dynamic_cast<vcl::filter::PDFDictionaryElement*>(rAttrRef); CPPUNIT_ASSERT(pAttrDict != nullptr); - auto pOwner - = dynamic_cast<vcl::filter::PDFNameElement*>(pAttrDict->LookupElement("O")); + auto pOwner = dynamic_cast<vcl::filter::PDFNameElement*>( + pAttrDict->LookupElement("O"_ostr)); CPPUNIT_ASSERT(pOwner != nullptr); if (pOwner->GetValue() == "Table") { auto pScope = dynamic_cast<vcl::filter::PDFNameElement*>( - pAttrDict->LookupElement("Scope")); + pAttrDict->LookupElement("Scope"_ostr)); CPPUNIT_ASSERT(pScope != nullptr); - CPPUNIT_ASSERT_EQUAL(OString("Column"), pScope->GetValue()); + CPPUNIT_ASSERT_EQUAL("Column"_ostr, pScope->GetValue()); ++nTable; } } @@ -1597,13 +1603,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testNestedSection) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "Document") { - auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K")); + auto pKids1 + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1); // assume there are no MCID ref at this level auto pKids1v = pKids1->GetElements(); @@ -1612,12 +1619,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testNestedSection) auto pObject10 = pRefKid10->LookupObject(); CPPUNIT_ASSERT(pObject10); auto pType10 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType10->GetValue()); - auto pS10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Sect"), pS10->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType10->GetValue()); + auto pS10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Sect"_ostr, pS10->GetValue()); - auto pKids10 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10->Lookup("K")); + auto pKids10 + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids10); // assume there are no MCID ref at this level auto pKids10v = pKids10->GetElements(); @@ -1627,33 +1635,36 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testNestedSection) auto pObject100 = pRefKid100->LookupObject(); CPPUNIT_ASSERT(pObject100); auto pType100 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType100->GetValue()); - auto pS100 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS100->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType100->GetValue()); + auto pS100 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS100->GetValue()); auto pRefKid101 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKids10v[1]); CPPUNIT_ASSERT(pRefKid101); auto pObject101 = pRefKid101->LookupObject(); CPPUNIT_ASSERT(pObject101); auto pType101 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject101->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType101->GetValue()); - auto pS101 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject101->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS101->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject101->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType101->GetValue()); + auto pS101 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject101->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS101->GetValue()); auto pRefKid102 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKids10v[2]); CPPUNIT_ASSERT(pRefKid102); auto pObject102 = pRefKid102->LookupObject(); CPPUNIT_ASSERT(pObject102); auto pType102 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType102->GetValue()); - auto pS102 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Sect"), pS102->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType102->GetValue()); + auto pS102 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Sect"_ostr, pS102->GetValue()); auto pKids102 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids102); // assume there are no MCID ref at this level auto pKids102v = pKids102->GetElements(); @@ -1663,10 +1674,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testNestedSection) auto pObject1020 = pRefKid1020->LookupObject(); CPPUNIT_ASSERT(pObject1020); auto pType1020 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1020->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1020->GetValue()); - auto pS1020 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1020->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS1020->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1020->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1020->GetValue()); + auto pS1020 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1020->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS1020->GetValue()); CPPUNIT_ASSERT_EQUAL(size_t(1), pKids102v.size()); @@ -1675,20 +1687,22 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testNestedSection) auto pObject103 = pRefKid103->LookupObject(); CPPUNIT_ASSERT(pObject103); auto pType103 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType103->GetValue()); - auto pS103 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS103->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType103->GetValue()); + auto pS103 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS103->GetValue()); auto pRefKid104 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKids10v[4]); CPPUNIT_ASSERT(pRefKid104); auto pObject104 = pRefKid104->LookupObject(); CPPUNIT_ASSERT(pObject104); auto pType104 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject104->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType104->GetValue()); - auto pS104 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject104->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS104->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject104->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType104->GetValue()); + auto pS104 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject104->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS104->GetValue()); CPPUNIT_ASSERT_EQUAL(size_t(5), pKids10v.size()); @@ -1697,10 +1711,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testNestedSection) auto pObject11 = pRefKid11->LookupObject(); CPPUNIT_ASSERT(pObject11); auto pType11 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType11->GetValue()); - auto pS11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS11->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType11->GetValue()); + auto pS11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS11->GetValue()); CPPUNIT_ASSERT_EQUAL(size_t(2), pKids1v.size()); ++nDoc; @@ -1734,10 +1748,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "TOC") { pTOC = pObject1; @@ -1746,7 +1760,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) } CPPUNIT_ASSERT(pTOC); - auto pKidsT = dynamic_cast<vcl::filter::PDFArrayElement*>(pTOC->Lookup("K")); + auto pKidsT = dynamic_cast<vcl::filter::PDFArrayElement*>(pTOC->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsT); // assume there are no MCID ref at this level auto pKidsTv = pKidsT->GetElements(); @@ -1754,33 +1768,33 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) CPPUNIT_ASSERT(pRefKidT0); auto pObjectT0 = pRefKidT0->LookupObject(); CPPUNIT_ASSERT(pObjectT0); - auto pTypeT0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT0->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT0->GetValue()); - auto pST0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT0->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Caption"), pST0->GetValue()); + auto pTypeT0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT0->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT0->GetValue()); + auto pST0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT0->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Caption"_ostr, pST0->GetValue()); - auto pKidsT0 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT0->Lookup("K")); + auto pKidsT0 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT0->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsT0); auto pKidsT0v = pKidsT0->GetElements(); auto pRefKidT00 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKidsT0v[0]); CPPUNIT_ASSERT(pRefKidT00); auto pObjectT00 = pRefKidT00->LookupObject(); CPPUNIT_ASSERT(pObjectT00); - auto pTypeT00 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT00->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT00->GetValue()); - auto pST00 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT00->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Contents#20Heading"), pST00->GetValue()); + auto pTypeT00 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT00->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT00->GetValue()); + auto pST00 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT00->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Contents#20Heading"_ostr, pST00->GetValue()); auto pRefKidT1 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKidsTv[1]); CPPUNIT_ASSERT(pRefKidT1); auto pObjectT1 = pRefKidT1->LookupObject(); CPPUNIT_ASSERT(pObjectT1); - auto pTypeT1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT1->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT1->GetValue()); - auto pST1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT1->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("TOCI"), pST1->GetValue()); + auto pTypeT1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT1->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT1->GetValue()); + auto pST1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT1->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("TOCI"_ostr, pST1->GetValue()); - auto pKidsT1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT1->Lookup("K")); + auto pKidsT1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT1->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsT1); auto pKidsT1v = pKidsT1->GetElements(); @@ -1788,12 +1802,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) CPPUNIT_ASSERT(pRefKidT10); auto pObjectT10 = pRefKidT10->LookupObject(); CPPUNIT_ASSERT(pObjectT10); - auto pTypeT10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT10->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT10->GetValue()); - auto pST10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT10->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Contents#201"), pST10->GetValue()); + auto pTypeT10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT10->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT10->GetValue()); + auto pST10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT10->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Contents#201"_ostr, pST10->GetValue()); - auto pKidsT10 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT10->Lookup("K")); + auto pKidsT10 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT10->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsT10); auto pKidsT10v = pKidsT10->GetElements(); CPPUNIT_ASSERT_EQUAL(size_t(1), pKidsT10v.size()); @@ -1803,21 +1817,21 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) CPPUNIT_ASSERT(pRefKidT100); auto pObjectT100 = pRefKidT100->LookupObject(); CPPUNIT_ASSERT(pObjectT100); - auto pTypeT100 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT100->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT100->GetValue()); - auto pST100 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT100->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pST100->GetValue()); + auto pTypeT100 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT100->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT100->GetValue()); + auto pST100 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT100->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pST100->GetValue()); auto pRefKidT2 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKidsTv[1]); CPPUNIT_ASSERT(pRefKidT2); auto pObjectT2 = pRefKidT2->LookupObject(); CPPUNIT_ASSERT(pObjectT2); - auto pTypeT2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT2->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT2->GetValue()); - auto pST2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT2->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("TOCI"), pST2->GetValue()); + auto pTypeT2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT2->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT2->GetValue()); + auto pST2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT2->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("TOCI"_ostr, pST2->GetValue()); - auto pKidsT2 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT2->Lookup("K")); + auto pKidsT2 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT2->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsT2); auto pKidsT2v = pKidsT2->GetElements(); @@ -1825,12 +1839,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) CPPUNIT_ASSERT(pRefKidT20); auto pObjectT20 = pRefKidT20->LookupObject(); CPPUNIT_ASSERT(pObjectT20); - auto pTypeT20 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT20->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT20->GetValue()); - auto pST20 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT20->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Contents#201"), pST20->GetValue()); + auto pTypeT20 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT20->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT20->GetValue()); + auto pST20 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT20->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Contents#201"_ostr, pST20->GetValue()); - auto pKidsT20 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT20->Lookup("K")); + auto pKidsT20 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT20->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsT20); auto pKidsT20v = pKidsT20->GetElements(); CPPUNIT_ASSERT_EQUAL(size_t(1), pKidsT20v.size()); @@ -1840,21 +1854,21 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) CPPUNIT_ASSERT(pRefKidT200); auto pObjectT200 = pRefKidT200->LookupObject(); CPPUNIT_ASSERT(pObjectT200); - auto pTypeT200 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT200->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT200->GetValue()); - auto pST200 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT200->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pST200->GetValue()); + auto pTypeT200 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT200->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT200->GetValue()); + auto pST200 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT200->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pST200->GetValue()); auto pRefKidT3 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKidsTv[1]); CPPUNIT_ASSERT(pRefKidT3); auto pObjectT3 = pRefKidT3->LookupObject(); CPPUNIT_ASSERT(pObjectT3); - auto pTypeT3 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT3->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT3->GetValue()); - auto pST3 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT3->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("TOCI"), pST3->GetValue()); + auto pTypeT3 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT3->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT3->GetValue()); + auto pST3 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT3->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("TOCI"_ostr, pST3->GetValue()); - auto pKidsT3 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT3->Lookup("K")); + auto pKidsT3 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT3->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsT3); auto pKidsT3v = pKidsT3->GetElements(); @@ -1862,12 +1876,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) CPPUNIT_ASSERT(pRefKidT30); auto pObjectT30 = pRefKidT30->LookupObject(); CPPUNIT_ASSERT(pObjectT30); - auto pTypeT30 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT30->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT30->GetValue()); - auto pST30 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT30->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Contents#201"), pST30->GetValue()); + auto pTypeT30 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT30->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT30->GetValue()); + auto pST30 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT30->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Contents#201"_ostr, pST30->GetValue()); - auto pKidsT30 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT30->Lookup("K")); + auto pKidsT30 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectT30->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsT30); auto pKidsT30v = pKidsT30->GetElements(); CPPUNIT_ASSERT_EQUAL(size_t(1), pKidsT30v.size()); @@ -1877,10 +1891,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157817) CPPUNIT_ASSERT(pRefKidT300); auto pObjectT300 = pRefKidT300->LookupObject(); CPPUNIT_ASSERT(pObjectT300); - auto pTypeT300 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT300->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeT300->GetValue()); - auto pST300 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT300->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pST300->GetValue()); + auto pTypeT300 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT300->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeT300->GetValue()); + auto pST300 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectT300->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pST300->GetValue()); } CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf135638) @@ -1907,21 +1921,21 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf135638) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S")); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S"_ostr)); if (pS && pS->GetValue() == "Figure") { auto pAttrDict - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("A")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAttrDict != nullptr); - auto pOwner - = dynamic_cast<vcl::filter::PDFNameElement*>(pAttrDict->LookupElement("O")); + auto pOwner = dynamic_cast<vcl::filter::PDFNameElement*>( + pAttrDict->LookupElement("O"_ostr)); CPPUNIT_ASSERT(pOwner != nullptr); - CPPUNIT_ASSERT_EQUAL(OString("Layout"), pOwner->GetValue()); - auto pBBox - = dynamic_cast<vcl::filter::PDFArrayElement*>(pAttrDict->LookupElement("BBox")); + CPPUNIT_ASSERT_EQUAL("Layout"_ostr, pOwner->GetValue()); + auto pBBox = dynamic_cast<vcl::filter::PDFArrayElement*>( + pAttrDict->LookupElement("BBox"_ostr)); CPPUNIT_ASSERT(pBBox != nullptr); if (nFigure == 0) { @@ -2001,10 +2015,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157703) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "Document") { pDocument = pObject1; @@ -2013,7 +2027,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157703) } CPPUNIT_ASSERT(pDocument); - auto pKidsD = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K")); + auto pKidsD = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD); // assume there are no MCID ref at this level auto pKidsDv = pKidsD->GetElements(); @@ -2021,12 +2035,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157703) CPPUNIT_ASSERT(pRefKidD0); auto pObjectD0 = pRefKidD0->LookupObject(); CPPUNIT_ASSERT(pObjectD0); - auto pTypeD0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD0->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD0->GetValue()); - auto pSD0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD0->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("H1"), pSD0->GetValue()); + auto pTypeD0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD0->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD0->GetValue()); + auto pSD0 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD0->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("H1"_ostr, pSD0->GetValue()); - auto pKidsD0 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD0->Lookup("K")); + auto pKidsD0 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD0->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD0); auto pKidsD0v = pKidsD0->GetElements(); auto pRefKidD00 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKidsD0v[0]); @@ -2041,12 +2055,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157703) CPPUNIT_ASSERT(pRefKidD1); auto pObjectD1 = pRefKidD1->LookupObject(); CPPUNIT_ASSERT(pObjectD1); - auto pTypeD1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD1->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD1->GetValue()); - auto pSD1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD1->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("H2"), pSD1->GetValue()); + auto pTypeD1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD1->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD1->GetValue()); + auto pSD1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD1->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("H2"_ostr, pSD1->GetValue()); - auto pKidsD1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD1->Lookup("K")); + auto pKidsD1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD1->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD1); auto pKidsD1v = pKidsD1->GetElements(); @@ -2079,13 +2093,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "Document") { - auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K")); + auto pKids1 + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1); // assume there are no MCID ref at this level auto vKids1 = pKids1->GetElements(); @@ -2095,12 +2110,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject10 = pRefKid10->LookupObject(); CPPUNIT_ASSERT(pObject10); auto pType10 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType10->GetValue()); - auto pS10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("L"), pS10->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType10->GetValue()); + auto pS10 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("L"_ostr, pS10->GetValue()); - auto pKids10 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10->Lookup("K")); + auto pKids10 + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids10); // assume there are no MCID ref at this level auto vKids10 = pKids10->GetElements(); @@ -2111,13 +2127,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject100 = pRefKid100->LookupObject(); CPPUNIT_ASSERT(pObject100); auto pType100 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType100->GetValue()); - auto pS100 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("LI"), pS100->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType100->GetValue()); + auto pS100 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("LI"_ostr, pS100->GetValue()); auto pKids100 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject100->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject100->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids100); // assume there are no MCID ref at this level auto vKids100 = pKids100->GetElements(); @@ -2128,22 +2145,24 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject1000 = pRefKid1000->LookupObject(); CPPUNIT_ASSERT(pObject1000); auto pType1000 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1000->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1000->GetValue()); - auto pS1000 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1000->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Lbl"), pS1000->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1000->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1000->GetValue()); + auto pS1000 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1000->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Lbl"_ostr, pS1000->GetValue()); auto pRefKid1001 = dynamic_cast<vcl::filter::PDFReferenceElement*>(vKids100[1]); CPPUNIT_ASSERT(pRefKid1001); auto pObject1001 = pRefKid1001->LookupObject(); CPPUNIT_ASSERT(pObject1001); auto pType1001 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1001->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1001->GetValue()); - auto pS1001 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1001->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("LBody"), pS1001->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1001->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1001->GetValue()); + auto pS1001 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1001->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("LBody"_ostr, pS1001->GetValue()); auto pKids1001 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1001->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1001->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1001); // assume there are no MCID ref at this level auto vKids1001 = pKids1001->GetElements(); @@ -2154,13 +2173,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject10010 = pRefKid10010->LookupObject(); CPPUNIT_ASSERT(pObject10010); auto pType10010 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10010->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType10010->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10010->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType10010->GetValue()); auto pS10010 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10010->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS10010->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10010->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS10010->GetValue()); auto pKids10010 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10010->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10010->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids10010); // assume there are no MCID ref at this level auto vKids10010 = pKids10010->GetElements(); @@ -2171,29 +2190,30 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) CPPUNIT_ASSERT(pRefKid100100); auto pObject100100 = pRefKid100100->LookupObject(); CPPUNIT_ASSERT(pObject100100); - auto pType100100 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100100->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType100100->GetValue()); + auto pType100100 = dynamic_cast<vcl::filter::PDFNameElement*>( + pObject100100->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType100100->GetValue()); auto pS100100 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100100->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Span"), pS100100->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject100100->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Span"_ostr, pS100100->GetValue()); // this span exists because of lang auto pLang100100 = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( - pObject100100->Lookup("Lang")); - CPPUNIT_ASSERT_EQUAL(OString("en-GB"), pLang100100->GetValue()); + pObject100100->Lookup("Lang"_ostr)); + CPPUNIT_ASSERT_EQUAL("en-GB"_ostr, pLang100100->GetValue()); auto pRefKid101 = dynamic_cast<vcl::filter::PDFReferenceElement*>(vKids10[1]); CPPUNIT_ASSERT(pRefKid101); auto pObject101 = pRefKid101->LookupObject(); CPPUNIT_ASSERT(pObject101); auto pType101 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject101->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType101->GetValue()); - auto pS101 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject101->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("LI"), pS101->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject101->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType101->GetValue()); + auto pS101 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject101->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("LI"_ostr, pS101->GetValue()); auto pKids101 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject101->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject101->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids101); // assume there are no MCID ref at this level auto vKids101 = pKids101->GetElements(); @@ -2204,23 +2224,25 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject1010 = pRefKid1010->LookupObject(); CPPUNIT_ASSERT(pObject1010); auto pType1010 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1010->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1010->GetValue()); - auto pS1010 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1010->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Lbl"), pS1010->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1010->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1010->GetValue()); + auto pS1010 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1010->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Lbl"_ostr, pS1010->GetValue()); auto pRefKid1011 = dynamic_cast<vcl::filter::PDFReferenceElement*>(vKids101[1]); CPPUNIT_ASSERT(pRefKid1011); auto pObject1011 = pRefKid1011->LookupObject(); CPPUNIT_ASSERT(pObject1011); auto pType1011 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1011->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1011->GetValue()); - auto pS1011 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1011->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("LBody"), pS1011->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1011->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1011->GetValue()); + auto pS1011 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1011->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("LBody"_ostr, pS1011->GetValue()); auto pKids1011 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1011->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1011->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1011); // assume there are no MCID ref at this level auto vKids1011 = pKids1011->GetElements(); @@ -2231,13 +2253,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject10110 = pRefKid10110->LookupObject(); CPPUNIT_ASSERT(pObject10110); auto pType10110 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10110->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType10110->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10110->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType10110->GetValue()); auto pS10110 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10110->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS10110->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10110->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS10110->GetValue()); auto pKids10110 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10110->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10110->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids10110); auto vKids10110 = pKids10110->GetElements(); // only MCIDs, no span @@ -2252,13 +2274,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject102 = pRefKid102->LookupObject(); CPPUNIT_ASSERT(pObject102); auto pType102 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType102->GetValue()); - auto pS102 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("LI"), pS102->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType102->GetValue()); + auto pS102 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("LI"_ostr, pS102->GetValue()); auto pKids102 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids102); // assume there are no MCID ref at this level auto vKids102 = pKids102->GetElements(); @@ -2269,23 +2292,25 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject1020 = pRefKid1020->LookupObject(); CPPUNIT_ASSERT(pObject1020); auto pType1020 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1020->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1020->GetValue()); - auto pS1020 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1020->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Lbl"), pS1020->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1020->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1020->GetValue()); + auto pS1020 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1020->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Lbl"_ostr, pS1020->GetValue()); auto pRefKid1021 = dynamic_cast<vcl::filter::PDFReferenceElement*>(vKids102[1]); CPPUNIT_ASSERT(pRefKid1021); auto pObject1021 = pRefKid1021->LookupObject(); CPPUNIT_ASSERT(pObject1021); auto pType1021 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1021->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1021->GetValue()); - auto pS1021 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1021->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("LBody"), pS1021->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1021->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1021->GetValue()); + auto pS1021 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1021->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("LBody"_ostr, pS1021->GetValue()); auto pKids1021 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1021->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1021->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1021); // assume there are no MCID ref at this level auto vKids1021 = pKids1021->GetElements(); @@ -2296,13 +2321,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject10210 = pRefKid10210->LookupObject(); CPPUNIT_ASSERT(pObject10210); auto pType10210 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10210->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType10210->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10210->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType10210->GetValue()); auto pS10210 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10210->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS10210->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10210->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS10210->GetValue()); auto pKids10210 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10210->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10210->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids10210); // assume there are no MCID ref at this level auto vKids10210 = pKids10210->GetElements(); @@ -2313,14 +2338,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) CPPUNIT_ASSERT(pRefKid102100); auto pObject102100 = pRefKid102100->LookupObject(); CPPUNIT_ASSERT(pObject102100); - auto pType102100 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102100->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType102100->GetValue()); + auto pType102100 = dynamic_cast<vcl::filter::PDFNameElement*>( + pObject102100->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType102100->GetValue()); auto pS102100 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102100->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Span"), pS102100->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102100->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Span"_ostr, pS102100->GetValue()); auto pKids102100 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102100->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102100->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids102100); auto vKids102100 = pKids102100->GetElements(); for (size_t i = 0; i < vKids102100.size(); ++i) @@ -2333,14 +2358,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) CPPUNIT_ASSERT(pRefKid102101); auto pObject102101 = pRefKid102101->LookupObject(); CPPUNIT_ASSERT(pObject102101); - auto pType102101 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102101->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType102101->GetValue()); + auto pType102101 = dynamic_cast<vcl::filter::PDFNameElement*>( + pObject102101->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType102101->GetValue()); auto pS102101 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102101->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pS102101->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102101->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pS102101->GetValue()); auto pKids102101 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102101->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102101->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids102101); auto vKids102101 = pKids102101->GetElements(); auto nRef(0); @@ -2358,14 +2383,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) CPPUNIT_ASSERT(pRefKid102102); auto pObject102102 = pRefKid102102->LookupObject(); CPPUNIT_ASSERT(pObject102102); - auto pType102102 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102102->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType102102->GetValue()); + auto pType102102 = dynamic_cast<vcl::filter::PDFNameElement*>( + pObject102102->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType102102->GetValue()); auto pS102102 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102102->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Span"), pS102102->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject102102->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Span"_ostr, pS102102->GetValue()); auto pKids102102 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102102->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject102102->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids102102); auto vKids102102 = pKids102102->GetElements(); // there is a footnote @@ -2377,11 +2402,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) { auto pObject = pKid->LookupObject(); CPPUNIT_ASSERT(pObject); - auto pType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType->GetValue()); - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pS->GetValue()); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>( + pObject->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType->GetValue()); + auto pS + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pS->GetValue()); ++nFtn; } } @@ -2392,13 +2418,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject103 = pRefKid103->LookupObject(); CPPUNIT_ASSERT(pObject103); auto pType103 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType103->GetValue()); - auto pS103 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("LI"), pS103->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType103->GetValue()); + auto pS103 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("LI"_ostr, pS103->GetValue()); auto pKids103 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject103->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject103->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids103); // assume there are no MCID ref at this level auto vKids103 = pKids103->GetElements(); @@ -2409,23 +2436,25 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject1030 = pRefKid1030->LookupObject(); CPPUNIT_ASSERT(pObject1030); auto pType1030 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1030->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1030->GetValue()); - auto pS1030 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1030->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Lbl"), pS1030->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1030->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1030->GetValue()); + auto pS1030 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1030->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Lbl"_ostr, pS1030->GetValue()); auto pRefKid1031 = dynamic_cast<vcl::filter::PDFReferenceElement*>(vKids103[1]); CPPUNIT_ASSERT(pRefKid1031); auto pObject1031 = pRefKid1031->LookupObject(); CPPUNIT_ASSERT(pObject1031); auto pType1031 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1031->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1031->GetValue()); - auto pS1031 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1031->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("LBody"), pS1031->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1031->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1031->GetValue()); + auto pS1031 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1031->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("LBody"_ostr, pS1031->GetValue()); auto pKids1031 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1031->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1031->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1031); // assume there are no MCID ref at this level auto vKids1031 = pKids1031->GetElements(); @@ -2436,13 +2465,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject10310 = pRefKid10310->LookupObject(); CPPUNIT_ASSERT(pObject10310); auto pType10310 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10310->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType10310->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10310->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType10310->GetValue()); auto pS10310 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10310->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pS10310->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject10310->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pS10310->GetValue()); auto pKids10310 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10310->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject10310->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids10310); // assume there are no MCID ref at this level auto vKids10310 = pKids10310->GetElements(); @@ -2456,21 +2485,21 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) CPPUNIT_ASSERT(pRefKid103101); auto pObject103101 = pRefKid103101->LookupObject(); CPPUNIT_ASSERT(pObject103101); - auto pType103101 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103101->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType103101->GetValue()); + auto pType103101 = dynamic_cast<vcl::filter::PDFNameElement*>( + pObject103101->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType103101->GetValue()); auto pS103101 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103101->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Span"), pS103101->GetValue()); - auto pDictA103101 - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject103101->Lookup("A")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject103101->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Span"_ostr, pS103101->GetValue()); + auto pDictA103101 = dynamic_cast<vcl::filter::PDFDictionaryElement*>( + pObject103101->Lookup("A"_ostr)); CPPUNIT_ASSERT(pDictA103101 != nullptr); - CPPUNIT_ASSERT_EQUAL(OString("Layout"), dynamic_cast<vcl::filter::PDFNameElement*>( - pDictA103101->LookupElement("O")) - ->GetValue()); - CPPUNIT_ASSERT_EQUAL(OString("LineThrough"), + CPPUNIT_ASSERT_EQUAL("Layout"_ostr, dynamic_cast<vcl::filter::PDFNameElement*>( + pDictA103101->LookupElement("O"_ostr)) + ->GetValue()); + CPPUNIT_ASSERT_EQUAL("LineThrough"_ostr, dynamic_cast<vcl::filter::PDFNameElement*>( - pDictA103101->LookupElement("TextDecorationType")) + pDictA103101->LookupElement("TextDecorationType"_ostr)) ->GetValue()); // now the footnote container - following the list @@ -2479,12 +2508,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject11 = pRefKid11->LookupObject(); CPPUNIT_ASSERT(pObject11); auto pType11 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType11->GetValue()); - auto pS11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Div"), pS11->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType11->GetValue()); + auto pS11 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Div"_ostr, pS11->GetValue()); - auto pKids11 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject11->Lookup("K")); + auto pKids11 + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject11->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids11); // assume there are no MCID ref at this level auto vKids11 = pKids11->GetElements(); @@ -2495,13 +2525,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject110 = pRefKid110->LookupObject(); CPPUNIT_ASSERT(pObject110); auto pType110 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject110->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType110->GetValue()); - auto pS110 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject110->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Note"), pS110->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject110->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType110->GetValue()); + auto pS110 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject110->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Note"_ostr, pS110->GetValue()); auto pKids110 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject110->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject110->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids110); // assume there are no MCID ref at this level auto vKids110 = pKids110->GetElements(); @@ -2512,13 +2543,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject1100 = pRefKid1100->LookupObject(); CPPUNIT_ASSERT(pObject1100); auto pType1100 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1100->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1100->GetValue()); - auto pS1100 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1100->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Lbl"), pS1100->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1100->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1100->GetValue()); + auto pS1100 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1100->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Lbl"_ostr, pS1100->GetValue()); auto pKids1100 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1100->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1100->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1100); // assume there are no MCID ref at this level auto vKids1100 = pKids1100->GetElements(); @@ -2529,21 +2561,22 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testSpans) auto pObject11000 = pRefKid11000->LookupObject(); CPPUNIT_ASSERT(pObject11000); auto pType11000 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11000->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType11000->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11000->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType11000->GetValue()); auto pS11000 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11000->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pS11000->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject11000->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pS11000->GetValue()); auto pRefKid1101 = dynamic_cast<vcl::filter::PDFReferenceElement*>(vKids110[1]); CPPUNIT_ASSERT(pRefKid1101); auto pObject1101 = pRefKid1101->LookupObject(); CPPUNIT_ASSERT(pObject1101); auto pType1101 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1101->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType1101->GetValue()); - auto pS1101 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1101->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Footnote"), pS1101->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1101->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType1101->GetValue()); + auto pS1101 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1101->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Footnote"_ostr, pS1101->GetValue()); ++nDoc; } @@ -2594,10 +2627,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf57423) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S")); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S"_ostr)); if (pS && pS->GetValue() == "Figure") { switch (nFigure) @@ -2606,21 +2639,21 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf57423) CPPUNIT_ASSERT_EQUAL(u"QR Code - Tells how to get to Mosegaard"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; case 0: CPPUNIT_ASSERT_EQUAL(u"Title: Arrows - Description: Explains the " u"different arrow appearances"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; case 1: CPPUNIT_ASSERT_EQUAL( u"My blue triangle - Does not need further description"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; } ++nFigure; @@ -2630,7 +2663,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf57423) CPPUNIT_ASSERT_EQUAL( u"Equation 1 - Now we give the full description of eq 1 here"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast<vcl::filter::PDFHexStringElement*>(pObject->Lookup("Alt")))); + *dynamic_cast<vcl::filter::PDFHexStringElement*>( + pObject->Lookup("Alt"_ostr)))); ++nFormula; } if (pS && pS->GetValue() == "Div") @@ -2641,24 +2675,24 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf57423) CPPUNIT_ASSERT_EQUAL(u"This frame has a description"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; case 1: // no properties set on this - CPPUNIT_ASSERT(!pObject->Lookup("Alt")); + CPPUNIT_ASSERT(!pObject->Lookup("Alt"_ostr)); break; case 2: CPPUNIT_ASSERT_EQUAL(u"My textbox - Has a light background"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; case 3: CPPUNIT_ASSERT_EQUAL(u"Hey! There is no alternate text for Frame " u"// but maybe not needed?"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; } ++nDiv; @@ -2694,10 +2728,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf154982) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S")); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S"_ostr)); if (pS && pS->GetValue() == "Figure") { switch (nFigure) @@ -2706,39 +2740,41 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf154982) CPPUNIT_ASSERT_EQUAL(u"Here comes the signature - Please sign here"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; case 1: CPPUNIT_ASSERT_EQUAL(u"Home"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; } // the problem was that the figures in the hell layer were not // below their anchor paragraphs in the structure tree auto pParentRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("P")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("P"_ostr)); CPPUNIT_ASSERT(pParentRef); auto pParent(pParentRef->LookupObject()); CPPUNIT_ASSERT(pParent); auto pParentType - = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pParentType->GetValue()); - auto pParentS = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pParentS->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pParentType->GetValue()); + auto pParentS + = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pParentS->GetValue()); auto pPParentRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pParent->Lookup("P")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pParent->Lookup("P"_ostr)); CPPUNIT_ASSERT(pPParentRef); auto pPParent(pPParentRef->LookupObject()); CPPUNIT_ASSERT(pPParent); auto pPParentType - = dynamic_cast<vcl::filter::PDFNameElement*>(pPParent->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pPParentType->GetValue()); - auto pPParentS = dynamic_cast<vcl::filter::PDFNameElement*>(pPParent->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Document"), pPParentS->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pPParent->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pPParentType->GetValue()); + auto pPParentS + = dynamic_cast<vcl::filter::PDFNameElement*>(pPParent->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Document"_ostr, pPParentS->GetValue()); ++nFigure; } } @@ -2770,10 +2806,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "Document") { pDocument = pObject1; @@ -2782,7 +2818,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) } CPPUNIT_ASSERT(pDocument); - auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K")); + auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1); // assume there are no MCID ref at this level auto pKids1v = pKids1->GetElements(); @@ -2790,12 +2826,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) CPPUNIT_ASSERT(pRefKid12); auto pObject12 = pRefKid12->LookupObject(); CPPUNIT_ASSERT(pObject12); - auto pType12 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject12->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType12->GetValue()); - auto pS12 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject12->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Text#20body"), pS12->GetValue()); + auto pType12 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject12->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType12->GetValue()); + auto pS12 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject12->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Text#20body"_ostr, pS12->GetValue()); - auto pKids12 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject12->Lookup("K")); + auto pKids12 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject12->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids12); // assume there are no MCID ref at this level auto pKids12v = pKids12->GetElements(); @@ -2803,13 +2839,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) CPPUNIT_ASSERT(pRefKid120); auto pObject120 = pRefKid120->LookupObject(); CPPUNIT_ASSERT(pObject120); - auto pType120 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject120->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType120->GetValue()); - auto pS120 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject120->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pS120->GetValue()); + auto pType120 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject120->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType120->GetValue()); + auto pS120 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject120->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pS120->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject120->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject120->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2824,32 +2860,35 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"https://klexikon.zum.de/wiki/Kläranlage"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A")); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAA + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAA); auto pAAType - = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Action"), pAAType->GetValue()); - auto pAAS = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("S")); - CPPUNIT_ASSERT_EQUAL(OString("URI"), pAAS->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Action"_ostr, pAAType->GetValue()); + auto pAAS + = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("URI"_ostr, pAAS->GetValue()); auto pAAURI = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( - pAA->LookupElement("URI")); - CPPUNIT_ASSERT_EQUAL(OString("https://klexikon.zum.de/wiki/Kl%C3%A4ranlage"), + pAA->LookupElement("URI"_ostr)); + CPPUNIT_ASSERT_EQUAL("https://klexikon.zum.de/wiki/Kl%C3%A4ranlage"_ostr, pAAURI->GetValue()); } } @@ -2861,12 +2900,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) CPPUNIT_ASSERT(pRefKid13); auto pObject13 = pRefKid13->LookupObject(); CPPUNIT_ASSERT(pObject13); - auto pType13 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject13->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType13->GetValue()); - auto pS13 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject13->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Text#20body"), pS13->GetValue()); + auto pType13 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject13->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType13->GetValue()); + auto pS13 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject13->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Text#20body"_ostr, pS13->GetValue()); - auto pKids13 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject13->Lookup("K")); + auto pKids13 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject13->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids13); // assume there are no MCID ref at this level auto pKids13v = pKids13->GetElements(); @@ -2874,13 +2913,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) CPPUNIT_ASSERT(pRefKid130); auto pObject130 = pRefKid130->LookupObject(); CPPUNIT_ASSERT(pObject130); - auto pType130 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject130->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType130->GetValue()); - auto pS130 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject130->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pS130->GetValue()); + auto pType130 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject130->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType130->GetValue()); + auto pS130 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject130->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pS130->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject130->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject130->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2895,34 +2934,36 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"https://de.wikipedia.org/wiki/Kläranlage#Mechanische_Vorreinigung"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A")); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAA + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAA); auto pAAType - = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Action"), pAAType->GetValue()); - auto pAAS = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("S")); - CPPUNIT_ASSERT_EQUAL(OString("URI"), pAAS->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Action"_ostr, pAAType->GetValue()); + auto pAAS + = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("URI"_ostr, pAAS->GetValue()); auto pAAURI = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( - pAA->LookupElement("URI")); + pAA->LookupElement("URI"_ostr)); CPPUNIT_ASSERT_EQUAL( - OString( - "https://de.wikipedia.org/wiki/Kl%C3%A4ranlage#Mechanische_Vorreinigung"), + "https://de.wikipedia.org/wiki/Kl%C3%A4ranlage#Mechanische_Vorreinigung"_ostr, pAAURI->GetValue()); } } @@ -2934,12 +2975,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) CPPUNIT_ASSERT(pRefKid14); auto pObject14 = pRefKid14->LookupObject(); CPPUNIT_ASSERT(pObject14); - auto pType14 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject14->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType14->GetValue()); - auto pS14 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject14->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Text#20body"), pS14->GetValue()); + auto pType14 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject14->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType14->GetValue()); + auto pS14 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject14->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Text#20body"_ostr, pS14->GetValue()); - auto pKids14 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject14->Lookup("K")); + auto pKids14 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject14->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids14); // assume there are no MCID ref at this level auto pKids14v = pKids14->GetElements(); @@ -2947,13 +2988,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) CPPUNIT_ASSERT(pRefKid140); auto pObject140 = pRefKid140->LookupObject(); CPPUNIT_ASSERT(pObject140); - auto pType140 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject140->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType140->GetValue()); - auto pS140 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject140->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pS140->GetValue()); + auto pType140 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject140->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType140->GetValue()); + auto pS140 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject140->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pS140->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject140->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject140->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2968,33 +3009,36 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"https://vr-easy.com/tour/usr/220113-virtuellerschulausflug/#pano=24"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A")); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAA + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAA); auto pAAType - = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Action"), pAAType->GetValue()); - auto pAAS = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("S")); - CPPUNIT_ASSERT_EQUAL(OString("URI"), pAAS->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Action"_ostr, pAAType->GetValue()); + auto pAAS + = dynamic_cast<vcl::filter::PDFNameElement*>(pAA->LookupElement("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("URI"_ostr, pAAS->GetValue()); auto pAAURI = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( - pAA->LookupElement("URI")); + pAA->LookupElement("URI"_ostr)); CPPUNIT_ASSERT_EQUAL( - OString("https://vr-easy.com/tour/usr/220113-virtuellerschulausflug/#pano=24"), + "https://vr-easy.com/tour/usr/220113-virtuellerschulausflug/#pano=24"_ostr, pAAURI->GetValue()); } } @@ -3006,12 +3050,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) CPPUNIT_ASSERT(pRefKid16); auto pObject16 = pRefKid16->LookupObject(); CPPUNIT_ASSERT(pObject16); - auto pType16 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject16->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType16->GetValue()); - auto pS16 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject16->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Text#20body"), pS16->GetValue()); + auto pType16 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject16->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType16->GetValue()); + auto pS16 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject16->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Text#20body"_ostr, pS16->GetValue()); - auto pKids16 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject16->Lookup("K")); + auto pKids16 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject16->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids16); // assume there are no MCID ref at this level auto pKids16v = pKids16->GetElements(); @@ -3019,21 +3063,22 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) CPPUNIT_ASSERT(pRefKid160); auto pObject160 = pRefKid160->LookupObject(); CPPUNIT_ASSERT(pObject160); - auto pType160 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject160->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType160->GetValue()); - auto pS160 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject160->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pS160->GetValue()); - auto pA160Dict = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject160->Lookup("A")); + auto pType160 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject160->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType160->GetValue()); + auto pS160 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject160->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pS160->GetValue()); + auto pA160Dict = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject160->Lookup("A"_ostr)); CPPUNIT_ASSERT(pA160Dict); - auto pA160O = dynamic_cast<vcl::filter::PDFNameElement*>(pA160Dict->LookupElement("O")); + auto pA160O = dynamic_cast<vcl::filter::PDFNameElement*>(pA160Dict->LookupElement("O"_ostr)); CPPUNIT_ASSERT(pA160O); - CPPUNIT_ASSERT_EQUAL(OString("PrintField"), pA160O->GetValue()); - auto pA160Role = dynamic_cast<vcl::filter::PDFNameElement*>(pA160Dict->LookupElement("Role")); + CPPUNIT_ASSERT_EQUAL("PrintField"_ostr, pA160O->GetValue()); + auto pA160Role + = dynamic_cast<vcl::filter::PDFNameElement*>(pA160Dict->LookupElement("Role"_ostr)); CPPUNIT_ASSERT(pA160Role); - CPPUNIT_ASSERT_EQUAL(OString("tv"), pA160Role->GetValue()); + CPPUNIT_ASSERT_EQUAL("tv"_ostr, pA160Role->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject160->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject160->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -3048,16 +3093,17 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf157397) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Widget"), pASubtype->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Widget"_ostr, pASubtype->GetValue()); } } CPPUNIT_ASSERT_EQUAL(static_cast<decltype(nMCID)>(1), nMCID); @@ -3089,14 +3135,15 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf135192) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "Table") { int nTR(0); - auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K")); + auto pKids1 + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1); // there can be additional children, such as MCID ref for (auto pKid1 : pKids1->GetElements()) @@ -3108,16 +3155,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf135192) if (pObject2) { auto pType2 = dynamic_cast<vcl::filter::PDFNameElement*>( - pObject2->Lookup("Type")); + pObject2->Lookup("Type"_ostr)); if (pType2 && pType2->GetValue() == "StructElem") { auto pS2 = dynamic_cast<vcl::filter::PDFNameElement*>( - pObject2->Lookup("S")); + pObject2->Lookup("S"_ostr)); if (pS2 && pS2->GetValue() == "TR") { int nTD(0); auto pKids2 = dynamic_cast<vcl::filter::PDFArrayElement*>( - pObject2->Lookup("K")); + pObject2->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids2); for (auto pKid2 : pKids2->GetElements()) { @@ -3131,18 +3178,18 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf135192) { auto pType3 = dynamic_cast<vcl::filter::PDFNameElement*>( - pObject3->Lookup("Type")); + pObject3->Lookup("Type"_ostr)); if (pType3 && pType3->GetValue() == "StructElem") { auto pS3 = dynamic_cast< vcl::filter::PDFNameElement*>( - pObject3->Lookup("S")); + pObject3->Lookup("S"_ostr)); if (nTR == 0 && pS3 && pS3->GetValue() == "TH") { int nOTable(0); auto pAttrs = dynamic_cast< vcl::filter::PDFArrayElement*>( - pObject3->Lookup("A")); + pObject3->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAttrs != nullptr); for (const auto& rAttrRef : pAttrs->GetElements()) @@ -3153,17 +3200,17 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf135192) CPPUNIT_ASSERT(pAttrDict != nullptr); auto pOwner = dynamic_cast< vcl::filter::PDFNameElement*>( - pAttrDict->LookupElement("O")); + pAttrDict->LookupElement("O"_ostr)); CPPUNIT_ASSERT(pOwner != nullptr); if (pOwner->GetValue() == "Table") { auto pScope = dynamic_cast< vcl::filter::PDFNameElement*>( pAttrDict->LookupElement( - "Scope")); + "Scope"_ostr)); CPPUNIT_ASSERT(pScope != nullptr); CPPUNIT_ASSERT_EQUAL( - OString("Column"), + "Column"_ostr, pScope->GetValue()); ++nOTable; } @@ -3213,7 +3260,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf154955) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -3286,10 +3333,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf154955) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S")); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S"_ostr)); if (pS && pS->GetValue() == "Figure") { switch (nFigure) @@ -3298,26 +3345,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf154955) CPPUNIT_ASSERT_EQUAL(u"Two rectangles - Grouped"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; case 1: CPPUNIT_ASSERT_EQUAL(u"these ones are green"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject->Lookup("Alt")))); + pObject->Lookup("Alt"_ostr)))); break; } auto pParentRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("P")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("P"_ostr)); CPPUNIT_ASSERT(pParentRef); auto pParent(pParentRef->LookupObject()); CPPUNIT_ASSERT(pParent); auto pParentType - = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pParentType->GetValue()); - auto pParentS = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Standard"), pParentS->GetValue()); + = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pParentType->GetValue()); + auto pParentS + = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Standard"_ostr, pParentS->GetValue()); ++nFigure; } @@ -3353,14 +3401,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf155190) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); // start with the text box if (pType1 && pType1->GetValue() == "StructElem" && pS1 && pS1->GetValue() == "Div") { ++nDiv; - auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K")); + auto pKids1 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject1->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids1); for (auto pKid1 : pKids1->GetElements()) { @@ -3370,13 +3418,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf155190) auto pObject2 = pRefKid1->LookupObject(); CPPUNIT_ASSERT(pObject2); auto pType2 - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject2->Lookup("Type")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject2->Lookup("Type"_ostr)); CPPUNIT_ASSERT(pType2); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType2->GetValue()); - auto pS2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject2->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("FigureCaption"), pS2->GetValue()); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType2->GetValue()); + auto pS2 + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject2->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("FigureCaption"_ostr, pS2->GetValue()); auto pKids2 - = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject2->Lookup("K")); + = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject2->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids2); // there are additional children, MCID ref for (auto pKid2 : pKids2->GetElements()) @@ -3387,19 +3436,19 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf155190) auto pObject3 = pRefKid2->LookupObject(); CPPUNIT_ASSERT(pObject3); auto pType3 = dynamic_cast<vcl::filter::PDFNameElement*>( - pObject3->Lookup("Type")); + pObject3->Lookup("Type"_ostr)); if (pType3 && pType3->GetValue() == "StructElem") { auto pS3 = dynamic_cast<vcl::filter::PDFNameElement*>( - pObject3->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Figure"), pS3->GetValue()); + pObject3->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Figure"_ostr, pS3->GetValue()); auto pAlt = dynamic_cast<vcl::filter::PDFHexStringElement*>( - pObject3->Lookup("Alt")); + pObject3->Lookup("Alt"_ostr)); CPPUNIT_ASSERT_EQUAL( OUString("Picture of apples"), ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAlt)); auto pKids3 = dynamic_cast<vcl::filter::PDFArrayElement*>( - pObject3->Lookup("K")); + pObject3->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKids3); // the problem was that this didn't reference an MCID CPPUNIT_ASSERT(!pKids3->GetElements().empty()); @@ -3434,7 +3483,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMediaShapeAnnot) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); // There should be one annotation @@ -3446,36 +3495,36 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMediaShapeAnnot) vcl::filter::PDFObjectElement* pAnnot = pAnnotReference->LookupObject(); CPPUNIT_ASSERT(pAnnot); CPPUNIT_ASSERT_EQUAL( - OString("Annot"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"))->GetValue()); + "Annot"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr))->GetValue()); CPPUNIT_ASSERT_EQUAL( - OString("Screen"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"))->GetValue()); + "Screen"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr))->GetValue()); - auto pA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A")); + auto pA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A"_ostr)); CPPUNIT_ASSERT(pA); - auto pR = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pA->LookupElement("R")); + auto pR = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pA->LookupElement("R"_ostr)); CPPUNIT_ASSERT(pR); - auto pC = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pR->LookupElement("C")); + auto pC = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pR->LookupElement("C"_ostr)); CPPUNIT_ASSERT(pC); - auto pCT = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pC->LookupElement("CT")); - CPPUNIT_ASSERT_EQUAL(OString("video/webm"), pCT->GetValue()); - auto pD = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pC->LookupElement("D")); + auto pCT = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pC->LookupElement("CT"_ostr)); + CPPUNIT_ASSERT_EQUAL("video/webm"_ostr, pCT->GetValue()); + auto pD = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pC->LookupElement("D"_ostr)); CPPUNIT_ASSERT(pD); - auto pDesc = dynamic_cast<vcl::filter::PDFHexStringElement*>(pD->LookupElement("Desc")); + auto pDesc = dynamic_cast<vcl::filter::PDFHexStringElement*>(pD->LookupElement("Desc"_ostr)); CPPUNIT_ASSERT(pDesc); CPPUNIT_ASSERT_EQUAL(OUString("alternativloser text\nand some description"), ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pDesc)); - auto pAlt = dynamic_cast<vcl::filter::PDFArrayElement*>(pC->LookupElement("Alt")); + auto pAlt = dynamic_cast<vcl::filter::PDFArrayElement*>(pC->LookupElement("Alt"_ostr)); CPPUNIT_ASSERT(pAlt); auto pLang = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pAlt->GetElement(0)); - CPPUNIT_ASSERT_EQUAL(OString(""), pLang->GetValue()); + CPPUNIT_ASSERT_EQUAL(""_ostr, pLang->GetValue()); auto pAltText = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAlt->GetElement(1)); CPPUNIT_ASSERT_EQUAL(OUString("alternativloser text\nand some description"), ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAltText)); auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); vcl::filter::PDFReferenceElement* pStructElemRef(nullptr); @@ -3487,16 +3536,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMediaShapeAnnot) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructTreeRoot") { ++nRoots; - auto pParentTree - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject1->Lookup("ParentTree")); + auto pParentTree = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject1->Lookup("ParentTree"_ostr)); CPPUNIT_ASSERT(pParentTree); auto pNumTree = pParentTree->LookupObject(); CPPUNIT_ASSERT(pNumTree); - auto pNums = dynamic_cast<vcl::filter::PDFArrayElement*>(pNumTree->Lookup("Nums")); + auto pNums = dynamic_cast<vcl::filter::PDFArrayElement*>(pNumTree->Lookup("Nums"_ostr)); CPPUNIT_ASSERT(pNums); auto nFound(0); for (size_t i = 0; i < pNums->GetElements().size(); i += 2) @@ -3521,14 +3570,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMediaShapeAnnot) auto pStructElem(pStructElemRef->LookupObject()); CPPUNIT_ASSERT(pStructElem); - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType->GetValue()); - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pS->GetValue()); - auto pSEAlt = dynamic_cast<vcl::filter::PDFHexStringElement*>(pStructElem->Lookup("Alt")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType->GetValue()); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pS->GetValue()); + auto pSEAlt = dynamic_cast<vcl::filter::PDFHexStringElement*>(pStructElem->Lookup("Alt"_ostr)); CPPUNIT_ASSERT_EQUAL(OUString("alternativloser text - and some description"), ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pSEAlt)); - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pStructElem->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pStructElem->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -3542,10 +3591,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testMediaShapeAnnot) if (pObjR) { ++nRef; - auto pOType = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); + auto pOType + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj"_ostr)); CPPUNIT_ASSERT_EQUAL(pAnnot, pAnnotRef->LookupObject()); } } @@ -3572,7 +3622,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFlyFrameHyperlinkAnnot) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); // There should be one annotation @@ -3584,18 +3634,19 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFlyFrameHyperlinkAnnot) vcl::filter::PDFObjectElement* pAnnot = pAnnotReference->LookupObject(); CPPUNIT_ASSERT(pAnnot); CPPUNIT_ASSERT_EQUAL( - OString("Annot"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"))->GetValue()); + "Annot"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr))->GetValue()); CPPUNIT_ASSERT_EQUAL( - OString("Link"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"))->GetValue()); + "Link"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr))->GetValue()); - auto pContents = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + auto pContents + = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL(OUString("Image2"), ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pContents)); auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); vcl::filter::PDFReferenceElement* pStructElemRef(nullptr); @@ -3607,16 +3658,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFlyFrameHyperlinkAnnot) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructTreeRoot") { ++nRoots; - auto pParentTree - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject1->Lookup("ParentTree")); + auto pParentTree = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject1->Lookup("ParentTree"_ostr)); CPPUNIT_ASSERT(pParentTree); auto pNumTree = pParentTree->LookupObject(); CPPUNIT_ASSERT(pNumTree); - auto pNums = dynamic_cast<vcl::filter::PDFArrayElement*>(pNumTree->Lookup("Nums")); + auto pNums = dynamic_cast<vcl::filter::PDFArrayElement*>(pNumTree->Lookup("Nums"_ostr)); CPPUNIT_ASSERT(pNums); auto nFound(0); for (size_t i = 0; i < pNums->GetElements().size(); i += 2) @@ -3641,11 +3692,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFlyFrameHyperlinkAnnot) auto pStructElem(pStructElemRef->LookupObject()); CPPUNIT_ASSERT(pStructElem); - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType->GetValue()); - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pS->GetValue()); - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pStructElem->Lookup("K")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType->GetValue()); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pS->GetValue()); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pStructElem->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -3659,10 +3710,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFlyFrameHyperlinkAnnot) if (pObjR) { ++nRef; - auto pOType = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); + auto pOType + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj"_ostr)); CPPUNIT_ASSERT_EQUAL(pAnnot, pAnnotRef->LookupObject()); } } @@ -3670,15 +3722,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFlyFrameHyperlinkAnnot) CPPUNIT_ASSERT_EQUAL(static_cast<decltype(nRef)>(1), nRef); // the Link is inside a Figure - auto pParentRef = dynamic_cast<vcl::filter::PDFReferenceElement*>(pStructElem->Lookup("P")); + auto pParentRef + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pStructElem->Lookup("P"_ostr)); CPPUNIT_ASSERT(pParentRef); auto pParent(pParentRef->LookupObject()); CPPUNIT_ASSERT(pParent); - auto pParentType = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pParentType->GetValue()); - auto pParentS = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Figure"), pParentS->GetValue()); - auto pAlt = dynamic_cast<vcl::filter::PDFHexStringElement*>(pParent->Lookup("Alt")); + auto pParentType = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pParentType->GetValue()); + auto pParentS = dynamic_cast<vcl::filter::PDFNameElement*>(pParent->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Figure"_ostr, pParentS->GetValue()); + auto pAlt = dynamic_cast<vcl::filter::PDFHexStringElement*>(pParent->Lookup("Alt"_ostr)); CPPUNIT_ASSERT_EQUAL(OUString("Ship drawing - Very cute"), ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAlt)); } @@ -3702,7 +3755,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormControlAnnot) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); // There should be one annotation @@ -3714,21 +3767,21 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormControlAnnot) vcl::filter::PDFObjectElement* pAnnot = pAnnotReference->LookupObject(); CPPUNIT_ASSERT(pAnnot); CPPUNIT_ASSERT_EQUAL( - OString("Annot"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"))->GetValue()); + "Annot"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr))->GetValue()); CPPUNIT_ASSERT_EQUAL( - OString("Widget"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"))->GetValue()); - auto pT = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pAnnot->Lookup("T")); + "Widget"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr))->GetValue()); + auto pT = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pAnnot->Lookup("T"_ostr)); CPPUNIT_ASSERT(pT); - CPPUNIT_ASSERT_EQUAL(OString("Check Box 1"), pT->GetValue()); - auto pTU = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("TU")); + CPPUNIT_ASSERT_EQUAL("Check Box 1"_ostr, pT->GetValue()); + auto pTU = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("TU"_ostr)); CPPUNIT_ASSERT(pTU); CPPUNIT_ASSERT_EQUAL(OUString("helpful text"), ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pTU)); auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); vcl::filter::PDFReferenceElement* pStructElemRef(nullptr); @@ -3740,16 +3793,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormControlAnnot) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructTreeRoot") { ++nRoots; - auto pParentTree - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject1->Lookup("ParentTree")); + auto pParentTree = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject1->Lookup("ParentTree"_ostr)); CPPUNIT_ASSERT(pParentTree); auto pNumTree = pParentTree->LookupObject(); CPPUNIT_ASSERT(pNumTree); - auto pNums = dynamic_cast<vcl::filter::PDFArrayElement*>(pNumTree->Lookup("Nums")); + auto pNums = dynamic_cast<vcl::filter::PDFArrayElement*>(pNumTree->Lookup("Nums"_ostr)); CPPUNIT_ASSERT(pNums); auto nFound(0); for (size_t i = 0; i < pNums->GetElements().size(); i += 2) @@ -3774,22 +3827,22 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormControlAnnot) auto pStructElem(pStructElemRef->LookupObject()); CPPUNIT_ASSERT(pStructElem); - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pType->GetValue()); - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pS->GetValue()); - auto pAlt = dynamic_cast<vcl::filter::PDFHexStringElement*>(pStructElem->Lookup("Alt")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pType->GetValue()); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pStructElem->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pS->GetValue()); + auto pAlt = dynamic_cast<vcl::filter::PDFHexStringElement*>(pStructElem->Lookup("Alt"_ostr)); CPPUNIT_ASSERT_EQUAL(OUString("textuelle alternative - a box to check"), ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAlt)); - auto pA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pStructElem->Lookup("A")); + auto pA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pStructElem->Lookup("A"_ostr)); CPPUNIT_ASSERT(pA); - auto pO = dynamic_cast<vcl::filter::PDFNameElement*>(pA->LookupElement("O")); + auto pO = dynamic_cast<vcl::filter::PDFNameElement*>(pA->LookupElement("O"_ostr)); CPPUNIT_ASSERT(pO); - CPPUNIT_ASSERT_EQUAL(OString("PrintField"), pO->GetValue()); - auto pRole = dynamic_cast<vcl::filter::PDFNameElement*>(pA->LookupElement("Role")); + CPPUNIT_ASSERT_EQUAL("PrintField"_ostr, pO->GetValue()); + auto pRole = dynamic_cast<vcl::filter::PDFNameElement*>(pA->LookupElement("Role"_ostr)); CPPUNIT_ASSERT(pRole); - CPPUNIT_ASSERT_EQUAL(OString("cb"), pRole->GetValue()); - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pStructElem->Lookup("K")); + CPPUNIT_ASSERT_EQUAL("cb"_ostr, pRole->GetValue()); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pStructElem->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -3803,10 +3856,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormControlAnnot) if (pObjR) { ++nRef; - auto pOType = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); + auto pOType + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj"_ostr)); CPPUNIT_ASSERT_EQUAL(pAnnot, pAnnotRef->LookupObject()); } } @@ -3839,7 +3893,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf142129) CPPUNIT_ASSERT(pCatalog); auto* pCatalogDictionary = pCatalog->GetDictionary(); CPPUNIT_ASSERT(pCatalogDictionary); - auto* pOutlinesObject = pCatalogDictionary->LookupObject("Outlines"); + auto* pOutlinesObject = pCatalogDictionary->LookupObject("Outlines"_ostr); CPPUNIT_ASSERT(pOutlinesObject); auto* pOutlinesDictionary = pOutlinesObject->GetDictionary(); #if 0 @@ -3851,52 +3905,52 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf142129) #endif auto* pFirst = dynamic_cast<vcl::filter::PDFReferenceElement*>( - pOutlinesDictionary->LookupElement("First")); + pOutlinesDictionary->LookupElement("First"_ostr)); CPPUNIT_ASSERT(pFirst); auto* pFirstD = pFirst->LookupObject()->GetDictionary(); CPPUNIT_ASSERT(pFirstD); //CPPUNIT_ASSERT_EQUAL(OString("Outlines"), dynamic_cast<vcl::filter::PDFNameElement*>(pFirstD->LookupElement("Type"))->GetValue()); CPPUNIT_ASSERT_EQUAL(u"Preface"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( *dynamic_cast<vcl::filter::PDFHexStringElement*>( - pFirstD->LookupElement("Title")))); + pFirstD->LookupElement("Title"_ostr)))); auto* pFirst1 - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFirstD->LookupElement("First")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFirstD->LookupElement("First"_ostr)); CPPUNIT_ASSERT(pFirst1); auto* pFirst1D = pFirst1->LookupObject()->GetDictionary(); CPPUNIT_ASSERT(pFirst1D); // here is a hidden section with headings "Copyright" etc.; check that // there are no outline entries for it //CPPUNIT_ASSERT_EQUAL(OString("Outlines"), dynamic_cast<vcl::filter::PDFNameElement*>(pFirst1D->LookupElement("Type"))->GetValue()); - CPPUNIT_ASSERT_EQUAL( - u"Who is this book for?"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast<vcl::filter::PDFHexStringElement*>(pFirst1D->LookupElement("Title")))); + CPPUNIT_ASSERT_EQUAL(u"Who is this book for?"_ustr, + ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( + *dynamic_cast<vcl::filter::PDFHexStringElement*>( + pFirst1D->LookupElement("Title"_ostr)))); auto* pFirst2 - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFirst1D->LookupElement("Next")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFirst1D->LookupElement("Next"_ostr)); auto* pFirst2D = pFirst2->LookupObject()->GetDictionary(); CPPUNIT_ASSERT(pFirst2D); //CPPUNIT_ASSERT_EQUAL(OString("Outlines"), dynamic_cast<vcl::filter::PDFNameElement*>(pFirst2D->LookupElement("Type"))->GetValue()); - CPPUNIT_ASSERT_EQUAL( - u"What\u2019s in this book?"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast<vcl::filter::PDFHexStringElement*>(pFirst2D->LookupElement("Title")))); + CPPUNIT_ASSERT_EQUAL(u"What\u2019s in this book?"_ustr, + ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( + *dynamic_cast<vcl::filter::PDFHexStringElement*>( + pFirst2D->LookupElement("Title"_ostr)))); auto* pFirst3 - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFirst2D->LookupElement("Next")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFirst2D->LookupElement("Next"_ostr)); auto* pFirst3D = pFirst3->LookupObject()->GetDictionary(); CPPUNIT_ASSERT(pFirst3D); //CPPUNIT_ASSERT_EQUAL(OString("Outlines"), dynamic_cast<vcl::filter::PDFNameElement*>(pFirst3D->LookupElement("Type"))->GetValue()); - CPPUNIT_ASSERT_EQUAL( - u"Minimum requirements for using LibreOffice"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast<vcl::filter::PDFHexStringElement*>(pFirst3D->LookupElement("Title")))); + CPPUNIT_ASSERT_EQUAL(u"Minimum requirements for using LibreOffice"_ustr, + ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( + *dynamic_cast<vcl::filter::PDFHexStringElement*>( + pFirst3D->LookupElement("Title"_ostr)))); CPPUNIT_ASSERT_EQUAL(static_cast<vcl::filter::PDFElement*>(nullptr), - pFirst3D->LookupElement("Next")); + pFirst3D->LookupElement("Next"_ostr)); CPPUNIT_ASSERT_EQUAL(static_cast<vcl::filter::PDFElement*>(nullptr), - pFirstD->LookupElement("Next")); + pFirstD->LookupElement("Next"_ostr)); } CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfImageRotate180) @@ -4099,29 +4153,29 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testURIs) bool relativeFsys; } URIs[] = { { "http://example.com/", - "http://example.com/", + "http://example.com/"_ostr, true, }, { "file://localfile.odt/", - "file://localfile.odt/", + "file://localfile.odt/"_ostr, true, }, { // tdf 143216 "http://username:password@example.com", - "http://username:password@example.com", + "http://username:password@example.com"_ostr, true, }, { "git://git.example.org/project/example", - "git://git.example.org/project/example", + "git://git.example.org/project/example"_ostr, true, }, { // The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' "filebypath.odt", - "filebypath.pdf", + "filebypath.pdf"_ostr, true, }, { @@ -4135,7 +4189,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testURIs) { // This also gets made relative due to 'ExportLinksRelativeFsys' utl::GetTempNameBaseDirectory() + "fileintempdir.odt", - "fileintempdir.pdf", + "fileintempdir.pdf"_ostr, true, } }; @@ -4183,7 +4237,8 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testURIs) // The document has one page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots + = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); // There should be one annotation @@ -4195,15 +4250,15 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testURIs) CPPUNIT_ASSERT(pAnnot); // We're expecting something like /Type /Annot /A << /Type /Action /S /URI /URI (path) CPPUNIT_ASSERT_EQUAL( - OString("Annot"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"))->GetValue()); + "Annot"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr))->GetValue()); CPPUNIT_ASSERT_EQUAL( - OString("Link"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"))->GetValue()); - auto pAction = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A")); + "Link"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr))->GetValue()); + auto pAction = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAction); - auto pURIElem - = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pAction->LookupElement("URI")); + auto pURIElem = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( + pAction->LookupElement("URI"_ostr)); CPPUNIT_ASSERT(pURIElem); // Check it matches CPPUNIT_ASSERT_EQUAL(URIs[i].out, pURIElem->GetValue()); @@ -4211,7 +4266,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testURIs) CPPUNIT_ASSERT_EQUAL( OUString("Test pdf"), ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")))); + *dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents"_ostr)))); } } @@ -4262,7 +4317,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testPdfImageEncryption) xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); // Then make sure that the image is not lost: - std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport("secret"); + std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport("secret"_ostr); CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount()); std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0); CPPUNIT_ASSERT(pPdfPage); @@ -4408,11 +4463,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testRexportRefToKids) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(size_t(5), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); // Without the fix LookupObject for all /Im's will fail. @@ -4449,9 +4504,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testRexportFilterSingletonArray) auto pInnerIm = aDocument.LookupObject(5); CPPUNIT_ASSERT(pInnerIm); - auto pFilter = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerIm->Lookup("Filter")); + auto pFilter = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerIm->Lookup("Filter"_ostr)); CPPUNIT_ASSERT(pFilter); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Filter must be FlateDecode", OString("FlateDecode"), + CPPUNIT_ASSERT_EQUAL_MESSAGE("Filter must be FlateDecode", "FlateDecode"_ostr, pFilter->GetValue()); vcl::filter::PDFStreamElement* pStream = pInnerIm->GetStream(); @@ -4469,7 +4524,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testRexportFilterSingletonArray) // hence one decompression will not yield the "re" expressions. auto pStart = static_cast<const char*>(aUncompressed.GetData()); const char* pEnd = pStart + aUncompressed.GetSize(); - OString aImage = "100 0 30 50 re B*\n70 67 50 30 re B*\n"; + OString aImage = "100 0 30 50 re B*\n70 67 50 30 re B*\n"_ostr; auto it = std::search(pStart, pEnd, aImage.getStr(), aImage.getStr() + aImage.getLength()); CPPUNIT_ASSERT(it != pEnd); } @@ -4502,7 +4557,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testRexportMediaBoxOrigin) constexpr sal_Int32 aOrigin[2] = { -800, -600 }; sal_Int32 aSize[2] = { 0, 0 }; - auto pBBox = dynamic_cast<vcl::filter::PDFArrayElement*>(pInnerIm->Lookup("BBox")); + auto pBBox = dynamic_cast<vcl::filter::PDFArrayElement*>(pInnerIm->Lookup("BBox"_ostr)); CPPUNIT_ASSERT(pBBox); const auto& rElements2 = pBBox->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements2.size()); @@ -4516,7 +4571,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testRexportMediaBoxOrigin) aSize[nIdx - 2] = static_cast<sal_Int32>(pNumElement->GetValue()) - aOrigin[nIdx - 2]; } - auto pMatrix = dynamic_cast<vcl::filter::PDFArrayElement*>(pInnerIm->Lookup("Matrix")); + auto pMatrix = dynamic_cast<vcl::filter::PDFArrayElement*>(pInnerIm->Lookup("Matrix"_ostr)); CPPUNIT_ASSERT(pMatrix); const auto& rElements = pMatrix->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(6), rElements.size()); @@ -4561,23 +4616,23 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testRexportResourceItemReference) CPPUNIT_ASSERT(pInnerIm); auto pResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pInnerIm->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pInnerIm->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pResources); auto pFontsReference - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pResources->LookupElement("Font")); + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pResources->LookupElement("Font"_ostr)); CPPUNIT_ASSERT(pFontsReference); auto pFontsObject = pFontsReference->LookupObject(); CPPUNIT_ASSERT(pFontsObject); auto pFontDict - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pFontsObject->Lookup("FF132")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pFontsObject->Lookup("FF132"_ostr)); CPPUNIT_ASSERT(pFontDict); - auto pFontDescriptor = pFontDict->LookupObject("FontDescriptor"); + auto pFontDescriptor = pFontDict->LookupObject("FontDescriptor"_ostr); CPPUNIT_ASSERT(pFontDescriptor); - auto pFontWidths = pFontDict->LookupObject("Widths"); + auto pFontWidths = pFontDict->LookupObject("Widths"_ostr); CPPUNIT_ASSERT(pFontWidths); } @@ -4604,7 +4659,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf152246) { 56.699, 652.501, 131.401, 666.299 } }; // Get page annotations. - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), pAnnots->GetElements().size()); for (sal_Int32 i = 0; i < 5; ++i) @@ -4615,13 +4670,13 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf152246) vcl::filter::PDFObjectElement* pAnnot = pAnnotReference->LookupObject(); CPPUNIT_ASSERT(pAnnot); CPPUNIT_ASSERT_EQUAL( - OString("Annot"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"))->GetValue()); + "Annot"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr))->GetValue()); CPPUNIT_ASSERT_EQUAL( - OString("Widget"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"))->GetValue()); + "Widget"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr))->GetValue()); - auto pRect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pRect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pRect); const auto& rElements = pRect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -4648,16 +4703,17 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf155161) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { - auto pSubtype = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Subtype")); + auto pSubtype + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Type3"), pSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Type3"_ostr, pSubtype->GetValue()); - auto pName = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Name")); + auto pName = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Name"_ostr)); CPPUNIT_ASSERT(pName); - CPPUNIT_ASSERT_EQUAL(OString("Cantarell-Regular"), pName->GetValue()); + CPPUNIT_ASSERT_EQUAL("Cantarell-Regular"_ostr, pName->GetValue()); nFonts++; } diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 2f1ccfd9ecef..92b7b71f408e 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -362,24 +362,24 @@ xmlDocUniquePtr SvmTest::dumpMeta(const GDIMetaFile& rMetaFile) void SvmTest::checkVirtualDevice(const xmlDocUniquePtr& pDoc) { - assertXPath(pDoc, "/metafile/linecolor[1]", "color", "#000000"); - assertXPath(pDoc, "/metafile/fillcolor[1]", "color", "#ffffff"); + assertXPath(pDoc, "/metafile/linecolor[1]"_ostr, "color"_ostr, "#000000"); + assertXPath(pDoc, "/metafile/fillcolor[1]"_ostr, "color"_ostr, "#ffffff"); - assertXPathAttrs(pDoc, "/metafile/rect[1]", { + assertXPathAttrs(pDoc, "/metafile/rect[1]"_ostr, { {"left", "0"}, {"top", "0"}, {"right", "9"}, {"bottom", "9"} }); - assertXPath(pDoc, "/metafile/linecolor[2]", "color", "#000000"); - assertXPath(pDoc, "/metafile/fillcolor[2]", "color", "#ffffff"); + assertXPath(pDoc, "/metafile/linecolor[2]"_ostr, "color"_ostr, "#000000"); + assertXPath(pDoc, "/metafile/fillcolor[2]"_ostr, "color"_ostr, "#ffffff"); } void SvmTest::checkErase(const xmlDocUniquePtr& pDoc) { - assertXPath(pDoc, "/metafile/linecolor[3]", "color", "#000000"); - assertXPath(pDoc, "/metafile/fillcolor[3]", "color", "#ff0000"); + assertXPath(pDoc, "/metafile/linecolor[3]"_ostr, "color"_ostr, "#000000"); + assertXPath(pDoc, "/metafile/fillcolor[3]"_ostr, "color"_ostr, "#ff0000"); - assertXPathAttrs(pDoc, "/metafile/rect[2]", { + assertXPathAttrs(pDoc, "/metafile/rect[2]"_ostr, { {"left", "0"}, {"top", "0"}, {"right", "9"}, {"bottom", "9"} }); @@ -389,11 +389,11 @@ void SvmTest::checkPixel(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/pixel[1]", { + assertXPathAttrs(pDoc, "/metafile/pixel[1]"_ostr, { {"x", "8"}, {"y", "1"}, {"color", "#008000"}, }); - assertXPathAttrs(pDoc, "/metafile/pixel[2]", { + assertXPathAttrs(pDoc, "/metafile/pixel[2]"_ostr, { {"x", "1"}, {"y", "8"}, {"color", "#000080"}, }); } @@ -415,7 +415,7 @@ void SvmTest::checkPoint(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/point[1]", { + assertXPathAttrs(pDoc, "/metafile/point[1]"_ostr, { {"x", "4"}, {"y", "4"} }); } @@ -436,12 +436,12 @@ void SvmTest::checkLine(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/line[1]", { + assertXPathAttrs(pDoc, "/metafile/line[1]"_ostr, { {"startx", "1"}, {"starty", "1"}, {"endx", "8"}, {"endy", "8"}, }); - assertXPathAttrs(pDoc, "/metafile/line[1]", { + assertXPathAttrs(pDoc, "/metafile/line[1]"_ostr, { {"style", "solid"}, {"width", "0"}, {"dashlen", "0"}, {"dashcount", "0"}, {"dotlen", "0"}, {"dotcount", "0"}, @@ -449,12 +449,12 @@ void SvmTest::checkLine(const GDIMetaFile& rMetaFile) {"join", "round"}, {"cap", "butt"} }); - assertXPathAttrs(pDoc, "/metafile/line[2]", { + assertXPathAttrs(pDoc, "/metafile/line[2]"_ostr, { {"startx", "1"}, {"starty", "8"}, {"endx", "8"}, {"endy", "1"}, }); - assertXPathAttrs(pDoc, "/metafile/line[2]", { + assertXPathAttrs(pDoc, "/metafile/line[2]"_ostr, { {"style", "dash"}, {"width", "7"}, {"dashlen", "5"}, {"dashcount", "4"}, {"dotlen", "3"}, {"dotcount", "2"}, @@ -489,10 +489,10 @@ void SvmTest::checkRect(const GDIMetaFile& rMetaFile) xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); - assertXPathAttrs(pDoc, "/metafile/rect[3]", { + assertXPathAttrs(pDoc, "/metafile/rect[3]"_ostr, { {"left", "1"}, {"top", "2"}, {"right", "4"}, {"bottom", "5"}, }); @@ -517,10 +517,10 @@ void SvmTest::checkRoundRect(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); - assertXPathAttrs(pDoc, "/metafile/roundrect[1]", { + assertXPathAttrs(pDoc, "/metafile/roundrect[1]"_ostr, { {"left", "1"}, {"top", "2"}, {"right", "4"}, {"bottom", "5"}, {"horizontalround", "1"}, {"verticalround", "2"} @@ -546,10 +546,10 @@ void SvmTest::checkEllipse(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); - assertXPathAttrs(pDoc, "/metafile/ellipse[1]", { + assertXPathAttrs(pDoc, "/metafile/ellipse[1]"_ostr, { {"left", "1"}, {"top", "2"}, {"right", "4"}, {"bottom", "5"}, }); @@ -574,10 +574,10 @@ void SvmTest::checkArc(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); - assertXPathAttrs(pDoc, "/metafile/arc[1]", { + assertXPathAttrs(pDoc, "/metafile/arc[1]"_ostr, { {"left", "1"}, {"top", "2"}, {"right", "4"}, {"bottom", "5"}, @@ -605,10 +605,10 @@ void SvmTest::checkPie(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); - assertXPathAttrs(pDoc, "/metafile/pie[1]", { + assertXPathAttrs(pDoc, "/metafile/pie[1]"_ostr, { {"left", "11"}, {"top", "12"}, {"right", "14"}, {"bottom", "15"}, @@ -636,10 +636,10 @@ void SvmTest::checkChord(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPath(pDoc, "/metafile/linecolor[5]", "color", "#123456"); - assertXPath(pDoc, "/metafile/fillcolor[5]", "color", "#654321"); + assertXPath(pDoc, "/metafile/linecolor[5]"_ostr, "color"_ostr, "#123456"); + assertXPath(pDoc, "/metafile/fillcolor[5]"_ostr, "color"_ostr, "#654321"); - assertXPathAttrs(pDoc, "/metafile/chord[1]", { + assertXPathAttrs(pDoc, "/metafile/chord[1]"_ostr, { {"left", "21"}, {"top", "22"}, {"right", "24"}, {"bottom", "25"}, @@ -667,7 +667,7 @@ void SvmTest::checkPolyLine(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/polyline[1]", { + assertXPathAttrs(pDoc, "/metafile/polyline[1]"_ostr, { {"style", "solid"}, {"width", "0"}, {"dashlen", "0"}, {"dashcount", "0"}, {"dotlen", "0"}, {"dotcount", "0"}, @@ -675,21 +675,21 @@ void SvmTest::checkPolyLine(const GDIMetaFile& rMetaFile) {"join", "round"}, {"cap", "butt"} }); - assertXPathAttrs(pDoc, "/metafile/polyline[1]/point[1]", {{"x", "1"}, {"y", "8"}}); - assertXPathAttrs(pDoc, "/metafile/polyline[1]/point[2]", {{"x", "2"}, {"y", "7"}}); - assertXPathAttrs(pDoc, "/metafile/polyline[1]/point[3]", {{"x", "3"}, {"y", "6"}}); + assertXPathAttrs(pDoc, "/metafile/polyline[1]/point[1]"_ostr, {{"x", "1"}, {"y", "8"}}); + assertXPathAttrs(pDoc, "/metafile/polyline[1]/point[2]"_ostr, {{"x", "2"}, {"y", "7"}}); + assertXPathAttrs(pDoc, "/metafile/polyline[1]/point[3]"_ostr, {{"x", "3"}, {"y", "6"}}); - assertXPathAttrs(pDoc, "/metafile/polyline[2]", { + assertXPathAttrs(pDoc, "/metafile/polyline[2]"_ostr, { {"style", "dash"}, {"width", "7"}, {"dashlen", "5"}, {"dashcount", "4"}, {"dotlen", "3"}, {"dotcount", "2"}, {"distance", "1"}, {"join", "miter"}, {"cap", "round"} }); - assertXPathAttrs(pDoc, "/metafile/polyline[2]/point[1]", {{"x", "8"}, {"y", "1"}, {"flags", "normal"}}); - assertXPathAttrs(pDoc, "/metafile/polyline[2]/point[2]", {{"x", "7"}, {"y", "2"}, {"flags", "control"}}); - assertXPathAttrs(pDoc, "/metafile/polyline[2]/point[3]", {{"x", "6"}, {"y", "3"}, {"flags", "smooth"}}); - assertXPathAttrs(pDoc, "/metafile/polyline[2]/point[4]", {{"x", "5"}, {"y", "4"}, {"flags", "symmetric"}}); + assertXPathAttrs(pDoc, "/metafile/polyline[2]/point[1]"_ostr, {{"x", "8"}, {"y", "1"}, {"flags", "normal"}}); + assertXPathAttrs(pDoc, "/metafile/polyline[2]/point[2]"_ostr, {{"x", "7"}, {"y", "2"}, {"flags", "control"}}); + assertXPathAttrs(pDoc, "/metafile/polyline[2]/point[3]"_ostr, {{"x", "6"}, {"y", "3"}, {"flags", "smooth"}}); + assertXPathAttrs(pDoc, "/metafile/polyline[2]/point[4]"_ostr, {{"x", "5"}, {"y", "4"}, {"flags", "symmetric"}}); } void SvmTest::testPolyLine() @@ -735,14 +735,14 @@ void SvmTest::checkPolygon(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/polygon[1]/point[1]", {{"x", "1"}, {"y", "8"}}); - assertXPathAttrs(pDoc, "/metafile/polygon[1]/point[2]", {{"x", "2"}, {"y", "7"}}); - assertXPathAttrs(pDoc, "/metafile/polygon[1]/point[3]", {{"x", "3"}, {"y", "6"}}); + assertXPathAttrs(pDoc, "/metafile/polygon[1]/point[1]"_ostr, {{"x", "1"}, {"y", "8"}}); + assertXPathAttrs(pDoc, "/metafile/polygon[1]/point[2]"_ostr, {{"x", "2"}, {"y", "7"}}); + assertXPathAttrs(pDoc, "/metafile/polygon[1]/point[3]"_ostr, {{"x", "3"}, {"y", "6"}}); - assertXPathAttrs(pDoc, "/metafile/polygon[2]/point[1]", {{"x", "8"}, {"y", "1"}, {"flags", "normal"}}); - assertXPathAttrs(pDoc, "/metafile/polygon[2]/point[2]", {{"x", "7"}, {"y", "2"}, {"flags", "control"}}); - assertXPathAttrs(pDoc, "/metafile/polygon[2]/point[3]", {{"x", "6"}, {"y", "3"}, {"flags", "smooth"}}); - assertXPathAttrs(pDoc, "/metafile/polygon[2]/point[4]", {{"x", "5"}, {"y", "4"}, {"flags", "symmetric"}}); + assertXPathAttrs(pDoc, "/metafile/polygon[2]/point[1]"_ostr, {{"x", "8"}, {"y", "1"}, {"flags", "normal"}}); + assertXPathAttrs(pDoc, "/metafile/polygon[2]/point[2]"_ostr, {{"x", "7"}, {"y", "2"}, {"flags", "control"}}); + assertXPathAttrs(pDoc, "/metafile/polygon[2]/point[3]"_ostr, {{"x", "6"}, {"y", "3"}, {"flags", "smooth"}}); + assertXPathAttrs(pDoc, "/metafile/polygon[2]/point[4]"_ostr, {{"x", "5"}, {"y", "4"}, {"flags", "symmetric"}}); } void SvmTest::testPolygon() @@ -779,14 +779,14 @@ void SvmTest::checkPolyPolygon(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[1]/point[1]", {{"x", "1"}, {"y", "8"}}); - assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[1]/point[2]", {{"x", "2"}, {"y", "7"}}); - assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[1]/point[3]", {{"x", "3"}, {"y", "6"}}); + assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[1]/point[1]"_ostr, {{"x", "1"}, {"y", "8"}}); + assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[1]/point[2]"_ostr, {{"x", "2"}, {"y", "7"}}); + assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[1]/point[3]"_ostr, {{"x", "3"}, {"y", "6"}}); - assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[2]/point[1]", {{"x", "8"}, {"y", "1"}, {"flags", "normal"}}); - assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[2]/point[2]", {{"x", "7"}, {"y", "2"}, {"flags", "control"}}); - assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[2]/point[3]", {{"x", "6"}, {"y", "3"}, {"flags", "smooth"}}); - assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[2]/point[4]", {{"x", "5"}, {"y", "4"}, {"flags", "symmetric"}}); + assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[2]/point[1]"_ostr, {{"x", "8"}, {"y", "1"}, {"flags", "normal"}}); + assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[2]/point[2]"_ostr, {{"x", "7"}, {"y", "2"}, {"flags", "control"}}); + assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[2]/point[3]"_ostr, {{"x", "6"}, {"y", "3"}, {"flags", "smooth"}}); + assertXPathAttrs(pDoc, "/metafile/polypolygon[1]/polygon[2]/point[4]"_ostr, {{"x", "5"}, {"y", "4"}, {"flags", "symmetric"}}); } void SvmTest::testPolyPolygon() @@ -825,11 +825,11 @@ void SvmTest::checkText(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/text[1]", { + assertXPathAttrs(pDoc, "/metafile/text[1]"_ostr, { {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "2"}, }); - assertXPathContent(pDoc, "/metafile/text[1]/textcontent", "xABC"); + assertXPathContent(pDoc, "/metafile/text[1]/textcontent"_ostr, "xABC"); } void SvmTest::testText() @@ -848,11 +848,11 @@ void SvmTest::checkTextArray(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/textarray[1]", { + assertXPathAttrs(pDoc, "/metafile/textarray[1]"_ostr, { {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"}, }); - assertXPathContent(pDoc, "/metafile/textarray[1]/dxarray", "15 20 25 "); - assertXPathContent(pDoc, "/metafile/textarray[1]/text", "123456"); + assertXPathContent(pDoc, "/metafile/textarray[1]/dxarray"_ostr, "15 20 25 "); + assertXPathContent(pDoc, "/metafile/textarray[1]/text"_ostr, "123456"); } void SvmTest::testTextArray() @@ -871,11 +871,11 @@ void SvmTest::checkstretchText(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/stretchtext[1]", { + assertXPathAttrs(pDoc, "/metafile/stretchtext[1]"_ostr, { {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"}, {"width", "10"} }); - assertXPathContent(pDoc, "/metafile/stretchtext[1]/textcontent", "123456"); + assertXPathContent(pDoc, "/metafile/stretchtext[1]/textcontent"_ostr, "123456"); } void SvmTest::teststretchText() @@ -893,11 +893,11 @@ void SvmTest::checkTextRect(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/textrect[1]", { + assertXPathAttrs(pDoc, "/metafile/textrect[1]"_ostr, { {"left", "0"}, {"top", "0"}, {"right", "4"}, {"bottom", "4"} }); - assertXPathContent(pDoc, "/metafile/textrect[1]/textcontent", "123456"); - assertXPathContent(pDoc, "/metafile/textrect[1]/style", "Center"); + assertXPathContent(pDoc, "/metafile/textrect[1]/textcontent"_ostr, "123456"); + assertXPathContent(pDoc, "/metafile/textrect[1]/style"_ostr, "Center"); } void SvmTest::testTextRect() @@ -915,7 +915,7 @@ void SvmTest::checkTextLine(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/textline[1]", { + assertXPathAttrs(pDoc, "/metafile/textline[1]"_ostr, { {"x", "4"}, {"y", "6"}, {"width", "10"}, {"strikeout", "single"}, {"underline", "single"}, {"overline", "single"} }); @@ -939,17 +939,17 @@ void SvmTest::checkBitmaps(const GDIMetaFile& rMetaFile) if (SkiaHelper::isVCLSkiaEnabled()) return; // TODO SKIA using CRCs is broken (the idea of it) - assertXPathAttrs(pDoc, "/metafile/bmp[1]", {{"x", "1"}, {"y", "2"}, {"crc", + assertXPathAttrs(pDoc, "/metafile/bmp[1]"_ostr, {{"x", "1"}, {"y", "2"}, {"crc", #if defined OSL_BIGENDIAN "5e01ddcc" #else "469f0820" #endif }}); - assertXPathAttrs(pDoc, "/metafile/bmpscale[1]", { + assertXPathAttrs(pDoc, "/metafile/bmpscale[1]"_ostr, { {"x", "1"}, {"y", "2"}, {"width", "3"}, {"height", "4"}, {"crc", "4937e32d"} }); - assertXPathAttrs(pDoc, "/metafile/bmpscalepart[1]", { + assertXPathAttrs(pDoc, "/metafile/bmpscalepart[1]"_ostr, { {"destx", "1"}, {"desty", "2"}, {"destwidth", "3"}, {"destheight", "4"}, {"srcx", "2"}, {"srcy", "1"}, {"srcwidth", "4"}, {"srcheight", "3"}, {"crc", @@ -1041,39 +1041,39 @@ void SvmTest::checkBitmapExs(const GDIMetaFile& rMetaFile, bool bIsSvmFile) "97e499b74104debf12f99a774a2c4edc914d8900", }; - assertXPathAttrs(pDoc, "/metafile/bmpex[1]", { + assertXPathAttrs(pDoc, "/metafile/bmpex[1]"_ostr, { {"x", "1"}, {"y", "1"}, {"crc", aExpectedCRC[0]}, {"transparenttype", "bitmap"}, {"contentchecksum", aExpectedContentChecksum[0]}, {"pixelformat", "24BPP"} }); - assertXPathAttrs(pDoc, "/metafile/bmpexscale[1]", { + assertXPathAttrs(pDoc, "/metafile/bmpexscale[1]"_ostr, { {"x", "5"}, {"y", "0"}, {"width", "2"}, {"height", "3"}, {"crc", aExpectedCRC[1]}, {"transparenttype", "bitmap"}, {"contentchecksum", aExpectedContentChecksum[1]}, {"pixelformat", "24BPP"} }); - assertXPathAttrs(pDoc, "/metafile/bmpexscalepart[1]", { + assertXPathAttrs(pDoc, "/metafile/bmpexscalepart[1]"_ostr, { {"destx", "7"}, {"desty", "1"}, {"destwidth", "2"}, {"destheight", "2"}, {"srcx", "0"}, {"srcy", "0"}, {"srcwidth", "3"}, {"srcheight", "4"}, {"crc", aExpectedCRC[2]}, {"transparenttype", "bitmap"}, {"contentchecksum", aExpectedContentChecksum[2]}, {"pixelformat", "24BPP"} }); #ifndef MACOSX - assertXPathAttrs(pDoc, "/metafile/bmpex[2]", { + assertXPathAttrs(pDoc, "/metafile/bmpex[2]"_ostr, { {"x", "6"}, {"y", "6"}, {"crc", aExpectedCRC[3]}, {"transparenttype", "bitmap"}, {"contentchecksum", aExpectedContentChecksum[3]} }); - assertXPathAttrs(pDoc, "/metafile/bmpex[3]", { + assertXPathAttrs(pDoc, "/metafile/bmpex[3]"_ostr, { {"x", "0"}, {"y", "6"}, {"transparenttype", "bitmap"}, {"contentchecksum", aExpectedContentChecksum[4]}, {"pixelformat", "8BPP"} }); if (!bIsSvmFile) { - assertXPathAttrs(pDoc, "/metafile/bmpex[3]", { + assertXPathAttrs(pDoc, "/metafile/bmpex[3]"_ostr, { {"crc", aExpectedCRC[4]} }); } - assertXPathAttrs(pDoc, "/metafile/bmpex[4]", { + assertXPathAttrs(pDoc, "/metafile/bmpex[4]"_ostr, { {"x", "2"}, {"y", "6"}, {"crc", aExpectedCRC[5]}, {"transparenttype", "bitmap"}, {"contentchecksum", aExpectedContentChecksum[5]}, {"pixelformat", "8BPP"} }); - assertXPathAttrs(pDoc, "/metafile/bmpex[5]", { + assertXPathAttrs(pDoc, "/metafile/bmpex[5]"_ostr, { {"x", "0"}, {"y", "8"}, {"crc", aExpectedCRC[6]}, {"transparenttype", "bitmap"}, {"contentchecksum", aExpectedContentChecksum[6]}, {"pixelformat", "8BPP"} }); - assertXPathAttrs(pDoc, "/metafile/bmpex[6]", { + assertXPathAttrs(pDoc, "/metafile/bmpex[6]"_ostr, { {"x", "2"}, {"y", "8"}, {"crc", aExpectedCRC[7]}, {"transparenttype", "bitmap"}, {"contentchecksum", aExpectedContentChecksum[7]}, {"pixelformat", "8BPP"} }); #else @@ -1192,15 +1192,15 @@ void SvmTest::checkMasks(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/mask[1]", { + assertXPathAttrs(pDoc, "/metafile/mask[1]"_ostr, { {"x", "1"}, {"y", "2"}, {"color", "#000000"} }); - assertXPathAttrs(pDoc, "/metafile/maskscale[1]", { + assertXPathAttrs(pDoc, "/metafile/maskscale[1]"_ostr, { {"x", "1"}, {"y", "2"}, {"width", "3"}, {"height", "4"}, {"color", "#000000"} }); - assertXPathAttrs(pDoc, "/metafile/maskscalepart[1]", { + assertXPathAttrs(pDoc, "/metafile/maskscalepart[1]"_ostr, { {"destx", "1"}, {"desty", "2"}, {"destwidth", "3"}, {"destheight", "4"}, {"srcx", "2"}, {"srcy", "1"}, {"srcwidth", "4"}, {"srcheight", "3"}, {"color", "#ff0000"} @@ -1244,7 +1244,7 @@ void SvmTest::checkGradient(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/gradient[1]", { + assertXPathAttrs(pDoc, "/metafile/gradient[1]"_ostr, { {"style", "Linear"}, {"startcolor", "#ffffff"}, {"endcolor", "#000000"}, @@ -1256,14 +1256,14 @@ void SvmTest::checkGradient(const GDIMetaFile& rMetaFile) {"endintensity", "100"}, {"steps", "0"}, }); - assertXPathAttrs(pDoc, "/metafile/gradient[1]/rectangle", { + assertXPathAttrs(pDoc, "/metafile/gradient[1]/rectangle"_ostr, { {"left", "1"}, {"top", "2"}, {"right", "4"}, {"bottom", "6"}, }); - assertXPathAttrs(pDoc, "/metafile/gradient[2]", { + assertXPathAttrs(pDoc, "/metafile/gradient[2]"_ostr, { {"style", "Radial"}, {"startcolor", "#ff0000"}, {"endcolor", "#00ff00"}, @@ -1275,7 +1275,7 @@ void SvmTest::checkGradient(const GDIMetaFile& rMetaFile) {"endintensity", "14"}, {"steps", "64"}, }); - assertXPathAttrs(pDoc, "/metafile/gradient[2]/rectangle", { + assertXPathAttrs(pDoc, "/metafile/gradient[2]/rectangle"_ostr, { {"left", "3"}, {"top", "4"}, {"right", "3"}, @@ -1317,7 +1317,7 @@ void SvmTest::checkGradientEx(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/gradientex[1]", { + assertXPathAttrs(pDoc, "/metafile/gradientex[1]"_ostr, { {"style", "Linear"}, {"startcolor", "#ffffff"}, {"endcolor", "#000000"}, @@ -1329,19 +1329,19 @@ void SvmTest::checkGradientEx(const GDIMetaFile& rMetaFile) {"endintensity", "100"}, {"steps", "0"} }); - assertXPathAttrs(pDoc, "/metafile/gradientex[1]/polygon/point[1]", { + assertXPathAttrs(pDoc, "/metafile/gradientex[1]/polygon/point[1]"_ostr, { {"x", "1"}, {"y", "8"} }); - assertXPathAttrs(pDoc, "/metafile/gradientex[1]/polygon/point[2]", { + assertXPathAttrs(pDoc, "/metafile/gradientex[1]/polygon/point[2]"_ostr, { {"x", "2"}, {"y", "7"} }); - assertXPathAttrs(pDoc, "/metafile/gradientex[1]/polygon/point[3]", { + assertXPathAttrs(pDoc, "/metafile/gradientex[1]/polygon/point[3]"_ostr, { {"x", "3"}, {"y", "6"} }); - assertXPathAttrs(pDoc, "/metafile/gradientex[2]", { + assertXPathAttrs(pDoc, "/metafile/gradientex[2]"_ostr, { {"style", "Axial"}, {"startcolor", "#ff00ff"}, {"endcolor", "#008080"}, @@ -1353,19 +1353,19 @@ void SvmTest::checkGradientEx(const GDIMetaFile& rMetaFile) {"endintensity", "14"}, {"steps", "64"} }); - assertXPathAttrs(pDoc, "/metafile/gradientex[2]/polygon[1]/point[1]", { + assertXPathAttrs(pDoc, "/metafile/gradientex[2]/polygon[1]/point[1]"_ostr, { {"x", "1"}, {"y", "2"} }); - assertXPathAttrs(pDoc, "/metafile/gradientex[2]/polygon[1]/point[2]", { + assertXPathAttrs(pDoc, "/metafile/gradientex[2]/polygon[1]/point[2]"_ostr, { {"x", "3"}, {"y", "4"} }); - assertXPathAttrs(pDoc, "/metafile/gradientex[2]/polygon[2]/point[1]", { + assertXPathAttrs(pDoc, "/metafile/gradientex[2]/polygon[2]/point[1]"_ostr, { {"x", "8"}, {"y", "9"} }); - assertXPathAttrs(pDoc, "/metafile/gradientex[2]/polygon[2]/point[2]", { + assertXPathAttrs(pDoc, "/metafile/gradientex[2]/polygon[2]/point[2]"_ostr, { {"x", "6"}, {"y", "7"} }); @@ -1421,17 +1421,17 @@ void SvmTest::checkHatch(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[1]", { + assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[1]"_ostr, { {"x", "1"}, {"y", "8"}, }); - assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[2]", { + assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[2]"_ostr, { {"x", "2"}, {"y", "7"}, }); - assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[3]", { + assertXPathAttrs(pDoc, "/metafile/hatch[1]/polygon/point[3]"_ostr, { {"x", "3"}, {"y", "6"}, }); - assertXPathAttrs(pDoc, "/metafile/hatch[1]/hatch", { + assertXPathAttrs(pDoc, "/metafile/hatch[1]/hatch"_ostr, { {"style", "Single"}, {"color", "#ffff00"}, {"distance", "15"}, @@ -1466,7 +1466,7 @@ void SvmTest::checkWallpaper(const GDIMetaFile& rMetaFile) xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); // Funny enough - we don't serialize the rectangle of the wallpaper so it's always EMPTY - assertXPathAttrs(pDoc, "/metafile/wallpaper[1]", + assertXPathAttrs(pDoc, "/metafile/wallpaper[1]"_ostr, { {"left", "0"}, {"top", "0"}, @@ -1474,7 +1474,7 @@ void SvmTest::checkWallpaper(const GDIMetaFile& rMetaFile) {"bottom", "empty"}, }); - assertXPathAttrs(pDoc, "/metafile/wallpaper[1]/wallpaper", + assertXPathAttrs(pDoc, "/metafile/wallpaper[1]/wallpaper"_ostr, { {"color", "#00ff00"}, {"style", "Tile"}, @@ -1500,69 +1500,69 @@ void SvmTest::checkClipRegion(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/clipregion[1]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[1]"_ostr, { {"left", "2"}, {"top", "2"}, {"right", "5"}, {"bottom", "5"}, }); - assertXPathAttrs(pDoc, "/metafile/clipregion[2]/polygon[1]/point[1]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[2]/polygon[1]/point[1]"_ostr, { {"x", "1"}, {"y", "8"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[2]/polygon[1]/point[2]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[2]/polygon[1]/point[2]"_ostr, { {"x", "2"}, {"y", "7"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[2]/polygon[1]/point[3]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[2]/polygon[1]/point[3]"_ostr, { {"x", "3"}, {"y", "6"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[1]/point[1]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[1]/point[1]"_ostr, { {"x", "1"}, {"y", "8"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[1]/point[2]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[1]/point[2]"_ostr, { {"x", "2"}, {"y", "7"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[1]/point[3]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[1]/point[3]"_ostr, { {"x", "3"}, {"y", "6"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[2]/point[1]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[2]/point[1]"_ostr, { {"x", "4"}, {"y", "9"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[2]/point[2]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[2]/point[2]"_ostr, { {"x", "5"}, {"y", "10"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[2]/point[3]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[3]/polygon[2]/point[3]"_ostr, { {"x", "6"}, {"y", "11"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[4]/polygon[1]/point[1]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[4]/polygon[1]/point[1]"_ostr, { {"x", "0"}, {"y", "1"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[4]/polygon[1]/point[2]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[4]/polygon[1]/point[2]"_ostr, { {"x", "2"}, {"y", "3"} }); - assertXPathAttrs(pDoc, "/metafile/clipregion[4]/polygon[1]/point[3]", { + assertXPathAttrs(pDoc, "/metafile/clipregion[4]/polygon[1]/point[3]"_ostr, { {"x", "4"}, {"y", "4"} }); @@ -1616,7 +1616,7 @@ void SvmTest::checkIntersectRectClipRegion(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[1]", { + assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[1]"_ostr, { {"left", "1"}, {"top", "2"}, {"right", "4"}, @@ -1643,21 +1643,21 @@ void SvmTest::checkIntersectRegionClipRegion(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[1]", { + assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[1]"_ostr, { {"left", "1"}, {"top", "2"}, {"right", "5"}, {"bottom", "6"} }); - assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[2]", { + assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[2]"_ostr, { {"left", "1"}, {"top", "2"}, {"right", "7"}, {"bottom", "8"} }); - assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[3]", { + assertXPathAttrs(pDoc, "/metafile/sectregionclipregion[3]"_ostr, { {"left", "0"}, {"top", "3"}, {"right", "2"}, @@ -1708,12 +1708,12 @@ void SvmTest::checkMoveClipRegion(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/moveclipregion[1]", { + assertXPathAttrs(pDoc, "/metafile/moveclipregion[1]"_ostr, { {"horzmove", "1"}, {"vertmove", "2"} }); - assertXPathAttrs(pDoc, "/metafile/moveclipregion[2]", { + assertXPathAttrs(pDoc, "/metafile/moveclipregion[2]"_ostr, { {"horzmove", "-3"}, {"vertmove", "-4"} }); @@ -1742,7 +1742,7 @@ void SvmTest::checkLineColor(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/push/linecolor[1]", { + assertXPathAttrs(pDoc, "/metafile/push/linecolor[1]"_ostr, { {"color", "#654321"}, }); } @@ -1765,7 +1765,7 @@ void SvmTest::checkFillColor(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/push/fillcolor[1]", { + assertXPathAttrs(pDoc, "/metafile/push/fillcolor[1]"_ostr, { {"color", "#456789"}, }); } @@ -1788,7 +1788,7 @@ void SvmTest::checkTextColor(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/textcolor[1]", { + assertXPathAttrs(pDoc, "/metafile/textcolor[1]"_ostr, { {"color", "#123456"}, }); } @@ -1809,7 +1809,7 @@ void SvmTest::checkTextFillColor(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/textfillcolor[1]", { + assertXPathAttrs(pDoc, "/metafile/textfillcolor[1]"_ostr, { {"color", "#234567"}, }); } @@ -1830,7 +1830,7 @@ void SvmTest::checkTextLineColor(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/textlinecolor[1]", { + assertXPathAttrs(pDoc, "/metafile/textlinecolor[1]"_ostr, { {"color", "#345678"}, }); } @@ -1851,7 +1851,7 @@ void SvmTest::checkOverLineColor(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/push/overlinecolor[1]", { + assertXPathAttrs(pDoc, "/metafile/push/overlinecolor[1]"_ostr, { {"color", "#345678"}, }); } @@ -1874,7 +1874,7 @@ void SvmTest::checkTextAlign(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/textalign[1]", { + assertXPathAttrs(pDoc, "/metafile/textalign[1]"_ostr, { {"align", "bottom"}, }); } @@ -1895,7 +1895,7 @@ void SvmTest::checkMapMode(const GDIMetaFile& rMetafile) { xmlDocUniquePtr pDoc = dumpMeta(rMetafile); - assertXPathAttrs(pDoc, "/metafile/mapmode[1]", { + assertXPathAttrs(pDoc, "/metafile/mapmode[1]"_ostr, { {"mapunit", "MapPixel"}, {"x", "0"}, {"y", "0"}, @@ -1903,7 +1903,7 @@ void SvmTest::checkMapMode(const GDIMetaFile& rMetafile) {"scaley", "(1/1)"} }); - assertXPathAttrs(pDoc, "/metafile/mapmode[2]", { + assertXPathAttrs(pDoc, "/metafile/mapmode[2]"_ostr, { {"mapunit", "Map100thInch"}, {"x", "0"}, {"y", "1"}, @@ -1911,7 +1911,7 @@ void SvmTest::checkMapMode(const GDIMetaFile& rMetafile) {"scaley", "(2/3)"} }); - assertXPathAttrs(pDoc, "/metafile/mapmode[3]", { + assertXPathAttrs(pDoc, "/metafile/mapmode[3]"_ostr, { {"mapunit", "MapRelative"}, {"x", "0"}, {"y", "-1"}, @@ -1950,7 +1950,7 @@ void SvmTest::testMapMode() void SvmTest::checkFont(const GDIMetaFile& rMetafile) { xmlDocUniquePtr pDoc = dumpMeta(rMetafile); - assertXPathAttrs(pDoc, "/metafile/font[1]", { + assertXPathAttrs(pDoc, "/metafile/font[1]"_ostr, { {"color", "#ffffff"}, {"fillcolor", "#ffffff"}, {"name", "Liberation Sans"}, @@ -1991,14 +1991,14 @@ void SvmTest::checkPushPop(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/push[1]", {{"flags", "PushAll"}}); - assertXPathAttrs(pDoc, "/metafile/push[1]/linecolor[1]", {{"color", "#800000"}}); - assertXPathAttrs(pDoc, "/metafile/push[1]/line[1]", { + assertXPathAttrs(pDoc, "/metafile/push[1]"_ostr, {{"flags", "PushAll"}}); + assertXPathAttrs(pDoc, "/metafile/push[1]/linecolor[1]"_ostr, {{"color", "#800000"}}); + assertXPathAttrs(pDoc, "/metafile/push[1]/line[1]"_ostr, { {"startx", "4"}, {"starty", "4"}, {"endx", "6"}, {"endy", "6"}, }); - assertXPathAttrs(pDoc, "/metafile/push[1]/push[1]", {{"flags", "PushLineColor, PushFillColor"}}); - assertXPathAttrs(pDoc, "/metafile/push[1]/push[1]/line[1]", { + assertXPathAttrs(pDoc, "/metafile/push[1]/push[1]"_ostr, {{"flags", "PushLineColor, PushFillColor"}}); + assertXPathAttrs(pDoc, "/metafile/push[1]/push[1]/line[1]"_ostr, { {"startx", "5"}, {"starty", "5"}, {"endx", "7"}, {"endy", "7"}, }); @@ -2029,7 +2029,7 @@ void SvmTest::checkRasterOp(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/rasterop[1]", { + assertXPathAttrs(pDoc, "/metafile/rasterop[1]"_ostr, { {"operation", "xor"}, }); } @@ -2050,17 +2050,17 @@ void SvmTest::checkTransparent(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/transparent[1]", { + assertXPathAttrs(pDoc, "/metafile/transparent[1]"_ostr, { {"transparence", "50"}, }); - assertXPathAttrs(pDoc, "/metafile/transparent[1]/polygon/point[1]", { + assertXPathAttrs(pDoc, "/metafile/transparent[1]/polygon/point[1]"_ostr, { {"x", "1"}, {"y", "8"}, }); - assertXPathAttrs(pDoc, "/metafile/transparent[1]/polygon/point[2]", { + assertXPathAttrs(pDoc, "/metafile/transparent[1]/polygon/point[2]"_ostr, { {"x", "2"}, {"y", "7"}, }); - assertXPathAttrs(pDoc, "/metafile/transparent[1]/polygon/point[3]", { + assertXPathAttrs(pDoc, "/metafile/transparent[1]/polygon/point[3]"_ostr, { {"x", "3"}, {"y", "6"}, }); } @@ -2090,7 +2090,7 @@ void SvmTest::checkFloatTransparent(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/floattransparent[1]", { + assertXPathAttrs(pDoc, "/metafile/floattransparent[1]"_ostr, { {"x", "1"}, {"y", "2"}, {"width", "3"}, @@ -2098,7 +2098,7 @@ void SvmTest::checkFloatTransparent(const GDIMetaFile& rMetaFile) {"transparent", "true"} }); - assertXPathAttrs(pDoc, "/metafile/floattransparent[1]/gradient[1]", { + assertXPathAttrs(pDoc, "/metafile/floattransparent[1]/gradient[1]"_ostr, { {"style", "Linear"}, {"startcolor", "#ffffff"}, {"endcolor", "#000000"}, @@ -2111,12 +2111,12 @@ void SvmTest::checkFloatTransparent(const GDIMetaFile& rMetaFile) {"steps", "0"} }); - assertXPathAttrs(pDoc, "/metafile/floattransparent[1]/metafile[1]/point[1]", { + assertXPathAttrs(pDoc, "/metafile/floattransparent[1]/metafile[1]/point[1]"_ostr, { {"x", "1"}, {"y", "8"} }); - assertXPathAttrs(pDoc, "/metafile/floattransparent[1]/metafile[1]/point[2]", { + assertXPathAttrs(pDoc, "/metafile/floattransparent[1]/metafile[1]/point[2]"_ostr, { {"x", "2"}, {"y", "7"} }); @@ -2147,14 +2147,14 @@ void SvmTest::checkEPS(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/eps[1]", { + assertXPathAttrs(pDoc, "/metafile/eps[1]"_ostr, { {"x", "1"}, {"y", "8"}, {"width", "2"}, {"height", "7"} }); - assertXPathAttrs(pDoc, "/metafile/eps[1]/gfxlink[1]", { + assertXPathAttrs(pDoc, "/metafile/eps[1]/gfxlink[1]"_ostr, { {"width", "3"}, {"height", "6"}, {"type", "EpsBuffer"}, @@ -2166,7 +2166,7 @@ void SvmTest::checkEPS(const GDIMetaFile& rMetaFile) {"validmapmode", "true"} }); - assertXPathAttrs(pDoc, "/metafile/eps[1]/gfxlink[1]/prefmapmode[1]", { + assertXPathAttrs(pDoc, "/metafile/eps[1]/gfxlink[1]/prefmapmode[1]"_ostr, { {"mapunit", "Map100thInch"}, {"x", "0"}, {"y", "1"}, @@ -2174,12 +2174,12 @@ void SvmTest::checkEPS(const GDIMetaFile& rMetaFile) {"scaley", "(2/3)"} }); - assertXPathAttrs(pDoc, "/metafile/eps[1]/metafile[1]/point[1]", { + assertXPathAttrs(pDoc, "/metafile/eps[1]/metafile[1]/point[1]"_ostr, { {"x", "1"}, {"y", "8"} }); - assertXPathAttrs(pDoc, "/metafile/eps[1]/metafile[1]/point[2]", { + assertXPathAttrs(pDoc, "/metafile/eps[1]/metafile[1]/point[2]"_ostr, { {"x", "2"}, {"y", "7"} }); @@ -2221,13 +2221,13 @@ void SvmTest::checkRefPoint(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/refpoint[1]", { + assertXPathAttrs(pDoc, "/metafile/refpoint[1]"_ostr, { {"x", "0"}, {"y", "0"}, {"set", "false"} }); - assertXPathAttrs(pDoc, "/metafile/refpoint[2]", { + assertXPathAttrs(pDoc, "/metafile/refpoint[2]"_ostr, { {"x", "1"}, {"y", "2"}, {"set", "true"} @@ -2252,25 +2252,25 @@ void SvmTest::checkComment(const GDIMetaFile& rMetafile) { xmlDocUniquePtr pDoc = dumpMeta(rMetafile); - assertXPathAttrs(pDoc, "/metafile/comment[1]", { + assertXPathAttrs(pDoc, "/metafile/comment[1]"_ostr, { {"value", "0"} }); - assertXPathContent(pDoc, "/metafile/comment[1]/comment[1]", "Test comment"); + assertXPathContent(pDoc, "/metafile/comment[1]/comment[1]"_ostr, "Test comment"); - assertXPathAttrs(pDoc, "/metafile/comment[2]", { + assertXPathAttrs(pDoc, "/metafile/comment[2]"_ostr, { {"datasize", "48"} }); - assertXPathAttrs(pDoc, "/metafile/comment[2]", { + assertXPathAttrs(pDoc, "/metafile/comment[2]"_ostr, { {"data", "540068006500730065002000610072006500200073006f006d0065002000740065007300740020006400610074006100"} }); - assertXPathAttrs(pDoc, "/metafile/comment[2]", { + assertXPathAttrs(pDoc, "/metafile/comment[2]"_ostr, { {"value", "4"} }); - assertXPathContent(pDoc, "/metafile/comment[2]/comment[1]", "This is a test comment"); + assertXPathContent(pDoc, "/metafile/comment[2]/comment[1]"_ostr, "This is a test comment"); } void SvmTest::testComment() @@ -2279,12 +2279,12 @@ void SvmTest::testComment() ScopedVclPtrInstance<VirtualDevice> pVirtualDev; setupBaseVirtualDevice(*pVirtualDev, aGDIMetaFile); - aGDIMetaFile.AddAction(new MetaCommentAction("Test comment")); + aGDIMetaFile.AddAction(new MetaCommentAction("Test comment"_ostr)); using namespace std::literals::string_view_literals; static constexpr auto aString = "T\0h\0e\0s\0e\0 \0a\0r\0e\0 \0s\0o\0m\0e\0 \0t\0e\0s\0t\0 \0d\0a\0t\0a\0"sv; - aGDIMetaFile.AddAction(new MetaCommentAction("This is a test comment", \ + aGDIMetaFile.AddAction(new MetaCommentAction("This is a test comment"_ostr, \ 4, \ reinterpret_cast<const sal_uInt8*>(aString.data()), \ aString.length() )); @@ -2297,11 +2297,11 @@ void SvmTest::checkLayoutMode(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/layoutmode[1]", { + assertXPathAttrs(pDoc, "/metafile/layoutmode[1]"_ostr, { {"textlayout", "TextOriginLeft"} }); - assertXPathAttrs(pDoc, "/metafile/layoutmode[2]", { + assertXPathAttrs(pDoc, "/metafile/layoutmode[2]"_ostr, { {"textlayout", "BiDiRtl"} }); } @@ -2323,11 +2323,11 @@ void SvmTest::checkTextLanguage(const GDIMetaFile& rMetaFile) { xmlDocUniquePtr pDoc = dumpMeta(rMetaFile); - assertXPathAttrs(pDoc, "/metafile/textlanguage[1]", { + assertXPathAttrs(pDoc, "/metafile/textlanguage[1]"_ostr, { {"language", "#0408"} }); - assertXPathAttrs(pDoc, "/metafile/textlanguage[2]", { + assertXPathAttrs(pDoc, "/metafile/textlanguage[2]"_ostr, { {"language", "#00ff"} }); } diff --git a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx index 29b98f0eb280..2665508ee433 100644 --- a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx +++ b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx @@ -47,7 +47,7 @@ void WidgetDefinitionReaderTest::testReadSettings() vcl::WidgetDefinitionReader aReader(getFullUrl(u"definitionSettings1.xml"), getFullUrl(u"")); CPPUNIT_ASSERT(aReader.read(aDefinition)); - CPPUNIT_ASSERT_EQUAL(OString(""), aDefinition.mpSettings->msCenteredTabs); + CPPUNIT_ASSERT_EQUAL(""_ostr, aDefinition.mpSettings->msCenteredTabs); } { @@ -55,7 +55,7 @@ void WidgetDefinitionReaderTest::testReadSettings() vcl::WidgetDefinitionReader aReader(getFullUrl(u"definitionSettings2.xml"), getFullUrl(u"")); CPPUNIT_ASSERT(aReader.read(aDefinition)); - CPPUNIT_ASSERT_EQUAL(OString("true"), aDefinition.mpSettings->msCenteredTabs); + CPPUNIT_ASSERT_EQUAL("true"_ostr, aDefinition.mpSettings->msCenteredTabs); } { @@ -63,16 +63,14 @@ void WidgetDefinitionReaderTest::testReadSettings() vcl::WidgetDefinitionReader aReader(getFullUrl(u"definitionSettings3.xml"), getFullUrl(u"")); CPPUNIT_ASSERT(aReader.read(aDefinition)); - CPPUNIT_ASSERT_EQUAL(OString("true"), aDefinition.mpSettings->msNoActiveTabTextRaise); - CPPUNIT_ASSERT_EQUAL(OString("false"), aDefinition.mpSettings->msCenteredTabs); - CPPUNIT_ASSERT_EQUAL(OString("0"), aDefinition.mpSettings->msListBoxEntryMargin); - CPPUNIT_ASSERT_EQUAL(OString("10"), aDefinition.mpSettings->msDefaultFontSize); - CPPUNIT_ASSERT_EQUAL(OString("16"), aDefinition.mpSettings->msTitleHeight); - CPPUNIT_ASSERT_EQUAL(OString("12"), aDefinition.mpSettings->msFloatTitleHeight); - CPPUNIT_ASSERT_EQUAL(OString("15"), - aDefinition.mpSettings->msListBoxPreviewDefaultLogicWidth); - CPPUNIT_ASSERT_EQUAL(OString("7"), - aDefinition.mpSettings->msListBoxPreviewDefaultLogicHeight); + CPPUNIT_ASSERT_EQUAL("true"_ostr, aDefinition.mpSettings->msNoActiveTabTextRaise); + CPPUNIT_ASSERT_EQUAL("false"_ostr, aDefinition.mpSettings->msCenteredTabs); + CPPUNIT_ASSERT_EQUAL("0"_ostr, aDefinition.mpSettings->msListBoxEntryMargin); + CPPUNIT_ASSERT_EQUAL("10"_ostr, aDefinition.mpSettings->msDefaultFontSize); + CPPUNIT_ASSERT_EQUAL("16"_ostr, aDefinition.mpSettings->msTitleHeight); + CPPUNIT_ASSERT_EQUAL("12"_ostr, aDefinition.mpSettings->msFloatTitleHeight); + CPPUNIT_ASSERT_EQUAL("15"_ostr, aDefinition.mpSettings->msListBoxPreviewDefaultLogicWidth); + CPPUNIT_ASSERT_EQUAL("7"_ostr, aDefinition.mpSettings->msListBoxPreviewDefaultLogicHeight); } } diff --git a/vcl/source/filter/GraphicFormatDetector.cxx b/vcl/source/filter/GraphicFormatDetector.cxx index 38a6ec28585e..a878a8ca111d 100644 --- a/vcl/source/filter/GraphicFormatDetector.cxx +++ b/vcl/source/filter/GraphicFormatDetector.cxx @@ -1119,7 +1119,8 @@ bool GraphicFormatDetector::checkEPS() maMetadata.mnFormat = GraphicFileFormat::EPS; return true; } - else if (checkArrayForMatchingStrings(pFirstBytesAsCharArray, 30, { "%!PS-Adobe", " EPS" })) + else if (checkArrayForMatchingStrings(pFirstBytesAsCharArray, 30, + { "%!PS-Adobe"_ostr, " EPS"_ostr })) { maMetadata.mnFormat = GraphicFileFormat::EPS; return true; @@ -1228,7 +1229,7 @@ bool GraphicFormatDetector::checkRAS() bool GraphicFormatDetector::checkXPM() { const char* pFirstBytesAsCharArray = reinterpret_cast<char*>(maFirstBytes.data()); - if (matchArrayWithString(pFirstBytesAsCharArray, 256, "/* XPM */")) + if (matchArrayWithString(pFirstBytesAsCharArray, 256, "/* XPM */"_ostr)) { maMetadata.mnFormat = GraphicFileFormat::XPM; return true; @@ -1247,7 +1248,7 @@ bool GraphicFormatDetector::checkXBM() const char* pBufferAsCharArray = reinterpret_cast<char*>(pBuffer.get()); - if (checkArrayForMatchingStrings(pBufferAsCharArray, nSize, { "#define", "_width" })) + if (checkArrayForMatchingStrings(pBufferAsCharArray, nSize, { "#define"_ostr, "_width"_ostr })) { maMetadata.mnFormat = GraphicFileFormat::XBM; return true; @@ -1272,14 +1273,15 @@ bool GraphicFormatDetector::checkSVG() // #119176# SVG files which have no xml header at all have shown up this is optional // check for "xml" then "version" then "DOCTYPE" and "svg" tags if (checkArrayForMatchingStrings(pCheckArrayAsCharArray, nCheckSize, - { "<?xml", "version", "DOCTYPE", "svg" })) + { "<?xml"_ostr, "version"_ostr, "DOCTYPE"_ostr, "svg"_ostr })) { bIsSvg = true; } // check for svg element in 1st 256 bytes // search for '<svg' - if (!bIsSvg && checkArrayForMatchingStrings(pCheckArrayAsCharArray, nCheckSize, { "<svg" })) + if (!bIsSvg + && checkArrayForMatchingStrings(pCheckArrayAsCharArray, nCheckSize, { "<svg"_ostr })) { bIsSvg = true; } @@ -1306,7 +1308,7 @@ bool GraphicFormatDetector::checkSVG() } // search for '<svg' - if (checkArrayForMatchingStrings(pCheckArrayAsCharArray, nCheckSize, { "<svg" })) + if (checkArrayForMatchingStrings(pCheckArrayAsCharArray, nCheckSize, { "<svg"_ostr })) { bIsSvg = true; } diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index f082e5b17d8b..374645ba9f27 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -1808,7 +1808,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, std::u16string_vi aCodec.BeginCompression( ZCODEC_DEFAULT_COMPRESSION, /*gzLib*/true ); // the inner modify time/filename doesn't really matter in this context because // compressed graphic formats are meant to be opened as is - not to be extracted - aCodec.SetCompressionMetadata( "inner", 0, nUncompressedCRC32 ); + aCodec.SetCompressionMetadata( "inner"_ostr, 0, nUncompressedCRC32 ); aCodec.Compress( rCompressableStm, rOStm ); tools::Long nCompressedLength = aCodec.EndCompression(); if ( rOStm.GetError() || nCompressedLength <= 0 ) diff --git a/vcl/source/filter/idxf/dxfentrd.cxx b/vcl/source/filter/idxf/dxfentrd.cxx index b4915c6573f8..9f9e075514db 100644 --- a/vcl/source/filter/idxf/dxfentrd.cxx +++ b/vcl/source/filter/idxf/dxfentrd.cxx @@ -26,8 +26,8 @@ //--------------------------DXFBasicEntity-------------------------------------- DXFBasicEntity::DXFBasicEntity(DXFEntityType eThisType) - : m_sLayer("0") - , m_sLineType("BYLAYER") + : m_sLayer("0"_ostr) + , m_sLineType("BYLAYER"_ostr) { eType=eThisType; pSucc=nullptr; @@ -192,7 +192,7 @@ void DXFSolidEntity::EvaluateGroup(DXFGroupReader & rDGR) DXFTextEntity::DXFTextEntity() : DXFBasicEntity(DXF_TEXT) - , m_sStyle("STANDARD") + , m_sStyle("STANDARD"_ostr) { fHeight=1.0; fRotAngle=0.0; @@ -289,7 +289,7 @@ void DXFInsertEntity::EvaluateGroup(DXFGroupReader & rDGR) DXFAttDefEntity::DXFAttDefEntity() : DXFBasicEntity(DXF_ATTDEF) - , m_sStyle("STANDARD") + , m_sStyle("STANDARD"_ostr) { fHeight=1.0; nAttrFlags=0; @@ -332,7 +332,7 @@ void DXFAttDefEntity::EvaluateGroup(DXFGroupReader & rDGR) DXFAttribEntity::DXFAttribEntity() : DXFBasicEntity(DXF_ATTRIB) - , m_sStyle("STANDARD") + , m_sStyle("STANDARD"_ostr) { fHeight=1.0; nAttrFlags=0; diff --git a/vcl/source/filter/ieps/ieps.cxx b/vcl/source/filter/ieps/ieps.cxx index dd2c1597abaf..bb4ea06b2a7a 100644 --- a/vcl/source/filter/ieps/ieps.cxx +++ b/vcl/source/filter/ieps/ieps.cxx @@ -427,7 +427,7 @@ static bool RenderAsBMP(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r static void CreateMtfReplacementAction( GDIMetaFile& rMtf, SvStream& rStrm, sal_uInt32 nOrigPos, sal_uInt32 nPSSize, sal_uInt32 nPosWMF, sal_uInt32 nSizeWMF, sal_uInt32 nPosTIFF, sal_uInt32 nSizeTIFF ) { - OString aComment("EPSReplacementGraphic"); + OString aComment("EPSReplacementGraphic"_ostr); if ( nSizeWMF || nSizeTIFF ) { std::vector<sal_uInt8> aWMFBuf; diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 53d3d37b4e86..159db9a38ba2 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -107,7 +107,7 @@ sal_uInt32 PDFDocument::GetNextSignature() sal_uInt32 nRet = 0; for (const auto& pSignature : GetSignatureWidgets()) { - auto pT = dynamic_cast<PDFLiteralStringElement*>(pSignature->Lookup("T")); + auto pT = dynamic_cast<PDFLiteralStringElement*>(pSignature->Lookup("T"_ostr)); if (!pT) continue; @@ -212,7 +212,7 @@ sal_Int32 PDFDocument::WriteAppearanceObject(tools::Rectangle& rSignatureRectang } // Calculate the bounding box. - PDFElement* pMediaBox = pPage->Lookup("MediaBox"); + PDFElement* pMediaBox = pPage->Lookup("MediaBox"_ostr); auto pMediaBoxArray = dynamic_cast<PDFArrayElement*>(pMediaBox); if (!pMediaBoxArray || pMediaBoxArray->GetElements().size() < 4) { @@ -236,7 +236,7 @@ sal_Int32 PDFDocument::WriteAppearanceObject(tools::Rectangle& rSignatureRectang } rSignatureRectangle.setHeight(pHeight->GetValue()); - if (PDFObjectElement* pContentStream = pPage->LookupObject("Contents")) + if (PDFObjectElement* pContentStream = pPage->LookupObject("Contents"_ostr)) { aContentStreams.push_back(pContentStream); } @@ -352,7 +352,7 @@ sal_Int32 PDFDocument::WriteAnnotObject(PDFObjectElement const& rFirstPage, sal_ bool PDFDocument::WritePageObject(PDFObjectElement& rFirstPage, sal_Int32 nAnnotId) { - PDFElement* pAnnots = rFirstPage.Lookup("Annots"); + PDFElement* pAnnots = rFirstPage.Lookup("Annots"_ostr); auto pAnnotsReference = dynamic_cast<PDFReferenceElement*>(pAnnots); if (pAnnotsReference) { @@ -428,8 +428,8 @@ bool PDFDocument::WritePageObject(PDFObjectElement& rFirstPage, sal_Int32 nAnnot PDFDictionaryElement* pDictionary = rFirstPage.GetDictionary(); // Offset right before the end of the Annots array. - sal_uInt64 nAnnotsEndOffset = pDictionary->GetKeyOffset("Annots") - + pDictionary->GetKeyValueLength("Annots") - 1; + sal_uInt64 nAnnotsEndOffset = pDictionary->GetKeyOffset("Annots"_ostr) + + pDictionary->GetKeyValueLength("Annots"_ostr) - 1; // Length of beginning of the dictionary -> Annots end. sal_uInt64 nAnnotsBeforeEndLength = nAnnotsEndOffset - rFirstPage.GetDictionaryOffset(); m_aEditBuffer.WriteBytes(static_cast<const char*>(m_aEditBuffer.GetData()) @@ -456,7 +456,7 @@ bool PDFDocument::WritePageObject(PDFObjectElement& rFirstPage, sal_Int32 nAnnot bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, PDFReferenceElement*& pRoot) { if (m_pXRefStream) - pRoot = dynamic_cast<PDFReferenceElement*>(m_pXRefStream->Lookup("Root")); + pRoot = dynamic_cast<PDFReferenceElement*>(m_pXRefStream->Lookup("Root"_ostr)); else { if (!m_pTrailer) @@ -464,7 +464,7 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, PDFReferenceElement*& p SAL_WARN("vcl.filter", "PDFDocument::Sign: found no trailer"); return false; } - pRoot = dynamic_cast<PDFReferenceElement*>(m_pTrailer->Lookup("Root")); + pRoot = dynamic_cast<PDFReferenceElement*>(m_pTrailer->Lookup("Root"_ostr)); } if (!pRoot) { @@ -483,7 +483,7 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, PDFReferenceElement*& p SAL_WARN("vcl.filter", "PDFDocument::Sign: invalid catalog obj id"); return false; } - PDFElement* pAcroForm = pCatalog->Lookup("AcroForm"); + PDFElement* pAcroForm = pCatalog->Lookup("AcroForm"_ostr); auto pAcroFormReference = dynamic_cast<PDFReferenceElement*>(pAcroForm); if (pAcroFormReference) { @@ -505,7 +505,7 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, PDFReferenceElement*& p // If this is nullptr, then the AcroForm object is not in an object stream. SvMemoryStream* pStreamBuffer = pAcroFormObject->GetStreamBuffer(); - if (!pAcroFormObject->Lookup("Fields")) + if (!pAcroFormObject->Lookup("Fields"_ostr)) { SAL_WARN("vcl.filter", "PDFDocument::Sign: AcroForm object without required Fields key"); @@ -520,8 +520,8 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, PDFReferenceElement*& p } // Offset right before the end of the Fields array. - sal_uInt64 nFieldsEndOffset = pAcroFormDictionary->GetKeyOffset("Fields") - + pAcroFormDictionary->GetKeyValueLength("Fields") + sal_uInt64 nFieldsEndOffset = pAcroFormDictionary->GetKeyOffset("Fields"_ostr) + + pAcroFormDictionary->GetKeyValueLength("Fields"_ostr) - strlen("]"); // Length of beginning of the object dictionary -> Fields end. @@ -585,7 +585,7 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, PDFReferenceElement*& p else { // AcroForm key is already there, insert our reference at the Fields end. - auto it = pAcroFormDictionary->GetItems().find("Fields"); + auto it = pAcroFormDictionary->GetItems().find("Fields"_ostr); if (it == pAcroFormDictionary->GetItems().end()) { SAL_WARN("vcl.filter", "PDFDocument::Sign: AcroForm without required Fields key"); @@ -600,8 +600,9 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, PDFReferenceElement*& p } // Offset right before the end of the Fields array. - sal_uInt64 nFieldsEndOffset = pAcroFormDictionary->GetKeyOffset("Fields") - + pAcroFormDictionary->GetKeyValueLength("Fields") - 1; + sal_uInt64 nFieldsEndOffset = pAcroFormDictionary->GetKeyOffset("Fields"_ostr) + + pAcroFormDictionary->GetKeyValueLength("Fields"_ostr) + - 1; // Length of beginning of the Catalog dictionary -> Fields end. sal_uInt64 nFieldsBeforeEndLength = nFieldsEndOffset - pCatalog->GetDictionaryOffset(); m_aEditBuffer.WriteBytes(static_cast<const char*>(m_aEditBuffer.GetData()) @@ -705,7 +706,7 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, PDFReferenceElement const* p " 0 obj\n<</DecodeParms<</Columns 5/Predictor 12>>/Filter/FlateDecode"); // ID. - auto pID = dynamic_cast<PDFArrayElement*>(m_pXRefStream->Lookup("ID")); + auto pID = dynamic_cast<PDFArrayElement*>(m_pXRefStream->Lookup("ID"_ostr)); if (pID) { const std::vector<PDFElement*>& rElements = pID->GetElements(); @@ -736,7 +737,7 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, PDFReferenceElement const* p m_aEditBuffer.WriteOString("] "); // Info. - auto pInfo = dynamic_cast<PDFReferenceElement*>(m_pXRefStream->Lookup("Info")); + auto pInfo = dynamic_cast<PDFReferenceElement*>(m_pXRefStream->Lookup("Info"_ostr)); if (pInfo) { m_aEditBuffer.WriteOString("/Info "); @@ -816,7 +817,7 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, PDFReferenceElement const* p m_aEditBuffer.WriteOString(" "); m_aEditBuffer.WriteNumberAsString(pRoot->GetGenerationValue()); m_aEditBuffer.WriteOString(" R\n"); - auto pInfo = dynamic_cast<PDFReferenceElement*>(m_pTrailer->Lookup("Info")); + auto pInfo = dynamic_cast<PDFReferenceElement*>(m_pTrailer->Lookup("Info"_ostr)); if (pInfo) { m_aEditBuffer.WriteOString("/Info "); @@ -825,7 +826,7 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, PDFReferenceElement const* p m_aEditBuffer.WriteNumberAsString(pInfo->GetGenerationValue()); m_aEditBuffer.WriteOString(" R\n"); } - auto pID = dynamic_cast<PDFArrayElement*>(m_pTrailer->Lookup("ID")); + auto pID = dynamic_cast<PDFArrayElement*>(m_pTrailer->Lookup("ID"_ostr)); if (pID) { const std::vector<PDFElement*>& rElements = pID->GetElements(); @@ -1210,7 +1211,7 @@ bool PDFDocument::Tokenize(SvStream& rStream, TokenizeMode eMode, if (!pObj) continue; - PDFElement* pLookup = pObj->Lookup("Length"); + PDFElement* pLookup = pObj->Lookup("Length"_ostr); auto pReference = dynamic_cast<PDFReferenceElement*>(pLookup); if (pReference) { @@ -1406,14 +1407,14 @@ bool PDFDocument::Read(SvStream& rStream) PDFNumberElement* pPrev = nullptr; if (m_pTrailer) { - pPrev = dynamic_cast<PDFNumberElement*>(m_pTrailer->Lookup("Prev")); + pPrev = dynamic_cast<PDFNumberElement*>(m_pTrailer->Lookup("Prev"_ostr)); // Remember the offset of this trailer in the correct order. It's // possible that newer trailers don't have a larger offset. m_aTrailerOffsets.push_back(m_pTrailer->GetLocation()); } else if (m_pXRefStream) - pPrev = dynamic_cast<PDFNumberElement*>(m_pXRefStream->Lookup("Prev")); + pPrev = dynamic_cast<PDFNumberElement*>(m_pXRefStream->Lookup("Prev"_ostr)); if (pPrev) nStartXRef = pPrev->GetValue(); @@ -1467,7 +1468,7 @@ size_t PDFDocument::FindStartXRef(SvStream& rStream) rStream.Seek(nBeforePeek); if (nSize != aBuf.size()) aBuf.resize(nSize); - OString aPrefix("startxref"); + OString aPrefix("startxref"_ostr); // Find the last startxref at the end of the document. auto itLastValid = aBuf.end(); auto it = aBuf.begin(); @@ -1534,7 +1535,7 @@ void PDFDocument::ReadXRefStream(SvStream& rStream) // So that the Prev key can be looked up later. m_pXRefStream = pObject; - PDFElement* pLookup = pObject->Lookup("Length"); + PDFElement* pLookup = pObject->Lookup("Length"_ostr); auto pNumber = dynamic_cast<PDFNumberElement*>(pLookup); if (!pNumber) { @@ -1564,7 +1565,7 @@ void PDFDocument::ReadXRefStream(SvStream& rStream) std::vector<char> aBuf(nLength); rStream.ReadBytes(aBuf.data(), aBuf.size()); - auto pFilter = dynamic_cast<PDFNameElement*>(pObject->Lookup("Filter")); + auto pFilter = dynamic_cast<PDFNameElement*>(pObject->Lookup("Filter"_ostr)); if (!pFilter) { SAL_WARN("vcl.filter", "PDFDocument::ReadXRefStream: no Filter found"); @@ -1580,14 +1581,15 @@ void PDFDocument::ReadXRefStream(SvStream& rStream) int nColumns = 1; int nPredictor = 1; - if (auto pDecodeParams = dynamic_cast<PDFDictionaryElement*>(pObject->Lookup("DecodeParms"))) + if (auto pDecodeParams + = dynamic_cast<PDFDictionaryElement*>(pObject->Lookup("DecodeParms"_ostr))) { const std::map<OString, PDFElement*>& rItems = pDecodeParams->GetItems(); - auto it = rItems.find("Columns"); + auto it = rItems.find("Columns"_ostr); if (it != rItems.end()) if (auto pColumns = dynamic_cast<PDFNumberElement*>(it->second)) nColumns = pColumns->GetValue(); - it = rItems.find("Predictor"); + it = rItems.find("Predictor"_ostr); if (it != rItems.end()) if (auto pPredictor = dynamic_cast<PDFNumberElement*>(it->second)) nPredictor = pPredictor->GetValue(); @@ -1605,12 +1607,12 @@ void PDFDocument::ReadXRefStream(SvStream& rStream) } // Look up the first and the last entry we need to read. - auto pIndex = dynamic_cast<PDFArrayElement*>(pObject->Lookup("Index")); + auto pIndex = dynamic_cast<PDFArrayElement*>(pObject->Lookup("Index"_ostr)); std::vector<size_t> aFirstObjects; std::vector<size_t> aNumberOfObjects; if (!pIndex) { - auto pSize = dynamic_cast<PDFNumberElement*>(pObject->Lookup("Size")); + auto pSize = dynamic_cast<PDFNumberElement*>(pObject->Lookup("Size"_ostr)); if (pSize) { aFirstObjects.push_back(0); @@ -1655,7 +1657,7 @@ void PDFDocument::ReadXRefStream(SvStream& rStream) // Look up the format of a single entry. const int nWSize = 3; - auto pW = dynamic_cast<PDFArrayElement*>(pObject->Lookup("W")); + auto pW = dynamic_cast<PDFArrayElement*>(pObject->Lookup("W"_ostr)); if (!pW || pW->GetElements().size() < nWSize) { SAL_WARN("vcl.filter", "PDFDocument::ReadXRefStream: W not found or has < 3 elements"); @@ -1912,7 +1914,7 @@ const std::vector<std::unique_ptr<PDFElement>>& PDFDocument::GetElements() const /// Visits the page tree recursively, looking for page objects. static void visitPages(PDFObjectElement* pPages, std::vector<PDFObjectElement*>& rRet) { - auto pKidsRef = pPages->Lookup("Kids"); + auto pKidsRef = pPages->Lookup("Kids"_ostr); auto pKids = dynamic_cast<PDFArrayElement*>(pKidsRef); if (!pKids) { @@ -1957,7 +1959,7 @@ static void visitPages(PDFObjectElement* pPages, std::vector<PDFObjectElement*>& continue; } - auto pName = dynamic_cast<PDFNameElement*>(pKidObject->Lookup("Type")); + auto pName = dynamic_cast<PDFNameElement*>(pKidObject->Lookup("Type"_ostr)); if (pName && pName->GetValue() == "Pages") // Pages inside pages: recurse. visitPages(pKidObject, rRet); @@ -1984,9 +1986,9 @@ PDFObjectElement* PDFDocument::GetCatalog() } if (pTrailer) - pRoot = dynamic_cast<PDFReferenceElement*>(pTrailer->Lookup("Root")); + pRoot = dynamic_cast<PDFReferenceElement*>(pTrailer->Lookup("Root"_ostr)); else if (m_pXRefStream) - pRoot = dynamic_cast<PDFReferenceElement*>(m_pXRefStream->Lookup("Root")); + pRoot = dynamic_cast<PDFReferenceElement*>(m_pXRefStream->Lookup("Root"_ostr)); if (!pRoot) { @@ -2008,7 +2010,7 @@ std::vector<PDFObjectElement*> PDFDocument::GetPages() return aRet; } - PDFObjectElement* pPages = pCatalog->LookupObject("Pages"); + PDFObjectElement* pPages = pCatalog->LookupObject("Pages"_ostr); if (!pPages) { SAL_WARN("vcl.filter", "PDFDocument::GetPages: catalog (obj " << pCatalog->GetObjectValue() @@ -2034,7 +2036,7 @@ std::vector<PDFObjectElement*> PDFDocument::GetSignatureWidgets() if (!pPage) continue; - PDFElement* pAnnotsElement = pPage->Lookup("Annots"); + PDFElement* pAnnotsElement = pPage->Lookup("Annots"_ostr); auto pAnnots = dynamic_cast<PDFArrayElement*>(pAnnotsElement); if (!pAnnots) { @@ -2063,7 +2065,7 @@ std::vector<PDFObjectElement*> PDFDocument::GetSignatureWidgets() if (!pAnnotObject) continue; - auto pFT = dynamic_cast<PDFNameElement*>(pAnnotObject->Lookup("FT")); + auto pFT = dynamic_cast<PDFNameElement*>(pAnnotObject->Lookup("FT"_ostr)); if (!pFT || pFT->GetValue() != "Sig") continue; @@ -2499,7 +2501,7 @@ void PDFObjectElement::ParseStoredObjects() return; } - auto pType = dynamic_cast<PDFNameElement*>(Lookup("Type")); + auto pType = dynamic_cast<PDFNameElement*>(Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "ObjStm") { if (!pType) @@ -2510,7 +2512,7 @@ void PDFObjectElement::ParseStoredObjects() return; } - auto pFilter = dynamic_cast<PDFNameElement*>(Lookup("Filter")); + auto pFilter = dynamic_cast<PDFNameElement*>(Lookup("Filter"_ostr)); if (!pFilter || pFilter->GetValue() != "FlateDecode") { if (!pFilter) @@ -2521,14 +2523,14 @@ void PDFObjectElement::ParseStoredObjects() return; } - auto pFirst = dynamic_cast<PDFNumberElement*>(Lookup("First")); + auto pFirst = dynamic_cast<PDFNumberElement*>(Lookup("First"_ostr)); if (!pFirst) { SAL_WARN("vcl.filter", "PDFObjectElement::ParseStoredObjects: no First"); return; } - auto pN = dynamic_cast<PDFNumberElement*>(Lookup("N")); + auto pN = dynamic_cast<PDFNumberElement*>(Lookup("N"_ostr)); if (!pN) { SAL_WARN("vcl.filter", "PDFObjectElement::ParseStoredObjects: no N"); @@ -2536,7 +2538,7 @@ void PDFObjectElement::ParseStoredObjects() } size_t nN = pN->GetValue(); - auto pLength = dynamic_cast<PDFNumberElement*>(Lookup("Length")); + auto pLength = dynamic_cast<PDFNumberElement*>(Lookup("Length"_ostr)); if (!pLength) { SAL_WARN("vcl.filter", "PDFObjectElement::ParseStoredObjects: no length"); diff --git a/vcl/source/gdi/WidgetDefinition.cxx b/vcl/source/gdi/WidgetDefinition.cxx index bd6019815e0f..c7d6032dfccc 100644 --- a/vcl/source/gdi/WidgetDefinition.cxx +++ b/vcl/source/gdi/WidgetDefinition.cxx @@ -70,7 +70,7 @@ WidgetDefinitionPart::getStates(ControlType eType, ControlPart ePart, ControlSta bAdd = false; } - OString sExtra = "any"; + OString sExtra = "any"_ostr; switch (eType) { diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx index a36c62564ea2..f5373b035cdd 100644 --- a/vcl/source/gdi/WidgetDefinitionReader.cxx +++ b/vcl/source/gdi/WidgetDefinitionReader.cxx @@ -67,7 +67,7 @@ bool readSetting(OString const& rInputString, OString& rOutputString) OString getValueOrAny(OString const& rInputString) { if (rInputString.isEmpty()) - return "any"; + return "any"_ostr; return rInputString; } @@ -202,34 +202,34 @@ void WidgetDefinitionReader::readDrawingDefinition( if (rWalker.name() == "rect") { Color aStrokeColor; - readColor(rWalker.attribute("stroke"), aStrokeColor); + readColor(rWalker.attribute("stroke"_ostr), aStrokeColor); Color aFillColor; - readColor(rWalker.attribute("fill"), aFillColor); - OString sStrokeWidth = rWalker.attribute("stroke-width"); + readColor(rWalker.attribute("fill"_ostr), aFillColor); + OString sStrokeWidth = rWalker.attribute("stroke-width"_ostr); sal_Int32 nStrokeWidth = -1; if (!sStrokeWidth.isEmpty()) nStrokeWidth = sStrokeWidth.toInt32(); sal_Int32 nRx = -1; - OString sRx = rWalker.attribute("rx"); + OString sRx = rWalker.attribute("rx"_ostr); if (!sRx.isEmpty()) nRx = sRx.toInt32(); sal_Int32 nRy = -1; - OString sRy = rWalker.attribute("ry"); + OString sRy = rWalker.attribute("ry"_ostr); if (!sRy.isEmpty()) nRy = sRy.toInt32(); - OString sX1 = rWalker.attribute("x1"); + OString sX1 = rWalker.attribute("x1"_ostr); float fX1 = sX1.isEmpty() ? 0.0 : sX1.toFloat(); - OString sY1 = rWalker.attribute("y1"); + OString sY1 = rWalker.attribute("y1"_ostr); float fY1 = sY1.isEmpty() ? 0.0 : sY1.toFloat(); - OString sX2 = rWalker.attribute("x2"); + OString sX2 = rWalker.attribute("x2"_ostr); float fX2 = sX2.isEmpty() ? 1.0 : sX2.toFloat(); - OString sY2 = rWalker.attribute("y2"); + OString sY2 = rWalker.attribute("y2"_ostr); float fY2 = sY2.isEmpty() ? 1.0 : sY2.toFloat(); rpState->addDrawRectangle(aStrokeColor, nStrokeWidth, aFillColor, fX1, fY1, fX2, fY2, @@ -238,36 +238,36 @@ void WidgetDefinitionReader::readDrawingDefinition( else if (rWalker.name() == "line") { Color aStrokeColor; - readColor(rWalker.attribute("stroke"), aStrokeColor); + readColor(rWalker.attribute("stroke"_ostr), aStrokeColor); - OString sStrokeWidth = rWalker.attribute("stroke-width"); + OString sStrokeWidth = rWalker.attribute("stroke-width"_ostr); sal_Int32 nStrokeWidth = -1; if (!sStrokeWidth.isEmpty()) nStrokeWidth = sStrokeWidth.toInt32(); - OString sX1 = rWalker.attribute("x1"); + OString sX1 = rWalker.attribute("x1"_ostr); float fX1 = sX1.isEmpty() ? -1.0 : sX1.toFloat(); - OString sY1 = rWalker.attribute("y1"); + OString sY1 = rWalker.attribute("y1"_ostr); float fY1 = sY1.isEmpty() ? -1.0 : sY1.toFloat(); - OString sX2 = rWalker.attribute("x2"); + OString sX2 = rWalker.attribute("x2"_ostr); float fX2 = sX2.isEmpty() ? -1.0 : sX2.toFloat(); - OString sY2 = rWalker.attribute("y2"); + OString sY2 = rWalker.attribute("y2"_ostr); float fY2 = sY2.isEmpty() ? -1.0 : sY2.toFloat(); rpState->addDrawLine(aStrokeColor, nStrokeWidth, fX1, fY1, fX2, fY2); } else if (rWalker.name() == "image") { - OString sSource = rWalker.attribute("source"); + OString sSource = rWalker.attribute("source"_ostr); rpState->addDrawImage(m_rResourcePath + OStringToOUString(sSource, RTL_TEXTENCODING_UTF8)); } else if (rWalker.name() == "external") { - OString sSource = rWalker.attribute("source"); + OString sSource = rWalker.attribute("source"_ostr); rpState->addDrawExternal(m_rResourcePath + OStringToOUString(sSource, RTL_TEXTENCODING_UTF8)); } @@ -284,40 +284,40 @@ void WidgetDefinitionReader::readDefinition(tools::XmlWalker& rWalker, { if (rWalker.name() == "part") { - OString sPart = rWalker.attribute("value"); + OString sPart = rWalker.attribute("value"_ostr); ControlPart ePart = xmlStringToControlPart(sPart); std::shared_ptr<WidgetDefinitionPart> pPart = std::make_shared<WidgetDefinitionPart>(); - OString sWidth = rWalker.attribute("width"); + OString sWidth = rWalker.attribute("width"_ostr); if (!sWidth.isEmpty()) { sal_Int32 nWidth = sWidth.isEmpty() ? 0 : sWidth.toInt32(); pPart->mnWidth = nWidth; } - OString sHeight = rWalker.attribute("height"); + OString sHeight = rWalker.attribute("height"_ostr); if (!sHeight.isEmpty()) { sal_Int32 nHeight = sHeight.isEmpty() ? 0 : sHeight.toInt32(); pPart->mnHeight = nHeight; } - OString sMarginHeight = rWalker.attribute("margin-height"); + OString sMarginHeight = rWalker.attribute("margin-height"_ostr); if (!sMarginHeight.isEmpty()) { sal_Int32 nMarginHeight = sMarginHeight.isEmpty() ? 0 : sMarginHeight.toInt32(); pPart->mnMarginHeight = nMarginHeight; } - OString sMarginWidth = rWalker.attribute("margin-width"); + OString sMarginWidth = rWalker.attribute("margin-width"_ostr); if (!sMarginWidth.isEmpty()) { sal_Int32 nMarginWidth = sMarginWidth.isEmpty() ? 0 : sMarginWidth.toInt32(); pPart->mnMarginWidth = nMarginWidth; } - OString sOrientation = rWalker.attribute("orientation"); + OString sOrientation = rWalker.attribute("orientation"_ostr); if (!sOrientation.isEmpty()) { pPart->msOrientation = sOrientation; @@ -339,14 +339,14 @@ void WidgetDefinitionReader::readPart(tools::XmlWalker& rWalker, { if (rWalker.name() == "state") { - OString sEnabled = getValueOrAny(rWalker.attribute("enabled")); - OString sFocused = getValueOrAny(rWalker.attribute("focused")); - OString sPressed = getValueOrAny(rWalker.attribute("pressed")); - OString sRollover = getValueOrAny(rWalker.attribute("rollover")); - OString sDefault = getValueOrAny(rWalker.attribute("default")); - OString sSelected = getValueOrAny(rWalker.attribute("selected")); - OString sButtonValue = getValueOrAny(rWalker.attribute("button-value")); - OString sExtra = getValueOrAny(rWalker.attribute("extra")); + OString sEnabled = getValueOrAny(rWalker.attribute("enabled"_ostr)); + OString sFocused = getValueOrAny(rWalker.attribute("focused"_ostr)); + OString sPressed = getValueOrAny(rWalker.attribute("pressed"_ostr)); + OString sRollover = getValueOrAny(rWalker.attribute("rollover"_ostr)); + OString sDefault = getValueOrAny(rWalker.attribute("default"_ostr)); + OString sSelected = getValueOrAny(rWalker.attribute("selected"_ostr)); + OString sButtonValue = getValueOrAny(rWalker.attribute("button-value"_ostr)); + OString sExtra = getValueOrAny(rWalker.attribute("extra"_ostr)); std::shared_ptr<WidgetDefinitionState> pState = std::make_shared<WidgetDefinitionState>( sEnabled, sFocused, sPressed, sRollover, sDefault, sSelected, sButtonValue, sExtra); @@ -459,7 +459,7 @@ bool WidgetDefinitionReader::read(WidgetDefinition& rWidgetDefinition) auto pair = aStyleColorMap.find(aWalker.name()); if (pair != aStyleColorMap.end()) { - readColor(aWalker.attribute("value"), *pair->second); + readColor(aWalker.attribute("value"_ostr), *pair->second); } aWalker.next(); } @@ -473,7 +473,7 @@ bool WidgetDefinitionReader::read(WidgetDefinition& rWidgetDefinition) auto pair = aSettingMap.find(aWalker.name()); if (pair != aSettingMap.end()) { - readSetting(aWalker.attribute("value"), *pair->second); + readSetting(aWalker.attribute("value"_ostr), *pair->second); } aWalker.next(); } diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx index ce7977599bc2..95c42c5df724 100644 --- a/vcl/source/gdi/gdimetafiletools.cxx +++ b/vcl/source/gdi/gdimetafiletools.cxx @@ -238,7 +238,7 @@ namespace WriteSvtGraphicStroke( aMemStm, rStroke ); rTarget.AddAction( new MetaCommentAction( - "XPATHSTROKE_SEQ_BEGIN", + "XPATHSTROKE_SEQ_BEGIN"_ostr, 0, static_cast< const sal_uInt8* >(aMemStm.GetData()), aMemStm.TellEnd())); @@ -251,7 +251,7 @@ namespace WriteSvtGraphicFill( aMemStm, rFilling ); rTarget.AddAction( new MetaCommentAction( - "XPATHFILL_SEQ_BEGIN", + "XPATHFILL_SEQ_BEGIN"_ostr, 0, static_cast< const sal_uInt8* >(aMemStm.GetData()), aMemStm.TellEnd())); diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index ecb7c25aa368..fb4ff37dfa9d 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -1141,7 +1141,7 @@ void GDIMetaFile::Rotate( Degree10 nAngle10 ) aStroke.getPath( aPath ); aStroke.setPath( ImplGetRotatedPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) ); WriteSvtGraphicStroke( aDest, aStroke ); - aMtf.AddAction( new MetaCommentAction( "XPATHSTROKE_SEQ_BEGIN", 0, + aMtf.AddAction( new MetaCommentAction( "XPATHSTROKE_SEQ_BEGIN"_ostr, 0, static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) ); } else @@ -1152,7 +1152,7 @@ void GDIMetaFile::Rotate( Degree10 nAngle10 ) aFill.getPath( aPath ); aFill.setPath( ImplGetRotatedPolyPolygon( aPath, aRotAnchor, aRotOffset, fSin, fCos ) ); WriteSvtGraphicFill( aDest, aFill ); - aMtf.AddAction( new MetaCommentAction( "XPATHFILL_SEQ_BEGIN", 0, + aMtf.AddAction( new MetaCommentAction( "XPATHFILL_SEQ_BEGIN"_ostr, 0, static_cast<const sal_uInt8*>( aDest.GetData()), aDest.Tell() ) ); } } diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index f507fddb284e..a5e0a716c5af 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -276,62 +276,62 @@ OString convertLineStyleToString(const MetaActionType nActionType) { switch (nActionType) { - case MetaActionType::NONE: return "null"; - case MetaActionType::PIXEL: return "pixel"; - case MetaActionType::POINT: return "point"; - case MetaActionType::LINE: return "line"; - case MetaActionType::RECT: return "rect"; - case MetaActionType::ROUNDRECT: return "roundrect"; - case MetaActionType::ELLIPSE: return "ellipse"; - case MetaActionType::ARC: return "arc"; - case MetaActionType::PIE: return "pie"; - case MetaActionType::CHORD: return "chord"; - case MetaActionType::POLYLINE: return "polyline"; - case MetaActionType::POLYGON: return "polygon"; - case MetaActionType::POLYPOLYGON: return "polypolygon"; - case MetaActionType::TEXT: return "text"; - case MetaActionType::TEXTARRAY: return "textarray"; - case MetaActionType::STRETCHTEXT: return "stretchtext"; - case MetaActionType::TEXTRECT: return "textrect"; - case MetaActionType::TEXTLINE: return "textline"; - case MetaActionType::BMP: return "bmp"; - case MetaActionType::BMPSCALE: return "bmpscale"; - case MetaActionType::BMPSCALEPART: return "bmpscalepart"; - case MetaActionType::BMPEX: return "bmpex"; - case MetaActionType::BMPEXSCALE: return "bmpexscale"; - case MetaActionType::BMPEXSCALEPART: return "bmpexscalepart"; - case MetaActionType::MASK: return "mask"; - case MetaActionType::MASKSCALE: return "maskscale"; - case MetaActionType::MASKSCALEPART: return "maskscalepart"; - case MetaActionType::GRADIENT: return "gradient"; - case MetaActionType::GRADIENTEX: return "gradientex"; - case MetaActionType::HATCH: return "hatch"; - case MetaActionType::WALLPAPER: return "wallpaper"; - case MetaActionType::CLIPREGION: return "clipregion"; - case MetaActionType::ISECTRECTCLIPREGION: return "sectrectclipregion"; - case MetaActionType::ISECTREGIONCLIPREGION: return "sectregionclipregion"; - case MetaActionType::MOVECLIPREGION: return "moveclipregion"; - case MetaActionType::LINECOLOR: return "linecolor"; - case MetaActionType::FILLCOLOR: return "fillcolor"; - case MetaActionType::TEXTCOLOR: return "textcolor"; - case MetaActionType::TEXTFILLCOLOR: return "textfillcolor"; - case MetaActionType::TEXTLINECOLOR: return "textlinecolor"; - case MetaActionType::OVERLINECOLOR: return "overlinecolor"; - case MetaActionType::TEXTALIGN: return "textalign"; - case MetaActionType::MAPMODE: return "mapmode"; - case MetaActionType::FONT: return "font"; - case MetaActionType::PUSH: return "push"; - case MetaActionType::POP: return "pop"; - case MetaActionType::RASTEROP: return "rasterop"; - case MetaActionType::Transparent: return "transparent"; - case MetaActionType::FLOATTRANSPARENT: return "floattransparent"; - case MetaActionType::EPS: return "eps"; - case MetaActionType::REFPOINT: return "refpoint"; - case MetaActionType::COMMENT: return "comment"; - case MetaActionType::LAYOUTMODE: return "layoutmode"; - case MetaActionType::TEXTLANGUAGE: return "textlanguage"; + case MetaActionType::NONE: return "null"_ostr; + case MetaActionType::PIXEL: return "pixel"_ostr; + case MetaActionType::POINT: return "point"_ostr; + case MetaActionType::LINE: return "line"_ostr; + case MetaActionType::RECT: return "rect"_ostr; + case MetaActionType::ROUNDRECT: return "roundrect"_ostr; + case MetaActionType::ELLIPSE: return "ellipse"_ostr; + case MetaActionType::ARC: return "arc"_ostr; + case MetaActionType::PIE: return "pie"_ostr; + case MetaActionType::CHORD: return "chord"_ostr; + case MetaActionType::POLYLINE: return "polyline"_ostr; + case MetaActionType::POLYGON: return "polygon"_ostr; + case MetaActionType::POLYPOLYGON: return "polypolygon"_ostr; + case MetaActionType::TEXT: return "text"_ostr; + case MetaActionType::TEXTARRAY: return "textarray"_ostr; + case MetaActionType::STRETCHTEXT: return "stretchtext"_ostr; + case MetaActionType::TEXTRECT: return "textrect"_ostr; + case MetaActionType::TEXTLINE: return "textline"_ostr; + case MetaActionType::BMP: return "bmp"_ostr; + case MetaActionType::BMPSCALE: return "bmpscale"_ostr; + case MetaActionType::BMPSCALEPART: return "bmpscalepart"_ostr; + case MetaActionType::BMPEX: return "bmpex"_ostr; + case MetaActionType::BMPEXSCALE: return "bmpexscale"_ostr; + case MetaActionType::BMPEXSCALEPART: return "bmpexscalepart"_ostr; + case MetaActionType::MASK: return "mask"_ostr; + case MetaActionType::MASKSCALE: return "maskscale"_ostr; + case MetaActionType::MASKSCALEPART: return "maskscalepart"_ostr; + case MetaActionType::GRADIENT: return "gradient"_ostr; + case MetaActionType::GRADIENTEX: return "gradientex"_ostr; + case MetaActionType::HATCH: return "hatch"_ostr; + case MetaActionType::WALLPAPER: return "wallpaper"_ostr; + case MetaActionType::CLIPREGION: return "clipregion"_ostr; + case MetaActionType::ISECTRECTCLIPREGION: return "sectrectclipregion"_ostr; + case MetaActionType::ISECTREGIONCLIPREGION: return "sectregionclipregion"_ostr; + case MetaActionType::MOVECLIPREGION: return "moveclipregion"_ostr; + case MetaActionType::LINECOLOR: return "linecolor"_ostr; + case MetaActionType::FILLCOLOR: return "fillcolor"_ostr; + case MetaActionType::TEXTCOLOR: return "textcolor"_ostr; + case MetaActionType::TEXTFILLCOLOR: return "textfillcolor"_ostr; + case MetaActionType::TEXTLINECOLOR: return "textlinecolor"_ostr; + case MetaActionType::OVERLINECOLOR: return "overlinecolor"_ostr; + case MetaActionType::TEXTALIGN: return "textalign"_ostr; + case MetaActionType::MAPMODE: return "mapmode"_ostr; + case MetaActionType::FONT: return "font"_ostr; + case MetaActionType::PUSH: return "push"_ostr; + case MetaActionType::POP: return "pop"_ostr; + case MetaActionType::RASTEROP: return "rasterop"_ostr; + case MetaActionType::Transparent: return "transparent"_ostr; + case MetaActionType::FLOATTRANSPARENT: return "floattransparent"_ostr; + case MetaActionType::EPS: return "eps"_ostr; + case MetaActionType::REFPOINT: return "refpoint"_ostr; + case MetaActionType::COMMENT: return "comment"_ostr; + case MetaActionType::LAYOUTMODE: return "layoutmode"_ostr; + case MetaActionType::TEXTLANGUAGE: return "textlanguage"_ostr; } - return ""; + return ""_ostr; } OUString convertBitmapExTransparentType(BitmapEx const & rBitmapEx) @@ -539,11 +539,11 @@ void writeRectangle(tools::XmlWriter& rWriter, tools::Rectangle const& rRectangl rWriter.attribute("left", rRectangle.Left()); rWriter.attribute("top", rRectangle.Top()); if (rRectangle.IsWidthEmpty()) - rWriter.attribute("right", OString("empty")); + rWriter.attribute("right", "empty"_ostr); else rWriter.attribute("right", rRectangle.Right()); if (rRectangle.IsHeightEmpty()) - rWriter.attribute("bottom", OString("empty")); + rWriter.attribute("bottom", "empty"_ostr); else rWriter.attribute("bottom", rRectangle.Bottom()); } @@ -1557,7 +1557,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r default: { rWriter.startElement(sCurrentElementTag); - rWriter.attribute("note", OString("not implemented in xml dump")); + rWriter.attribute("note", "not implemented in xml dump"_ostr); rWriter.endElement(); } break; diff --git a/vcl/source/gdi/pdfobjectcopier.cxx b/vcl/source/gdi/pdfobjectcopier.cxx index e0e1599f384c..0d07c0df7f67 100644 --- a/vcl/source/gdi/pdfobjectcopier.cxx +++ b/vcl/source/gdi/pdfobjectcopier.cxx @@ -181,7 +181,8 @@ OString PDFObjectCopier::copyExternalResources(filter::PDFObjectElement& rPage, // Get the rKind subset of the resource dictionary. std::map<OString, filter::PDFElement*> aItems; filter::PDFObjectElement* pKindObject = nullptr; - if (auto pResources = dynamic_cast<filter::PDFDictionaryElement*>(rPage.Lookup("Resources"))) + if (auto pResources + = dynamic_cast<filter::PDFDictionaryElement*>(rPage.Lookup("Resources"_ostr))) { // Resources is a direct dictionary. filter::PDFElement* pLookup = pResources->LookupElement(rKind); @@ -203,7 +204,7 @@ OString PDFObjectCopier::copyExternalResources(filter::PDFObjectElement& rPage, aItems = pReferenced->GetDictionaryItems(); } } - else if (filter::PDFObjectElement* pPageResources = rPage.LookupObject("Resources")) + else if (filter::PDFObjectElement* pPageResources = rPage.LookupObject("Resources"_ostr)) { // Resources is an indirect object. filter::PDFElement* pValue = pPageResources->Lookup(rKind); @@ -278,7 +279,8 @@ void PDFObjectCopier::copyPageResources(filter::PDFObjectElement* pPage, OString { rLine.append(" /Resources <<"); static const std::initializer_list<OString> aKeys - = { "ColorSpace", "ExtGState", "Font", "XObject", "Shading", "Pattern" }; + = { "ColorSpace"_ostr, "ExtGState"_ostr, "Font"_ostr, + "XObject"_ostr, "Shading"_ostr, "Pattern"_ostr }; for (const auto& rKey : aKeys) { rLine.append(copyExternalResources(*pPage, rKey, rCopiedResources)); @@ -300,8 +302,8 @@ sal_Int32 PDFObjectCopier::copyPageStreams(std::vector<filter::PDFObjectElement* SvMemoryStream& rPageStream = pPageStream->GetMemory(); - auto pFilter = dynamic_cast<filter::PDFNameElement*>(pContent->Lookup("Filter")); - auto pFilterArray = dynamic_cast<filter::PDFArrayElement*>(pContent->Lookup("Filter")); + auto pFilter = dynamic_cast<filter::PDFNameElement*>(pContent->Lookup("Filter"_ostr)); + auto pFilterArray = dynamic_cast<filter::PDFArrayElement*>(pContent->Lookup("Filter"_ostr)); if (!pFilter && pFilterArray) { auto& aElements = pFilterArray->GetElements(); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index e8b9cf7a777c..f132c585fde3 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -439,7 +439,7 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr OString::number( static_cast<const PDFWriter::RadioButtonWidget&>(i_rControl).RadioGroup ); } else - aPartialName = OString( "Widget" ); + aPartialName = "Widget"_ostr; } if( ! m_aContext.AllowDuplicateFieldNames ) @@ -4185,7 +4185,7 @@ void PDFWriterImpl::createDefaultPushButtonAppearance( PDFWidget& rButton, const pop(); - rButton.m_aAppearances[ "N" ][ "Standard" ] = new SvMemoryStream(); + rButton.m_aAppearances[ "N"_ostr ][ "Standard"_ostr ] = new SvMemoryStream(); /* seems like a bad hack but at least works in both AR5 and 6: we draw the button ourselves and tell AR @@ -4293,7 +4293,7 @@ void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const PDFWrit endRedirect(); pop(); - rEdit.m_aAppearances[ "N" ][ "Standard" ] = pEditStream; + rEdit.m_aAppearances[ "N"_ostr ][ "Standard"_ostr ] = pEditStream; rEdit.m_aDAString = aDA.makeStringAndClear(); } @@ -4321,7 +4321,7 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr endRedirect(); pop(); - rBox.m_aAppearances[ "N" ][ "Standard" ] = pListBoxStream; + rBox.m_aAppearances[ "N"_ostr ][ "Standard"_ostr ] = pListBoxStream; // prepare DA string OStringBuffer aDA( 256 ); @@ -4462,14 +4462,14 @@ void PDFWriterImpl::createDefaultCheckBoxAppearance( PDFWidget& rBox, const PDFW aDA.append( "> Tj\nET\nQ\nEMC\n" ); writeBuffer( aDA ); endRedirect(); - rBox.m_aAppearances[ "N" ][ "Yes" ] = pCheckStream; + rBox.m_aAppearances[ "N"_ostr ][ "Yes"_ostr ] = pCheckStream; // write 'unchecked' appearance stream SvMemoryStream* pUncheckStream = new SvMemoryStream( 256, 256 ); beginRedirect( pUncheckStream, aCheckRect ); writeBuffer( "/Tx BMC\nEMC\n" ); endRedirect(); - rBox.m_aAppearances[ "N" ][ "Off" ] = pUncheckStream; + rBox.m_aAppearances[ "N"_ostr ][ "Off"_ostr ] = pUncheckStream; } void PDFWriterImpl::createDefaultRadioButtonAppearance( PDFWidget& rBox, const PDFWriter::RadioButtonWidget& rWidget ) @@ -4559,13 +4559,13 @@ void PDFWriterImpl::createDefaultRadioButtonAppearance( PDFWidget& rBox, const P endRedirect(); pop(); - rBox.m_aAppearances[ "N" ][ "Yes" ] = pCheckStream; + rBox.m_aAppearances[ "N"_ostr ][ "Yes"_ostr ] = pCheckStream; SvMemoryStream* pUncheckStream = new SvMemoryStream( 256, 256 ); beginRedirect( pUncheckStream, aCheckRect ); writeBuffer( "/Tx BMC\nEMC\n" ); endRedirect(); - rBox.m_aAppearances[ "N" ][ "Off" ] = pUncheckStream; + rBox.m_aAppearances[ "N"_ostr ][ "Off"_ostr ] = pUncheckStream; } bool PDFWriterImpl::emitAppearances( PDFWidget& rWidget, OStringBuffer& rAnnotDict ) @@ -4684,10 +4684,10 @@ bool PDFWriterImpl::emitWidgetAnnotations() { if ( !rWidget.m_aOnValue.isEmpty() ) { - auto app_it = rWidget.m_aAppearances.find( "N" ); + auto app_it = rWidget.m_aAppearances.find( "N"_ostr ); if( app_it != rWidget.m_aAppearances.end() ) { - auto stream_it = app_it->second.find( "Yes" ); + auto stream_it = app_it->second.find( "Yes"_ostr ); if( stream_it != app_it->second.end() ) { SvMemoryStream* pStream = stream_it->second; @@ -4703,10 +4703,10 @@ bool PDFWriterImpl::emitWidgetAnnotations() if ( !rWidget.m_aOffValue.isEmpty() ) { - auto app_it = rWidget.m_aAppearances.find( "N" ); + auto app_it = rWidget.m_aAppearances.find( "N"_ostr ); if( app_it != rWidget.m_aAppearances.end() ) { - auto stream_it = app_it->second.find( "Off" ); + auto stream_it = app_it->second.find( "Off"_ostr ); if( stream_it != app_it->second.end() ) { SvMemoryStream* pStream = stream_it->second; @@ -9125,7 +9125,7 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) } double aOrigin[2] = { 0.0, 0.0 }; - if (auto* pArray = dynamic_cast<filter::PDFArrayElement*>(pPage->Lookup("MediaBox"))) + if (auto* pArray = dynamic_cast<filter::PDFArrayElement*>(pPage->Lookup("MediaBox"_ostr))) { const auto& rElements = pArray->GetElements(); if (rElements.size() >= 4) @@ -9140,9 +9140,9 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) } std::vector<filter::PDFObjectElement*> aContentStreams; - if (filter::PDFObjectElement* pContentStream = pPage->LookupObject("Contents")) + if (filter::PDFObjectElement* pContentStream = pPage->LookupObject("Contents"_ostr)) aContentStreams.push_back(pContentStream); - else if (auto pArray = dynamic_cast<filter::PDFArrayElement*>(pPage->Lookup("Contents"))) + else if (auto pArray = dynamic_cast<filter::PDFArrayElement*>(pPage->Lookup("Contents"_ostr))) { for (const auto pElement : pArray->GetElements()) { @@ -9166,7 +9166,7 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) // Merge link annotations from pPage to our page. std::vector<filter::PDFObjectElement*> aAnnots; - if (auto pArray = dynamic_cast<filter::PDFArrayElement*>(pPage->Lookup("Annots"))) + if (auto pArray = dynamic_cast<filter::PDFArrayElement*>(pPage->Lookup("Annots"_ostr))) { for (const auto pElement : pArray->GetElements()) { @@ -9182,13 +9182,13 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) continue; } - auto pType = dynamic_cast<filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (!pType || pType->GetValue() != "Annot") { continue; } - auto pSubtype = dynamic_cast<filter::PDFNameElement*>(pObject->Lookup("Subtype")); + auto pSubtype = dynamic_cast<filter::PDFNameElement*>(pObject->Lookup("Subtype"_ostr)); if (!pSubtype || pSubtype->GetValue() != "Link") { continue; @@ -9224,7 +9224,7 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) tools::Long nWidth = aSize.Width(); tools::Long nHeight = aSize.Height(); basegfx::B2DRange aBBox(0, 0, aSize.Width(), aSize.Height()); - if (auto pRotate = dynamic_cast<filter::PDFNumberElement*>(pPage->Lookup("Rotate"))) + if (auto pRotate = dynamic_cast<filter::PDFNumberElement*>(pPage->Lookup("Rotate"_ostr))) { // The original page was rotated, then construct a transformation matrix which does the // same with our form object. @@ -10729,7 +10729,7 @@ void PDFWriterImpl::beginStructureElementMCSeq() ! m_aStructure[ m_nCurrentStructElement ].m_bOpenMCSeq // already opened sequence ) { - OString aLine = "/Artifact "; + OString aLine = "/Artifact "_ostr; writeBuffer( aLine ); // emit property list if requested OStringBuffer buf; @@ -11055,7 +11055,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) std::vector< sal_Int32 > aNewChildren; // add Div in RoleMap, in case no one else did (TODO: is it needed? Is it dangerous?) - OString aAliasName("Div"); + OString aAliasName("Div"_ostr); addRoleMap(aAliasName, PDFWriter::Division); while( rEle.m_aKids.size() > ncMaxPDFArraySize ) @@ -11635,10 +11635,10 @@ void PDFWriterImpl::ensureUniqueRadioOnValues() PDFWidget& rKid = m_aWidgets[nKidIndex]; if ( !rKid.m_aOnValue.isEmpty() ) { - auto app_it = rKid.m_aAppearances.find( "N" ); + auto app_it = rKid.m_aAppearances.find( "N"_ostr ); if( app_it != rKid.m_aAppearances.end() ) { - auto stream_it = app_it->second.find( "Yes" ); + auto stream_it = app_it->second.find( "Yes"_ostr ); if( stream_it != app_it->second.end() ) { SvMemoryStream* pStream = stream_it->second; @@ -11654,10 +11654,10 @@ void PDFWriterImpl::ensureUniqueRadioOnValues() if ( !rKid.m_aOffValue.isEmpty() ) { - auto app_it = rKid.m_aAppearances.find( "N" ); + auto app_it = rKid.m_aAppearances.find( "N"_ostr ); if( app_it != rKid.m_aAppearances.end() ) { - auto stream_it = app_it->second.find( "Off" ); + auto stream_it = app_it->second.find( "Off"_ostr ); if( stream_it != app_it->second.end() ) { SvMemoryStream* pStream = stream_it->second; @@ -11896,7 +11896,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa rNewWidget.m_aValue = OUString::number( m_nSignatureObject ); rNewWidget.m_aValue += " 0 R"; // let's add a fake appearance - rNewWidget.m_aAppearances[ "N" ][ "Standard" ] = new SvMemoryStream(); + rNewWidget.m_aAppearances[ "N"_ostr ][ "Standard"_ostr ] = new SvMemoryStream(); } #endif diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 37583d0b01d1..58fc31aafdf8 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -604,7 +604,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa if( pA->GetComment() == "XPATHSTROKE_SEQ_BEGIN" ) { - sSeqEnd = OString("XPATHSTROKE_SEQ_END"); + sSeqEnd = "XPATHSTROKE_SEQ_END"_ostr; SvtGraphicStroke aStroke; ReadSvtGraphicStroke( aMemStm, aStroke ); @@ -689,7 +689,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa } else if ( pA->GetComment() == "XPATHFILL_SEQ_BEGIN" ) { - sSeqEnd = OString("XPATHFILL_SEQ_END"); + sSeqEnd = "XPATHFILL_SEQ_END"_ostr; SvtGraphicFill aFill; ReadSvtGraphicFill( aMemStm, aFill ); diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx index d7fb11afd5d5..e3803d660d67 100644 --- a/vcl/source/outdev/gradient.cxx +++ b/vcl/source/outdev/gradient.cxx @@ -193,12 +193,12 @@ void OutputDevice::DrawGradientToMetafile ( const tools::PolyPolygon& rPolyPoly, } else { - mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_BEGIN" ) ); + mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_BEGIN"_ostr ) ); mpMetaFile->AddAction( new MetaGradientExAction( rPolyPoly, rGradient ) ); ClipAndDrawGradientMetafile ( rGradient, rPolyPoly ); - mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_END" ) ); + mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_END"_ostr ) ); } } diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx index 8817f54c738d..ce933f9417c7 100644 --- a/vcl/source/outdev/transparent.cxx +++ b/vcl/source/outdev/transparent.cxx @@ -1845,9 +1845,9 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, Point(), aBandBmp.GetSizePixel(), aBandBmp, nMaxBmpDPIX, nMaxBmpDPIY); - rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_BEGIN" ) ); + rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_BEGIN"_ostr ) ); rOutMtf.AddAction( new MetaBmpScaleAction( aDstPtPix, aDstSzPix, aBandBmp ) ); - rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_END" ) ); + rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_END"_ostr ) ); aPaintVDev->mbMap = true; mbMap = bOldMap; diff --git a/vcl/source/pdf/XmpMetadata.cxx b/vcl/source/pdf/XmpMetadata.cxx index e90befdc05b6..53bf3902ab2b 100644 --- a/vcl/source/pdf/XmpMetadata.cxx +++ b/vcl/source/pdf/XmpMetadata.cxx @@ -41,8 +41,9 @@ void XmpMetadata::write() { tools::XmlWriter aXmlWriter(mpMemoryStream.get()); aXmlWriter.startDocument(2, false); - aXmlWriter.startElement("x", "xmpmeta", "adobe:ns:meta/"); - aXmlWriter.startElement("rdf", "RDF", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); + aXmlWriter.startElement("x"_ostr, "xmpmeta"_ostr, "adobe:ns:meta/"_ostr); + aXmlWriter.startElement("rdf"_ostr, "RDF"_ostr, + "http://www.w3.org/1999/02/22-rdf-syntax-ns#"_ostr); // PDF/A part ( ISO 19005-1:2005 - 6.7.11 ) if (mnPDF_A > 0) @@ -50,15 +51,15 @@ void XmpMetadata::write() OString sPdfVersion = OString::number(mnPDF_A); aXmlWriter.startElement("rdf:Description"); - aXmlWriter.attribute("rdf:about", OString("")); - aXmlWriter.attribute("xmlns:pdfaid", OString("http://www.aiim.org/pdfa/ns/id/")); + aXmlWriter.attribute("rdf:about", ""_ostr); + aXmlWriter.attribute("xmlns:pdfaid", "http://www.aiim.org/pdfa/ns/id/"_ostr); aXmlWriter.startElement("pdfaid:part"); aXmlWriter.content(sPdfVersion); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaid:conformance"); - aXmlWriter.content("B"); + aXmlWriter.content("B"_ostr); aXmlWriter.endElement(); aXmlWriter.endElement(); @@ -71,11 +72,11 @@ void XmpMetadata::write() || !msSource.isEmpty() || !msType.isEmpty()) { aXmlWriter.startElement("rdf:Description"); - aXmlWriter.attribute("rdf:about", OString("")); - aXmlWriter.attribute("xmlns:dc", OString("http://purl.org/dc/elements/1.1/")); + aXmlWriter.attribute("rdf:about", ""_ostr); + aXmlWriter.attribute("xmlns:dc", "http://purl.org/dc/elements/1.1/"_ostr); aXmlWriter.startElement("dc:format"); - aXmlWriter.content("application/pdf"); + aXmlWriter.content("application/pdf"_ostr); aXmlWriter.endElement(); if (!msTitle.isEmpty()) @@ -84,7 +85,7 @@ void XmpMetadata::write() aXmlWriter.startElement("dc:title"); aXmlWriter.startElement("rdf:Alt"); aXmlWriter.startElement("rdf:li"); - aXmlWriter.attribute("xml:lang", OString("x-default")); + aXmlWriter.attribute("xml:lang", "x-default"_ostr); aXmlWriter.content(msTitle); aXmlWriter.endElement(); aXmlWriter.endElement(); @@ -105,7 +106,7 @@ void XmpMetadata::write() aXmlWriter.startElement("dc:description"); aXmlWriter.startElement("rdf:Alt"); aXmlWriter.startElement("rdf:li"); - aXmlWriter.attribute("xml:lang", OString("x-default")); + aXmlWriter.attribute("xml:lang", "x-default"_ostr); aXmlWriter.content(msSubject); aXmlWriter.endElement(); aXmlWriter.endElement(); @@ -167,7 +168,7 @@ void XmpMetadata::write() aXmlWriter.startElement("dc:rights"); aXmlWriter.startElement("rdf:Alt"); aXmlWriter.startElement("rdf:li"); - aXmlWriter.attribute("xml:lang", OString("x-default")); + aXmlWriter.attribute("xml:lang", "x-default"_ostr); aXmlWriter.content(msRights); aXmlWriter.endElement(); aXmlWriter.endElement(); @@ -194,74 +195,74 @@ void XmpMetadata::write() if (mnPDF_A != 0) { // tdf#157517 PDF/A extension schema is required aXmlWriter.startElement("rdf:Description"); - aXmlWriter.attribute("rdf:about", OString("")); + aXmlWriter.attribute("rdf:about", ""_ostr); aXmlWriter.attribute("xmlns:pdfaExtension", - OString("http://www.aiim.org/pdfa/ns/extension/")); + "http://www.aiim.org/pdfa/ns/extension/"_ostr); aXmlWriter.attribute("xmlns:pdfaSchema", - OString("http://www.aiim.org/pdfa/ns/schema#")); + "http://www.aiim.org/pdfa/ns/schema#"_ostr); aXmlWriter.attribute("xmlns:pdfaProperty", - OString("http://www.aiim.org/pdfa/ns/property#")); + "http://www.aiim.org/pdfa/ns/property#"_ostr); aXmlWriter.startElement("pdfaExtension:schemas"); aXmlWriter.startElement("rdf:Bag"); aXmlWriter.startElement("rdf:li"); - aXmlWriter.attribute("rdf:parseType", OString("Resource")); + aXmlWriter.attribute("rdf:parseType", "Resource"_ostr); aXmlWriter.startElement("pdfaSchema:namespaceURI"); - aXmlWriter.content("http://www.aiim.org/pdfua/ns/id/"); + aXmlWriter.content("http://www.aiim.org/pdfua/ns/id/"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaSchema:prefix"); - aXmlWriter.content("pdfuaid"); + aXmlWriter.content("pdfuaid"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaSchema:schema"); - aXmlWriter.content("PDF/UA identification schema"); + aXmlWriter.content("PDF/UA identification schema"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaSchema:property"); aXmlWriter.startElement("rdf:Seq"); aXmlWriter.startElement("rdf:li"); - aXmlWriter.attribute("rdf:parseType", OString("Resource")); + aXmlWriter.attribute("rdf:parseType", "Resource"_ostr); aXmlWriter.startElement("pdfaProperty:category"); - aXmlWriter.content("internal"); + aXmlWriter.content("internal"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaProperty:description"); - aXmlWriter.content("PDF/UA version identifier"); + aXmlWriter.content("PDF/UA version identifier"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaProperty:name"); - aXmlWriter.content("part"); + aXmlWriter.content("part"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaProperty:valueType"); - aXmlWriter.content("Integer"); + aXmlWriter.content("Integer"_ostr); aXmlWriter.endElement(); aXmlWriter.endElement(); // rdf:li aXmlWriter.startElement("rdf:li"); - aXmlWriter.attribute("rdf:parseType", OString("Resource")); + aXmlWriter.attribute("rdf:parseType", "Resource"_ostr); aXmlWriter.startElement("pdfaProperty:category"); - aXmlWriter.content("internal"); + aXmlWriter.content("internal"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaProperty:description"); - aXmlWriter.content("PDF/UA amendment identifier"); + aXmlWriter.content("PDF/UA amendment identifier"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaProperty:name"); - aXmlWriter.content("amd"); + aXmlWriter.content("amd"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaProperty:valueType"); - aXmlWriter.content("Text"); + aXmlWriter.content("Text"_ostr); aXmlWriter.endElement(); aXmlWriter.endElement(); // rdf:li aXmlWriter.startElement("rdf:li"); - aXmlWriter.attribute("rdf:parseType", OString("Resource")); + aXmlWriter.attribute("rdf:parseType", "Resource"_ostr); aXmlWriter.startElement("pdfaProperty:category"); - aXmlWriter.content("internal"); + aXmlWriter.content("internal"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaProperty:description"); - aXmlWriter.content("PDF/UA corrigenda identifier"); + aXmlWriter.content("PDF/UA corrigenda identifier"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaProperty:name"); - aXmlWriter.content("corr"); + aXmlWriter.content("corr"_ostr); aXmlWriter.endElement(); aXmlWriter.startElement("pdfaProperty:valueType"); - aXmlWriter.content("Text"); + aXmlWriter.content("Text"_ostr); aXmlWriter.endElement(); aXmlWriter.endElement(); // rdf:li @@ -274,8 +275,8 @@ void XmpMetadata::write() } OString sPdfUaVersion = OString::number(1); aXmlWriter.startElement("rdf:Description"); - aXmlWriter.attribute("rdf:about", OString("")); - aXmlWriter.attribute("xmlns:pdfuaid", OString("http://www.aiim.org/pdfua/ns/id/")); + aXmlWriter.attribute("rdf:about", ""_ostr); + aXmlWriter.attribute("xmlns:pdfuaid", "http://www.aiim.org/pdfua/ns/id/"_ostr); aXmlWriter.startElement("pdfuaid:part"); aXmlWriter.content(sPdfUaVersion); @@ -288,8 +289,8 @@ void XmpMetadata::write() if (!msProducer.isEmpty() || !msKeywords.isEmpty() || !msPDFVersion.isEmpty()) { aXmlWriter.startElement("rdf:Description"); - aXmlWriter.attribute("rdf:about", OString("")); - aXmlWriter.attribute("xmlns:pdf", OString("http://ns.adobe.com/pdf/1.3/")); + aXmlWriter.attribute("rdf:about", ""_ostr); + aXmlWriter.attribute("xmlns:pdf", "http://ns.adobe.com/pdf/1.3/"_ostr); if (!msProducer.isEmpty()) { aXmlWriter.startElement("pdf:Producer"); @@ -313,8 +314,8 @@ void XmpMetadata::write() // XMP Basic schema aXmlWriter.startElement("rdf:Description"); - aXmlWriter.attribute("rdf:about", OString("")); - aXmlWriter.attribute("xmlns:xmp", OString("http://ns.adobe.com/xap/1.0/")); + aXmlWriter.attribute("rdf:about", ""_ostr); + aXmlWriter.attribute("xmlns:xmp", "http://ns.adobe.com/xap/1.0/"_ostr); if (!m_sCreatorTool.isEmpty()) { aXmlWriter.startElement("xmp:CreatorTool"); diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index bd4368e9a998..e80a29b0bc0b 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -275,7 +275,7 @@ static OString extractPngString(const SvLBoxContextBmp* pBmpItem) return aBuffer.makeStringAndClear(); } - return ""; + return ""_ostr; } void IconView::DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, SvTreeListEntry* pEntry) diff --git a/vcl/source/treelist/imap2.cxx b/vcl/source/treelist/imap2.cxx index 0c3d4d8bf9e2..154380139246 100644 --- a/vcl/source/treelist/imap2.cxx +++ b/vcl/source/treelist/imap2.cxx @@ -245,7 +245,7 @@ void ImageMap::ImpReadCERNLine( std::string_view rLine ) { OString aStr( comphelper::string::stripStart(rLine, ' ') ); aStr = comphelper::string::stripStart(aStr, '\t'); - aStr = aStr.replaceAll(";", ""); + aStr = aStr.replaceAll(";"_ostr, ""_ostr); aStr = aStr.toAsciiLowerCase(); const char* pStr = aStr.getStr(); @@ -378,7 +378,7 @@ void ImageMap::ImpReadNCSALine( std::string_view rLine ) { OString aStr( comphelper::string::stripStart(rLine, ' ') ); aStr = comphelper::string::stripStart(aStr, '\t'); - aStr = aStr.replaceAll(";", ""); + aStr = aStr.replaceAll(";"_ostr, ""_ostr); aStr = aStr.toAsciiLowerCase(); const char* pStr = aStr.getStr(); diff --git a/vcl/source/window/DocWindow.cxx b/vcl/source/window/DocWindow.cxx index 971252553b9a..fe2ce61dfb4c 100644 --- a/vcl/source/window/DocWindow.cxx +++ b/vcl/source/window/DocWindow.cxx @@ -25,7 +25,7 @@ void DocWindow::SetPointer(PointerStyle nPointer) PointerStyle aPointer = GetPointer(); // We don't map all possible pointers hence we need a default - OString aPointerString = "default"; + OString aPointerString = "default"_ostr; auto aIt = vcl::gaLOKPointerMap.find(aPointer); if (aIt != vcl::gaLOKPointerMap.end()) { diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 9adcbefda372..3f9bee4041f2 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -658,7 +658,7 @@ void FloatingWindow::PixelInvalidate(const tools::Rectangle* /*pRectangle*/) const tools::Rectangle aRect(Point(0,0), Size(GetSizePixel().Width()+1, GetSizePixel().Height()+1)); std::vector<vcl::LOKPayloadItem> aPayload { - std::make_pair(OString("rectangle"), aRect.toString()) + std::make_pair("rectangle"_ostr, aRect.toString()) }; const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier(); pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload); diff --git a/vcl/unx/generic/app/sm.cxx b/vcl/unx/generic/app/sm.cxx index 3ad2c855a5c4..071ac32fdbe1 100644 --- a/vcl/unx/generic/app/sm.cxx +++ b/vcl/unx/generic/app/sm.cxx @@ -159,9 +159,9 @@ SalSession * SessionManagerClient::m_pSession = nullptr; std::unique_ptr< ICEConnectionObserver > SessionManagerClient::m_xICEConnectionObserver; SmcConn SessionManagerClient::m_pSmcConnection = nullptr; -OString SessionManagerClient::m_aClientID = ""; -OString SessionManagerClient::m_aTimeID = ""; -OString SessionManagerClient::m_aClientTimeID = ""; +OString SessionManagerClient::m_aClientID = ""_ostr; +OString SessionManagerClient::m_aTimeID = ""_ostr; +OString SessionManagerClient::m_aClientTimeID = ""_ostr; bool SessionManagerClient::m_bDocSaveDone = false; // HACK extern "C" { @@ -228,7 +228,7 @@ static void BuildSmPropertyList() OString aRestartOption = "--session=" + SessionManagerClient::getSessionID(); pSmProps[ eRestartCommand ].vals[1].length = aRestartOption.getLength()+1; pSmProps[ eRestartCommand ].vals[1].value = strdup(aRestartOption.getStr()); - OString aRestartOptionNoLogo("--nologo"); + OString aRestartOptionNoLogo("--nologo"_ostr); pSmProps[ eRestartCommand ].vals[2].length = aRestartOptionNoLogo.getLength()+1; pSmProps[ eRestartCommand ].vals[2].value = strdup(aRestartOptionNoLogo.getStr()); diff --git a/vcl/unx/generic/fontmanager/helper.cxx b/vcl/unx/generic/fontmanager/helper.cxx index 0abbb812a610..afa6d9cb76ed 100644 --- a/vcl/unx/generic/fontmanager/helper.cxx +++ b/vcl/unx/generic/fontmanager/helper.cxx @@ -229,7 +229,7 @@ void psp::normPath( OString& rPath ) // double slashes and slash at end are probably // removed by realpath anyway, but since this runs // on many different platforms let's play it safe - OString aPath = rPath.replaceAll("//", "/"); + OString aPath = rPath.replaceAll("//"_ostr, "/"_ostr); if( aPath.endsWith("/") ) aPath = aPath.copy(0, aPath.getLength()-1); diff --git a/vcl/unx/generic/printer/cpdmgr.cxx b/vcl/unx/generic/printer/cpdmgr.cxx index 3955a0235a0a..834c1383efba 100644 --- a/vcl/unx/generic/printer/cpdmgr.cxx +++ b/vcl/unx/generic/printer/cpdmgr.cxx @@ -624,20 +624,20 @@ void CPDManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, if (!sPayLoad.isEmpty()) { OString aKey = OUStringToOString( pKey->getKey(), RTL_TEXTENCODING_ASCII_US ); OString aValue = OUStringToOString( sPayLoad, RTL_TEXTENCODING_ASCII_US ); - if (aKey.equals("Duplex")) { - aKey = OString("sides"); - } else if (aKey.equals("Resolution")) { - aKey = OString("printer-resolution"); - } else if (aKey.equals("PageSize")) { - aKey = OString("media"); + if (aKey.equals("Duplex"_ostr)) { + aKey = "sides"_ostr; + } else if (aKey.equals("Resolution"_ostr)) { + aKey = "printer-resolution"_ostr; + } else if (aKey.equals("PageSize"_ostr)) { + aKey = "media"_ostr; } - if (aKey.equals("sides")) { - if (aValue.equals("None")) { - aValue = OString("one-sided"); - } else if (aValue.equals("DuplexNoTumble")) { - aValue = OString("two-sided-long-edge"); - } else if (aValue.equals("DuplexTumble")) { - aValue = OString("two-sided-short-edge"); + if (aKey.equals("sides"_ostr)) { + if (aValue.equals("None"_ostr)) { + aValue = "one-sided"_ostr; + } else if (aValue.equals("DuplexNoTumble"_ostr)) { + aValue = "two-sided-long-edge"_ostr; + } else if (aValue.equals("DuplexTumble"_ostr)) { + aValue = "two-sided-short-edge"_ostr; } } g_variant_builder_add(builder, "(ss)", aKey.getStr(), aValue.getStr()); diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 41f8ff9840d9..870390e39e08 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -211,15 +211,15 @@ void PrinterInfoManager::initialize() #endif aConfig.SetGroup( GLOBAL_DEFAULTS_GROUP ); - OString aValue( aConfig.ReadKey( "Copies" ) ); + OString aValue( aConfig.ReadKey( "Copies"_ostr ) ); if (!aValue.isEmpty()) m_aGlobalDefaults.m_nCopies = aValue.toInt32(); - aValue = aConfig.ReadKey( "Orientation" ); + aValue = aConfig.ReadKey( "Orientation"_ostr ); if (!aValue.isEmpty()) m_aGlobalDefaults.m_eOrientation = aValue.equalsIgnoreAsciiCase("Landscape") ? orientation::Landscape : orientation::Portrait; - aValue = aConfig.ReadKey( "MarginAdjust" ); + aValue = aConfig.ReadKey( "MarginAdjust"_ostr ); if (!aValue.isEmpty()) { sal_Int32 nIdx {0}; @@ -229,11 +229,11 @@ void PrinterInfoManager::initialize() m_aGlobalDefaults.m_nBottomMarginAdjust = o3tl::toInt32(o3tl::getToken(aValue, 0, ',', nIdx)); } - aValue = aConfig.ReadKey( "ColorDepth", "24" ); + aValue = aConfig.ReadKey( "ColorDepth"_ostr, "24"_ostr ); if (!aValue.isEmpty()) m_aGlobalDefaults.m_nColorDepth = aValue.toInt32(); - aValue = aConfig.ReadKey( "ColorDevice" ); + aValue = aConfig.ReadKey( "ColorDevice"_ostr ); if (!aValue.isEmpty()) m_aGlobalDefaults.m_nColorDevice = aValue.toInt32(); @@ -296,7 +296,7 @@ void PrinterInfoManager::initialize() for( int nGroup = 0; nGroup < aConfig.GetGroupCount(); nGroup++ ) { aConfig.SetGroup( aConfig.GetGroupName( nGroup ) ); - OString aValue = aConfig.ReadKey( "Printer" ); + OString aValue = aConfig.ReadKey( "Printer"_ostr ); if (!aValue.isEmpty()) { OUString aPrinterName; @@ -353,7 +353,7 @@ void PrinterInfoManager::initialize() } } - aValue = aConfig.ReadKey( "Command" ); + aValue = aConfig.ReadKey( "Command"_ostr ); // no printer without a command if (aValue.isEmpty()) { @@ -370,32 +370,32 @@ void PrinterInfoManager::initialize() aPrinter.m_aInfo.m_aCommand = OStringToOUString(aValue, RTL_TEXTENCODING_UTF8); } - aValue = aConfig.ReadKey( "QuickCommand" ); + aValue = aConfig.ReadKey( "QuickCommand"_ostr ); aPrinter.m_aInfo.m_aQuickCommand = OStringToOUString(aValue, RTL_TEXTENCODING_UTF8); - aValue = aConfig.ReadKey( "Features" ); + aValue = aConfig.ReadKey( "Features"_ostr ); aPrinter.m_aInfo.m_aFeatures = OStringToOUString(aValue, RTL_TEXTENCODING_UTF8); // override the settings in m_aGlobalDefaults if keys exist - aValue = aConfig.ReadKey( "DefaultPrinter" ); + aValue = aConfig.ReadKey( "DefaultPrinter"_ostr ); if (aValue != "0" && !aValue.equalsIgnoreAsciiCase("false")) aDefaultPrinter = aPrinterName; - aValue = aConfig.ReadKey( "Location" ); + aValue = aConfig.ReadKey( "Location"_ostr ); aPrinter.m_aInfo.m_aLocation = OStringToOUString(aValue, RTL_TEXTENCODING_UTF8); - aValue = aConfig.ReadKey( "Comment" ); + aValue = aConfig.ReadKey( "Comment"_ostr ); aPrinter.m_aInfo.m_aComment = OStringToOUString(aValue, RTL_TEXTENCODING_UTF8); - aValue = aConfig.ReadKey( "Copies" ); + aValue = aConfig.ReadKey( "Copies"_ostr ); if (!aValue.isEmpty()) aPrinter.m_aInfo.m_nCopies = aValue.toInt32(); - aValue = aConfig.ReadKey( "Orientation" ); + aValue = aConfig.ReadKey( "Orientation"_ostr ); if (!aValue.isEmpty()) aPrinter.m_aInfo.m_eOrientation = aValue.equalsIgnoreAsciiCase("Landscape") ? orientation::Landscape : orientation::Portrait; - aValue = aConfig.ReadKey( "MarginAdjust" ); + aValue = aConfig.ReadKey( "MarginAdjust"_ostr ); if (!aValue.isEmpty()) { sal_Int32 nIdx {0}; @@ -405,11 +405,11 @@ void PrinterInfoManager::initialize() aPrinter.m_aInfo.m_nBottomMarginAdjust = o3tl::toInt32(o3tl::getToken(aValue, 0, ',', nIdx)); } - aValue = aConfig.ReadKey( "ColorDepth" ); + aValue = aConfig.ReadKey( "ColorDepth"_ostr ); if (!aValue.isEmpty()) aPrinter.m_aInfo.m_nColorDepth = aValue.toInt32(); - aValue = aConfig.ReadKey( "ColorDevice" ); + aValue = aConfig.ReadKey( "ColorDevice"_ostr ); if (!aValue.isEmpty()) aPrinter.m_aInfo.m_nColorDevice = aValue.toInt32(); diff --git a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx index 36278074c446..aeaeccf51831 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx @@ -985,7 +985,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() RTL_TEXTENCODING_UTF8 ) ); - OString toReplace("$filename$"); + OString toReplace("$filename$"_ostr); aMsg = aMsg.replaceAt( aMsg.indexOf( toReplace ), diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index ad980fd2b76d..18d1f1aaad0a 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -242,12 +242,12 @@ OString MyWin::processCommand( const OString& rCommand ) IMPL_LINK_NOARG( MyWin, ListHdl, Button*, void) { - parseList( processCommand( "list" ) ); + parseList( processCommand( "list"_ostr ) ); } IMPL_STATIC_LINK_NOARG( MyWin, QuitHdl, Button*, void) { - processCommand( "quit" ); + processCommand( "quit"_ostr ); } IMPL_LINK_NOARG( MyWin, SelectHdl, ListBox&, void) |