Kaydet (Commit) 0518bb5c authored tarafından Miklos Vajna's avatar Miklos Vajna

desktop lok: handle NoFileSync in saveAs()

Similar to TakeOwnership: detect this, remove it from FilterOptions and
turn it into its own sequence element. Online uses this for its
convert-to functionality.

The new cost for converting a small ODT file into PDF is 84% of the
original (when opting in for this flag).

Change-Id: Id2fcf5dd8b40eed04e0bc37f33519fd7691a9e5a
Reviewed-on: https://gerrit.libreoffice.org/51909Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 862dc17e
......@@ -1564,28 +1564,25 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
// saveAs() is more like save-a-copy, which allows saving to any
// random format like PDF or PNG.
// It is not a real filter option, so we have to filter it out.
uno::Sequence<OUString> aOptionSeq = comphelper::string::convertCommaSeparated(aFilterOptions);
std::vector<OUString> aFilteredOptionVec;
bool bTakeOwnership = false;
int nIndex = -1;
if (aFilterOptions == "TakeOwnership")
{
bTakeOwnership = true;
aFilterOptions.clear();
}
else if ((nIndex = aFilterOptions.indexOf(",TakeOwnership")) >= 0 || (nIndex = aFilterOptions.indexOf("TakeOwnership,")) >= 0)
MediaDescriptor aSaveMediaDescriptor;
for (const auto& rOption : aOptionSeq)
{
OUString aFiltered;
if (nIndex > 0)
aFiltered = aFilterOptions.copy(0, nIndex);
if (nIndex + 14 < aFilterOptions.getLength())
aFiltered = aFiltered + aFilterOptions.copy(nIndex + 14);
bTakeOwnership = true;
aFilterOptions = aFiltered;
if (rOption == "TakeOwnership")
bTakeOwnership = true;
else if (rOption == "NoFileSync")
aSaveMediaDescriptor["NoFileSync"] <<= true;
else
aFilteredOptionVec.push_back(rOption);
}
MediaDescriptor aSaveMediaDescriptor;
aSaveMediaDescriptor["Overwrite"] <<= true;
aSaveMediaDescriptor["FilterName"] <<= aFilterName;
auto aFilteredOptionSeq = comphelper::containerToSequence<OUString>(aFilteredOptionVec);
aFilterOptions = comphelper::string::convertCommaSeparated(aFilteredOptionSeq);
aSaveMediaDescriptor[MediaDescriptor::PROP_FILTEROPTIONS()] <<= aFilterOptions;
// add interaction handler too
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment