updatefeed.cxx (9da13427) updatefeed.cxx (554deb42)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 164 unchanged lines hidden (view full) ---

173 // XCommandEnvironment
174 virtual uno::Reference< task::XInteractionHandler > SAL_CALL getInteractionHandler()
175 throw ( uno::RuntimeException );
176
177 virtual uno::Reference< ucb::XProgressHandler > SAL_CALL getProgressHandler()
178 throw ( uno::RuntimeException ) { return uno::Reference< ucb::XProgressHandler >(); };
179
180 // XWebDAVCommandEnvironment
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 164 unchanged lines hidden (view full) ---

173 // XCommandEnvironment
174 virtual uno::Reference< task::XInteractionHandler > SAL_CALL getInteractionHandler()
175 throw ( uno::RuntimeException );
176
177 virtual uno::Reference< ucb::XProgressHandler > SAL_CALL getProgressHandler()
178 throw ( uno::RuntimeException ) { return uno::Reference< ucb::XProgressHandler >(); };
179
180 // XWebDAVCommandEnvironment
181 virtual uno::Sequence< beans::NamedValue > SAL_CALL getUserRequestHeaders(
181 virtual uno::Sequence< beans::StringPair > SAL_CALL getUserRequestHeaders(
182 const rtl::OUString&, const rtl::OUString& )
183 throw ( uno::RuntimeException ) { return m_aRequestHeaderList; };
184
185 // XServiceInfo
186 virtual rtl::OUString SAL_CALL getImplementationName()
187 throw (uno::RuntimeException);
188 virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & serviceName)
189 throw (uno::RuntimeException);
190 virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
191 throw (uno::RuntimeException);
192
193protected:
194
195 virtual ~UpdateInformationProvider();
182 const rtl::OUString&, const rtl::OUString& )
183 throw ( uno::RuntimeException ) { return m_aRequestHeaderList; };
184
185 // XServiceInfo
186 virtual rtl::OUString SAL_CALL getImplementationName()
187 throw (uno::RuntimeException);
188 virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & serviceName)
189 throw (uno::RuntimeException);
190 virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
191 throw (uno::RuntimeException);
192
193protected:
194
195 virtual ~UpdateInformationProvider();
196 static uno::Any getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, rtl::OUString const & node, rtl::OUString const & item);
196 static rtl::OUString getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, rtl::OUString const & node, rtl::OUString const & item);
197
198private:
199 uno::Reference< io::XInputStream > load(const rtl::OUString& rURL);
200
201 void storeCommandInfo( sal_Int32 nCommandId,
202 uno::Reference< ucb::XCommandProcessor > const & rxCommandProcessor);
203
204 UpdateInformationProvider(const uno::Reference<uno::XComponentContext>& xContext,

--- 4 unchanged lines hidden (view full) ---

209
210 const uno::Reference< uno::XComponentContext> m_xContext;
211
212 const uno::Reference< ucb::XContentIdentifierFactory > m_xContentIdFactory;
213 const uno::Reference< ucb::XContentProvider > m_xContentProvider;
214 const uno::Reference< xml::dom::XDocumentBuilder > m_xDocumentBuilder;
215 const uno::Reference< xml::xpath::XXPathAPI > m_xXPathAPI;
216
197
198private:
199 uno::Reference< io::XInputStream > load(const rtl::OUString& rURL);
200
201 void storeCommandInfo( sal_Int32 nCommandId,
202 uno::Reference< ucb::XCommandProcessor > const & rxCommandProcessor);
203
204 UpdateInformationProvider(const uno::Reference<uno::XComponentContext>& xContext,

--- 4 unchanged lines hidden (view full) ---

209
210 const uno::Reference< uno::XComponentContext> m_xContext;
211
212 const uno::Reference< ucb::XContentIdentifierFactory > m_xContentIdFactory;
213 const uno::Reference< ucb::XContentProvider > m_xContentProvider;
214 const uno::Reference< xml::dom::XDocumentBuilder > m_xDocumentBuilder;
215 const uno::Reference< xml::xpath::XXPathAPI > m_xXPathAPI;
216
217 uno::Sequence< beans::NamedValue > m_aRequestHeaderList;
217 uno::Sequence< beans::StringPair > m_aRequestHeaderList;
218
219 uno::Reference< ucb::XCommandProcessor > m_xCommandProcessor;
220 uno::Reference< task::XInteractionHandler > m_xInteractionHandler;
221 uno::Reference< task::XInteractionHandler > m_xPwContainerInteractionHandler;
222
223 osl::Mutex m_aMutex;
224 osl::Condition m_bCancelled;
225

--- 113 unchanged lines hidden (view full) ---

339
340 uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(
341 xServiceManager->createInstanceWithContext(
342 UNISTRING("com.sun.star.configuration.ConfigurationProvider"),
343 xContext ),
344 uno::UNO_QUERY_THROW);
345
346 rtl::OUStringBuffer buf;
218
219 uno::Reference< ucb::XCommandProcessor > m_xCommandProcessor;
220 uno::Reference< task::XInteractionHandler > m_xInteractionHandler;
221 uno::Reference< task::XInteractionHandler > m_xPwContainerInteractionHandler;
222
223 osl::Mutex m_aMutex;
224 osl::Condition m_bCancelled;
225

--- 113 unchanged lines hidden (view full) ---

339
340 uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(
341 xServiceManager->createInstanceWithContext(
342 UNISTRING("com.sun.star.configuration.ConfigurationProvider"),
343 xContext ),
344 uno::UNO_QUERY_THROW);
345
346 rtl::OUStringBuffer buf;
347 rtl::OUString name;
348 getConfigurationItem(
349 xConfigurationProvider,
350 UNISTRING("org.openoffice.Setup/Product"),
351 UNISTRING("ooName")) >>= name;
352 buf.append(name);
347 buf.append(
348 getConfigurationItem(
349 xConfigurationProvider,
350 UNISTRING("org.openoffice.Setup/Product"),
351 UNISTRING("ooName")));
353 buf.append(sal_Unicode(' '));
352 buf.append(sal_Unicode(' '));
354 rtl::OUString version;
355 getConfigurationItem(
356 xConfigurationProvider,
357 UNISTRING("org.openoffice.Setup/Product"),
358 UNISTRING("ooSetupVersion")) >>= version;
359 buf.append(version);
353 buf.append(
354 getConfigurationItem(
355 xConfigurationProvider,
356 UNISTRING("org.openoffice.Setup/Product"),
357 UNISTRING("ooSetupVersion")));
360 rtl::OUString edition(
361 UNISTRING(
362 "${${BRAND_BASE_DIR}/program/edition/edition.ini:"
363 "EDITIONNAME}"));
364 rtl::Bootstrap::expandMacros(edition);
365 if (edition.getLength() != 0) {
366 buf.append(sal_Unicode(' '));
367 buf.append(edition);
368 }
358 rtl::OUString edition(
359 UNISTRING(
360 "${${BRAND_BASE_DIR}/program/edition/edition.ini:"
361 "EDITIONNAME}"));
362 rtl::Bootstrap::expandMacros(edition);
363 if (edition.getLength() != 0) {
364 buf.append(sal_Unicode(' '));
365 buf.append(edition);
366 }
369 rtl::OUString extension;
370 getConfigurationItem(
371 xConfigurationProvider,
372 UNISTRING("org.openoffice.Setup/Product"),
373 UNISTRING("ooSetupExtension")) >>= extension;
367 rtl::OUString extension(
368 getConfigurationItem(
369 xConfigurationProvider,
370 UNISTRING("org.openoffice.Setup/Product"),
371 UNISTRING("ooSetupExtension")));
374 if (extension.getLength() != 0) {
375 buf.append(sal_Unicode(' '));
376 buf.append(extension);
377 }
378 rtl::OUString product(buf.makeStringAndClear());
379
380 rtl::OUString aBaseBuildId( UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) );
381 rtl::Bootstrap::expandMacros( aBaseBuildId );

--- 17 unchanged lines hidden (view full) ---

399 if (i == -1) {
400 break;
401 }
402 aUserAgent = aUserAgent.replaceAt(
403 i, RTL_CONSTASCII_LENGTH("<PRODUCT>"), product);
404 i += product.getLength();
405 }
406
372 if (extension.getLength() != 0) {
373 buf.append(sal_Unicode(' '));
374 buf.append(extension);
375 }
376 rtl::OUString product(buf.makeStringAndClear());
377
378 rtl::OUString aBaseBuildId( UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) );
379 rtl::Bootstrap::expandMacros( aBaseBuildId );

--- 17 unchanged lines hidden (view full) ---

397 if (i == -1) {
398 break;
399 }
400 aUserAgent = aUserAgent.replaceAt(
401 i, RTL_CONSTASCII_LENGTH("<PRODUCT>"), product);
402 i += product.getLength();
403 }
404
407 m_aRequestHeaderList[0].Name = UNISTRING("Accept-Language");
408 m_aRequestHeaderList[0].Value = getConfigurationItem( xConfigurationProvider, UNISTRING("org.openoffice.Setup/L10N"), UNISTRING("ooLocale") );
405 m_aRequestHeaderList[0].First = UNISTRING("Accept-Language");
406 m_aRequestHeaderList[0].Second = getConfigurationItem( xConfigurationProvider, UNISTRING("org.openoffice.Setup/L10N"), UNISTRING("ooLocale") );
409 if( aUserAgent.getLength() > 0 )
410 {
411 m_aRequestHeaderList.realloc(2);
407 if( aUserAgent.getLength() > 0 )
408 {
409 m_aRequestHeaderList.realloc(2);
412 m_aRequestHeaderList[1].Name = UNISTRING("User-Agent");
413 m_aRequestHeaderList[1].Value = uno::makeAny(aUserAgent);
410 m_aRequestHeaderList[1].First = UNISTRING("User-Agent");
411 m_aRequestHeaderList[1].Second = aUserAgent;
414 }
415}
416
417//------------------------------------------------------------------------------
418uno::Reference< uno::XInterface >
419UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentContext>& xContext)
420{
421 uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager());

--- 24 unchanged lines hidden (view full) ---

446//------------------------------------------------------------------------------
447
448UpdateInformationProvider::~UpdateInformationProvider()
449{
450}
451
452//------------------------------------------------------------------------------
453
412 }
413}
414
415//------------------------------------------------------------------------------
416uno::Reference< uno::XInterface >
417UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentContext>& xContext)
418{
419 uno::Reference< lang::XMultiComponentFactory > xServiceManager(xContext->getServiceManager());

--- 24 unchanged lines hidden (view full) ---

444//------------------------------------------------------------------------------
445
446UpdateInformationProvider::~UpdateInformationProvider()
447{
448}
449
450//------------------------------------------------------------------------------
451
454uno::Any
452rtl::OUString
455UpdateInformationProvider::getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, rtl::OUString const & node, rtl::OUString const & item)
456{
453UpdateInformationProvider::getConfigurationItem(uno::Reference<lang::XMultiServiceFactory> const & configurationProvider, rtl::OUString const & node, rtl::OUString const & item)
454{
455 rtl::OUString sRet;
457 beans::PropertyValue aProperty;
458 aProperty.Name = UNISTRING("nodepath");
459 aProperty.Value = uno::makeAny(node);
460
461 uno::Sequence< uno::Any > aArgumentList( 1 );
462 aArgumentList[0] = uno::makeAny( aProperty );
463
464 uno::Reference< container::XNameAccess > xNameAccess(
465 configurationProvider->createInstanceWithArguments(
466 UNISTRING("com.sun.star.configuration.ConfigurationAccess"),
467 aArgumentList ),
468 uno::UNO_QUERY_THROW);
469
456 beans::PropertyValue aProperty;
457 aProperty.Name = UNISTRING("nodepath");
458 aProperty.Value = uno::makeAny(node);
459
460 uno::Sequence< uno::Any > aArgumentList( 1 );
461 aArgumentList[0] = uno::makeAny( aProperty );
462
463 uno::Reference< container::XNameAccess > xNameAccess(
464 configurationProvider->createInstanceWithArguments(
465 UNISTRING("com.sun.star.configuration.ConfigurationAccess"),
466 aArgumentList ),
467 uno::UNO_QUERY_THROW);
468
470 return xNameAccess->getByName(item);
469 xNameAccess->getByName(item) >>= sRet;
470 return sRet;
471}
472
473//------------------------------------------------------------------------------
474
475void
476UpdateInformationProvider::storeCommandInfo(
477 sal_Int32 nCommandId,
478 uno::Reference< ucb::XCommandProcessor > const & rxCommandProcessor)

--- 382 unchanged lines hidden ---
471}
472
473//------------------------------------------------------------------------------
474
475void
476UpdateInformationProvider::storeCommandInfo(
477 sal_Int32 nCommandId,
478 uno::Reference< ucb::XCommandProcessor > const & rxCommandProcessor)

--- 382 unchanged lines hidden ---