convert LoadEnv::EFeature to o3tl::typed_flags
Change-Id: I4c16b68c820783e9bd27fa273f2017b5088f4b85
This commit is contained in:
@@ -106,7 +106,7 @@ css::uno::Any LoadDispatcher::impl_dispatch( const css::util::URL& rURL,
|
|||||||
css::uno::Reference< css::lang::XComponent > xComponent;
|
css::uno::Reference< css::lang::XComponent > xComponent;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_aLoader.initializeLoading( rURL.Complete, lArguments, xBaseFrame, m_sTarget, m_nSearchFlags, (LoadEnv::EFeature)(LoadEnv::E_ALLOW_CONTENTHANDLER | LoadEnv::E_WORK_WITH_UI));
|
m_aLoader.initializeLoading( rURL.Complete, lArguments, xBaseFrame, m_sTarget, m_nSearchFlags, LoadEnvFeatures::AllowContentHandler | LoadEnvFeatures::WorkWithUI);
|
||||||
m_aLoader.startLoading();
|
m_aLoader.startLoading();
|
||||||
m_aLoader.waitWhileLoading(); // wait for ever!
|
m_aLoader.waitWhileLoading(); // wait for ever!
|
||||||
xComponent = m_aLoader.getTargetComponent();
|
xComponent = m_aLoader.getTargetComponent();
|
||||||
|
@@ -35,6 +35,33 @@
|
|||||||
#include <rtl/ref.hxx>
|
#include <rtl/ref.hxx>
|
||||||
#include <unotools/mediadescriptor.hxx>
|
#include <unotools/mediadescriptor.hxx>
|
||||||
#include <comphelper/sequenceashashmap.hxx>
|
#include <comphelper/sequenceashashmap.hxx>
|
||||||
|
#include <o3tl/typed_flags_set.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
/** @short enable/disable special features
|
||||||
|
of a load request.
|
||||||
|
|
||||||
|
@desrc Such features must outcome without
|
||||||
|
any special parameters.
|
||||||
|
To make enabling/disabling of
|
||||||
|
features very easy (e.g. at the ctor of
|
||||||
|
this class) these values must be combinable
|
||||||
|
as flags. That means: its values must be in
|
||||||
|
range of [2^n]!
|
||||||
|
*/
|
||||||
|
enum class LoadEnvFeatures
|
||||||
|
{
|
||||||
|
/// we should be informed, if no feature is enabled :-)
|
||||||
|
NONE = 0,
|
||||||
|
/// enable using of UI elements during loading (means progress, interaction handler etcpp.)
|
||||||
|
WorkWithUI = 1,
|
||||||
|
/// enable loading of resources, which are not related to a target frame! (see concept of ContentHandler)
|
||||||
|
AllowContentHandler = 2
|
||||||
|
};
|
||||||
|
namespace o3tl {
|
||||||
|
template<> struct typed_flags<LoadEnvFeatures> : is_typed_flags<LoadEnvFeatures, 0x3> {};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace framework {
|
namespace framework {
|
||||||
|
|
||||||
@@ -51,28 +78,6 @@ class QuietInteraction;
|
|||||||
class LoadEnv
|
class LoadEnv
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** @short enable/disable special features
|
|
||||||
of a load request.
|
|
||||||
|
|
||||||
@desrc Such features must outcome without
|
|
||||||
any special parameters.
|
|
||||||
To make enabling/disabling of
|
|
||||||
features very easy (e.g. at the ctor of
|
|
||||||
this class) these values must be combinable
|
|
||||||
as flags. That means: its values must be in
|
|
||||||
range of [2^n]!
|
|
||||||
*/
|
|
||||||
enum EFeature
|
|
||||||
{
|
|
||||||
/// we should be informed, if no feature is enabled :-)
|
|
||||||
E_NO_FEATURE = 0,
|
|
||||||
/// enable using of UI elements during loading (means progress, interaction handler etcpp.)
|
|
||||||
E_WORK_WITH_UI = 1,
|
|
||||||
/// enable loading of resources, which are not related to a target frame! (see concept of ContentHandler)
|
|
||||||
E_ALLOW_CONTENTHANDLER = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @short classify a content.
|
/** @short classify a content.
|
||||||
|
|
||||||
@descr The load environment must know, if a content
|
@descr The load environment must know, if a content
|
||||||
@@ -153,7 +158,7 @@ private:
|
|||||||
css::util::URL m_aURL;
|
css::util::URL m_aURL;
|
||||||
|
|
||||||
/** @short enable/disable special features of a load request. */
|
/** @short enable/disable special features of a load request. */
|
||||||
EFeature m_eFeature;
|
LoadEnvFeatures m_eFeature;
|
||||||
|
|
||||||
/** @short classify the content, which should be loaded by this instance. */
|
/** @short classify the content, which should be loaded by this instance. */
|
||||||
EContentType m_eContentType;
|
EContentType m_eContentType;
|
||||||
@@ -264,7 +269,7 @@ public:
|
|||||||
const css::uno::Reference< css::frame::XFrame >& xBaseFrame ,
|
const css::uno::Reference< css::frame::XFrame >& xBaseFrame ,
|
||||||
const OUString& sTarget ,
|
const OUString& sTarget ,
|
||||||
sal_Int32 nSearchFlags ,
|
sal_Int32 nSearchFlags ,
|
||||||
EFeature eFeature = E_NO_FEATURE);
|
LoadEnvFeatures eFeature = LoadEnvFeatures::NONE);
|
||||||
|
|
||||||
/** @short start loading of the resource represented by this loadenv instance.
|
/** @short start loading of the resource represented by this loadenv instance.
|
||||||
|
|
||||||
|
@@ -123,7 +123,7 @@ class LoadEnvListener : public ::cppu::WeakImplHelper< css::frame::XLoadEventLis
|
|||||||
LoadEnv::LoadEnv(const css::uno::Reference< css::uno::XComponentContext >& xContext)
|
LoadEnv::LoadEnv(const css::uno::Reference< css::uno::XComponentContext >& xContext)
|
||||||
: m_xContext(xContext)
|
: m_xContext(xContext)
|
||||||
, m_nSearchFlags(0)
|
, m_nSearchFlags(0)
|
||||||
, m_eFeature(E_NO_FEATURE)
|
, m_eFeature(LoadEnvFeatures::NONE)
|
||||||
, m_eContentType(E_UNSUPPORTED_CONTENT)
|
, m_eContentType(E_UNSUPPORTED_CONTENT)
|
||||||
, m_bCloseFrameOnError(false)
|
, m_bCloseFrameOnError(false)
|
||||||
, m_bReactivateControllerOnError(false)
|
, m_bReactivateControllerOnError(false)
|
||||||
@@ -213,7 +213,7 @@ utl::MediaDescriptor addModelArgs(const uno::Sequence<beans::PropertyValue>& rDe
|
|||||||
|
|
||||||
void LoadEnv::initializeLoading(const OUString& sURL, const uno::Sequence<beans::PropertyValue>& lMediaDescriptor,
|
void LoadEnv::initializeLoading(const OUString& sURL, const uno::Sequence<beans::PropertyValue>& lMediaDescriptor,
|
||||||
const uno::Reference<frame::XFrame>& xBaseFrame, const OUString& sTarget,
|
const uno::Reference<frame::XFrame>& xBaseFrame, const OUString& sTarget,
|
||||||
sal_Int32 nSearchFlags, EFeature eFeature)
|
sal_Int32 nSearchFlags, LoadEnvFeatures eFeature)
|
||||||
{
|
{
|
||||||
osl::MutexGuard g(m_mutex);
|
osl::MutexGuard g(m_mutex);
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ void LoadEnv::initializeLoading(const OUString& sURL, const uno::Sequence<beans:
|
|||||||
|
|
||||||
// UI mode
|
// UI mode
|
||||||
const bool bUIMode =
|
const bool bUIMode =
|
||||||
((m_eFeature & E_WORK_WITH_UI) == E_WORK_WITH_UI) &&
|
(m_eFeature & LoadEnvFeatures::WorkWithUI) &&
|
||||||
!m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN(), false) &&
|
!m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN(), false) &&
|
||||||
!m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW(), false);
|
!m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW(), false);
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ void LoadEnv::startLoading()
|
|||||||
// Use another strategy here. Try it and let it run into the case "loading not possible".
|
// Use another strategy here. Try it and let it run into the case "loading not possible".
|
||||||
bool bStarted = false;
|
bool bStarted = false;
|
||||||
if (
|
if (
|
||||||
((m_eFeature & E_ALLOW_CONTENTHANDLER) == E_ALLOW_CONTENTHANDLER) &&
|
(m_eFeature & LoadEnvFeatures::AllowContentHandler) &&
|
||||||
(m_eContentType != E_CAN_BE_SET ) /* Attention: special feature to set existing component on a frame must ignore type detection! */
|
(m_eContentType != E_CAN_BE_SET ) /* Attention: special feature to set existing component on a frame must ignore type detection! */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user