Kaydet (Commit) b18cfdc7 authored tarafından Chr. Rossmanith's avatar Chr. Rossmanith Kaydeden (comit) Fridrich Štrba

SVG: text elements and graphic elements should not share style ids

üst 23791c1c
......@@ -173,10 +173,11 @@ struct State
maTransform(),
maViewport(),
maViewBox(),
mbIsText(false),
maFontFamily(), // app-default
mnFontSize(0),
maFontStyle(RTL_CONSTASCII_USTRINGPARAM("normal")),
maFontVariant(RTL_CONSTASCII_USTRINGPARAM("normal")),
maFontStyle("normal"),
maFontVariant("normal"),
mnFontWeight(400.0),
meTextAnchor(BEFORE),
meTextDisplayAlign(BEFORE),
......@@ -211,6 +212,7 @@ struct State
basegfx::B2DRange maViewport;
basegfx::B2DRange maViewBox;
bool mbIsText;
rtl::OUString maFontFamily;
/** Absolute: xx-small=6.94 | x-small=8.33 | small=10 | medium=12 | large=14.4 | x-large=17.28 | xx-large=20.736
......@@ -263,6 +265,7 @@ inline bool operator==(const State& rLHS, const State& rRHS )
rLHS.maTransform==rRHS.maTransform &&
rLHS.maViewport==rRHS.maViewport &&
rLHS.maViewBox==rRHS.maViewBox &&
rLHS.mbIsText==rRHS.mbIsText &&
rLHS.maFontFamily==rRHS.maFontFamily &&
rLHS.mnFontSize==rRHS.mnFontSize &&
rLHS.maFontStyle==rRHS.maFontStyle &&
......@@ -309,6 +312,7 @@ struct StateHash
^ size_t(rState.maViewport.getHeight())
^ size_t(rState.maViewBox.getWidth())
^ size_t(rState.maViewBox.getHeight())
^ size_t(rState.mbIsText)
^ size_t(rState.maFontFamily.hashCode())
^ size_t(rState.mnFontSize)
^ size_t(rState.maFontStyle.hashCode())
......
......@@ -521,8 +521,12 @@ struct AnnotatingVisitor
rtl::Reference<SvXMLAttributeList> xAttrs( new SvXMLAttributeList() );
uno::Reference<xml::sax::XAttributeList> xUnoAttrs( xAttrs.get() );
if (XML_TEXT == nTagId)
rState.mbIsText = true;
std::pair<StatePool::iterator,
bool> aRes = mrStates.insert(rState);
SAL_INFO ("svg", "size " << mrStates.size() << " id " << const_cast<State&>(*aRes.first).mnStyleId);
if( !aRes.second )
return false; // not written
......@@ -530,6 +534,8 @@ struct AnnotatingVisitor
// mnStyleId does not take part in hashing/comparison
const_cast<State&>(*aRes.first).mnStyleId = mnCurrStateId;
SAL_INFO ("svg", " --> " << const_cast<State&>(*aRes.first).mnStyleId);
mrStateMap.insert(std::make_pair(
mnCurrStateId,
rState));
......@@ -750,6 +756,7 @@ struct AnnotatingVisitor
void writeStyle(const uno::Reference<xml::dom::XElement>& xElem, const sal_Int32 nTagId)
{
SAL_INFO ("svg", "writeStyle xElem " << xElem->getTagName());
sal_Int32 nEmulatedStyleId=0;
if( maCurrState.maDashArray.size() &&
maCurrState.meStrokeType != NONE )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment