true, 'user_globalsiteselector' => true]; public function __construct( protected ServerVersion $serverVersion, protected IL10N $l, protected Defaults $defaults, protected IAppManager $appManager, protected ISession $session, protected ?IUser $currentUser, protected IConfig $config, protected IGroupManager $groupManager, protected IniGetWrapper $iniWrapper, protected IURLGenerator $urlGenerator, protected CapabilitiesManager $capabilitiesManager, protected IInitialStateService $initialStateService, protected IProvider $tokenProvider, protected FilenameValidator $filenameValidator, ) { } public function getConfig(): string { $userBackendAllowsPasswordConfirmation = true; if ($this->currentUser !== null) { $uid = $this->currentUser->getUID(); $backend = $this->currentUser->getBackend(); if ($backend instanceof IPasswordConfirmationBackend) { $userBackendAllowsPasswordConfirmation = $backend->canConfirmPassword($uid); } elseif (isset($this->excludedUserBackEnds[$this->currentUser->getBackendClassName()])) { $userBackendAllowsPasswordConfirmation = false; } } else { $uid = null; } // Get the config $apps_paths = []; if ($this->currentUser === null) { $apps = $this->appManager->getEnabledApps(); } else { $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); } foreach ($apps as $app) { try { $apps_paths[$app] = $this->appManager->getAppWebPath($app); } catch (AppPathNotFoundException $e) { $apps_paths[$app] = false; } } $enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'); $enableLinkPasswordByDefault = $enableLinkPasswordByDefault === 'yes'; $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; $defaultExpireDate = $enforceDefaultExpireDate = null; if ($defaultExpireDateEnabled) { $defaultExpireDate = (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); $enforceDefaultExpireDate = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; } $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; $defaultInternalExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes'; $defaultInternalExpireDate = $defaultInternalExpireDateEnforced = null; if ($defaultInternalExpireDateEnabled) { $defaultInternalExpireDate = (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); $defaultInternalExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes'; } $defaultRemoteExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_remote_expire_date', 'no') === 'yes'; $defaultRemoteExpireDate = $defaultRemoteExpireDateEnforced = null; if ($defaultRemoteExpireDateEnabled) { $defaultRemoteExpireDate = (int)$this->config->getAppValue('core', 'shareapi_remote_expire_after_n_days', '7'); $defaultRemoteExpireDateEnforced = $this->config->getAppValue('core', 'shareapi_enforce_remote_expire_date', 'no') === 'yes'; } $countOfDataLocation = 0; $dataLocation = str_replace(\OC::$SERVERROOT . '/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); if ($countOfDataLocation !== 1 || $uid === null || !$this->groupManager->isAdmin($uid)) { $dataLocation = false; } if ($this->currentUser instanceof IUser) { if ($this->canUserValidatePassword()) { $lastConfirmTimestamp = $this->session->get('last-password-confirm'); if (!is_int($lastConfirmTimestamp)) { $lastConfirmTimestamp = 0; } } else { $lastConfirmTimestamp = PHP_INT_MAX; } } else { $lastConfirmTimestamp = 0; } $capabilities = $this->capabilitiesManager->getCapabilities(false, true); $userFirstDay = $this->config->getUserValue($uid, 'core', AUserDataOCSController::USER_FIELD_FIRST_DAY_OF_WEEK, null); $firstDay = (int)($userFirstDay ?? $this->l->l('firstday', null)); $config = [ /** @deprecated 30.0.0 - use files capabilities instead */ 'blacklist_files_regex' => FileInfo::BLACKLIST_FILES_REGEX, /** @deprecated 30.0.0 - use files capabilities instead */ 'forbidden_filename_characters' => $this->filenameValidator->getForbiddenCharacters(), 'auto_logout' => $this->config->getSystemValue('auto_logout', false), 'loglevel' => $this->config->getSystemValue('loglevel_frontend', $this->config->getSystemValue('loglevel', ILogger::WARN) ), 'lost_password_link' => $this->config->getSystemValue('lost_password_link', null), 'modRewriteWorking' => $this->config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true', 'no_unsupported_browser_warning' => $this->config->getSystemValue('no_unsupported_browser_warning', false), 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), 'sharing.maxAutocompleteResults' => max(0, $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT)), 'sharing.minSearchStringLength' => $this->config->getSystemValueInt('sharing.minSearchStringLength', 0), 'version' => implode('.', $this->serverVersion->getVersion()), 'versionstring' => $this->serverVersion->getVersionString(), 'enable_non-accessible_features' => $this->config->getSystemValueBool('enable_non-accessible_features', true), ]; $array = [ '_oc_debug' => $this->config->getSystemValue('debug', false) ? 'true' : 'false', '_oc_isadmin' => $uid !== null && $this->groupManager->isAdmin($uid) ? 'true' : 'false', 'backendAllowsPasswordConfirmation' => $userBackendAllowsPasswordConfirmation ? 'true' : 'false', 'oc_dataURL' => is_string($dataLocation) ? '"' . $dataLocation . '"' : 'false', '_oc_webroot' => '"' . \OC::$WEBROOT . '"', '_oc_appswebroots' => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution 'datepickerFormatDate' => json_encode($this->l->l('jsdate', null)), 'nc_lastLogin' => $lastConfirmTimestamp, 'nc_pageLoad' => time(), 'dayNames' => json_encode([ $this->l->t('Sunday'), $this->l->t('Monday'), $this->l->t('Tuesday'), $this->l->t('Wednesday'), $this->l->t('Thursday'), $this->l->t('Friday'), $this->l->t('Saturday') ]), 'dayNamesShort' => json_encode([ $this->l->t('Sun.'), $this->l->t('Mon.'), $this->l->t('Tue.'), $this->l->t('Wed.'), $this->l->t('Thu.'), $this->l->t('Fri.'), $this->l->t('Sat.') ]), 'dayNamesMin' => json_encode([ $this->l->t('Su'), $this->l->t('Mo'), $this->l->t('Tu'), $this->l->t('We'), $this->l->t('Th'), $this->l->t('Fr'), $this->l->t('Sa') ]), 'monthNames' => json_encode([ $this->l->t('January'), $this->l->t('February'), $this->l->t('March'), $this->l->t('April'), $this->l->t('May'), $this->l->t('June'), $this->l->t('July'), $this->l->t('August'), $this->l->t('September'), $this->l->t('October'), $this->l->t('November'), $this->l->t('December') ]), 'monthNamesShort' => json_encode([ $this->l->t('Jan.'), $this->l->t('Feb.'), $this->l->t('Mar.'), $this->l->t('Apr.'), $this->l->t('May.'), $this->l->t('Jun.'), $this->l->t('Jul.'), $this->l->t('Aug.'), $this->l->t('Sep.'), $this->l->t('Oct.'), $this->l->t('Nov.'), $this->l->t('Dec.') ]), 'firstDay' => json_encode($firstDay), '_oc_config' => json_encode($config), 'oc_appconfig' => json_encode([ 'core' => [ 'defaultExpireDateEnabled' => $defaultExpireDateEnabled, 'defaultExpireDate' => $defaultExpireDate, 'defaultExpireDateEnforced' => $enforceDefaultExpireDate, 'enforcePasswordForPublicLink' => Util::isPublicLinkPasswordRequired(), 'enableLinkPasswordByDefault' => $enableLinkPasswordByDefault, 'sharingDisabledForUser' => Util::isSharingDisabledForUser(), 'resharingAllowed' => Share::isResharingAllowed(), 'remoteShareAllowed' => $outgoingServer2serverShareEnabled, 'federatedCloudShareDoc' => $this->urlGenerator->linkToDocs('user-sharing-federated'), 'allowGroupSharing' => \OC::$server->get(IShareManager::class)->allowGroupSharing(), 'defaultInternalExpireDateEnabled' => $defaultInternalExpireDateEnabled, 'defaultInternalExpireDate' => $defaultInternalExpireDate, 'defaultInternalExpireDateEnforced' => $defaultInternalExpireDateEnforced, 'defaultRemoteExpireDateEnabled' => $defaultRemoteExpireDateEnabled, 'defaultRemoteExpireDate' => $defaultRemoteExpireDate, 'defaultRemoteExpireDateEnforced' => $defaultRemoteExpireDateEnforced, ] ]), '_theme' => json_encode([ 'entity' => $this->defaults->getEntity(), 'name' => $this->defaults->getName(), 'productName' => $this->defaults->getProductName(), 'title' => $this->defaults->getTitle(), 'baseUrl' => $this->defaults->getBaseUrl(), 'syncClientUrl' => $this->defaults->getSyncClientUrl(), 'docBaseUrl' => $this->defaults->getDocBaseUrl(), 'docPlaceholderUrl' => $this->defaults->buildDocLinkToKey('PLACEHOLDER'), 'slogan' => $this->defaults->getSlogan(), 'logoClaim' => '', 'folder' => \OC_Util::getTheme(), ]), ]; if ($this->currentUser !== null) { $array['oc_userconfig'] = json_encode([ 'avatar' => [ 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), 'generated' => $this->config->getUserValue($uid, 'avatar', 'generated', 'true') === 'true', ] ]); } $this->initialStateService->provideInitialState('core', 'projects_enabled', $this->config->getSystemValueBool('projects.enabled', false)); $this->initialStateService->provideInitialState('core', 'config', $config); $this->initialStateService->provideInitialState('core', 'capabilities', $capabilities); // Allow hooks to modify the output values \OC_Hook::emit('\OCP\Config', 'js', ['array' => &$array]); $result = ''; // Echo it foreach ($array as $setting => $value) { $result .= 'var ' . $setting . '=' . $value . ';' . PHP_EOL; } return $result; } protected function canUserValidatePassword(): bool { try { $token = $this->tokenProvider->getToken($this->session->getId()); } catch (ExpiredTokenException|WipeTokenException|InvalidTokenException|SessionNotAvailableException) { // actually we do not know, so we fall back to this statement return true; } $scope = $token->getScopeAsArray(); return !isset($scope[IToken::SCOPE_SKIP_PASSWORD_VALIDATION]) || $scope[IToken::SCOPE_SKIP_PASSWORD_VALIDATION] === false; } } ='n131' href='#n131'>131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
/*
* ============================================================================
* The Apache Software License, Version 1.1
* ============================================================================
*
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment: "This product includes software
* developed by the Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
*
* 4. The names "FOP" and "Apache Software Foundation" must not be used to
* endorse or promote products derived from this software without prior
* written permission. For written permission, please contact
* apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache", nor may
* "Apache" appear in their name, without prior written permission of the
* Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ============================================================================
*
* This software consists of voluntary contributions made by many individuals
* on behalf of the Apache Software Foundation and was originally created by
* James Tauber <jtauber@jtauber.com>. For more information on the Apache
* Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.fop.rtf.renderer;
//XML
import org.xml.sax.Attributes;
//FOP
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.EnumProperty;
import org.apache.fop.fo.expr.NCnameProperty;
import org.apache.fop.fo.properties.Constants;
import org.apache.fop.fo.LengthProperty;
import org.apache.fop.fo.ListProperty;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.Property;
import org.apache.fop.fo.SpaceProperty;
import org.apache.fop.fo.ColorTypeProperty;
import org.apache.fop.fo.NumberProperty;
import org.apache.fop.datatypes.ColorType;
//RTF
import org.apache.fop.rtf.rtflib.rtfdoc.RtfAttributes;
import org.apache.fop.rtf.rtflib.rtfdoc.RtfColorTable;
import org.apache.fop.rtf.rtflib.rtfdoc.RtfFontManager;
import org.apache.fop.rtf.rtflib.rtfdoc.RtfText;
/** Converts FO properties to RtfAttributes
* @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
* @author Andreas Putz a.putz@skynamics.com
* @author Boris Poud�rous boris.pouderous@eads-telecom.com
* @author Peter Herweg, pherweg@web.de
* @author Normand Mass�
* @author Chris Scott
* @author rmarra
*/
class TextAttributesConverter {
private static Logger log = new ConsoleLogger();
/**
* Converts all known text FO properties to RtfAttributes
* @param props list of FO properites, which are to be converted
* @param props list of default FO properites (usally null)
*/
public static RtfAttributes convertAttributes(PropertyList props, PropertyList defProps)
throws FOPException {
RtfAttributes attrib = null;
if (defProps != null) {
attrib = convertAttributes(defProps, null);
} else {
attrib = new RtfAttributes();
}
attrBlockFontFamily(props, attrib);
attrBlockFontWeight(props, attrib);
attrBlockFontSize(props, attrib);
attrBlockFontColor(props, attrib);
attrBlockFontItalic(props, attrib);
attrBlockFontUnderline(props, attrib);
attrBlockBackgroundColor(props, attrib);
attrBlockSpaceBeforeAfter(props, attrib);
attrBlockMargins(props, attrib);
attrBlockTextAlign(props, attrib);
return attrib;
}
/**
* Converts all character related FO properties to RtfAttributes.
* @param props list of FO properites, which are to be converted
* @param props list of default FO properites (usally null)
*/
public static RtfAttributes convertCharacterAttributes(PropertyList props, PropertyList defProps)
throws FOPException {
RtfAttributes attrib = null;
if (defProps != null) {
attrib = convertCharacterAttributes(defProps, null);
} else {
attrib = new RtfAttributes();
}
attrBlockFontFamily(props, attrib);
attrBlockFontWeight(props, attrib);
attrBlockFontSize(props, attrib);
attrBlockFontColor(props, attrib);
attrBlockFontItalic(props, attrib);
attrBlockFontUnderline(props, attrib);
attrBlockBackgroundColor(props, attrib);
return attrib;
}
private static void attrBlockFontFamily(PropertyList properties, RtfAttributes rtfAttr) {
String fopValue = properties.get("font-family").getString();
if (fopValue != null) {
rtfAttr.set(RtfText.ATTR_FONT_FAMILY, RtfFontManager.getInstance().getFontNumber(fopValue));
}
}
private static void attrBlockFontSize(PropertyList properties, RtfAttributes rtfAttr) {
int fopValue = properties.get("font-size").getLength().getValue() / 500;
rtfAttr.set("fs", fopValue);
}
private static void attrBlockFontColor(PropertyList properties, RtfAttributes rtfAttr) {
// Cell background color
ColorTypeProperty colorTypeProp=(ColorTypeProperty)properties.get("color");
if(colorTypeProp != null) {
ColorType colorType = colorTypeProp.getColorType();
if (colorType != null) {
if (colorType.getAlpha() != 0
|| colorType.getRed() != 0
|| colorType.getGreen() != 0
|| colorType.getBlue() != 0) {
rtfAttr.set(
RtfText.ATTR_FONT_COLOR,
convertFOPColorToRTF(colorType));
}
} else {
log.warn("Named color '" + colorTypeProp.toString() + "' not found. ");
}
}
}
private static void attrBlockFontWeight(PropertyList properties, RtfAttributes rtfAttr) {
String fopValue = properties.get("font-weight").getString();
if (fopValue == "bold" || fopValue == "700") {
rtfAttr.set("b", 1);
} else {
rtfAttr.set("b", 0);
}
}
private static void attrBlockFontItalic(PropertyList properties, RtfAttributes rtfAttr) {
String fopValue = properties.get("font-style").getString();
if(fopValue.equals("italic")) {
rtfAttr.set(RtfText.ATTR_ITALIC, 1);
} else {
rtfAttr.set(RtfText.ATTR_ITALIC, 0);
}
}
private static void attrBlockFontUnderline(PropertyList properties, RtfAttributes rtfAttr) {
EnumProperty enumProp=(EnumProperty)properties.get("text-decoration");
if(enumProp.getEnum()==Constants.UNDERLINE) {
rtfAttr.set(RtfText.ATTR_UNDERLINE, 1);
} else {
rtfAttr.set(RtfText.ATTR_UNDERLINE, 0);
}
}
private static void attrBlockSpaceBeforeAfter(PropertyList properties, RtfAttributes rtfAttr) {
SpaceProperty spaceProp=null;
//space-before
spaceProp=(SpaceProperty)properties.get("space-before");
if(spaceProp!=null) {
Float f = new Float(spaceProp.getLengthRange().getOptimum().getLength().getValue() / 1000f);
String sValue = f.toString() + "pt";
try {
rtfAttr.set(
RtfText.SPACE_BEFORE,
(int)FoUnitsConverter.getInstance().convertToTwips(sValue));
} catch(FOPException fe) {
log.warn("attrBlockSpaceBeforeAfter: " + fe.getMessage());
}
}
//space-after
spaceProp=(SpaceProperty)properties.get("space-after");
if(spaceProp!=null) {
Float f = new Float(spaceProp.getLengthRange().getOptimum().getLength().getValue() / 1000f);
String sValue = f.toString() + "pt";
try {
rtfAttr.set(
RtfText.SPACE_AFTER,
(int)FoUnitsConverter.getInstance().convertToTwips(sValue));
} catch(FOPException fe) {
log.warn("attrBlockSpaceBeforeAfter: " + fe.getMessage());
}
}
}
private static void attrBlockMargins(PropertyList properties, RtfAttributes rtfAttr) {
try {
LengthProperty lengthProp=null;
// margin-left
lengthProp=(LengthProperty)properties.get("margin-left");
if (lengthProp != null) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
String sValue = f.toString() + "pt";
rtfAttr.set(
RtfText.LEFT_INDENT_BODY,
(int)FoUnitsConverter.getInstance().convertToTwips(sValue));
} else {
rtfAttr.set(RtfText.LEFT_INDENT_BODY, 0);
}
// margin-right
lengthProp=(LengthProperty)properties.get("margin-right");
if (lengthProp != null) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
String sValue = f.toString() + "pt";
rtfAttr.set(
RtfText.LEFT_INDENT_BODY,
(int)FoUnitsConverter.getInstance().convertToTwips(sValue));
} else {
rtfAttr.set(RtfText.RIGHT_INDENT_BODY, 0);
}
} catch(FOPException fe) {
log.warn("attrBlockSpaceBeforeAfter: " + fe.getMessage());
}
}
private static void attrBlockTextAlign(PropertyList properties, RtfAttributes rtfAttr) {
int fopValue = properties.get("text-align").getEnum();
String rtfValue = null;
switch (fopValue) {
case Constants.CENTER: {
rtfValue = RtfText.ALIGN_CENTER;
break;
}
case Constants.END: {
rtfValue = RtfText.ALIGN_RIGHT;
break;
}
case Constants.JUSTIFY: {
rtfValue = RtfText.ALIGN_JUSTIFIED;
break;
}
default: {
rtfValue = RtfText.ALIGN_LEFT;
break;
}
}
rtfAttr.set(rtfValue);
}
/**
* Reads background-color from bl and writes it to rtfAttr.
*
* @param bl the Block object the properties are read from
* @param rtfAttr the RtfAttributes object the attributes are written to
*/
private static void attrBlockBackgroundColor(PropertyList properties, RtfAttributes rtfAttr) {
ColorType fopValue = properties.get("background-color").getColorType();
int rtfColor = 0;
/* FOP uses a default background color of "transparent", which is
actually a transparent black, which is generally not suitable as a
default here. Changing FOP's default to "white" causes problems in
PDF output, so we will look for the default here & change it to
"auto". */
if ((fopValue.getRed() == 0)
&& (fopValue.getGreen() == 0)
&& (fopValue.getBlue() == 0)
&& (fopValue.getAlpha() == 0)) {
rtfColor = 0; //=auto
} else {
rtfColor = convertFOPColorToRTF(fopValue);
}
rtfAttr.set(RtfText.ATTR_BACKGROUND_COLOR, rtfColor);
}
/**
* Converts a FOP ColorType to the integer pointing into the RTF color table
* @param fopColor the ColorType object to be converted
* @return integer pointing into the RTF color table
*/
public static int convertFOPColorToRTF(ColorType fopColor) {
int redComponent = ColorType.convertChannelToInteger (fopColor.getRed());
int greenComponent = ColorType.convertChannelToInteger (fopColor.getGreen());
int blueComponent = ColorType.convertChannelToInteger (fopColor.getBlue());
return RtfColorTable.getInstance().getColorNumber(redComponent,
greenComponent, blueComponent).intValue();
}
}