Ejemplo n.º 1
0
drop_cap_length drop_cap_length::parse(const std::wstring & Str)
{
    std::wstring tmp = Str;
    boost::algorithm::to_lower(tmp);

    if (L"word" == tmp)
    {
        try 
        {
            return drop_cap_length( Word );
        }
        catch(errors::invalid_attribute &) {}
    }

    try 
    {
        return drop_cap_length( boost::lexical_cast<unsigned int>(tmp) );
    } 
    catch(...)
    {
    }

    BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
    return drop_cap_length( 1 );
}
void style_drop_cap::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
    CP_APPLY_ATTR(L"style:length", style_length_, drop_cap_length());
    CP_APPLY_ATTR(L"style:lines", style_lines_, (unsigned int)1);
    CP_APPLY_ATTR(L"style:distance", style_distance_);
    CP_APPLY_ATTR(L"style:style-name", style_style_name_);
}