/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column:100 -*- */ /* * 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/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// Detect if there is no path then we need to use the current folder.
INetURLObject aURL(sURL);
sURL = aURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri); if (sURL.isEmpty())
{ // Need to add cur dir ( of this document ) or else the 'Work' dir
sURL = xModel->getURL();
if (sURL.isEmpty())
{ // Not path available from 'this' document. Need to add the 'document'/work directory then. // Based on SwVbaOptions::getValueEvent()
uno::Reference<util::XPathSettings> xPathSettings
= util::thePathSettings::get(comphelper::getProcessComponentContext());
OUString sPathUrl;
xPathSettings->getPropertyValue(u"Work"_ustr) >>= sPathUrl; // Path could be a multipath, Microsoft doesn't support this feature in Word currently. // Only the last path is from interest. // No idea if this crack is relevant for WordBasic or not.
sal_Int32 nIndex = sPathUrl.lastIndexOf(';'); if (nIndex != -1)
{
sPathUrl = sPathUrl.copy(nIndex + 1);
}
// FIXME: Here I would much prefer to call VbaDocumentBase::Close() but not sure how to get at // the VbaDocumentBase of the current document. (Probably it is easy and I haven't looked hard // enough.) // // FIXME: Error handling. If there is no current document, return some kind of error? But for // now, just ignore errors. This code is written to work for a very specific customer use case // anyway, not for an arbitrary sequence of COM calls to the "VBA" API.
dispatchRequests(xModel, u".uno:CloseDoc"_ustr);
}
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.