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 #ifndef RPTUI_COLORCHANGER_HXX 24 #define RPTUI_COLORCHANGER_HXX 25 26 namespace rptui 27 { 28 //===================================================================== 29 //= ColorChanger 30 //===================================================================== 31 class ColorChanger 32 { 33 protected: 34 OutputDevice* m_pDev; 35 36 public: ColorChanger(OutputDevice * _pDev,const Color & _rNewLineColor)37 ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor) 38 :m_pDev( _pDev ) 39 { 40 m_pDev->Push( PUSH_LINECOLOR ); 41 m_pDev->SetLineColor( _rNewLineColor ); 42 } ColorChanger(OutputDevice * _pDev,const Color & _rNewLineColor,const Color & _rNewFillColor)43 ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor, const Color& _rNewFillColor ) 44 :m_pDev( _pDev ) 45 { 46 m_pDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); 47 m_pDev->SetLineColor( _rNewLineColor ); 48 m_pDev->SetFillColor( _rNewFillColor ); 49 } ColorChanger(OutputDevice * _pDev,const Color & _rNewLineColor,const Color & _rNewFillColor,const Color & _rNewTextColor)50 ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor, const Color& _rNewFillColor, const Color& _rNewTextColor ) 51 :m_pDev( _pDev ) 52 { 53 m_pDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_TEXTCOLOR); 54 m_pDev->SetLineColor( _rNewLineColor ); 55 m_pDev->SetFillColor( _rNewFillColor ); 56 m_pDev->SetTextColor( _rNewTextColor ); 57 } 58 ~ColorChanger()59 ~ColorChanger() 60 { 61 m_pDev->Pop(); 62 } 63 }; 64 } 65 #endif //RPTUI_COLORCHANGER_HXX 66 67