Files
odfstudio/include/comphelper/scriptbrowse.hxx
T
Neil Roberts 54ba86b578 scripting: Replace XAggregation of XBrowseNode with helper function
The browse node factory had a wrapper using XAggregation that wraps
every XBrowseNode. As far as I can tell this was used to replace the
implementation of getChildNodes with one that checks for exceptions from
the underlying provider and then sorts all of the resulting nodes by
name. The trouble with this is that it prevents the script providers
from detecting when a node is one from the same script provider and thus
makes it difficult to implement the XCopyableBrowseNode interface. The
documentation for XAggregation mentions this problem and also states
that the interface is deprecated.

To avoid this overhead, this patch replaces the aggregation with a
helper function in comphelper that should be used to retrieve children
from a browse node. That takes care of catching exceptions and sorting
the results.

Change-Id: I319888fee1b84ddcef397317d2cf7e72bd2867cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208160
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-07-23 15:18:22 +02:00

58 lines
2.1 KiB
C++

/* -*- 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/.
*/
#pragma once
#include <sal/config.h>
#include <comphelper/comphelperdllapi.h>
#include <com/sun/star/uno/Reference.hxx>
#include <vector>
namespace com::sun::star::script::browse
{
class XBrowseNode;
}
namespace comphelper::scriptbrowse
{
COMPHELPER_DLLPUBLIC bool
isEditable(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode);
COMPHELPER_DLLPUBLIC bool
editNode(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode);
COMPHELPER_DLLPUBLIC bool
isDeletable(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode);
COMPHELPER_DLLPUBLIC bool
deleteNode(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode);
COMPHELPER_DLLPUBLIC bool
isCreatable(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode);
COMPHELPER_DLLPUBLIC css::uno::Reference<css::script::browse::XBrowseNode>
createNode(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode,
const OUString& sName);
COMPHELPER_DLLPUBLIC bool
isRenamable(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode);
COMPHELPER_DLLPUBLIC css::uno::Reference<css::script::browse::XBrowseNode>
renameNode(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode,
const OUString& sName);
COMPHELPER_DLLPUBLIC std::vector<css::uno::Reference<css::script::browse::XBrowseNode>>
getChildNodes(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode);
COMPHELPER_DLLPUBLIC void
sortNodes(std::vector<css::uno::Reference<css::script::browse::XBrowseNode>>& aNodes);
COMPHELPER_DLLPUBLIC std::vector<css::uno::Reference<css::script::browse::XBrowseNode>>
getSortedChildNodes(const css::uno::Reference<css::script::browse::XBrowseNode>& xNode);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */