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 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX 25 #define _UNOCONTROLS_PROGRESSBAR_CTRL_HXX 26 27 //____________________________________________________________________________________________________________ 28 // includes of other projects 29 //____________________________________________________________________________________________________________ 30 31 #include <com/sun/star/lang/XServiceName.hpp> 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 34 //____________________________________________________________________________________________________________ 35 // includes of my own project 36 //____________________________________________________________________________________________________________ 37 #include "basecontrol.hxx" 38 39 //____________________________________________________________________________________________________________ 40 // namespaces 41 //____________________________________________________________________________________________________________ 42 43 namespace unocontrols{ 44 45 #define UNO3_REFERENCE ::com::sun::star::uno::Reference 46 #define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory 47 #define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException 48 #define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel 49 #define UNO3_XPROGRESSBAR ::com::sun::star::awt::XProgressBar 50 #define UNO3_ANY ::com::sun::star::uno::Any 51 #define UNO3_TYPE ::com::sun::star::uno::Type 52 #define UNO3_SEQUENCE ::com::sun::star::uno::Sequence 53 #define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics 54 #define UNO3_OUSTRING ::rtl::OUString 55 #define UNO3_SIZE ::com::sun::star::awt::Size 56 57 //____________________________________________________________________________________________________________ 58 // defines 59 //____________________________________________________________________________________________________________ 60 61 #define SERVICENAME_PROGRESSBAR "com.sun.star.awt.XProgressBar" 62 #define IMPLEMENTATIONNAME_PROGRESSBAR "stardiv.UnoControls.ProgressBar" 63 #define FREESPACE 4 64 #define DEFAULT_HORIZONTAL sal_True 65 #define DEFAULT_BLOCKDIMENSION Size(1,1) 66 #define DEFAULT_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray 67 #define DEFAULT_FOREGROUNDCOLOR TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x80 ) // blue 68 #define DEFAULT_MINRANGE INT_MIN 69 #define DEFAULT_MAXRANGE INT_MAX 70 #define DEFAULT_BLOCKVALUE 1 71 #define DEFAULT_VALUE DEFAULT_MINRANGE 72 #define LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white 73 #define LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black 74 75 //____________________________________________________________________________________________________________ 76 // classes 77 //____________________________________________________________________________________________________________ 78 79 class ProgressBar : public UNO3_XCONTROLMODEL 80 , public UNO3_XPROGRESSBAR 81 , public BaseControl 82 { 83 84 //____________________________________________________________________________________________________________ 85 // public methods 86 //____________________________________________________________________________________________________________ 87 88 public: 89 90 //________________________________________________________________________________________________________ 91 // construct/destruct 92 //________________________________________________________________________________________________________ 93 94 /**_________________________________________________________________________________________________________ 95 @short 96 @descr 97 98 @seealso 99 100 @param 101 102 @return 103 104 @onerror 105 */ 106 107 ProgressBar( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory ); 108 109 /**_________________________________________________________________________________________________________ 110 @short 111 @descr 112 113 @seealso 114 115 @param 116 117 @return 118 119 @onerror 120 */ 121 122 virtual ~ProgressBar(); 123 124 //__________________________________________________________________________________________________________ 125 // XInterface 126 //__________________________________________________________________________________________________________ 127 128 /**_________________________________________________________________________________________________________ 129 @short 130 @descr 131 132 @seealso 133 134 @param 135 136 @return 137 138 @onerror 139 */ 140 141 virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION ); 142 143 /**_______________________________________________________________________________________________________ 144 @short increment refcount 145 @descr - 146 147 @seealso XInterface 148 @seealso release() 149 150 @param - 151 152 @return - 153 154 @onerror A RuntimeException is thrown. 155 */ 156 157 virtual void SAL_CALL acquire() throw(); 158 159 /**_______________________________________________________________________________________________________ 160 @short decrement refcount 161 @descr - 162 163 @seealso XInterface 164 @seealso acquire() 165 166 @param - 167 168 @return - 169 170 @onerror A RuntimeException is thrown. 171 */ 172 173 virtual void SAL_CALL release() throw(); 174 175 //__________________________________________________________________________________________________________ 176 // XTypeProvider 177 //__________________________________________________________________________________________________________ 178 179 /**_________________________________________________________________________________________________________ 180 @short 181 @descr 182 183 @seealso 184 185 @param 186 187 @return 188 189 @onerror 190 */ 191 192 virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION ); 193 194 //__________________________________________________________________________________________________________ 195 // XAggregation 196 //__________________________________________________________________________________________________________ 197 198 /**_________________________________________________________________________________________________________ 199 @short 200 @descr 201 202 @seealso 203 204 @param 205 206 @return 207 208 @onerror 209 */ 210 211 UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION ); 212 213 //________________________________________________________________________________________________________ 214 // XProgressBar 215 //________________________________________________________________________________________________________ 216 217 /**_________________________________________________________________________________________________________ 218 @short 219 @descr 220 221 @seealso 222 223 @param 224 225 @return 226 227 @onerror 228 */ 229 230 virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION ); 231 232 /**_________________________________________________________________________________________________________ 233 @short 234 @descr 235 236 @seealso 237 238 @param 239 240 @return 241 242 @onerror 243 */ 244 245 virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION ); 246 247 /**_________________________________________________________________________________________________________ 248 @short 249 @descr 250 251 @seealso 252 253 @param 254 255 @return 256 257 @onerror 258 */ 259 260 virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( UNO3_RUNTIMEEXCEPTION ); 261 262 /**_________________________________________________________________________________________________________ 263 @short 264 @descr 265 266 @seealso 267 268 @param 269 270 @return 271 272 @onerror 273 */ 274 275 virtual void SAL_CALL setRange( sal_Int32 nMin , 276 sal_Int32 nMax ) throw( UNO3_RUNTIMEEXCEPTION ); 277 278 /**_________________________________________________________________________________________________________ 279 @short 280 @descr 281 282 @seealso 283 284 @param 285 286 @return 287 288 @onerror 289 */ 290 291 virtual sal_Int32 SAL_CALL getValue() throw( UNO3_RUNTIMEEXCEPTION ); 292 293 //__________________________________________________________________________________________________________ 294 // XWindow 295 //__________________________________________________________________________________________________________ 296 297 /**_________________________________________________________________________________________________________ 298 @short 299 @descr 300 301 @seealso 302 303 @param 304 305 @return 306 307 @onerror 308 */ 309 310 virtual void SAL_CALL setPosSize( sal_Int32 nX , 311 sal_Int32 nY , 312 sal_Int32 nWidth , 313 sal_Int32 nHeight , 314 sal_Int16 nFlags ) throw( UNO3_RUNTIMEEXCEPTION ); 315 316 //__________________________________________________________________________________________________________ 317 // XControl 318 //__________________________________________________________________________________________________________ 319 320 /**_________________________________________________________________________________________________________ 321 @short 322 @descr 323 324 @seealso 325 326 @param 327 328 @return 329 330 @onerror 331 */ 332 333 virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION ); 334 335 /**_________________________________________________________________________________________________________ 336 @short 337 @descr 338 339 @seealso 340 341 @param 342 343 @return 344 345 @onerror 346 */ 347 348 virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION ); 349 350 //__________________________________________________________________________________________________________ 351 // BaseControl 352 //__________________________________________________________________________________________________________ 353 354 /**_________________________________________________________________________________________________________ 355 @short 356 @descr 357 358 @seealso 359 360 @param 361 362 @return 363 364 @onerror 365 */ 366 367 static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames(); 368 369 /**_________________________________________________________________________________________________________ 370 @short 371 @descr 372 373 @seealso 374 375 @param 376 377 @return 378 379 @onerror 380 */ 381 382 static const UNO3_OUSTRING impl_getStaticImplementationName(); 383 384 //____________________________________________________________________________________________________________ 385 // protected methods 386 //____________________________________________________________________________________________________________ 387 388 protected: 389 390 /**_________________________________________________________________________________________________________ 391 @short 392 @descr 393 394 @seealso 395 396 @param 397 398 @return 399 400 @onerror 401 */ 402 403 virtual void impl_paint( sal_Int32 nX , 404 sal_Int32 nY , 405 const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics ); 406 407 /**_________________________________________________________________________________________________________ 408 @short 409 @descr 410 411 @seealso 412 413 @param 414 415 @return 416 417 @onerror 418 */ 419 420 void impl_recalcRange(); 421 422 //____________________________________________________________________________________________________________ 423 // private variables 424 //____________________________________________________________________________________________________________ 425 426 private: 427 428 sal_Bool m_bHorizontal ; // orientation for steps [true=horizontal/false=vertikal] 429 UNO3_SIZE m_aBlockSize ; // width and height of a block [>=0,0] 430 sal_Int32 m_nForegroundColor ; // (alpha,r,g,b) 431 sal_Int32 m_nBackgroundColor ; // (alpha,r,g,b) 432 sal_Int32 m_nMinRange ; // lowest value = 0% [long, <_nMaxRange] 433 sal_Int32 m_nMaxRange ; // highest value = 100% [long, >_nMinRange] 434 double m_nBlockValue ; // value for one block [long, >0] 435 sal_Int32 m_nValue ; // value for progress [long] 436 437 }; // class ProgressBar 438 439 } // namespace unocontrols 440 441 #endif // #ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX 442