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: cfgapi.cxx,v $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_configmgr.hxx"
33 #define _PRIVATE_TEST_
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 #include <com/sun/star/uno/Type.hxx>
40 #include <com/sun/star/uno/TypeClass.hpp>
42 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
43 #include <com/sun/star/container/XNameAccess.hpp>
44 #include <com/sun/star/container/XHierarchicalName.hpp>
45 #include <com/sun/star/container/XNamed.hpp>
46 #include <com/sun/star/container/XNameReplace.hpp>
47 #include <com/sun/star/container/XChild.hpp>
48 #include <com/sun/star/beans/XExactName.hpp>
49 #include <com/sun/star/util/XChangesBatch.hpp>
52 #include <rtl/ustring.hxx>
53 #include <rtl/string.hxx>
54 #include <cppuhelper/servicefactory.hxx>
55 #include <com/sun/star/uno/Sequence.h>
56 #include <com/sun/star/uno/Any.h>
57 #include <osl/profile.hxx>
58 #include <osl/process.h>
61 #include "createpropertyvalue.hxx"
63 #include "typeconverter.hxx"
65 // #include <com/sun/star/configuration/XConfigurationSync.hpp>
67 using namespace ::com::sun::star::uno
;
68 using namespace ::com::sun::star::lang
;
69 using namespace ::com::sun::star::container
;
70 using namespace ::com::sun::star::beans
;
71 //using namespace ::com::sun::star::util;
72 using namespace ::com::sun::star::util
;
74 using ::rtl::OUString
;
76 //using namespace ::configmgr;
78 using namespace ::cppu
;
80 #define ASCII(x) ::rtl::OUString::createFromAscii(x)
82 ostream
& operator << (ostream
& out
, rtl::OUString
const& aStr
)
84 sal_Unicode
const* const pStr
= aStr
.getStr();
85 sal_Unicode
const* const pEnd
= pStr
+ aStr
.getLength();
86 for (sal_Unicode
const* p
= pStr
; p
< pEnd
; ++p
)
87 if (0 < *p
&& *p
< 127) // ASCII
90 out
<< "[\\u" << hex
<< *p
<< "]";
94 void showSequence(const Sequence
<OUString
> &aSeq
)
97 const OUString
*pStr
= aSeq
.getConstArray();
98 for (int i
=0;i
<aSeq
.getLength();i
++)
100 OUString aStr
= pStr
[i
];
101 // aArray += aStr + ASCII(", ");
102 cout
<< aStr
<< endl
;
104 volatile int dummy
= 0;
107 //=============================================================================
109 inline void operator <<= (::rtl::OUString
& _rUnicodeString
, const sal_Char
* _pAsciiString
)
111 _rUnicodeString
= ::rtl::OUString::createFromAscii(_pAsciiString
);
114 inline void operator <<= (::rtl::OUString
& _rUnicodeString
, const ::rtl::OString
& _rAsciiString
)
116 _rUnicodeString
<<= _rAsciiString
.getStr();
119 inline void operator <<= (Any
& _rUnoValue
, const sal_Char
* _pAsciiString
)
121 _rUnoValue
<<= ::rtl::OUString::createFromAscii(_pAsciiString
);
124 inline void operator <<= (Any
& _rUnoValue
, const ::rtl::OString
& _rAsciiString
)
126 _rUnoValue
<<= _rAsciiString
.getStr();
129 //=============================================================================
130 void test_read_access(Reference
< XInterface
>& xIface
, Reference
< XMultiServiceFactory
> &xMSF
);
131 //=============================================================================
132 struct prompt_and_wait
135 prompt_and_wait(char const* text
= "") : myText(text
) {}
138 cout
<< myText
<< ">" << endl
;
139 int const mx
= int( (+0u - +1u) >> 1);
142 if (cin
.get(c
) && c
!= '\n')
146 static prompt_and_wait
exit_prompt("Quitting\nQ");
149 Reference
< XChangesBatch
> xChangesBatch
= NULL
;
152 if (xChangesBatch
.is())
154 xChangesBatch
->commitChanges();
158 // -----------------------------------------------------------------------------
159 static sal_Bool s_bInitialized
= sal_False
;
160 #ifdef LLA_PRIVAT_DEBUG
161 static const sal_Char
* s_pSourcePath
= "l:/src625/configmgr/workben/local_io/share";
162 static const sal_Char
* s_pUpdatePath
= "l:/src625/configmgr/workben/local_io/user";
163 static const sal_Char
* s_pRootNode
= "org.openoffice.ucb.Hierarchy"; // "org.openoffice.test";
164 static const sal_Char
* s_pServerType
= "local";
165 static const sal_Char
* s_pLocale
= "de-DE";
166 static const sal_Char
* s_pServer
= "";
167 static const sal_Char
* s_pUser
= "";
168 static const sal_Char
* s_pPassword
= "";
170 static const sal_Char
* s_pSourcePath
= "g:/src/configmgr/workben/local_io/share";
171 static const sal_Char
* s_pUpdatePath
= "g:/src/configmgr/workben/local_io/user";
172 static const sal_Char
* s_pRootNode
= "org.openoffice.Office.TypeDetection";
173 static const sal_Char
* s_pServerType
= "setup";
174 static const sal_Char
* s_pLocale
= "de-DE";
175 static const sal_Char
* s_pServer
= "lautrec-3108:19205";
176 static const sal_Char
* s_pUser
= "lars";
177 static const sal_Char
* s_pPassword
= "";
181 // -----------------------------------------------------------------------------
182 static void loadDefaults()
187 s_bInitialized
= sal_True
;
191 // the executable file name
192 ::rtl::OUString sExecutable
;
193 osl_getExecutableFile(&sExecutable
.pData
);
194 // cut the name, add a cfgapi.ini to the path
195 sal_Int32 nLastSep
= sExecutable
.lastIndexOf('/');
197 sExecutable
= sExecutable
.copy(0, nLastSep
+ 1);
199 sExecutable
+= ::rtl::OUString::createFromAscii("cfgapirc");
201 sExecutable
+= ::rtl::OUString::createFromAscii("cfgapi.ini");
203 ::rtl::OUString sNormalized
;
204 sNormalized
= sExecutable
;
207 ::osl::Profile
aProfile(sNormalized
);
209 static ::rtl::OString
sSection("defaults");
210 static ::rtl::OString
sSourcePath("sourcepath");
211 static ::rtl::OString
sUpdatePath("updatepath");
212 static ::rtl::OString
sRootNode("rootnode");
213 static ::rtl::OString
sServerType("servertype");
214 static ::rtl::OString
sLocale("Locale");
215 static ::rtl::OString
sServer("Server");
216 static ::rtl::OString
sUser("User");
217 static ::rtl::OString
sPassword("Password");
219 // read some strings.
220 // Do this static because we want to redirect the global static character pointers to the buffers.
221 static ::rtl::OString s_sSourcePath
= aProfile
.readString(sSection
, sSourcePath
, s_pSourcePath
);
222 static ::rtl::OString s_sUpdatePath
= aProfile
.readString(sSection
, sUpdatePath
, s_pUpdatePath
);
223 static ::rtl::OString s_sRootNode
= aProfile
.readString(sSection
, sRootNode
, s_pRootNode
);
224 static ::rtl::OString s_sServerType
= aProfile
.readString(sSection
, sServerType
, s_pServerType
);
225 static ::rtl::OString s_sLocale
= aProfile
.readString(sSection
, sLocale
, s_pLocale
);
226 static ::rtl::OString s_sServer
= aProfile
.readString(sSection
, sServer
, s_pServer
);
227 static ::rtl::OString s_sUser
= aProfile
.readString(sSection
, sUser
, s_pUser
);
228 static ::rtl::OString s_sPassword
= aProfile
.readString(sSection
, sPassword
, s_pPassword
);
230 // do this redirection
231 s_pSourcePath
= s_sSourcePath
.getStr();
232 s_pUpdatePath
= s_sUpdatePath
.getStr();
233 s_pRootNode
= s_sRootNode
.getStr();
234 s_pServerType
= s_sServerType
.getStr();
235 s_pLocale
= s_sLocale
.getStr();
236 s_pServer
= s_sServer
.getStr();
237 s_pUser
= s_sUser
.getStr();
238 s_pPassword
= s_sPassword
.getStr();
241 catch(std::exception
& e
)
243 e
.what(); // silence warnings
247 // -----------------------------------------------------------------------------
248 Sequence
<Any
> createSequence(const OUString
&sUser
, const OUString
&sPasswd
)
250 Sequence
< Any
> aCPArgs
;
252 if (sUser
.getLength() > 0)
255 aCPArgs
[0] <<= configmgr::createPropertyValue(ASCII("user"), sUser
);
257 if (sPasswd
.getLength() > 0)
260 aCPArgs
[1] <<= configmgr::createPropertyValue(ASCII("password"), sPasswd
);
265 //=============================================================================
267 #if (defined UNX) || (defined OS2)
272 OString
input(const char* pDefaultText
, char cEcho
)
274 // PRE: a Default Text would be shown, cEcho is a Value which will show if a key is pressed.
275 const int MAX_INPUT_LEN
= 500;
276 char aBuffer
[MAX_INPUT_LEN
];
278 strcpy(aBuffer
, pDefaultText
);
279 int nLen
= strlen(aBuffer
);
297 aBuffer
[nLen
] = '\0';
307 if (nLen
< MAX_INPUT_LEN
)
318 aBuffer
[nLen
++] = ch
;
319 aBuffer
[nLen
] = '\0';
329 if (!cin
.getline(aBuffer
,sizeof aBuffer
))
332 return OString(aBuffer
);
335 // -----------------------------------------------------------------------------
336 rtl::OUString
enterValue(const char* _aStr
, const char* _aDefault
, bool _bIsAPassword
)
342 sValue
<<= input(_aDefault
, _bIsAPassword
? '*' : 0);
348 // -----------------------------------------------------------------------------
349 // ---------------------------------- M A I N ----------------------------------
350 // -----------------------------------------------------------------------------
352 #if (defined UNX) || (defined OS2)
353 int main( int argc
, char * argv
[] )
355 int _cdecl
main( int argc
, char * argv
[] )
359 aTimeout
.Seconds
= 5;
360 aTimeout
.Nanosec
= 0;
362 // cout << " Please insert Text: ";
364 // OString aTxt = input("Der Text", 0);
365 // cout << endl << "You inserted: " << aTxt.getStr() << endl;
367 // cout << "Please insert Password: ";
369 // OString aPasswd = input("", '*');
370 // cout << endl << "You inserted: " << aPasswd.getStr() << endl;
376 OUString
const sServiceRegistry
= OUString::createFromAscii( argc
> 1 ? argv
[1] : "applicat.rdb" );
377 Reference
< XMultiServiceFactory
> xORB
= createRegistryServiceFactory(
384 cerr
<< "Could not create the service factory !\n\n";
387 cout
<< "Service factory created !\n---------------------------------------------------------------" << endl
;
389 Sequence
< Any
> aCPArgs
;
391 OUString sServerType
= enterValue("servertype: ", s_pServerType
, false);
397 bool bLocal
= sServerType
.equalsIgnoreAsciiCase(ASCII("local")) || sServerType
.equalsIgnoreAsciiCase(ASCII("setup"));
400 rtl::OUString sServer
;
401 sServer
= enterValue("server : ", s_pServer
,false);
404 sUser
= enterValue("user : ", s_pUser
, false);
407 OUString sPasswd
= enterValue("password: ", s_pPassword
, true);
410 aCPArgs
= createSequence(sUser
, sPasswd
);
412 aCPArgs
.realloc(aCPArgs
.getLength() + 1);
413 aCPArgs
[aCPArgs
.getLength() - 1] <<= configmgr::createPropertyValue(ASCII("server"), sServer
);
415 OUString sTimeout
= ASCII("10000");
416 aCPArgs
.realloc(aCPArgs
.getLength() + 1);
417 aCPArgs
[aCPArgs
.getLength() - 1] <<= configmgr::createPropertyValue(ASCII("timeout"), sTimeout
);
422 rtl::OUString sSharePath
, sUserPath
;
423 sSharePath
= enterValue("share path: ", s_pSourcePath
, false);
425 sUserPath
= enterValue("user path : ", s_pUpdatePath
, false);
428 aCPArgs
.realloc(aCPArgs
.getLength() + 1);
429 sal_Int32 nCount
= aCPArgs
.getLength() - 1;
430 Any
*pAny
= &aCPArgs
[nCount
];
431 *pAny
<<= configmgr::createPropertyValue(ASCII("sourcepath"), sSharePath
);
432 aCPArgs
.realloc(aCPArgs
.getLength() + 1);
433 aCPArgs
[aCPArgs
.getLength() - 1] <<= configmgr::createPropertyValue(ASCII("updatepath"), sUserPath
);
436 aCPArgs
.realloc(aCPArgs
.getLength() + 1);
437 aCPArgs
[aCPArgs
.getLength() - 1] <<= configmgr::createPropertyValue(ASCII("servertype"), sServerType
);
439 Reference
< XMultiServiceFactory
> xCfgProvider(
440 xORB
->createInstanceWithArguments(
441 ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"),
444 if (!xCfgProvider
.is())
447 cerr
<< "Could not create the configuration provider !\n\n";
454 char aPath
[300] = "/";
455 int nStart
= sizeof( "/" ) - 1;
457 cout
<< "---------------------------------------------------------------\n Configuration Provider created !\n---------------------------------------------------------------" << endl
;
459 Sequence
< Any
> aArgs
;
460 aArgs
= createSequence(sUser
, ASCII(""));
462 OUString sPath
= enterValue("nodepath: ", s_pRootNode
, false);
465 aArgs
.realloc(aArgs
.getLength() + 1);
466 aArgs
[aArgs
.getLength() - 1] <<= configmgr::createPropertyValue(ASCII("nodepath"), sPath
);
470 OUString sLocale
= enterValue("locale : ", s_pLocale
, false);
472 aArgs
.realloc(aArgs
.getLength() + 1);
473 aArgs
[aArgs
.getLength() - 1] <<= configmgr::createPropertyValue(ASCII("locale"), sLocale
);
477 OUString aStr = ASCII("String");
478 sal_Int32 nDepth = 10;
479 Sequence< Any > aArgs(2);
485 Reference
< XInterface
> xIFace
= xCfgProvider
->createInstanceWithArguments(
486 OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"),
488 cout
<< "---------------------------------------------------------------\n Configuration Read/Write Access created !\n---------------------------------------------------------------" << endl
;
490 xChangesBatch
= Reference
< XChangesBatch
>(xIFace
, UNO_QUERY
);
492 Sequence
<OUString
> aSeq
= xCfgProvider
->getAvailableServiceNames();
495 test_read_access(xIFace
, xCfgProvider
);
500 cerr
<< "Caught exception: " << e
.Message
<< endl
;
506 cerr << "BUG: Caught UNKNOWN exception (?) " << endl;
512 ///////////////////////////////////////////////////////////////////////////////////////////
513 void test(Reference
< XHierarchicalName
>& xAccessName
)
515 if (xAccessName
.is())
516 cout
<< "Accessing Node: " << xAccessName
->getHierarchicalName();
518 cout
<< "BUG: XHierarchicalName not available";
521 void test(Reference
< XNamed
>& xAccess
)
524 cout
<< "Node is named: " << xAccess
->getName();
526 cout
<< "BUG: XNamed not available";
530 ///////////////////////////////////////////////////////////////////////////////////////////
531 void write(Reference
<XNameAccess
>& xAccess
)
535 Sequence
<OUString
> aNames( xAccess
->getElementNames() );
537 cout
<< "Element Names: (" << aNames
.getLength() << ")";
538 for (int i
= 0; i
< aNames
.getLength(); ++i
)
539 cout
<< "\n[" << i
<< "] -\t" << aNames
[i
];
543 cout
<< "BUG: XNameAccess not available";
546 void write(Reference
< XChild
>& xChild
)
549 cout
<< "\n[ P ] -\tParent";
551 cout
<< "BUG: Parent not available (no XChild)";
554 ///////////////////////////////////////////////////////////////////////////////////////////
556 bool ask(Reference
< XInterface
>& xIface
, Reference
<XMultiServiceFactory
> &);
558 void test_read_access(Reference
< XInterface
>& xIface
, Reference
< XMultiServiceFactory
> &xMSF
)
560 using com::sun::star::uno::UNO_QUERY
;
563 cout
<< "\n\n---------------------------------------------------------------" << endl
;
564 Reference
< XNameAccess
> xAccess(xIface
, UNO_QUERY
);
565 Reference
< XChild
> xChild(xIface
, UNO_QUERY
);
566 Reference
< XHierarchicalName
> xAccessPath(xIface
,UNO_QUERY
);
567 Reference
< XNamed
> xAccessName(xIface
,UNO_QUERY
);
568 // Reference< XHierarchicalNameAccess >& xAccess(xIface, UNO_QUERY);
575 while (ask(xIface
, xMSF
));
578 bool ask(Reference
< XInterface
>& xIface
, Reference
< XMultiServiceFactory
> &xMSF
)
580 cout
<< "\n[ Q ] -> <Quit>";
581 cout
<< "\n[ S ] -> <SetValue> ";
584 cout
<< "\n:> " << flush
;
588 bool bHandled
= false;
589 bool bInserted
= false;
591 if (cin
.getline(buf
,sizeof buf
))
593 Reference
< XInterface
> xNext
;
594 if ((buf
[0] == 'q' || buf
[0] == 'Q') && (0 == buf
[1]))
598 else if (buf
[0] == 0)
602 else if((buf
[0] == 0 || buf
[0] == 'o' || buf
[0] == 'O') && (0 == buf
[1]))
605 cout << "work Offline" << endl;
606 Reference<com::sun::star::configuration::XConfigurationSync> xSync(xMSF, UNO_QUERY);
608 Sequence< Any > aArgs2(5);
610 aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Setup"));
611 // aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Office.Common"));
612 // aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Office.Java"));
613 // aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Office.Writer"));
614 // aArgs2[n++] <<= configmgr::createPropertyValue(ASCII("path"), ASCII("org.openoffice.Office.ucb.Hierarchy"));
615 xSync->offline(aArgs2);
619 else if((buf
[0] == 0 || buf
[0] == 's' || buf
[0] == 'S') && (0 == buf
[1]))
622 Reference
< XNameAccess
> xAccess(xIface
, UNO_QUERY
);
624 cout
<< "SetMode, insert a Number" << endl
;
625 cin
.getline(buf
,sizeof buf
);
629 else if ((buf
[0] == 'p' || buf
[0] == 'P') && (0 == buf
[1]))
631 Reference
< XChild
> xChild(xIface
, UNO_QUERY
);
633 xNext
= xChild
->getParent();
637 if (bHandled
== false)
639 Reference
< XNameAccess
> xAccess(xIface
, UNO_QUERY
);
640 Reference
< XHierarchicalNameAccess
> xDeepAccess(xIface
, UNO_QUERY
);
641 Reference
< XExactName
> xExactName(xIface
, UNO_QUERY
);
643 if (xAccess
.is() || xDeepAccess
.is())
646 OUString aInput
= OUString::createFromAscii(buf
);
650 ::rtl::OUString sTemp
= xExactName
->getExactName(aInput
);
651 if (sTemp
.getLength())
655 if (xAccess
.is() && xAccess
->hasByName(aInput
))
659 else if (xDeepAccess
.is() && xDeepAccess
->hasByHierarchicalName(aInput
))
663 else if ('0' <= buf
[0] && buf
[0] <= '9' && xAccess
.is())
665 unsigned int n
= unsigned(atoi(buf
));
666 Sequence
<OUString
> aNames
= xAccess
->getElementNames();
667 if (n
< aNames
.getLength())
671 if (aName
.getLength())
673 bool bNest
= aInput
.indexOf(sal_Unicode('/')) >= 0;
675 Any aElement
= bNest
? ( xDeepAccess
.is() ? xDeepAccess
->getByHierarchicalName(aName
) : Any())
676 : ( xAccess
. is() ? xAccess
-> getByName(aName
) : Any() );
678 while (aElement
.getValueTypeClass() == TypeClass_ANY
)
683 sal_Bool bValue
= true;
684 sal_Bool bValueOk
= false;
686 switch (aElement
.getValueTypeClass() )
688 case TypeClass_INTERFACE
: bValue
= false; break;
689 case TypeClass_BOOLEAN
:
691 sal_Bool
* pVal
= (sal_Bool
*)aElement
.getValue();
692 bValueOk
= (pVal
!= 0);
694 cout
<< "VALUE '" << aName
<< "' is a BOOLEAN = ";
696 cout
<< "NULL (error!!)";
705 case TypeClass_SHORT
:
708 cout
<< "VALUE '" << aName
<< "' is a SHORT (16 bit) = ";
709 if (bValueOk
= (aElement
>>= aValue
))
712 cout
<< "ERROR RETRIEVING VALUE";
720 cout
<< "VALUE '" << aName
<< "' is a INT (32 bit) = ";
721 if (bValueOk
= (aElement
>>= aValue
))
724 cout
<< "ERROR RETRIEVING VALUE";
728 case TypeClass_HYPER
:
731 cout
<< "VALUE '" << aName
<< "' is a LONG (64 bit) = ";
732 if (bValueOk
= (aElement
>>= aValue
))
733 cout
<< double(aValue
);
735 cout
<< "ERROR RETRIEVING VALUE";
739 case TypeClass_DOUBLE
:
742 cout
<< "VALUE '" << aName
<< "' is a DOUBLE = ";
743 if (bValueOk
= (aElement
>>= aValue
))
746 cout
<< "ERROR RETRIEVING VALUE";
750 case TypeClass_STRING
:
753 cout
<< "VALUE '" << aName
<< "' is a STRING = ";
754 if (bValueOk
= (aElement
>>= aValue
))
755 cout
<< "\"" << aValue
<< "\"";
757 cout
<< "ERROR RETRIEVING VALUE";
761 case TypeClass_SEQUENCE
:
763 cout
<< "VALUE '" << aName
<< "' is a SEQUENCE or BINARY" << endl
;
765 Type aTypeS
= configmgr::getSequenceElementType(aElement
.getValueType());
766 OUString sType
= configmgr::toTypeName(aTypeS
.getTypeClass());
767 cout
<< "Real type is Sequence<" << sType
<< ">" << endl
;
772 cout
<< "ELEMENT '" << aName
<< "' is NULL and VOID " << endl
;
776 cout
<< "Error: ELEMENT '" << aName
<< "' is of unknown or unrecognized type" << endl
;
783 if (aElement
.getValueTypeClass() == TypeClass_BOOLEAN
||
784 aElement
.getValueTypeClass() == TypeClass_VOID
)
786 cout
<< "Set Value (Type=BOOL) to :";
788 cin
.getline(buf
,sizeof buf
);
789 OUString aInput
= OUString::createFromAscii(buf
);
790 sal_Bool bValue
= false;
791 if (aInput
.equalsIgnoreAsciiCase(ASCII("true")))
794 OUString aStr
= ASCII("false");
796 aValueAny
<<= bValue
;
798 Reference
< XNameReplace
> xNameReplace(xAccess
, UNO_QUERY
);
799 if (xNameReplace
.is())
801 xNameReplace
->replaceByName(aName
, aValueAny
);
806 else if (aElement
.getValueTypeClass() == TypeClass_STRING
)
808 cout
<< "set value (type = string) to : ";
810 cin
.getline(buf
,sizeof buf
);
814 Reference
< XNameReplace
> xNameReplace(xAccess
, UNO_QUERY
);
815 if (xNameReplace
.is())
817 xNameReplace
->replaceByName(aName
, aValue
);
824 cout
<< "Sorry, only BOOLEAN Values can changed today." << endl
;
828 return bValueOk
? true : false;
831 if (aElement
>>= xNext
)
832 cout
<< "Got an Interface for '" << aName
<< "'" << endl
;
834 cout
<< "Error: Cannot get an Interface for '" << aName
<< "'" << endl
;
838 cout
<< "Error: No element \"" << aInput
<< "\" found." <<endl
;
848 cout
<< "Error: could not obtain the requested Object " << endl
;
852 cout
<< "Input Error " << endl
;
858 cout
<< "An Exception occurred: " << e
.Message
<< endl
;
863 cout
<< "An UNKNOWN Exception occurred !" << endl
;