LibreOffice Module sd (master) 1
ConfigurationClassifier.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include "debugtrace.hxx"
23#include <com/sun/star/uno/Reference.hxx>
24
25#include <vector>
26
28{
29class XConfiguration;
30}
32{
33class XResourceId;
34}
35
36namespace sd::framework
37{
45{
46public:
51 const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration1,
52 const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration2);
53
61 bool Partition();
62
63 typedef ::std::vector<css::uno::Reference<css::drawing::framework::XResourceId>>
65
74 const ResourceIdVector& GetC1minusC2() const { return maC1minusC2; }
75
84 const ResourceIdVector& GetC2minusC1() const { return maC2minusC1; }
85
86#if DEBUG_SD_CONFIGURATION_TRACE
87
95 const ResourceIdVector& GetC1andC2() const { return maC1andC2; }
96
97 static void TraceResourceIdVector(const char* pMessage, const ResourceIdVector& rResources);
98
99#endif
100
101private:
102 css::uno::Reference<css::drawing::framework::XConfiguration> mxConfiguration1;
103 css::uno::Reference<css::drawing::framework::XConfiguration> mxConfiguration2;
104
109
114
126 const css::uno::Sequence<css::uno::Reference<css::drawing::framework::XResourceId>>& rS1,
127 const css::uno::Sequence<css::uno::Reference<css::drawing::framework::XResourceId>>& rS2);
128
139 static void ClassifyResources(
140 const css::uno::Sequence<css::uno::Reference<css::drawing::framework::XResourceId>>& rS1,
141 const css::uno::Sequence<css::uno::Reference<css::drawing::framework::XResourceId>>& rS2,
142 ResourceIdVector& rS1minusS2, ResourceIdVector& rS2minusS1, ResourceIdVector& rS1andS2);
143
157 static void CopyResources(
158 const ResourceIdVector& rSource,
159 const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration,
160 ResourceIdVector& rTarget);
161};
162
163} // end of namespace sd::framework
164
165/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
A ConfigurationClassifier object compares two configurations of resources and gives access to the dif...
css::uno::Reference< css::drawing::framework::XConfiguration > mxConfiguration1
const ResourceIdVector & GetC2minusC1() const
Return the resources that belong to the configuration given as rxConfiguration2 to the constructor bu...
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.
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 ...
const ResourceIdVector & GetC1minusC2() const
Return the resources that belong to the configuration given as rxConfiguration1 to the constructor bu...
ResourceIdVector maC1minusC2
After the call to Classify() this vector holds all elements from mxConfiguration1 that are not in mxC...
bool Partition()
Calculate three lists of resource ids.
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 resourc...
::std::vector< css::uno::Reference< css::drawing::framework::XResourceId > > ResourceIdVector
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.
ResourceIdVector maC2minusC1
After the call to Classify() this vector holds all elements from mxConfiguration2 that are not in mxC...
css::uno::Reference< css::drawing::framework::XConfiguration > mxConfiguration2