31#include "FilterInternal.h"
32#include "TextRunStyle.h"
33#include "WriterProperties.h"
34#include "DocumentElement.h"
42ParagraphStyle::ParagraphStyle(_SH_PropertyList *pPropList, const _SH_PropertyListVector &xTabStops, const _SH_String &sName) :
43 mpPropList(pPropList),
44 mxTabStops(xTabStops),
49ParagraphStyle::~ParagraphStyle()
54void ParagraphStyle::write(DocumentHandler &xHandler) const
56 WRITER_DEBUG_MSG(( "Writing a paragraph style..\n"));
58 _SH_PropertyList propList;
59 propList.insert( "style:name", msName.cstr());
60 propList.insert( "style:family", "paragraph");
61 propList.insert( "style:parent-style-name", (*mpPropList)[ "style:parent-style-name"]->getStr());
62 if ((*mpPropList)[ "style:master-page-name"])
63 propList.insert( "style:master-page-name", (*mpPropList)[ "style:master-page-name"]->getStr());
64 xHandler.startElement( "style:style", propList);
67 _SH_PropertyList::Iter i((*mpPropList));
68 for (i.rewind(); i.next(); )
70 if (strcmp(i.key(), "style:list-style-name") == 0)
71 propList.insert( "style:list-style-name", i()->getStr());
72 if (strcmp(i.key(), "fo:margin-left") == 0)
73 propList.insert( "fo:margin-left", i()->getStr());
74 if (strcmp(i.key(), "fo:margin-right") == 0)
75 propList.insert( "fo:margin-right", i()->getStr());
76 if (strcmp(i.key(), "fo:text-indent") == 0)
77 propList.insert( "fo:text-indent", i()->getStr());
78 if (strcmp(i.key(), "fo:margin-top") == 0)
79 propList.insert( "fo:margin-top", i()->getStr());
80 if (strcmp(i.key(), "fo:margin-bottom") == 0)
81 propList.insert( "fo:margin-bottom", i()->getStr());
82 if (strcmp(i.key(), "fo:line-height") == 0)
83 propList.insert( "fo:line-height", i()->getStr());
84 if (strcmp(i.key(), "fo:break-before") == 0)
85 propList.insert( "fo:break-before", i()->getStr());
86 if (strcmp(i.key(), "fo:text-align") == 0)
87 propList.insert( "fo:text-align", i()->getStr());
88 if (strcmp(i.key(), "fo:text-align-last") == 0)
89 propList.insert( "fo:text-align-last", i()->getStr());
92 propList.insert( "style:justify-single-word", "false");
93 xHandler.startElement( "style:properties", propList);
95 if (mxTabStops.count() > 0)
97 TagOpenElement tabListOpen( "style:tab-stops");
98 tabListOpen.write(xHandler);
99 _SH_PropertyListVector::Iter i(mxTabStops);
100 for (i.rewind(); i.next();)
102 TagOpenElement tabStopOpen( "style:tab-stop");
104 _SH_PropertyList::Iter j(i());
105 for (j.rewind(); j.next(); )
107 tabStopOpen.addAttribute(j.key(), j()->getStr().cstr());
109 tabStopOpen.write(xHandler);
110 xHandler.endElement( "style:tab-stop");
112 xHandler.endElement( "style:tab-stops");
115 xHandler.endElement( "style:properties");
116 xHandler.endElement( "style:style");
119SpanStyle::SpanStyle( const char *psName, const _SH_PropertyList &xPropList) :
125void SpanStyle::write(DocumentHandler &xHandler) const
127 WRITER_DEBUG_MSG(( "Writing a span style..\n"));
128 _SH_PropertyList styleOpenList;
129 styleOpenList.insert( "style:name", getName());
130 styleOpenList.insert( "style:family", "text");
131 xHandler.startElement( "style:style", styleOpenList);
133 _SH_PropertyList propList(mPropList);
135 if (mPropList[ "style:font-name"])
137 propList.insert( "style:font-name-asian", mPropList[ "style:font-name"]->getStr());
138 propList.insert( "style:font-name-complex", mPropList[ "style:font-name"]->getStr());
141 if (mPropList[ "fo:font-size"])
143 propList.insert( "style:font-size-asian", mPropList[ "fo:font-size"]->getStr());
144 propList.insert( "style:font-size-complex", mPropList[ "fo:font-size"]->getStr());
147 if (mPropList[ "fo:font-weight"])
149 propList.insert( "style:font-weight-asian", mPropList[ "fo:font-weight"]->getStr());
150 propList.insert( "style:font-weight-complex", mPropList[ "fo:font-weight"]->getStr());
153 if (mPropList[ "fo:font-style"])
155 propList.insert( "style:font-style-asian", mPropList[ "fo:font-style"]->getStr());
156 propList.insert( "style:font-style-complex", mPropList[ "fo:font-style"]->getStr());
159 xHandler.startElement( "style:properties", propList);
161 xHandler.endElement( "style:properties");
162 xHandler.endElement( "style:style");
|