00001
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00021
00030
00031
00032
00033
00034
00035
00036 #include "AIDA_TextStyle.h"
00037 #include "GracePlotter/TextStyle.h"
00038 #include <iostream>
00039
00040
00041
00042 namespace Anaphe {
00043 namespace AIDA_Plotter_Grace {
00044
00045
00046
00047
00049
00050
00051
00053
00054 AIDA_TextStyle::AIDA_TextStyle()
00055 : rep (0),
00056 ownRep(false)
00057 {
00058
00059 }
00060
00061
00062
00063
00064 AIDA_TextStyle::AIDA_TextStyle(TextStyle* x, bool b)
00065 : rep (x),
00066 ownRep(b)
00067 {
00068
00069 }
00070
00071
00072
00073
00074 AIDA_TextStyle::~AIDA_TextStyle()
00075 {
00076 if (ownRep) delete rep;
00077 }
00078
00079
00080
00081
00082
00084
00085
00086
00088
00089 void AIDA_TextStyle::reset()
00090 {
00091 if (!rep) {
00092 crisis();
00093 return;
00094 }
00095 rep->reset();
00096 }
00097
00098
00099
00100
00101 bool AIDA_TextStyle::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::string AIDA_TextStyle::parameterValue(const std::string& param) const
00115 {
00116 if (!rep) {
00117 crisis();
00118 return "";
00119 }
00120 return rep->parameterValue(param);
00121 }
00122
00123
00124
00125
00126 std::vector<std::string> AIDA_TextStyle::availableParameters() const
00127 {
00128 if (!rep) {
00129 crisis();
00130 return std::vector<std::string>();
00131 }
00132 return rep->availableParameters();
00133 }
00134
00135
00136
00137
00138 std::vector<std::string>
00139 AIDA_TextStyle::availableParameterOptions(const std::string& paramName) const
00140 {
00141 if (!rep) {
00142 crisis();
00143 return std::vector<std::string>();
00144 }
00145 return rep->availableOptions(paramName);
00146 }
00147
00148
00149
00150
00151 std::vector<std::string> AIDA_TextStyle::availableColors() const
00152 {
00153 if (!rep) {
00154 crisis();
00155 return std::vector<std::string>();
00156 }
00157 return rep->availableColors();
00158 }
00159
00160
00161
00162
00163 std::string AIDA_TextStyle::color() const
00164 {
00165 if (!rep) {
00166 crisis();
00167 return "";
00168 }
00169 return rep->color();
00170 }
00171
00172
00173
00174
00175 double AIDA_TextStyle::opacity() const
00176 {
00177 if (!rep) {
00178 crisis();
00179 return -1.0;
00180 }
00181 return rep->opacity();
00182 }
00183
00184
00185
00186
00187 bool AIDA_TextStyle::setColor(const std::string & newColor)
00188 {
00189 if (!rep) {
00190 crisis();
00191 return false;
00192 }
00193 return rep->setColor(newColor);
00194 }
00195
00196
00197
00198
00199 bool AIDA_TextStyle::setOpacity(double newOpacity)
00200 {
00201 if (!rep) {
00202 crisis();
00203 return false;
00204 }
00205 return rep->setOpacity(newOpacity);
00206 }
00207
00208
00209
00210
00211 std::vector<std::string> AIDA_TextStyle::availableFonts() const
00212 {
00213 if (!rep) {
00214 crisis();
00215 return std::vector<std::string>();
00216 }
00217 return rep->availableFonts();
00218 }
00219
00220
00221
00222
00223 double AIDA_TextStyle::fontSize() const
00224 {
00225 if (!rep) {
00226 crisis();
00227 return -1.0;
00228 }
00229 return rep->fontSize();
00230 }
00231
00232
00233
00234
00235 bool AIDA_TextStyle::setFontSize(double size)
00236 {
00237 if (!rep) {
00238 crisis();
00239 return false;
00240 }
00241 return rep->setFontSize( static_cast<int>( size ) );
00242 }
00243
00244
00245
00246
00247 std::string AIDA_TextStyle::font() const
00248 {
00249 if (!rep) {
00250 crisis();
00251 return "";
00252 }
00253 return rep->font();
00254 }
00255
00256
00257
00258
00259 bool AIDA_TextStyle::setFont(const std::string& font)
00260 {
00261 if (!rep) {
00262 crisis();
00263 return false;
00264 }
00265 return rep->setFont(font);
00266 }
00267
00268
00269
00270
00271 bool AIDA_TextStyle::isBold() const
00272 {
00273 if (!rep) {
00274 crisis();
00275 return false;
00276 }
00277 return rep->isBold();
00278 }
00279
00280
00281
00282
00283 bool AIDA_TextStyle::isItalic() const
00284 {
00285 if (!rep) {
00286 crisis();
00287 return false;
00288 }
00289 return rep->isItalic();
00290 }
00291
00292
00293
00294
00295 bool AIDA_TextStyle::isUnderlined() const
00296 {
00297 if (!rep) {
00298 crisis();
00299 return false;
00300 }
00301 return rep->isUnderlined();
00302 }
00303
00304
00305
00306
00307 bool AIDA_TextStyle::setBold(bool bold)
00308 {
00309 if (!rep) {
00310 crisis();
00311 return false;
00312 }
00313 return rep->setBold(bold);
00314 }
00315
00316
00317
00318
00319 bool AIDA_TextStyle::setItalic(bool italic)
00320 {
00321 if (!rep) {
00322 crisis();
00323 return false;
00324 }
00325 return rep->setItalic(italic);
00326 }
00327
00328
00329
00330
00331 bool AIDA_TextStyle::setUnderlined(bool underlined)
00332 {
00333 if (!rep) {
00334 crisis();
00335 return false;
00336 }
00337 return rep->setUnderlined(underlined);
00338 }
00339
00340
00341
00342 void AIDA_TextStyle::setRep(TextStyle& s, bool ownership)
00343 {
00344 if (ownRep) delete rep;
00345 rep = &s;
00346 ownRep = ownership;
00347 }
00348
00349
00350
00351 TextStyle* AIDA_TextStyle::theRep()
00352 {
00353 return rep;
00354 }
00355
00356
00357
00358
00359
00360
00361 void AIDA_TextStyle::crisis() const
00362 {
00363 std::cout << "*** AIDA_Plotter_Grace SEVERE ERROR: proxy failure in AIDA_TextStyle" << std::endl;
00364 }
00365
00366
00367
00368 }
00369 }
00370