2951cbdf3a
In this part, oox module has been modified in order to prepare
for WPG handling during OOXML import. Note: Wpg is the drawingML
equivalent of v:group, supporting text boxes in the group.
1) Added new parameter for WpgContext to support nested
Wpg shapes, and WPS enabled for the WPG member shapes.
2) A bug has fixed, where group member line shape and
connector shapes have wrong positions before in the group.
3) Unit tests had to be modified, and 3 of them disabled
temporarily due to missing Writerfilter implementation (what
will be the next commit)
Now group shapes can have textboxes and the text is imported
for that, but complex content is still missing (this will be
fixed in writerfilter by the next commit).
Known issue: WPG shapes with textboxes in floating table
have issues during import at floating table conversion, so until
this is not fixed this function is disabled for shapes in tables
(will be fixed a follow-up commit later).
Follow-up to commit 19394a924f
"tdf#143574 sw: textboxes in group shapes -- part 4".
Change-Id: I71032187697807087bd8f27f7c3a7b052e174bd7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124964
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
99 lines
3.7 KiB
C++
99 lines
3.7 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#include "WpgContext.hxx"
|
|
#include "WpsContext.hxx"
|
|
#include <sal/log.hxx>
|
|
#include <drawingml/shapepropertiescontext.hxx>
|
|
#include <oox/drawingml/shapegroupcontext.hxx>
|
|
#include <oox/drawingml/graphicshapecontext.hxx>
|
|
#include <oox/token/namespaces.hxx>
|
|
#include <oox/token/tokens.hxx>
|
|
|
|
using namespace com::sun::star;
|
|
|
|
namespace oox::shape
|
|
{
|
|
WpgContext::WpgContext(FragmentHandler2 const& rParent, oox::drawingml::ShapePtr pMaster)
|
|
: FragmentHandler2(rParent)
|
|
, m_bFullWPGSupport(false)
|
|
{
|
|
mpShape = std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape");
|
|
mpShape->setWps(true);
|
|
if (pMaster)
|
|
pMaster->addChild(mpShape);
|
|
}
|
|
|
|
WpgContext::~WpgContext() = default;
|
|
|
|
oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken,
|
|
const oox::AttributeList& /*rAttribs*/)
|
|
{
|
|
switch (getBaseToken(nElementToken))
|
|
{
|
|
case XML_wgp:
|
|
case XML_cNvGrpSpPr:
|
|
case XML_grpSpPr:
|
|
return new oox::drawingml::ShapePropertiesContext(*this, *mpShape);
|
|
case XML_wsp:
|
|
{
|
|
if (m_bFullWPGSupport)
|
|
{
|
|
oox::drawingml::ShapePtr pShape = std::make_shared<oox::drawingml::Shape>(
|
|
"com.sun.star.drawing.CustomShape", /*bDefaultHeight=*/false);
|
|
return new oox::shape::WpsContext(*this, uno::Reference<drawing::XShape>(), mpShape,
|
|
pShape);
|
|
}
|
|
else
|
|
{
|
|
// Don't set default character height, Writer has its own way to set
|
|
// the default, and if we don't set it here, editeng properly inherits
|
|
// it.
|
|
oox::drawingml::ShapePtr pShape = std::make_shared<oox::drawingml::Shape>(
|
|
"com.sun.star.drawing.CustomShape", /*bDefaultHeight=*/false);
|
|
return new oox::drawingml::ShapeContext(*this, mpShape, pShape);
|
|
}
|
|
}
|
|
case XML_pic:
|
|
return new oox::drawingml::GraphicShapeContext(
|
|
*this, mpShape,
|
|
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"));
|
|
case XML_grpSp:
|
|
{
|
|
if (m_bFullWPGSupport)
|
|
{
|
|
rtl::Reference<WpgContext> pWPGShape = new oox::shape::WpgContext(*this, mpShape);
|
|
pWPGShape->setFullWPGSupport(m_bFullWPGSupport);
|
|
return pWPGShape;
|
|
}
|
|
else
|
|
{
|
|
return new oox::drawingml::ShapeGroupContext(
|
|
*this, mpShape,
|
|
std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape"));
|
|
}
|
|
}
|
|
case XML_graphicFrame:
|
|
{
|
|
auto pShape = std::make_shared<oox::drawingml::Shape>(
|
|
"com.sun.star.drawing.GraphicObjectShape");
|
|
pShape->setWps(true);
|
|
return new oox::drawingml::GraphicalObjectFrameContext(*this, mpShape, pShape,
|
|
/*bEmbedShapesInChart=*/true);
|
|
}
|
|
default:
|
|
SAL_WARN("oox", "WpgContext::createFastChildContext: unhandled element: "
|
|
<< getBaseToken(nElementToken));
|
|
break;
|
|
}
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|