LibreOffice Module sd (master) 1
ResourceId.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 <sal/config.h>
23
24#include <vector>
25
26#include <com/sun/star/drawing/framework/XResourceId.hpp>
27#include <com/sun/star/lang/XInitialization.hpp>
28#include <com/sun/star/lang/XServiceInfo.hpp>
30
31#include <memory>
32
33namespace com::sun::star::util { class XURLTransformer; }
34namespace com::sun::star::uno { template <class interface_type> class WeakReference; }
35
36namespace sd::framework {
37
38typedef ::cppu::WeakImplHelper <
39 css::drawing::framework::XResourceId,
40 css::lang::XInitialization,
41 css::lang::XServiceInfo
43
48class ResourceId final
50{
51public:
54 ResourceId();
55
63 ResourceId (std::vector<OUString>&& rsResourceURLs);
64
72 const OUString& rsResourceURL);
73
83 const OUString& rsResourceURL,
84 const OUString& rsAnchorURL);
85
96 const OUString& rsResourceURL,
97 const OUString& rsFirstAnchorURL,
98 const css::uno::Sequence<OUString>& rAnchorURLs);
99
100 virtual ~ResourceId() override;
101
102 //===== XResourceId =======================================================
103
104 virtual OUString SAL_CALL
105 getResourceURL() override;
106
107 virtual css::util::URL SAL_CALL
108 getFullResourceURL() override;
109
110 virtual sal_Bool SAL_CALL
111 hasAnchor() override;
112
113 virtual css::uno::Reference<
114 css::drawing::framework::XResourceId> SAL_CALL
115 getAnchor() override;
116
117 virtual css::uno::Sequence<OUString> SAL_CALL
118 getAnchorURLs() override;
119
120 virtual OUString SAL_CALL
121 getResourceTypePrefix() override;
122
123 virtual sal_Int16 SAL_CALL
124 compareTo (const css::uno::Reference<
125 css::drawing::framework::XResourceId>& rxResourceId) override;
126
127 virtual sal_Bool SAL_CALL
128 isBoundTo (
129 const css::uno::Reference<
130 css::drawing::framework::XResourceId>& rxResourceId,
131 css::drawing::framework::AnchorBindingMode eMode) override;
132
133 virtual sal_Bool SAL_CALL
135 const OUString& rsAnchorURL,
136 css::drawing::framework::AnchorBindingMode eMode) override;
137
138 virtual css::uno::Reference<
139 css::drawing::framework::XResourceId> SAL_CALL
140 clone() override;
141
142 //===== XInitialization ===================================================
143
144 void SAL_CALL initialize (
145 const css::uno::Sequence<css::uno::Any>& aArguments) override;
146
147 OUString SAL_CALL getImplementationName() override;
148
149 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
150
151 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
152
153private:
157 std::vector<OUString> maResourceURLs;
158
159 std::unique_ptr<css::util::URL> mpURL;
160
161 static css::uno::WeakReference<css::util::XURLTransformer> mxURLTransformerWeak;
162
167 sal_Int16 CompareToLocalImplementation (const ResourceId& rId) const;
168
174 sal_Int16 CompareToExternalImplementation (const css::uno::Reference<
175 css::drawing::framework::XResourceId>& rxId) const;
176
191 const OUString* psFirstAnchorURL,
192 const css::uno::Sequence<OUString>* paAnchorURLs,
193 css::drawing::framework::AnchorBindingMode eMode) const;
194
205 const ::std::vector<OUString>& rResourceURLs,
206 css::drawing::framework::AnchorBindingMode eMode) const;
207
208 void ParseResourceURL();
209};
210
211} // end of namespace sd::framework
212
213/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implementation of the css::drawing::framework::ResourceId service and the css::drawing::framework::XR...
Definition: ResourceId.hxx:50
bool IsBoundToAnchor(const OUString *psFirstAnchorURL, const css::uno::Sequence< OUString > *paAnchorURLs, css::drawing::framework::AnchorBindingMode eMode) const
Return whether the called ResourceId object is bound to the anchor consisting of the URLs given by ps...
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL clone() override
Definition: ResourceId.cxx:344
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: ResourceId.cxx:385
virtual css::util::URL SAL_CALL getFullResourceURL() override
Definition: ResourceId.cxx:110
virtual css::uno::Sequence< OUString > SAL_CALL getAnchorURLs() override
Definition: ResourceId.cxx:151
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getAnchor() override
Definition: ResourceId.cxx:137
std::unique_ptr< css::util::URL > mpURL
Definition: ResourceId.hxx:159
ResourceId()
Create a new, empty resource id.
Definition: ResourceId.cxx:51
virtual sal_Int16 SAL_CALL compareTo(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId) override
Definition: ResourceId.cxx:186
virtual OUString SAL_CALL getResourceTypePrefix() override
Definition: ResourceId.cxx:165
bool IsBoundToAnchor(const ::std::vector< OUString > &rResourceURLs, css::drawing::framework::AnchorBindingMode eMode) const
Return whether the called ResourceId object is bound to the anchor consisting of the URLs in rResourc...
sal_Int16 CompareToExternalImplementation(const css::uno::Reference< css::drawing::framework::XResourceId > &rxId) const
Compare the called ResourceId object to the given XResourceId object reference.
Definition: ResourceId.cxx:263
virtual sal_Bool SAL_CALL hasAnchor() override
Definition: ResourceId.cxx:131
virtual ~ResourceId() override
Definition: ResourceId.cxx:95
sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
Definition: ResourceId.cxx:380
ResourceId(const OUString &rsResourceURL, const OUString &rsFirstAnchorURL, const css::uno::Sequence< OUString > &rAnchorURLs)
Create a new resource id with an anchor that consists of a sequence of URLs that is extended by a fur...
virtual OUString SAL_CALL getResourceURL() override
Definition: ResourceId.cxx:101
std::vector< OUString > maResourceURLs
The set of URLs that consist of the resource URL at index 0 and the anchor URLs and indices 1 and abo...
Definition: ResourceId.hxx:157
OUString SAL_CALL getImplementationName() override
Definition: ResourceId.cxx:375
static css::uno::WeakReference< css::util::XURLTransformer > mxURLTransformerWeak
Definition: ResourceId.hxx:161
sal_Int16 CompareToLocalImplementation(const ResourceId &rId) const
Compare the called ResourceId object to the given ResourceId object.
Definition: ResourceId.cxx:221
virtual sal_Bool SAL_CALL isBoundToURL(const OUString &rsAnchorURL, css::drawing::framework::AnchorBindingMode eMode) override
Definition: ResourceId.cxx:336
virtual sal_Bool SAL_CALL isBoundTo(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId, css::drawing::framework::AnchorBindingMode eMode) override
Definition: ResourceId.cxx:309
void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: ResourceId.cxx:351
::cppu::WeakImplHelper< css::drawing::framework::XResourceId, css::lang::XInitialization, css::lang::XServiceInfo > ResourceIdInterfaceBase
Definition: ResourceId.hxx:42
unsigned char sal_Bool