/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// link should be modified to be placed in temp dir - for testing relative links void UseTempDir()
{
uno::Reference<text::XTextRange> xParagraph = getParagraph(1); /* can be changed only after import */
uno::Reference<text::XTextRange> xText = getRun(xParagraph, 1);
/* Get original link */
OUString sOriginalFileName = getProperty<OUString>(xText, u"HyperLinkURL"_ustr);
INetURLObject aOriginalURL(sOriginalFileName);
CPPUNIT_ASSERT(!aOriginalURL.HasError());
OUString sFileName = aOriginalURL.GetLastName();
CPPUNIT_ASSERT(!sFileName.isEmpty());
/* Get temp path */
OUString sTempDir = utl::GetTempNameBaseDirectory();
CPPUNIT_TEST_FIXTURE(Test, testAbsoluteToRelativeImport)
{
SetAbsolute(USE_RELATIVE);
createSwDoc("absolute-link.docx");
uno::Reference<text::XTextRange> xParagraph = getParagraph(1);
uno::Reference<text::XTextRange> xText = getRun(xParagraph, 1); // when target file (B:\\...) & document with link (temp dir) are placed on different partitions, absolute path will be loaded
CPPUNIT_ASSERT_EQUAL(u"file:///B:/Users/user/Desktop/a%23b/test.docx"_ustr,
getProperty<OUString>(xText, u"HyperLinkURL"_ustr));
}
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.16Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-05-04)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.