Files
libreoffice/xmloff/source/style/XMLFontStylesContext.cxx

416 lines
15 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by: Armin Le Grand. #118558# Correcting OLE attributes of LO3.4 at load time by loading as OOo3.3, details see task. http://svn.apache.org/viewvc?view=revision&revision=1195906 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles http://svn.apache.org/viewvc?view=revision&revision=1293316 #119337# Solves the wrong get/setPropertyValue calls in SvxShapeText (and thus in SvxOle2Shape) http://svn.apache.org/viewvc?view=revision&revision=1344156 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117717#: remove wrong assertion http://svn.apache.org/viewvc?view=revision&revision=1172349 Patch contributed by Herbert Duerr goodbye Registration and License dialogs, don't let the door hit you http://svn.apache.org/viewvc?view=revision&revision=1172613 help gcc 4.6.0 on 32bit ubuntu 11.10" http://svn.apache.org/viewvc?view=revision&revision=1245357 Do not add targets for junit tests when junit is disabled. Patch contributed by Andre Fischer http://svn.apache.org/viewvc?view=revision&revision=1241508 Revert "sb140: #i117082# avoid unncessary static class data members commit 21d97438e2944861e26e4984195f959a0cce1e41. remove obsolete FreeBSD visibility special case. retain consolidated BSD bridge code, remove OS/2 pieces.
2012-11-12 17:21:24 +00:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-11-14 09:19:45 +00:00
#include <xmloff/XMLFontStylesContext.hxx>
#include "XMLFontStylesContext_impl.hxx"
2000-11-14 09:19:45 +00:00
#include <com/sun/star/awt/FontFamily.hpp>
#include <com/sun/star/awt/FontPitch.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <comphelper/seqstream.hxx>
#include <osl/file.hxx>
#include <vcl/embeddedfontshelper.hxx>
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmltoken.hxx>
2000-11-14 09:19:45 +00:00
#include "fonthdl.hxx"
#include <xmloff/xmlimp.hxx>
#include <xmloff/maptype.hxx>
#include <xmloff/XMLBase64ImportContext.hxx>
2000-11-14 09:19:45 +00:00
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::awt;
using namespace ::xmloff::token;
2000-11-14 09:19:45 +00:00
2000-11-14 09:19:45 +00:00
#define XML_STYLE_FAMILY_FONT 1
enum XMLFontStyleAttrTokens
{
XML_TOK_FONT_STYLE_ATTR_FAMILY,
XML_TOK_FONT_STYLE_ATTR_FAMILY_GENERIC,
XML_TOK_FONT_STYLE_ATTR_STYLENAME,
XML_TOK_FONT_STYLE_ATTR_PITCH,
XML_TOK_FONT_STYLE_ATTR_CHARSET,
XML_TOK_FONT_STYLE_ATTR_END=XML_TOK_UNKNOWN
};
static const SvXMLTokenMapEntry* lcl_getFontStyleAttrTokenMap()
2000-11-14 09:19:45 +00:00
{
static const SvXMLTokenMapEntry aFontStyleAttrTokenMap[] =
CWS-TOOLING: integrate CWS dbaperf1 2009-04-02 09:12:25 +0200 oj r270372 : CWS-TOOLING: rebase CWS dbaperf1 to trunk@270033 (milestone: DEV300:m45) 2009-03-17 10:20:34 +0100 oj r269577 : add parameter 2009-03-17 10:20:05 +0100 oj r269576 : add parameter 2009-03-12 12:32:24 +0100 oj r269387 : add missing ++ 2009-03-11 12:53:35 +0100 oj r269315 : compile error 2009-03-06 08:52:11 +0100 oj r268968 : #i99264# remove duplicate code 2009-03-06 08:20:08 +0100 oj r268966 : add missingheader 2009-03-06 08:17:41 +0100 oj r268965 : add header 2009-03-06 08:15:07 +0100 oj r268964 : #i99708# remove duplicate code 2009-03-06 07:24:11 +0100 oj r268963 : #i99708# remove duplicate code 2009-03-06 07:22:24 +0100 oj r268962 : #i99708# use tenary operator 2009-03-06 07:19:21 +0100 oj r268961 : remove unused rtl_logs 2009-03-06 07:15:55 +0100 oj r268960 : #i99708# extract getLength from for loop 2009-03-06 07:15:35 +0100 oj r268959 : #i99708# extract getLength from for loop 2009-03-06 07:14:57 +0100 oj r268958 : remove unused rtl_logs 2009-03-06 07:13:01 +0100 oj r268957 : insert DBG_ helper 2009-03-06 07:12:17 +0100 oj r268956 : remove unused rtl_logs 2009-03-06 07:10:26 +0100 oj r268955 : remove unused rtl_logs 2009-03-06 07:04:51 +0100 oj r268954 : #i99708# use tenary operator 2009-03-05 12:04:46 +0100 oj r268895 : comment RTL_LOG out 2009-03-05 09:05:07 +0100 oj r268874 : add rtl logfile 2009-03-04 14:21:18 +0100 oj r268828 : #i99708# make static inplace and some method calls in for loop removed 2009-03-04 14:20:34 +0100 oj r268827 : #i99708# impl double check pattern for getInfohelper 2009-03-02 09:31:42 +0100 oj r268636 : add rtl logfile 2009-03-02 08:18:37 +0100 oj r268633 : add rtl logfile 2009-02-27 11:22:16 +0100 oj r268570 : #i99709# change algorithm for marking objects 2009-02-27 11:17:04 +0100 oj r268568 : #i99708# some improvements to load forms, controls faster and replacement of size() call with !empty() which is much faster 2009-02-24 10:09:35 +0100 sb r268383 : #i99290# no longer care to set a sensible context class loader for native threads attached to the VM 2009-02-23 13:44:04 +0100 oj r268354 : #i76606# seekrow changes 2009-02-23 12:27:30 +0100 oj r268349 : deleted 2009-02-20 15:14:23 +0100 oj r268325 : #i76606# some code changes 2009-02-19 14:15:25 +0100 oj r268284 : #i76606# use of simple prep stmt instead of full blown rowset, when source and dest connection are the same use insert into ... ( select ... ) 2009-02-19 11:27:55 +0100 oj r268265 : #i76606# insert some RTL_LOG and setObject impl 2009-02-18 14:45:37 +0100 oj r268222 : #i99363# insert RTL_LOG 2009-02-18 14:45:18 +0100 oj r268221 : #i99363# insert RTL_LOG 2009-02-18 11:14:54 +0100 oj r268207 : #i99363# call some impl_ methods to avoid duplicate cechCache calls 2009-02-18 11:10:47 +0100 oj r268206 : #i99363# make isCount inline 2009-02-18 10:33:22 +0100 oj r268203 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-18 10:32:57 +0100 oj r268202 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-17 07:29:05 +0100 oj r267843 : #i96897# remove some dll public 2009-02-16 15:01:04 +0100 oj r267816 : #i96897# remove some dll public 2009-02-16 14:25:53 +0100 oj r267810 : #i99264# remove duplicate code 2009-02-16 14:25:33 +0100 oj r267809 : #i99264# remove duplicate code 2009-02-16 14:24:59 +0100 oj r267808 : #i99264# remove duplicate code 2009-02-13 10:56:17 +0100 oj r267703 : #i99191# comment the contextclassloader 2009-02-13 10:32:40 +0100 oj r267700 : reduce call to resultset meta data 2009-02-13 10:27:31 +0100 oj r267699 : reduce call to resultset meta data 2009-02-13 10:27:08 +0100 oj r267698 : reduce call to resultset meta data
2009-04-23 10:42:05 +00:00
{
{ XML_NAMESPACE_SVG, XML_FONT_FAMILY,
XML_TOK_FONT_STYLE_ATTR_FAMILY },
{ XML_NAMESPACE_STYLE, XML_FONT_FAMILY_GENERIC,
XML_TOK_FONT_STYLE_ATTR_FAMILY_GENERIC },
{ XML_NAMESPACE_STYLE, XML_FONT_ADORNMENTS,
XML_TOK_FONT_STYLE_ATTR_STYLENAME },
{ XML_NAMESPACE_STYLE, XML_FONT_PITCH,
XML_TOK_FONT_STYLE_ATTR_PITCH },
{ XML_NAMESPACE_STYLE, XML_FONT_CHARSET,
XML_TOK_FONT_STYLE_ATTR_CHARSET },
2000-11-14 09:19:45 +00:00
CWS-TOOLING: integrate CWS dbaperf1 2009-04-02 09:12:25 +0200 oj r270372 : CWS-TOOLING: rebase CWS dbaperf1 to trunk@270033 (milestone: DEV300:m45) 2009-03-17 10:20:34 +0100 oj r269577 : add parameter 2009-03-17 10:20:05 +0100 oj r269576 : add parameter 2009-03-12 12:32:24 +0100 oj r269387 : add missing ++ 2009-03-11 12:53:35 +0100 oj r269315 : compile error 2009-03-06 08:52:11 +0100 oj r268968 : #i99264# remove duplicate code 2009-03-06 08:20:08 +0100 oj r268966 : add missingheader 2009-03-06 08:17:41 +0100 oj r268965 : add header 2009-03-06 08:15:07 +0100 oj r268964 : #i99708# remove duplicate code 2009-03-06 07:24:11 +0100 oj r268963 : #i99708# remove duplicate code 2009-03-06 07:22:24 +0100 oj r268962 : #i99708# use tenary operator 2009-03-06 07:19:21 +0100 oj r268961 : remove unused rtl_logs 2009-03-06 07:15:55 +0100 oj r268960 : #i99708# extract getLength from for loop 2009-03-06 07:15:35 +0100 oj r268959 : #i99708# extract getLength from for loop 2009-03-06 07:14:57 +0100 oj r268958 : remove unused rtl_logs 2009-03-06 07:13:01 +0100 oj r268957 : insert DBG_ helper 2009-03-06 07:12:17 +0100 oj r268956 : remove unused rtl_logs 2009-03-06 07:10:26 +0100 oj r268955 : remove unused rtl_logs 2009-03-06 07:04:51 +0100 oj r268954 : #i99708# use tenary operator 2009-03-05 12:04:46 +0100 oj r268895 : comment RTL_LOG out 2009-03-05 09:05:07 +0100 oj r268874 : add rtl logfile 2009-03-04 14:21:18 +0100 oj r268828 : #i99708# make static inplace and some method calls in for loop removed 2009-03-04 14:20:34 +0100 oj r268827 : #i99708# impl double check pattern for getInfohelper 2009-03-02 09:31:42 +0100 oj r268636 : add rtl logfile 2009-03-02 08:18:37 +0100 oj r268633 : add rtl logfile 2009-02-27 11:22:16 +0100 oj r268570 : #i99709# change algorithm for marking objects 2009-02-27 11:17:04 +0100 oj r268568 : #i99708# some improvements to load forms, controls faster and replacement of size() call with !empty() which is much faster 2009-02-24 10:09:35 +0100 sb r268383 : #i99290# no longer care to set a sensible context class loader for native threads attached to the VM 2009-02-23 13:44:04 +0100 oj r268354 : #i76606# seekrow changes 2009-02-23 12:27:30 +0100 oj r268349 : deleted 2009-02-20 15:14:23 +0100 oj r268325 : #i76606# some code changes 2009-02-19 14:15:25 +0100 oj r268284 : #i76606# use of simple prep stmt instead of full blown rowset, when source and dest connection are the same use insert into ... ( select ... ) 2009-02-19 11:27:55 +0100 oj r268265 : #i76606# insert some RTL_LOG and setObject impl 2009-02-18 14:45:37 +0100 oj r268222 : #i99363# insert RTL_LOG 2009-02-18 14:45:18 +0100 oj r268221 : #i99363# insert RTL_LOG 2009-02-18 11:14:54 +0100 oj r268207 : #i99363# call some impl_ methods to avoid duplicate cechCache calls 2009-02-18 11:10:47 +0100 oj r268206 : #i99363# make isCount inline 2009-02-18 10:33:22 +0100 oj r268203 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-18 10:32:57 +0100 oj r268202 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-17 07:29:05 +0100 oj r267843 : #i96897# remove some dll public 2009-02-16 15:01:04 +0100 oj r267816 : #i96897# remove some dll public 2009-02-16 14:25:53 +0100 oj r267810 : #i99264# remove duplicate code 2009-02-16 14:25:33 +0100 oj r267809 : #i99264# remove duplicate code 2009-02-16 14:24:59 +0100 oj r267808 : #i99264# remove duplicate code 2009-02-13 10:56:17 +0100 oj r267703 : #i99191# comment the contextclassloader 2009-02-13 10:32:40 +0100 oj r267700 : reduce call to resultset meta data 2009-02-13 10:27:31 +0100 oj r267699 : reduce call to resultset meta data 2009-02-13 10:27:08 +0100 oj r267698 : reduce call to resultset meta data
2009-04-23 10:42:05 +00:00
XML_TOKEN_MAP_END
};
return aFontStyleAttrTokenMap;
}
2000-11-14 09:19:45 +00:00
TYPEINIT1( XMLFontStyleContextFontFace, SvXMLStyleContext );
2000-11-14 09:19:45 +00:00
XMLFontStyleContextFontFace::XMLFontStyleContextFontFace( SvXMLImport& rImport,
2000-11-14 09:19:45 +00:00
sal_uInt16 nPrfx, const OUString& rLName,
const Reference< XAttributeList > & xAttrList,
XMLFontStylesContext& rStyles ) :
2001-01-16 15:36:55 +00:00
SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_FONT ),
2000-11-14 09:19:45 +00:00
xStyles( &rStyles )
{
OUString sEmpty;
aFamilyName <<= sEmpty;
aStyleName <<= sEmpty;
aFamily <<= (sal_Int16)awt::FontFamily::DONTKNOW;
aPitch <<= (sal_Int16)awt::FontPitch::DONTKNOW;
2000-11-14 09:19:45 +00:00
aEnc <<= (sal_Int16)rStyles.GetDfltCharset();
}
void XMLFontStyleContextFontFace::SetAttribute( sal_uInt16 nPrefixKey,
2000-11-14 09:19:45 +00:00
const OUString& rLocalName,
const OUString& rValue )
{
SvXMLUnitConverter& rUnitConv = GetImport().GetMM100UnitConverter();
const SvXMLTokenMap& rTokenMap = GetStyles()->GetFontStyleAttrTokenMap();
Any aAny;
switch( rTokenMap.Get( nPrefixKey, rLocalName ) )
{
case XML_TOK_FONT_STYLE_ATTR_FAMILY:
if( GetStyles()->GetFamilyNameHdl().importXML( rValue, aAny,
rUnitConv ) )
aFamilyName = aAny;
break;
case XML_TOK_FONT_STYLE_ATTR_STYLENAME:
aStyleName <<= rValue;
break;
case XML_TOK_FONT_STYLE_ATTR_FAMILY_GENERIC:
if( GetStyles()->GetFamilyHdl().importXML( rValue, aAny,
rUnitConv ) )
aFamily = aAny;
break;
case XML_TOK_FONT_STYLE_ATTR_PITCH:
if( GetStyles()->GetPitchHdl().importXML( rValue, aAny,
rUnitConv ) )
aPitch = aAny;
break;
case XML_TOK_FONT_STYLE_ATTR_CHARSET:
if( GetStyles()->GetEncodingHdl().importXML( rValue, aAny,
rUnitConv ) )
aEnc = aAny;
break;
default:
SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
break;
}
}
XMLFontStyleContextFontFace::~XMLFontStyleContextFontFace()
2000-11-14 09:19:45 +00:00
{
}
void XMLFontStyleContextFontFace::FillProperties(
2000-11-14 09:19:45 +00:00
::std::vector< XMLPropertyState > &rProps,
sal_Int32 nFamilyNameIdx,
sal_Int32 nStyleNameIdx,
sal_Int32 nFamilyIdx,
sal_Int32 nPitchIdx,
sal_Int32 nCharsetIdx ) const
{
if( nFamilyNameIdx != -1 )
{
XMLPropertyState aPropState( nFamilyNameIdx, aFamilyName );
rProps.push_back( aPropState );
}
if( nStyleNameIdx != -1 )
{
XMLPropertyState aPropState( nStyleNameIdx, aStyleName );
rProps.push_back( aPropState );
}
if( nFamilyIdx != -1 )
{
XMLPropertyState aPropState( nFamilyIdx, aFamily );
rProps.push_back( aPropState );
}
if( nPitchIdx != -1 )
{
XMLPropertyState aPropState( nPitchIdx, aPitch );
rProps.push_back( aPropState );
}
if( nCharsetIdx != -1 )
{
XMLPropertyState aPropState( nCharsetIdx, aEnc );
rProps.push_back( aPropState );
}
}
SvXMLImportContext * XMLFontStyleContextFontFace::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList )
{
if( nPrefix == XML_NAMESPACE_SVG && IsXMLToken( rLocalName, XML_FONT_FACE_SRC ))
return new XMLFontStyleContextFontFaceSrc( GetImport(), nPrefix, rLocalName, *this );
return SvXMLStyleContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
}
OUString XMLFontStyleContextFontFace::familyName() const
{
OUString ret;
aFamilyName >>= ret;
return ret;
}
TYPEINIT1( XMLFontStyleContextFontFaceFormat, SvXMLStyleContext );
XMLFontStyleContextFontFaceFormat::XMLFontStyleContextFontFaceFormat( SvXMLImport& rImport,
sal_uInt16 nPrfx, const OUString& rLName,
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList > &xAttrList,
XMLFontStyleContextFontFaceUri& _uri )
: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList)
, uri(_uri)
{
}
void XMLFontStyleContextFontFaceFormat::SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
const OUString& rValue )
{
if( nPrefixKey == XML_NAMESPACE_SVG && IsXMLToken( rLocalName, XML_STRING ))
uri.SetFormat(rValue);
else
SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
}
TYPEINIT1( XMLFontStyleContextFontFaceSrc, SvXMLImportContext );
XMLFontStyleContextFontFaceSrc::XMLFontStyleContextFontFaceSrc( SvXMLImport& rImport,
sal_uInt16 nPrfx, const OUString& rLName,
const XMLFontStyleContextFontFace& _font )
: SvXMLImportContext( rImport, nPrfx, rLName )
, font( _font )
{
}
SvXMLImportContext * XMLFontStyleContextFontFaceSrc::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList )
{
if( nPrefix == XML_NAMESPACE_SVG && IsXMLToken( rLocalName, XML_FONT_FACE_URI ))
return new XMLFontStyleContextFontFaceUri( GetImport(), nPrefix, rLocalName, xAttrList, font );
return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
}
TYPEINIT1( XMLFontStyleContextFontFaceUri, SvXMLImportContext );
XMLFontStyleContextFontFaceUri::XMLFontStyleContextFontFaceUri( SvXMLImport& rImport,
sal_uInt16 nPrfx, const OUString& rLName,
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList > & xAttrList,
const XMLFontStyleContextFontFace& _font )
: SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList )
, font( _font )
{
}
SvXMLImportContext * XMLFontStyleContextFontFaceUri::CreateChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList )
{
if( nPrefix == XML_NAMESPACE_SVG && IsXMLToken( rLocalName, XML_FONT_FACE_FORMAT ))
return new XMLFontStyleContextFontFaceFormat( GetImport(), nPrefix, rLocalName, xAttrList, *this );
if( linkPath.isEmpty() && ( nPrefix == XML_NAMESPACE_OFFICE ) && IsXMLToken( rLocalName, XML_BINARY_DATA ) )
{
mxBase64Stream.set( new comphelper::OSequenceOutputStream( maFontData ) );
if( mxBase64Stream.is() )
return new XMLBase64ImportContext( GetImport(), nPrefix, rLocalName, xAttrList, mxBase64Stream );
}
return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
}
void XMLFontStyleContextFontFaceUri::SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
const OUString& rValue )
{
if( nPrefixKey == XML_NAMESPACE_XLINK && IsXMLToken( rLocalName, XML_HREF ))
linkPath = rValue;
else
SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
}
void XMLFontStyleContextFontFaceUri::SetFormat( const OUString& rFormat )
{
format = rFormat;
}
// the CSS2 standard ( http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#referencing )
// defines these format strings.
const char* OPENTYPE_FORMAT = "opentype";
const char* TRUETYPE_FORMAT = "truetype";
const char* EOT_FORMAT = "embedded-opentype";
void XMLFontStyleContextFontFaceUri::EndElement()
{
if( ( linkPath.getLength() == 0 ) && ( maFontData.getLength() == 0 ) )
{
SAL_WARN( "xmloff", "svg:font-face-uri tag with no link or base64 data; ignoring." );
return;
}
bool eot;
// Assume by default that the font is not compressed.
if( format.getLength() == 0
|| format.equalsAscii( OPENTYPE_FORMAT )
|| format.equalsAscii( TRUETYPE_FORMAT ))
{
eot = false;
}
else if( format.equalsAscii( EOT_FORMAT ))
{
eot = true;
}
else
{
SAL_WARN( "xmloff", "Unknown format of embedded font; assuming TTF." );
eot = false;
}
if ( maFontData.getLength() == 0 )
handleEmbeddedFont( linkPath, eot );
else
handleEmbeddedFont( maFontData, eot );
}
void XMLFontStyleContextFontFaceUri::handleEmbeddedFont( const OUString& url, bool eot )
{
if( GetImport().embeddedFontAlreadyProcessed( url ))
{
GetImport().NotifyEmbeddedFontRead();
return;
}
OUString fontName = font.familyName();
// If there's any giveMeStreamForThisURL(), then it's well-hidden for me to find it.
if( GetImport().IsPackageURL( url ))
{
uno::Reference< embed::XStorage > storage;
storage.set( GetImport().GetSourceStorage(), UNO_QUERY_THROW );
if( url.indexOf( '/' ) > -1 ) // TODO what if more levels?
storage.set( storage->openStorageElement( url.copy( 0, url.indexOf( '/' )),
::embed::ElementModes::READ ), uno::UNO_QUERY_THROW );
uno::Reference< io::XInputStream > inputStream;
inputStream.set( storage->openStreamElement( url.copy( url.indexOf( '/' ) + 1 ), ::embed::ElementModes::READ ),
UNO_QUERY_THROW );
if( EmbeddedFontsHelper::addEmbeddedFont( inputStream, fontName, "?", std::vector< unsigned char >(), eot ))
GetImport().NotifyEmbeddedFontRead();
inputStream->closeInput();
}
else
SAL_WARN( "xmloff", "External URL for font file not handled." );
}
void XMLFontStyleContextFontFaceUri::handleEmbeddedFont( const ::css::uno::Sequence< sal_Int8 >& rData, const bool eot )
{
const uno::Reference< io::XInputStream > xInput( new comphelper::SequenceInputStream( rData ) );
const OUString fontName = font.familyName();
if( EmbeddedFontsHelper::addEmbeddedFont( xInput, fontName, "?", std::vector< unsigned char >(), eot ) )
GetImport().NotifyEmbeddedFontRead();
xInput->closeInput();
}
2000-11-14 09:19:45 +00:00
SvXMLStyleContext *XMLFontStylesContext::CreateStyleChildContext(
sal_uInt16 nPrefix,
const OUString& rLocalName,
2000-11-14 09:19:45 +00:00
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList > & xAttrList )
{
SvXMLStyleContext *pStyle;
if( XML_NAMESPACE_STYLE == nPrefix &&
IsXMLToken( rLocalName, XML_FONT_FACE ) )
2000-11-14 09:19:45 +00:00
{
pStyle = new XMLFontStyleContextFontFace( GetImport(), nPrefix,
2000-11-14 09:19:45 +00:00
rLocalName, xAttrList, *this );
}
else
{
pStyle = SvXMLStylesContext::CreateStyleChildContext( nPrefix,
rLocalName, xAttrList );
}
return pStyle;
}
TYPEINIT1( XMLFontStylesContext, SvXMLStylesContext );
XMLFontStylesContext::XMLFontStylesContext( SvXMLImport& rImport,
sal_uInt16 nPrfx, const OUString& rLName,
const Reference< XAttributeList > & xAttrList,
rtl_TextEncoding eDfltEnc ) :
SvXMLStylesContext( rImport, nPrfx, rLName, xAttrList ),
pFamilyNameHdl( new XMLFontFamilyNamePropHdl ),
pFamilyHdl( new XMLFontFamilyPropHdl ),
pPitchHdl( new XMLFontPitchPropHdl ),
pEncHdl( new XMLFontEncodingPropHdl ),
CWS-TOOLING: integrate CWS dbaperf1 2009-04-02 09:12:25 +0200 oj r270372 : CWS-TOOLING: rebase CWS dbaperf1 to trunk@270033 (milestone: DEV300:m45) 2009-03-17 10:20:34 +0100 oj r269577 : add parameter 2009-03-17 10:20:05 +0100 oj r269576 : add parameter 2009-03-12 12:32:24 +0100 oj r269387 : add missing ++ 2009-03-11 12:53:35 +0100 oj r269315 : compile error 2009-03-06 08:52:11 +0100 oj r268968 : #i99264# remove duplicate code 2009-03-06 08:20:08 +0100 oj r268966 : add missingheader 2009-03-06 08:17:41 +0100 oj r268965 : add header 2009-03-06 08:15:07 +0100 oj r268964 : #i99708# remove duplicate code 2009-03-06 07:24:11 +0100 oj r268963 : #i99708# remove duplicate code 2009-03-06 07:22:24 +0100 oj r268962 : #i99708# use tenary operator 2009-03-06 07:19:21 +0100 oj r268961 : remove unused rtl_logs 2009-03-06 07:15:55 +0100 oj r268960 : #i99708# extract getLength from for loop 2009-03-06 07:15:35 +0100 oj r268959 : #i99708# extract getLength from for loop 2009-03-06 07:14:57 +0100 oj r268958 : remove unused rtl_logs 2009-03-06 07:13:01 +0100 oj r268957 : insert DBG_ helper 2009-03-06 07:12:17 +0100 oj r268956 : remove unused rtl_logs 2009-03-06 07:10:26 +0100 oj r268955 : remove unused rtl_logs 2009-03-06 07:04:51 +0100 oj r268954 : #i99708# use tenary operator 2009-03-05 12:04:46 +0100 oj r268895 : comment RTL_LOG out 2009-03-05 09:05:07 +0100 oj r268874 : add rtl logfile 2009-03-04 14:21:18 +0100 oj r268828 : #i99708# make static inplace and some method calls in for loop removed 2009-03-04 14:20:34 +0100 oj r268827 : #i99708# impl double check pattern for getInfohelper 2009-03-02 09:31:42 +0100 oj r268636 : add rtl logfile 2009-03-02 08:18:37 +0100 oj r268633 : add rtl logfile 2009-02-27 11:22:16 +0100 oj r268570 : #i99709# change algorithm for marking objects 2009-02-27 11:17:04 +0100 oj r268568 : #i99708# some improvements to load forms, controls faster and replacement of size() call with !empty() which is much faster 2009-02-24 10:09:35 +0100 sb r268383 : #i99290# no longer care to set a sensible context class loader for native threads attached to the VM 2009-02-23 13:44:04 +0100 oj r268354 : #i76606# seekrow changes 2009-02-23 12:27:30 +0100 oj r268349 : deleted 2009-02-20 15:14:23 +0100 oj r268325 : #i76606# some code changes 2009-02-19 14:15:25 +0100 oj r268284 : #i76606# use of simple prep stmt instead of full blown rowset, when source and dest connection are the same use insert into ... ( select ... ) 2009-02-19 11:27:55 +0100 oj r268265 : #i76606# insert some RTL_LOG and setObject impl 2009-02-18 14:45:37 +0100 oj r268222 : #i99363# insert RTL_LOG 2009-02-18 14:45:18 +0100 oj r268221 : #i99363# insert RTL_LOG 2009-02-18 11:14:54 +0100 oj r268207 : #i99363# call some impl_ methods to avoid duplicate cechCache calls 2009-02-18 11:10:47 +0100 oj r268206 : #i99363# make isCount inline 2009-02-18 10:33:22 +0100 oj r268203 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-18 10:32:57 +0100 oj r268202 : #i99363# use bookmarkable if available and inserted some RTL_LOG 2009-02-17 07:29:05 +0100 oj r267843 : #i96897# remove some dll public 2009-02-16 15:01:04 +0100 oj r267816 : #i96897# remove some dll public 2009-02-16 14:25:53 +0100 oj r267810 : #i99264# remove duplicate code 2009-02-16 14:25:33 +0100 oj r267809 : #i99264# remove duplicate code 2009-02-16 14:24:59 +0100 oj r267808 : #i99264# remove duplicate code 2009-02-13 10:56:17 +0100 oj r267703 : #i99191# comment the contextclassloader 2009-02-13 10:32:40 +0100 oj r267700 : reduce call to resultset meta data 2009-02-13 10:27:31 +0100 oj r267699 : reduce call to resultset meta data 2009-02-13 10:27:08 +0100 oj r267698 : reduce call to resultset meta data
2009-04-23 10:42:05 +00:00
pFontStyleAttrTokenMap( new SvXMLTokenMap(lcl_getFontStyleAttrTokenMap()) ),
eDfltEncoding( eDfltEnc )
2000-11-14 09:19:45 +00:00
{
}
XMLFontStylesContext::~XMLFontStylesContext()
{
delete pFamilyNameHdl;
delete pFamilyHdl;
delete pPitchHdl;
delete pEncHdl;
delete pFontStyleAttrTokenMap;
}
bool XMLFontStylesContext::FillProperties( const OUString& rName,
2000-11-14 09:19:45 +00:00
::std::vector< XMLPropertyState > &rProps,
sal_Int32 nFamilyNameIdx,
sal_Int32 nStyleNameIdx,
sal_Int32 nFamilyIdx,
sal_Int32 nPitchIdx,
sal_Int32 nCharsetIdx ) const
{
const SvXMLStyleContext* pStyle = FindStyleChildContext( XML_STYLE_FAMILY_FONT, rName, true );
const XMLFontStyleContextFontFace *pFontStyle = PTR_CAST( XMLFontStyleContextFontFace,pStyle);// use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice
2000-11-14 09:19:45 +00:00
if( pFontStyle )
pFontStyle->FillProperties( rProps, nFamilyNameIdx, nStyleNameIdx,
nFamilyIdx, nPitchIdx, nCharsetIdx );
return 0 != pFontStyle;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */