Skip to content

Commit 697313f

Browse files
committed
pages[all]: try to retrieve text boxes attached as char...
Change-Id: Ic015bdaf8bda94547b3a752c8c28ae90bd9b2c10
1 parent 9c097a2 commit 697313f

File tree

3 files changed

+14
-45
lines changed

3 files changed

+14
-45
lines changed

src/lib/IWORKCollector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class IWORKCollector
143143
static void fillWrapProps(const IWORKStylePtr_t style, librevenge::RVNGPropertyList &props,
144144
const boost::optional<int> &order);
145145
static void writeFill(const IWORKFill &fill, librevenge::RVNGPropertyList &props);
146-
virtual void drawShape(const IWORKShapePtr_t &shape);
146+
void drawShape(const IWORKShapePtr_t &shape);
147147

148148
private:
149149
void pushStyle(const IWORKStylePtr_t &style);

src/lib/PAGCollector.cpp

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -280,45 +280,6 @@ void PAGCollector::drawTable()
280280
openGroup();
281281
}
282282

283-
void PAGCollector::drawShape(const IWORKShapePtr_t &shape)
284-
{
285-
if (!m_inAttachment)
286-
return IWORKCollector::drawShape(shape);
287-
288-
if (!bool(shape) || !bool(shape->m_path))
289-
{
290-
ETONYEK_DEBUG_MSG(("PAGCollector::drawShape: can not find the shape\n"));
291-
return;
292-
}
293-
294-
librevenge::RVNGPropertyList styleProps;
295-
if (bool(shape->m_style))
296-
fillGraphicProps(shape->m_style, styleProps, true, false);
297-
if (shape->m_locked) // CHECKME: maybe also content
298-
styleProps.insert("style:protect", "position size");
299-
300-
librevenge::RVNGPropertyList shapeProps;
301-
librevenge::RVNGPropertyListVector vec;
302-
auto const trafo = m_levelStack.top().m_trafo;
303-
auto const path = *shape->m_path * trafo;
304-
path.write(vec);
305-
shapeProps.insert("svg:d", vec);
306-
shapeProps.insert("text:anchor-type", "as-char");
307-
shapeProps.insert("style:vertical-pos", "bottom");
308-
shapeProps.insert("style:vertical-rel", "text");
309-
shapeProps.insert("style:run-through", "foreground");
310-
shapeProps.insert("style:wrap","run-through");
311-
312-
auto &elements = m_outputManager.getCurrent();
313-
elements.addSetStyle(styleProps);
314-
elements.addDrawPath(shapeProps);
315-
316-
if (bool(shape->m_text) && !shape->m_text->empty())
317-
{
318-
ETONYEK_DEBUG_MSG(("PAGCollector::drawShape: sorry sending text in a attachment is not implemented\n"));
319-
}
320-
}
321-
322283
void PAGCollector::drawMedia(const double x, const double y, const librevenge::RVNGPropertyList &data)
323284
{
324285
if (!data["office:binary-data"] || !data["librevenge:mime-type"])
@@ -359,10 +320,19 @@ void PAGCollector::drawMedia(const double x, const double y, const librevenge::R
359320

360321
void PAGCollector::fillShapeProperties(librevenge::RVNGPropertyList &props)
361322
{
362-
props.insert("text:anchor-type", "page");
363-
props.insert("text:anchor-page-number", m_page);
364-
props.insert("style:vertical-pos", "from-top");
365-
props.insert("style:vertical-rel", "page");
323+
if (m_inAttachments)
324+
{
325+
props.insert("text:anchor-type", "as-char");
326+
props.insert("style:vertical-pos", "bottom");
327+
props.insert("style:vertical-rel", "text");
328+
}
329+
else
330+
{
331+
props.insert("text:anchor-type", "page");
332+
props.insert("text:anchor-page-number", m_page);
333+
props.insert("style:vertical-pos", "from-top");
334+
props.insert("style:vertical-rel", "page");
335+
}
366336
}
367337

368338
void PAGCollector::drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox, const librevenge::RVNGPropertyList &style)

src/lib/PAGCollector.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class PAGCollector : public IWORKCollector
5454
PAGFootnoteKind getFootnoteKind() const;
5555

5656
private:
57-
void drawShape(const IWORKShapePtr_t &shape) override;
5857
void drawTable() override;
5958
void drawMedia(double x, double y, const librevenge::RVNGPropertyList &data) override;
6059
void fillShapeProperties(librevenge::RVNGPropertyList &props) override;

0 commit comments

Comments
 (0)