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