throbber.cxx (9f62ea84) | throbber.cxx (aeee3b8f) |
---|---|
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 --- 74 unchanged lines hidden (view full) --- 83Throbber::~Throbber() 84{ 85 maWaitTimer.Stop(); 86} 87 88//---------------------------------------------------------------------------------------------------------------------- 89namespace 90{ | 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 --- 74 unchanged lines hidden (view full) --- 83Throbber::~Throbber() 84{ 85 maWaitTimer.Stop(); 86} 87 88//---------------------------------------------------------------------------------------------------------------------- 89namespace 90{ |
91 //.................................................................................................................. 92 ::rtl::OUString lcl_getHighContrastURL( ::rtl::OUString const& i_imageURL ) 93 { 94 INetURLObject aURL( i_imageURL ); 95 if ( aURL.GetProtocol() != INET_PROT_PRIV_SOFFICE ) 96 { 97 OSL_VERIFY( aURL.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hicontrast" ) ), false, 0 ) ); 98 return aURL.GetMainURL( INetURLObject::NO_DECODE ); 99 } 100 // the private: scheme is not considered to be hierarchical by INetURLObject, so manually insert the 101 // segment 102 const sal_Int32 separatorPos = i_imageURL.indexOf( '/' ); 103 ENSURE_OR_RETURN( separatorPos != -1, "lcl_getHighContrastURL: unsipported URL scheme - cannot automatically determine HC version!", i_imageURL ); 104 105 ::rtl::OUStringBuffer composer; 106 composer.append( i_imageURL.copy( 0, separatorPos ) ); 107 composer.appendAscii( "/hicontrast" ); 108 composer.append( i_imageURL.copy( separatorPos ) ); 109 return composer.makeStringAndClear(); 110 } 111 112 //.................................................................................................................. | |
113 ::std::vector< Image > lcl_loadImageSet( const Throbber::ImageSet i_imageSet, const bool i_isHiContrast ) 114 { 115 ::std::vector< Image > aImages; 116 ENSURE_OR_RETURN( i_imageSet != Throbber::IMAGES_NONE, "lcl_loadImageSet: illegal image set", aImages ); 117 118 const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); 119 const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); 120 --- 4 unchanged lines hidden (view full) --- 125 for ( ::std::vector< ::rtl::OUString >::const_iterator imageURL = aImageURLs.begin(); 126 imageURL != aImageURLs.end(); 127 ++imageURL 128 ) 129 { 130 Reference< XGraphic > xGraphic; 131 if ( i_isHiContrast ) 132 { | 91 ::std::vector< Image > lcl_loadImageSet( const Throbber::ImageSet i_imageSet, const bool i_isHiContrast ) 92 { 93 ::std::vector< Image > aImages; 94 ENSURE_OR_RETURN( i_imageSet != Throbber::IMAGES_NONE, "lcl_loadImageSet: illegal image set", aImages ); 95 96 const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); 97 const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); 98 --- 4 unchanged lines hidden (view full) --- 103 for ( ::std::vector< ::rtl::OUString >::const_iterator imageURL = aImageURLs.begin(); 104 imageURL != aImageURLs.end(); 105 ++imageURL 106 ) 107 { 108 Reference< XGraphic > xGraphic; 109 if ( i_isHiContrast ) 110 { |
133 aMediaProperties.put( "URL", lcl_getHighContrastURL( *imageURL ) ); 134 xGraphic.set( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); | 111 INetURLObject aURL( *imageURL ); 112 if ( aURL.GetProtocol() != INET_PROT_PRIV_SOFFICE ) 113 { 114 const sal_Int32 separatorPos = imageURL->lastIndexOf( '/' ); 115 if ( separatorPos != -1 ) 116 { 117 ::rtl::OUStringBuffer composer; 118 composer.append( imageURL->copy( 0, separatorPos ) ); 119 composer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/hicontrast" ) ); 120 composer.append( imageURL->copy( separatorPos ) ); 121 122 aMediaProperties.put( "URL", composer.makeStringAndClear() ); 123 xGraphic.set( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); 124 } 125 } |
135 } 136 if ( !xGraphic.is() ) 137 { 138 aMediaProperties.put( "URL", *imageURL ); 139 xGraphic.set( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); 140 } 141 aImages.push_back( Image( xGraphic ) ); 142 } --- 131 unchanged lines hidden (view full) --- 274 OSL_ENSURE( false, "Throbber::getDefaultImageURLs: illegal image set!" ); 275 return aImageURLs; 276 } 277 278 aImageURLs.reserve( nImageCounts[index] ); 279 for ( size_t i=0; i<nImageCounts[index]; ++i ) 280 { 281 ::rtl::OUStringBuffer aURL; | 126 } 127 if ( !xGraphic.is() ) 128 { 129 aMediaProperties.put( "URL", *imageURL ); 130 xGraphic.set( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); 131 } 132 aImages.push_back( Image( xGraphic ) ); 133 } --- 131 unchanged lines hidden (view full) --- 265 OSL_ENSURE( false, "Throbber::getDefaultImageURLs: illegal image set!" ); 266 return aImageURLs; 267 } 268 269 aImageURLs.reserve( nImageCounts[index] ); 270 for ( size_t i=0; i<nImageCounts[index]; ++i ) 271 { 272 ::rtl::OUStringBuffer aURL; |
282 aURL.appendAscii( "private:graphicrepository/shared/spinner-" ); | 273 aURL.appendAscii( "private:graphicrepository/vcl/res/spinner-" ); |
283 aURL.appendAscii( pResolutions[index] ); 284 aURL.appendAscii( "-" ); 285 if ( i < 9 ) 286 aURL.appendAscii( "0" ); 287 aURL.append ( sal_Int32( i + 1 ) ); 288 aURL.appendAscii( ".png" ); 289 290 aImageURLs.push_back( aURL.makeStringAndClear() ); --- 31 unchanged lines hidden --- | 274 aURL.appendAscii( pResolutions[index] ); 275 aURL.appendAscii( "-" ); 276 if ( i < 9 ) 277 aURL.appendAscii( "0" ); 278 aURL.append ( sal_Int32( i + 1 ) ); 279 aURL.appendAscii( ".png" ); 280 281 aImageURLs.push_back( aURL.makeStringAndClear() ); --- 31 unchanged lines hidden --- |