Main Page   Namespace List   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

AIDA_TitleStyle.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00004 //                                                                     //
00005 //  This library is free software; you can redistribute it and/or      //
00006 //  modify it under the terms of the GNU Lesser General Public         //
00007 //  License as published by the Free Software Foundation; either       //
00008 //  version 2.1 of the License, or (at your option) any later version. //
00009 //                                                                     //
00010 //  This library is distributed in the hope that it will be useful,    //
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of     //
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   //
00013 //  Lesser General Public License for more details.                    //
00014 //                                                                     //
00015 //  You should have received a copy of the GNU Lesser General Public   //
00016 //  License along with this library (see file COPYING); if not, write  //
00017 //  to the Free Software Foundation, Inc., 59 Temple Place, Suite      //
00018 //  330, Boston, MA 02111-1307 USA, or contact the author.             //
00019 //                                                                     //
00021 
00030 // 
00031 // Created by user sang on Sun Oct  6 20:43:17 2002
00032 // 
00033 
00034 
00035 
00036 #include "AIDA_TitleStyle.h"
00037 #include "AIDA_TextStyle.h"
00038 #include "GracePlotter/TitleStyle.h"
00039 
00040 #include <iostream>
00041 
00042 
00043 
00044 namespace Anaphe {
00045 namespace AIDA_Plotter_Grace {
00046 
00047 
00048 
00050 //                                        //
00051 // Constructors, destructor and operator= //
00052 //                                        //
00054 
00055 AIDA_TitleStyle::AIDA_TitleStyle()
00056   : rep   (0),
00057     ownRep(false)
00058 {
00059   // no-op
00060 }
00061 
00062 
00063 
00064 
00065 AIDA_TitleStyle::AIDA_TitleStyle(TitleStyle* x, bool b)
00066   : rep   (x),
00067     ownRep(b)
00068 {
00069   // no-op
00070 }
00071 
00072 
00073 
00074 
00075 AIDA_TitleStyle::~AIDA_TitleStyle()
00076 {
00077   if (ownRep) delete rep;
00078 }
00079 
00080 
00081 
00082 
00084 //                //
00085 // Public methods //
00086 //                //
00088 
00089 void AIDA_TitleStyle::reset()
00090 {
00091   if (!rep) { 
00092     crisis();
00093     return;
00094   }
00095   rep->reset();
00096 }
00097 
00098 
00099 
00100 
00101 bool AIDA_TitleStyle::setParameter(const std::string& paramName, 
00102                                      const std::string& options)
00103 {
00104   if (!rep) { 
00105     crisis();
00106     return false;
00107   }
00108   return rep->setParameter(paramName,options);
00109 }
00110 
00111 
00112 
00113 
00114 std::vector<std::string> AIDA_TitleStyle::availableParameters() const
00115 {
00116   if (!rep) { 
00117     crisis();
00118     return std::vector<std::string>();
00119   }
00120   return rep->availableParameters();
00121 }
00122 
00123 
00124 
00125 
00126 std::vector<std::string> AIDA_TitleStyle::availableParameterOptions(const std::string& paramName) const
00127 {
00128   if (!rep) { 
00129     crisis();
00130     return std::vector<std::string>();
00131   }
00132   return rep->availableOptions(paramName);
00133 }
00134 
00135 
00136 
00137 
00138 std::string AIDA_TitleStyle::parameterValue(const std::string& param) const
00139 {
00140   if (!rep) { 
00141     crisis();
00142     return "";
00143   }
00144   return rep->parameterValue(param);
00145 }
00146 
00147 
00148 
00149 
00150 AIDA::ITextStyle& AIDA_TitleStyle::textStyle()
00151 {
00152   static AIDA_TextStyle pr;
00153   if (!rep) { 
00154     crisis();
00155     return pr;
00156   }
00157   TextStyle& gts = rep->textStyle();
00158   pr.setRep(gts,false);
00159   return pr;
00160 }
00161 
00162 
00163 
00164 
00165 bool AIDA_TitleStyle::setTextStyle(const AIDA::ITextStyle& textStyle)
00166 {
00167   if (!rep) { 
00168     crisis();
00169     return false;
00170   }
00171   const AIDA_TextStyle* pr = dynamic_cast<const AIDA_TextStyle*>(&textStyle);
00172   if (!pr) return false;
00173   AIDA_TextStyle* ncpr = const_cast<AIDA_TextStyle*>(pr);
00174   TextStyle* tsrep = ncpr->theRep();
00175   if (tsrep == 0) return false;
00176   else return rep->setTextStyle(*tsrep);
00177 }
00178 
00179 
00180 
00181 
00182 void AIDA_TitleStyle::setRep(TitleStyle& s, bool ownership)
00183 {
00184   if (ownRep) delete rep;
00185   rep = &s;
00186   ownRep = ownership;
00187 }
00188 
00189 
00190 
00191 TitleStyle* AIDA_TitleStyle::theRep()
00192 {
00193   return rep;
00194 }
00195 
00196 
00197 
00198 void AIDA_TitleStyle::crisis() const
00199 {
00200   std::cout << "*** AIDA_Plotter_Grace SEVERE ERROR: proxy failure in AIDA_TitleStyle" << std::endl; 
00201 }
00202 
00203 
00204 
00205 
00206 
00207 } // end of namespace AIDA_Plotter_Grace
00208 } // end of namespace Anaphe
00209 

Generated on Tue Jan 28 13:30:45 2003 for Anaphe_AIDA_Plotter_Grace by doxygen1.2.16