22 #include <rtl/ustrbuf.hxx>
24 #include <com/sun/star/awt/FontWeight.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
27 #include <com/sun/star/drawing/XShape.hpp>
28 #include <com/sun/star/text/XTextAppend.hpp>
29 #include <com/sun/star/text/WritingMode.hpp>
30 #include <com/sun/star/style/ParagraphAdjust.hpp>
43 maParagraph( rParagraph ),
50 : mrTypeModel(rTypeModel)
51 , borderDistanceSet(
false )
52 , borderDistanceLeft(0)
53 , borderDistanceTop(0)
54 , borderDistanceRight(0)
55 , borderDistanceBottom(0)
61 maPortions.emplace_back( rParagraph, rFont, rText );
73 aBuffer.append( portion.maText );
74 return aBuffer.makeStringAndClear();
79 uno::Reference<text::XTextAppend> xTextAppend(xShape, uno::UNO_QUERY);
81 bool bAmbiguousStyle =
true;
85 beans::PropertyValue aPropertyValue;
86 std::vector<beans::PropertyValue> aPropVec;
91 aPropertyValue.Name =
"CharFontName";
92 aPropertyValue.Value <<= rFont.
moName.
get();
93 aPropVec.push_back(aPropertyValue);
95 aPropertyValue.Name =
"CharFontNameAsian";
97 aPropVec.push_back(aPropertyValue);
99 aPropertyValue.Name =
"CharFontNameComplex";
101 aPropVec.push_back(aPropertyValue);
105 aPropertyValue.Name =
"CharWeight";
106 aPropertyValue.Value <<= rFont.
mobBold.
get() ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL;
107 aPropVec.push_back(aPropertyValue);
111 aPropertyValue.Name =
"CharHeight";
112 aPropertyValue.Value <<= double(rFont.
monSize.
get()) / 2.;
113 aPropVec.push_back(aPropertyValue);
117 aPropertyValue.Name =
"CharKerning";
122 aPropVec.push_back(aPropertyValue);
126 style::ParagraphAdjust eAdjust = style::ParagraphAdjust_LEFT;
128 eAdjust = style::ParagraphAdjust_CENTER;
130 eAdjust = style::ParagraphAdjust_RIGHT;
132 aPropertyValue.Name =
"ParaAdjust";
133 aPropertyValue.Value <<= eAdjust;
134 aPropVec.push_back(aPropertyValue);
139 if (sParaStyle.isEmpty() )
143 if ( bAmbiguousStyle )
144 bAmbiguousStyle =
false;
148 else if ( !bAmbiguousStyle )
151 bAmbiguousStyle =
true;
153 bAmbiguousStyle =
true;
157 aPropertyValue.Name =
"CharColor";
158 aPropertyValue.Value <<= rFont.
moColor.
get().toUInt32(16);
159 aPropVec.push_back(aPropertyValue);
168 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY_THROW);
169 aGrabBag.
update( xPropertySet->getPropertyValue(
"CharInteropGrabBag") );
170 aGrabBag[
"mso-pStyle"] <<= sParaStyle;
173 catch (
const uno::Exception&)
179 uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor();
180 xCursor->gotoEnd(
false);
181 xCursor->goLeft(1,
true);
182 if (xCursor->getString() ==
"\n")
183 xCursor->setString(
"");
188 uno::Reference<beans::XPropertySet> xProperties(xShape, uno::UNO_QUERY);
197 xProperties->setPropertyValue(
"TextHorizontalAdjust",
uno::Any(drawing::TextHorizontalAdjust_RIGHT));
199 xProperties->setPropertyValue(
"TextWritingMode",
uno::Any( text::WritingMode_TB_RL ) );
The shape model structure contains all properties shared by all types of shapes.
OptValue< OUString > moParaAdjust
Paragraph adjust (left, center, right, etc.)
A text paragraph in a textbox.
void appendPortion(const TextParagraphModel &rParagraph, const TextFontModel &rFont, const OUString &rText)
Appends a new text portion to the textbox.
OptValue< sal_Int32 > monSpacing
const TextFontModel * getFirstFont() const
Returns the font settings of the first text portion.
OptValue< OUString > moNameAsian
Asian font name.
css::uno::Sequence< css::beans::PropertyValue > getAsConstPropertyValueList() const
Font settings for a text portion in a textbox.
void convert(const css::uno::Reference< css::drawing::XShape > &xShape) const
TextPortionModel(const TextParagraphModel &rParagraph, const TextFontModel &rFont, const OUString &rText)
void update(const SequenceAsHashMap &rSource)
#define TOOLS_WARN_EXCEPTION(area, stream)
OUString getText() const
Returns the entire text of all text portions.
OptValue< OUString > moParaStyleName
std::unique_ptr< char[]> aBuffer
OptValue< OUString > moColor
Font color, HTML encoded, sort of.
OptValue< OUString > moName
Font name.
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
OptValue< OUString > moNameComplex
Complex font name.
OptValue< sal_Int32 > monSize
Font size in twips.
bool m_bDetectedRangeSegmentation false
TextBox(ShapeTypeModel &rTypeModel)