LibreOffice Module sd (master) 1
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
sd::framework::ConfigurationClassifier Class Reference

A ConfigurationClassifier object compares two configurations of resources and gives access to the differences. More...

#include <ConfigurationClassifier.hxx>

Public Types

typedef ::std::vector< css::uno::Reference< css::drawing::framework::XResourceId > > ResourceIdVector
 

Public Member Functions

 ConfigurationClassifier (const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration1, const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration2)
 Create a new ConfigurationClassifier object that will compare the two given configurations. More...
 
bool Partition ()
 Calculate three lists of resource ids. More...
 
const ResourceIdVectorGetC1minusC2 () const
 Return the resources that belong to the configuration given as rxConfiguration1 to the constructor but that do not belong to rxConfiguration2. More...
 
const ResourceIdVectorGetC2minusC1 () const
 Return the resources that belong to the configuration given as rxConfiguration2 to the constructor but that do not belong to rxConfiguration1. More...
 

Private Member Functions

void PartitionResources (const css::uno::Sequence< css::uno::Reference< css::drawing::framework::XResourceId > > &rS1, const css::uno::Sequence< css::uno::Reference< css::drawing::framework::XResourceId > > &rS2)
 Put all the elements in the two given sequences of resource ids and copy them into one of the resource id result vectors maC1minusC2, maC2minusC1, and maC1andC2. More...
 

Static Private Member Functions

static void ClassifyResources (const css::uno::Sequence< css::uno::Reference< css::drawing::framework::XResourceId > > &rS1, const css::uno::Sequence< css::uno::Reference< css::drawing::framework::XResourceId > > &rS2, ResourceIdVector &rS1minusS2, ResourceIdVector &rS2minusS1, ResourceIdVector &rS1andS2)
 Compare the given sequences of resource ids and put their elements in one of three vectors depending on whether an element belongs to both sequences or to one but not the other. More...
 
static void CopyResources (const ResourceIdVector &rSource, const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration, ResourceIdVector &rTarget)
 Copy the resources given in rSource to the list of resources specified by rTarget. More...
 

Private Attributes

css::uno::Reference< css::drawing::framework::XConfiguration > mxConfiguration1
 
css::uno::Reference< css::drawing::framework::XConfiguration > mxConfiguration2
 
ResourceIdVector maC1minusC2
 After the call to Classify() this vector holds all elements from mxConfiguration1 that are not in mxConfiguration2. More...
 
ResourceIdVector maC2minusC1
 After the call to Classify() this vector holds all elements from mxConfiguration2 that are not in mxConfiguration1. More...
 

Detailed Description

A ConfigurationClassifier object compares two configurations of resources and gives access to the differences.

It is used mainly when changes to the current configuration have been requested and the various resource controllers have to be supplied with the set of resources that are to be activated or deactivated.

Definition at line 44 of file ConfigurationClassifier.hxx.

Member Typedef Documentation

◆ ResourceIdVector

typedef ::std::vector<css::uno::Reference<css::drawing::framework::XResourceId> > sd::framework::ConfigurationClassifier::ResourceIdVector

Definition at line 64 of file ConfigurationClassifier.hxx.

Constructor & Destructor Documentation

◆ ConfigurationClassifier()

sd::framework::ConfigurationClassifier::ConfigurationClassifier ( const css::uno::Reference< css::drawing::framework::XConfiguration > &  rxConfiguration1,
const css::uno::Reference< css::drawing::framework::XConfiguration > &  rxConfiguration2 
)

Create a new ConfigurationClassifier object that will compare the two given configurations.

Definition at line 32 of file ConfigurationClassifier.cxx.

Member Function Documentation

◆ ClassifyResources()

void sd::framework::ConfigurationClassifier::ClassifyResources ( const css::uno::Sequence< css::uno::Reference< css::drawing::framework::XResourceId > > &  rS1,
const css::uno::Sequence< css::uno::Reference< css::drawing::framework::XResourceId > > &  rS2,
ResourceIdVector rS1minusS2,
ResourceIdVector rS2minusS1,
ResourceIdVector rS1andS2 
)
staticprivate

Compare the given sequences of resource ids and put their elements in one of three vectors depending on whether an element belongs to both sequences or to one but not the other.

Note that only the resource URLs of the XResourceId objects are used for the classification.

Parameters
rS1One sequence of XResourceId objects.
rS2Another sequence of XResourceId objects.

Definition at line 83 of file ConfigurationClassifier.cxx.

Referenced by PartitionResources().

◆ CopyResources()

void sd::framework::ConfigurationClassifier::CopyResources ( const ResourceIdVector rSource,
const css::uno::Reference< css::drawing::framework::XConfiguration > &  rxConfiguration,
ResourceIdVector rTarget 
)
staticprivate

Copy the resources given in rSource to the list of resources specified by rTarget.

Resources bound to the ones in rSource, either directly or indirectly, are copied as well.

Parameters
rSourceAll resources and the ones bound to them, either directly or indirectly, are copied.
rxConfigurationThis configuration is used to determine the resources bound to the ones in rSource.
rTargetThis list is filled with resources from rSource and the ones bound to them.

Definition at line 118 of file ConfigurationClassifier.cxx.

References sd::framework::FrameworkHelper::ResourceIdToString(), rTarget, and SAL_INFO.

Referenced by PartitionResources().

◆ GetC1minusC2()

const ResourceIdVector & sd::framework::ConfigurationClassifier::GetC1minusC2 ( ) const
inline

Return the resources that belong to the configuration given as rxConfiguration1 to the constructor but that do not belong to rxConfiguration2.

Returns
A reference to the, possibly empty, list of resources is returned. This reference remains valid as long as the called ConfigurationClassifier object stays alive.

Definition at line 74 of file ConfigurationClassifier.hxx.

References maC1minusC2.

Referenced by sd::framework::ConfigurationController::restoreConfiguration(), and sd::framework::ConfigurationUpdater::UpdateCore().

◆ GetC2minusC1()

const ResourceIdVector & sd::framework::ConfigurationClassifier::GetC2minusC1 ( ) const
inline

Return the resources that belong to the configuration given as rxConfiguration2 to the constructor but that do not belong to rxConfiguration1.

Returns
A reference to the, possibly empty, list of resources is returned. This reference remains valid as long as the called ConfigurationClassifier object stays alive.

Definition at line 84 of file ConfigurationClassifier.hxx.

References maC2minusC1.

Referenced by sd::framework::ConfigurationController::restoreConfiguration(), and sd::framework::ConfigurationUpdater::UpdateCore().

◆ Partition()

bool sd::framework::ConfigurationClassifier::Partition ( )

Calculate three lists of resource ids.

These contain the resources that belong to one configuration but not the other, or that belong to both configurations.

Returns
When the two configurations differ then return <TRUE>. When they are equivalent then return <FALSE>.

Definition at line 40 of file ConfigurationClassifier.cxx.

References maC1minusC2, maC2minusC1, mxConfiguration1, mxConfiguration2, and PartitionResources().

Referenced by sd::framework::ConfigurationController::restoreConfiguration(), and sd::framework::ConfigurationUpdater::UpdateConfiguration().

◆ PartitionResources()

void sd::framework::ConfigurationClassifier::PartitionResources ( const css::uno::Sequence< css::uno::Reference< css::drawing::framework::XResourceId > > &  rS1,
const css::uno::Sequence< css::uno::Reference< css::drawing::framework::XResourceId > > &  rS2 
)
private

Put all the elements in the two given sequences of resource ids and copy them into one of the resource id result vectors maC1minusC2, maC2minusC1, and maC1andC2.

This is done by using only the resource URLs for classification. Therefore this method calls itself recursively.

Parameters
rS1One sequence of XResourceId objects.
rS2Another sequence of XResourceId objects.

Definition at line 52 of file ConfigurationClassifier.cxx.

References ClassifyResources(), CopyResources(), maC1minusC2, maC2minusC1, mxConfiguration1, mxConfiguration2, PartitionResources(), and SAL_INFO.

Referenced by Partition(), and PartitionResources().

Member Data Documentation

◆ maC1minusC2

ResourceIdVector sd::framework::ConfigurationClassifier::maC1minusC2
private

After the call to Classify() this vector holds all elements from mxConfiguration1 that are not in mxConfiguration2.

Definition at line 108 of file ConfigurationClassifier.hxx.

Referenced by GetC1minusC2(), Partition(), and PartitionResources().

◆ maC2minusC1

ResourceIdVector sd::framework::ConfigurationClassifier::maC2minusC1
private

After the call to Classify() this vector holds all elements from mxConfiguration2 that are not in mxConfiguration1.

Definition at line 113 of file ConfigurationClassifier.hxx.

Referenced by GetC2minusC1(), Partition(), and PartitionResources().

◆ mxConfiguration1

css::uno::Reference<css::drawing::framework::XConfiguration> sd::framework::ConfigurationClassifier::mxConfiguration1
private

Definition at line 102 of file ConfigurationClassifier.hxx.

Referenced by Partition(), and PartitionResources().

◆ mxConfiguration2

css::uno::Reference<css::drawing::framework::XConfiguration> sd::framework::ConfigurationClassifier::mxConfiguration2
private

Definition at line 103 of file ConfigurationClassifier.hxx.

Referenced by Partition(), and PartitionResources().


The documentation for this class was generated from the following files: