merge the formfield patch from ooo-build
[ooovba.git] / unoxml / source / rdf / CURI.cxx
blobe02fe5e03461a409558954ac644bbb2373161b89
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CURI.cxx,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "CNodes.hxx"
33 #include <cppuhelper/implbase3.hxx>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/lang/XInitialization.hpp>
36 #include <com/sun/star/rdf/XURI.hpp>
37 #include <com/sun/star/rdf/URIs.hpp>
39 #include <com/sun/star/lang/IllegalArgumentException.hpp>
42 /// anonymous implementation namespace
43 namespace {
45 namespace css = ::com::sun::star;
47 class CURI:
48 public ::cppu::WeakImplHelper3<
49 css::lang::XServiceInfo,
50 css::lang::XInitialization,
51 css::rdf::XURI>
53 public:
54 explicit CURI(css::uno::Reference< css::uno::XComponentContext > const & context);
55 virtual ~CURI() {}
57 // ::com::sun::star::lang::XServiceInfo:
58 virtual ::rtl::OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException);
59 virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException);
60 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException);
62 // ::com::sun::star::lang::XInitialization:
63 virtual void SAL_CALL initialize(const css::uno::Sequence< ::com::sun::star::uno::Any > & aArguments) throw (css::uno::RuntimeException, css::uno::Exception);
65 // ::com::sun::star::rdf::XNode:
66 virtual ::rtl::OUString SAL_CALL getStringValue() throw (css::uno::RuntimeException);
68 // ::com::sun::star::rdf::XURI:
69 virtual ::rtl::OUString SAL_CALL getLocalName() throw (css::uno::RuntimeException);
70 virtual ::rtl::OUString SAL_CALL getNamespace() throw (css::uno::RuntimeException);
72 private:
73 CURI(const CURI &); // not defined
74 CURI& operator=(const CURI &); // not defined
76 /// handle css.rdf.URIs
77 void SAL_CALL initFromConstant(const sal_Int16 i_Constant);
79 css::uno::Reference< css::uno::XComponentContext > m_xContext;
81 ::rtl::OUString m_Namespace;
82 ::rtl::OUString m_LocalName;
85 CURI::CURI(css::uno::Reference< css::uno::XComponentContext > const & context) :
86 m_xContext(context), m_Namespace(), m_LocalName()
89 // com.sun.star.uno.XServiceInfo:
90 ::rtl::OUString SAL_CALL CURI::getImplementationName() throw (css::uno::RuntimeException)
92 return comp_CURI::_getImplementationName();
95 ::sal_Bool SAL_CALL CURI::supportsService(::rtl::OUString const & serviceName) throw (css::uno::RuntimeException)
97 css::uno::Sequence< ::rtl::OUString > serviceNames = comp_CURI::_getSupportedServiceNames();
98 for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {
99 if (serviceNames[i] == serviceName)
100 return sal_True;
102 return sal_False;
105 css::uno::Sequence< ::rtl::OUString > SAL_CALL CURI::getSupportedServiceNames() throw (css::uno::RuntimeException)
107 return comp_CURI::_getSupportedServiceNames();
110 const char s_nsXS [] = "http://www.w3.org/2001/XMLSchema#";
111 const char s_nsXSD [] = "http://www.w3.org/2001/XMLSchema-datatypes#";
112 const char s_nsRDF [] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
113 const char s_nsRDFs [] = "http://www.w3.org/2000/01/rdf-schema#";
114 const char s_nsOWL [] = "http://www.w3.org/2002/07/owl#";
115 const char s_nsPkg [] =
116 "http://docs.oasis-open.org/ns/office/1.2/meta/pkg#";
117 const char s_nsODF [] =
118 "http://docs.oasis-open.org/ns/office/1.2/meta/odf#";
120 void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant)
122 const char *ns(0);
123 const char *ln(0);
124 switch (i_Constant)
126 case css::rdf::URIs::XSD_NCNAME:
127 ns = s_nsXSD;
128 ln = "NCName";
129 break;
131 case css::rdf::URIs::XSD_STRING:
132 ns = s_nsXSD;
133 ln = "string";
134 break;
136 case css::rdf::URIs::XSD_NORMALIZEDSTRING:
137 ns = s_nsXSD;
138 ln = "normalizedString";
139 break;
141 case css::rdf::URIs::XSD_BOOLEAN:
142 ns = s_nsXSD;
143 ln = "boolean";
144 break;
146 case css::rdf::URIs::XSD_DECIMAL:
147 ns = s_nsXSD;
148 ln = "decimal";
149 break;
151 case css::rdf::URIs::XSD_FLOAT:
152 ns = s_nsXSD;
153 ln = "float";
154 break;
156 case css::rdf::URIs::XSD_DOUBLE:
157 ns = s_nsXSD;
158 ln = "double";
159 break;
161 case css::rdf::URIs::XSD_INTEGER:
162 ns = s_nsXSD;
163 ln = "integer";
164 break;
166 case css::rdf::URIs::XSD_NONNEGATIVEINTEGER:
167 ns = s_nsXSD;
168 ln = "nonNegativeInteger";
169 break;
171 case css::rdf::URIs::XSD_POSITIVEINTEGER:
172 ns = s_nsXSD;
173 ln = "positiveInteger";
174 break;
176 case css::rdf::URIs::XSD_NONPOSITIVEINTEGER:
177 ns = s_nsXSD;
178 ln = "nonPositiveInteger";
179 break;
181 case css::rdf::URIs::XSD_NEGATIVEINTEGER:
182 ns = s_nsXSD;
183 ln = "negativeInteger";
184 break;
186 case css::rdf::URIs::XSD_LONG:
187 ns = s_nsXSD;
188 ln = "long";
189 break;
191 case css::rdf::URIs::XSD_INT:
192 ns = s_nsXSD;
193 ln = "int";
194 break;
196 case css::rdf::URIs::XSD_SHORT:
197 ns = s_nsXSD;
198 ln = "short";
199 break;
201 case css::rdf::URIs::XSD_BYTE:
202 ns = s_nsXSD;
203 ln = "byte";
204 break;
206 case css::rdf::URIs::XSD_UNSIGNEDLONG:
207 ns = s_nsXSD;
208 ln = "unsignedLong";
209 break;
211 case css::rdf::URIs::XSD_UNSIGNEDINT:
212 ns = s_nsXSD;
213 ln = "unsignedInt";
214 break;
216 case css::rdf::URIs::XSD_UNSIGNEDSHORT:
217 ns = s_nsXSD;
218 ln = "unsignedShort";
219 break;
221 case css::rdf::URIs::XSD_UNSIGNEDBYTE:
222 ns = s_nsXSD;
223 ln = "unsignedByte";
224 break;
226 case css::rdf::URIs::XSD_HEXBINARY:
227 ns = s_nsXSD;
228 ln = "hexBinary";
229 break;
231 case css::rdf::URIs::XSD_BASE64BINARY:
232 ns = s_nsXSD;
233 ln = "base64Binary";
234 break;
236 case css::rdf::URIs::XSD_DATETIME:
237 ns = s_nsXSD;
238 ln = "dateTime";
239 break;
241 case css::rdf::URIs::XSD_TIME:
242 ns = s_nsXSD;
243 ln = "time";
244 break;
246 case css::rdf::URIs::XSD_DATE:
247 ns = s_nsXSD;
248 ln = "date";
249 break;
251 case css::rdf::URIs::XSD_GYEARMONTH:
252 ns = s_nsXSD;
253 ln = "gYearMonth";
254 break;
256 case css::rdf::URIs::XSD_GYEAR:
257 ns = s_nsXSD;
258 ln = "gYear";
259 break;
261 case css::rdf::URIs::XSD_GMONTHDAY:
262 ns = s_nsXSD;
263 ln = "gMonthDay";
264 break;
266 case css::rdf::URIs::XSD_GDAY:
267 ns = s_nsXSD;
268 ln = "gDay";
269 break;
271 case css::rdf::URIs::XSD_GMONTH:
272 ns = s_nsXSD;
273 ln = "gMonth";
274 break;
276 case css::rdf::URIs::XSD_ANYURI:
277 ns = s_nsXSD;
278 ln = "anyURI";
279 break;
281 case css::rdf::URIs::XSD_TOKEN:
282 ns = s_nsXSD;
283 ln = "token";
284 break;
286 case css::rdf::URIs::XSD_LANGUAGE:
287 ns = s_nsXSD;
288 ln = "language";
289 break;
291 case css::rdf::URIs::XSD_NMTOKEN:
292 ns = s_nsXSD;
293 ln = "NMTOKEN";
294 break;
296 case css::rdf::URIs::XSD_NAME:
297 ns = s_nsXSD;
298 ln = "Name";
299 break;
301 case css::rdf::URIs::XSD_DURATION:
302 ns = s_nsXSD;
303 ln = "duration";
304 break;
306 case css::rdf::URIs::XSD_QNAME:
307 ns = s_nsXSD;
308 ln = "QName";
309 break;
311 case css::rdf::URIs::XSD_NOTATION:
312 ns = s_nsXSD;
313 ln = "NOTATION";
314 break;
316 case css::rdf::URIs::XSD_NMTOKENS:
317 ns = s_nsXSD;
318 ln = "NMTOKENS";
319 break;
321 case css::rdf::URIs::XSD_ID:
322 ns = s_nsXSD;
323 ln = "ID";
324 break;
326 case css::rdf::URIs::XSD_IDREF:
327 ns = s_nsXSD;
328 ln = "IDREF";
329 break;
331 case css::rdf::URIs::XSD_IDREFS:
332 ns = s_nsXSD;
333 ln = "IDREFS";
334 break;
336 case css::rdf::URIs::XSD_ENTITY:
337 ns = s_nsXSD;
338 ln = "ENTITY";
339 break;
341 case css::rdf::URIs::XSD_ENTITIES:
342 ns = s_nsXSD;
343 ln = "ENTITIES";
344 break;
346 case css::rdf::URIs::RDF_TYPE:
347 ns = s_nsRDF;
348 ln = "type";
349 break;
351 case css::rdf::URIs::RDF_SUBJECT:
352 ns = s_nsRDF;
353 ln = "subject";
354 break;
356 case css::rdf::URIs::RDF_PREDICATE:
357 ns = s_nsRDF;
358 ln = "predicate";
359 break;
361 case css::rdf::URIs::RDF_OBJECT:
362 ns = s_nsRDF;
363 ln = "object";
364 break;
366 case css::rdf::URIs::RDF_PROPERTY:
367 ns = s_nsRDF;
368 ln = "Property";
369 break;
371 case css::rdf::URIs::RDF_STATEMENT:
372 ns = s_nsRDF;
373 ln = "Statement";
374 break;
376 case css::rdf::URIs::RDF_VALUE:
377 ns = s_nsRDF;
378 ln = "value";
379 break;
381 case css::rdf::URIs::RDF_FIRST:
382 ns = s_nsRDF;
383 ln = "first";
384 break;
386 case css::rdf::URIs::RDF_REST:
387 ns = s_nsRDF;
388 ln = "rest";
389 break;
391 case css::rdf::URIs::RDF_NIL:
392 ns = s_nsRDF;
393 ln = "nil";
394 break;
396 case css::rdf::URIs::RDF_XMLLITERAL:
397 ns = s_nsRDF;
398 ln = "XMLLiteral";
399 break;
401 case css::rdf::URIs::RDF_ALT:
402 ns = s_nsRDF;
403 ln = "Alt";
404 break;
406 case css::rdf::URIs::RDF_BAG:
407 ns = s_nsRDF;
408 ln = "Bag";
409 break;
411 case css::rdf::URIs::RDF_LIST:
412 ns = s_nsRDF;
413 ln = "List";
414 break;
416 case css::rdf::URIs::RDF_SEQ:
417 ns = s_nsRDF;
418 ln = "Seq";
419 break;
421 case css::rdf::URIs::RDF_1:
422 ns = s_nsRDF;
423 ln = "_1";
424 break;
426 case css::rdf::URIs::RDFS_COMMENT:
427 ns = s_nsRDFs;
428 ln = "comment";
429 break;
431 case css::rdf::URIs::RDFS_LABEL:
432 ns = s_nsRDFs;
433 ln = "label";
434 break;
436 case css::rdf::URIs::RDFS_DOMAIN:
437 ns = s_nsRDFs;
438 ln = "domain";
439 break;
441 case css::rdf::URIs::RDFS_RANGE:
442 ns = s_nsRDFs;
443 ln = "range";
444 break;
446 case css::rdf::URIs::RDFS_SUBCLASSOF:
447 ns = s_nsRDFs;
448 ln = "subClassOf";
449 break;
451 case css::rdf::URIs::RDFS_LITERAL:
452 ns = s_nsRDFs;
453 ln = "Literal";
454 break;
456 case css::rdf::URIs::OWL_CLASS:
457 ns = s_nsOWL;
458 ln = "Class";
459 break;
461 case css::rdf::URIs::OWL_OBJECTPROPERTY:
462 ns = s_nsOWL;
463 ln = "ObjectProperty";
464 break;
466 case css::rdf::URIs::OWL_DATATYPEPROPERTY:
467 ns = s_nsOWL;
468 ln = "DatatypeProperty";
469 break;
471 case css::rdf::URIs::OWL_FUNCTIONALPROPERTY:
472 ns = s_nsOWL;
473 ln = "FunctionalProperty";
474 break;
476 case css::rdf::URIs::OWL_THING:
477 ns = s_nsOWL;
478 ln = "Thing";
479 break;
481 case css::rdf::URIs::OWL_NOTHING:
482 ns = s_nsOWL;
483 ln = "Nothing";
484 break;
486 case css::rdf::URIs::OWL_INDIVIDUAL:
487 ns = s_nsOWL;
488 ln = "Individual";
489 break;
491 case css::rdf::URIs::OWL_EQUIVALENTCLASS:
492 ns = s_nsOWL;
493 ln = "equivalentClass";
494 break;
496 case css::rdf::URIs::OWL_EQUIVALENTPROPERTY:
497 ns = s_nsOWL;
498 ln = "equivalentProperty";
499 break;
501 case css::rdf::URIs::OWL_SAMEAS:
502 ns = s_nsOWL;
503 ln = "sameAs";
504 break;
506 case css::rdf::URIs::OWL_DIFFERENTFROM:
507 ns = s_nsOWL;
508 ln = "differentFrom";
509 break;
511 case css::rdf::URIs::OWL_ALLDIFFERENT:
512 ns = s_nsOWL;
513 ln = "AllDifferent";
514 break;
516 case css::rdf::URIs::OWL_DISTINCTMEMBERS:
517 ns = s_nsOWL;
518 ln = "distinctMembers";
519 break;
521 case css::rdf::URIs::OWL_INVERSEOF:
522 ns = s_nsOWL;
523 ln = "inverseOf";
524 break;
526 case css::rdf::URIs::OWL_TRANSITIVEPROPERTY:
527 ns = s_nsOWL;
528 ln = "TransitiveProperty";
529 break;
531 case css::rdf::URIs::OWL_SYMMETRICPROPERTY:
532 ns = s_nsOWL;
533 ln = "SymmetricProperty";
534 break;
536 case css::rdf::URIs::OWL_INVERSEFUNCTIONALPROPERTY:
537 ns = s_nsOWL;
538 ln = "InverseFunctionalProperty";
539 break;
541 case css::rdf::URIs::OWL_RESTRICTION:
542 ns = s_nsOWL;
543 ln = "Restriction";
544 break;
546 case css::rdf::URIs::OWL_ONPROPERTY:
547 ns = s_nsOWL;
548 ln = "onProperty";
549 break;
551 case css::rdf::URIs::OWL_ALLVALUESFROM:
552 ns = s_nsOWL;
553 ln = "allValuesFrom";
554 break;
556 case css::rdf::URIs::OWL_SOMEVALUESFROM:
557 ns = s_nsOWL;
558 ln = "someValuesFrom";
559 break;
561 case css::rdf::URIs::OWL_MINCARDINALITY:
562 ns = s_nsOWL;
563 ln = "minCardinality";
564 break;
566 case css::rdf::URIs::OWL_MAXCARDINALITY:
567 ns = s_nsOWL;
568 ln = "maxCardinality";
569 break;
571 case css::rdf::URIs::OWL_CARDINALITY:
572 ns = s_nsOWL;
573 ln = "cardinality";
574 break;
576 case css::rdf::URIs::OWL_ONTOLOGY:
577 ns = s_nsOWL;
578 ln = "Ontology";
579 break;
581 case css::rdf::URIs::OWL_IMPORTS:
582 ns = s_nsOWL;
583 ln = "imports";
584 break;
586 case css::rdf::URIs::OWL_VERSIONINFO:
587 ns = s_nsOWL;
588 ln = "versionInfo";
589 break;
591 case css::rdf::URIs::OWL_PRIORVERSION:
592 ns = s_nsOWL;
593 ln = "priorVersion";
594 break;
596 case css::rdf::URIs::OWL_BACKWARDCOMPATIBLEWITH:
597 ns = s_nsOWL;
598 ln = "backwardCompatibleWith";
599 break;
601 case css::rdf::URIs::OWL_INCOMPATIBLEWITH:
602 ns = s_nsOWL;
603 ln = "incompatibleWith";
604 break;
606 case css::rdf::URIs::OWL_DEPRECATEDCLASS:
607 ns = s_nsOWL;
608 ln = "DeprecatedClass";
609 break;
611 case css::rdf::URIs::OWL_DEPRECATEDPROPERTY:
612 ns = s_nsOWL;
613 ln = "DeprecatedProperty";
614 break;
616 case css::rdf::URIs::OWL_ANNOTATIONPROPERTY:
617 ns = s_nsOWL;
618 ln = "AnnotationProperty";
619 break;
621 case css::rdf::URIs::OWL_ONTOLOGYPROPERTY:
622 ns = s_nsOWL;
623 ln = "OntologyProperty";
624 break;
626 case css::rdf::URIs::OWL_ONEOF:
627 ns = s_nsOWL;
628 ln = "oneOf";
629 break;
631 case css::rdf::URIs::OWL_DATARANGE:
632 ns = s_nsOWL;
633 ln = "dataRange";
634 break;
636 case css::rdf::URIs::OWL_DISJOINTWITH:
637 ns = s_nsOWL;
638 ln = "disjointWith";
639 break;
641 case css::rdf::URIs::OWL_UNIONOF:
642 ns = s_nsOWL;
643 ln = "unionOf";
644 break;
646 case css::rdf::URIs::OWL_COMPLEMENTOF:
647 ns = s_nsOWL;
648 ln = "complementOf";
649 break;
651 case css::rdf::URIs::OWL_INTERSECTIONOF:
652 ns = s_nsOWL;
653 ln = "intersectionOf";
654 break;
656 case css::rdf::URIs::OWL_HASVALUE:
657 ns = s_nsOWL;
658 ln = "hasValue";
659 break;
662 case css::rdf::URIs::PKG_HASPART:
663 ns = s_nsPkg;
664 ln = "hasPart";
665 break;
667 /* REMOVED
668 case css::rdf::URIs::PKG_IDREF:
669 ns = s_nsPkg;
670 ln = "idref";
671 break;
673 case css::rdf::URIs::PKG_PATH:
674 ns = s_nsPkg;
675 ln = "path";
676 break;
679 case css::rdf::URIs::PKG_MIMETYPE:
680 ns = s_nsPkg;
681 ln = "mimeType";
682 break;
684 case css::rdf::URIs::PKG_PACKAGE:
685 ns = s_nsPkg;
686 ln = "Package";
687 break;
689 case css::rdf::URIs::PKG_ELEMENT:
690 ns = s_nsPkg;
691 ln = "Element";
692 break;
694 case css::rdf::URIs::PKG_FILE:
695 ns = s_nsPkg;
696 ln = "File";
697 break;
699 case css::rdf::URIs::PKG_METADATAFILE:
700 ns = s_nsPkg;
701 ln = "MetadataFile";
702 break;
704 case css::rdf::URIs::PKG_DOCUMENT:
705 ns = s_nsPkg;
706 ln = "Document";
707 break;
709 case css::rdf::URIs::ODF_PREFIX:
710 ns = s_nsODF;
711 ln = "prefix";
712 break;
714 case css::rdf::URIs::ODF_SUFFIX:
715 ns = s_nsODF;
716 ln = "suffix";
717 break;
719 case css::rdf::URIs::ODF_ELEMENT:
720 ns = s_nsODF;
721 ln = "Element";
722 break;
724 case css::rdf::URIs::ODF_CONTENTFILE:
725 ns = s_nsODF;
726 ln = "ContentFile";
727 break;
729 case css::rdf::URIs::ODF_STYLESFILE:
730 ns = s_nsODF;
731 ln = "StylesFile";
732 break;
734 /* REMOVED
735 case css::rdf::URIs::ODF_METADATAFILE:
736 ns = s_nsODF;
737 ln = "MetadataFile";
738 break;
741 default:
742 throw css::lang::IllegalArgumentException(
743 ::rtl::OUString::createFromAscii("CURI::initialize: "
744 "invalid URIs constant argument"), *this, 0);
746 m_Namespace = ::rtl::OUString::createFromAscii(ns).intern();
747 m_LocalName = ::rtl::OUString::createFromAscii(ln).intern();
748 return;
751 // ::com::sun::star::lang::XInitialization:
752 void SAL_CALL CURI::initialize(const css::uno::Sequence< ::com::sun::star::uno::Any > & aArguments) throw (css::uno::RuntimeException, css::uno::Exception)
754 sal_Int32 len = aArguments.getLength();
755 if ((len < 1) || (len > 2)) {
756 throw css::lang::IllegalArgumentException(
757 ::rtl::OUString::createFromAscii("CURI::initialize: "
758 "must give 1 or 2 argument(s)"), *this, 2);
761 sal_Int16 arg(0);
762 ::rtl::OUString arg0;
763 ::rtl::OUString arg1;
764 if ((aArguments[0] >>= arg)) {
765 // integer argument: constant from rdf::URIs
766 if (len != 1) {
767 throw css::lang::IllegalArgumentException(
768 ::rtl::OUString::createFromAscii("CURI::initialize: "
769 "must give 1 int argument"), *this, 1);
771 initFromConstant(arg);
772 return;
774 if (!(aArguments[0] >>= arg0)) {
775 throw css::lang::IllegalArgumentException(
776 ::rtl::OUString::createFromAscii("CURI::initialize: "
777 "argument must be string or short"), *this, 0);
779 if (len > 1) {
780 if (!(aArguments[1] >>= arg1)) {
781 throw css::lang::IllegalArgumentException(
782 ::rtl::OUString::createFromAscii("CURI::initialize: "
783 "argument must be string"), *this, 1);
785 // just append the parameters and then split them again; seems simplest
786 arg0 = arg0 + arg1;
787 arg1 = ::rtl::OUString();
790 // split parameter
791 sal_Int32 idx;
792 if ( ((idx = arg0.indexOf ('#')) >= 0)
793 || ((idx = arg0.lastIndexOf('/')) >= 0)
794 || ((idx = arg0.lastIndexOf(':')) >= 0))
797 if (idx < arg0.getLength() - 1) {
798 arg1 = arg0.copy(idx+1);
799 arg0 = arg0.copy(0, idx+1);
801 } else {
802 throw css::lang::IllegalArgumentException(
803 ::rtl::OUString::createFromAscii("CURI::initialize: "
804 "argument not splittable: no separator [#/:]"), *this, 0);
807 //FIXME: what is legal?
808 if (arg0.getLength() > 0) {
809 m_Namespace = arg0;
810 } else {
811 throw css::lang::IllegalArgumentException(
812 ::rtl::OUString::createFromAscii("CURI::initialize: "
813 "argument is not valid namespace"), *this, 0);
815 //FIXME: what is legal?
816 if (true) {
817 m_LocalName = arg1;
818 } else {
819 throw css::lang::IllegalArgumentException(
820 ::rtl::OUString::createFromAscii("CURI::initialize: "
821 "argument is not valid local name"), *this, 1);
825 // ::com::sun::star::rdf::XNode:
826 ::rtl::OUString SAL_CALL CURI::getStringValue() throw (css::uno::RuntimeException)
828 return m_Namespace + m_LocalName;
831 // ::com::sun::star::rdf::XURI:
832 ::rtl::OUString SAL_CALL CURI::getNamespace() throw (css::uno::RuntimeException)
834 return m_Namespace;
837 ::rtl::OUString SAL_CALL CURI::getLocalName() throw (css::uno::RuntimeException)
839 return m_LocalName;
842 } // closing anonymous implementation namespace
846 // component helper namespace
847 namespace comp_CURI {
849 ::rtl::OUString SAL_CALL _getImplementationName() {
850 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
851 "CURI"));
854 css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
856 css::uno::Sequence< ::rtl::OUString > s(1);
857 s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
858 "com.sun.star.rdf.URI"));
859 return s;
862 css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
863 const css::uno::Reference< css::uno::XComponentContext > & context)
864 SAL_THROW((css::uno::Exception))
866 return static_cast< ::cppu::OWeakObject * >(new CURI(context));
869 } // closing component helper namespace