Kaydet (Commit) 6acc6c01 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

text:p is not allowed as child element of draw:frame

Regression from #i118485#.

Change-Id: Ib242ca1417f46b731d62d117132cbed6c02448fb
Reviewed-on: https://gerrit.libreoffice.org/15173Tested-by: 's avatarJenkins <ci@libreoffice.org>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 204d1093
......@@ -38,6 +38,7 @@
#include <xmloff/xmlexppr.hxx>
#include <xmloff/animexp.hxx>
#include <xmloff/families.hxx>
#include <xmloff/txtparae.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <xmloff/table/XMLTableExport.hxx>
......@@ -216,7 +217,7 @@ private:
SAL_DLLPRIVATE void ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMat, ::basegfx::B2DTuple& rTRScale, double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, com::sun::star::awt::Point* pRefPoint);
SAL_DLLPRIVATE void ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTRScale, double fTRShear, double fTRRotate, ::basegfx::B2DTuple& rTRTranslate, const XMLShapeExportFlags nFeatures);
SAL_DLLPRIVATE bool ImpExportPresentationAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet, const OUString& rClass );
SAL_DLLPRIVATE void ImpExportText( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
SAL_DLLPRIVATE void ImpExportText( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, TextPNS eExtensionNS = TextPNS::ODF );
SAL_DLLPRIVATE void ImpExportEvents( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
SAL_DLLPRIVATE void ImpExportDescription( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ); // #i68101#
SAL_DLLPRIVATE void ImpExportGluePoints( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
......
......@@ -61,8 +61,15 @@ namespace xmloff
{
class OFormLayerXMLExport;
class BoundFrameSets;
}
enum class TextPNS
{
ODF,
EXTENSION
};
class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport
{
struct Impl;
......@@ -282,14 +289,14 @@ protected:
void exportText(
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XText > & rText,
bool bAutoStyles, bool bProgress, bool bExportParagraph );
bool bAutoStyles, bool bProgress, bool bExportParagraph, TextPNS eExtensionNS = TextPNS::ODF );
void exportText(
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XText > & rText,
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XTextSection > & rBaseSection,
bool bAutoStyles, bool bProgress, bool bExportParagraph );
bool bAutoStyles, bool bProgress, bool bExportParagraph, TextPNS eExtensionNS = TextPNS::ODF );
bool exportTextContentEnumeration(
const ::com::sun::star::uno::Reference <
......@@ -301,13 +308,16 @@ protected:
bool bExportParagraph = true,
const ::com::sun::star::uno::Reference <
::com::sun::star::beans::XPropertySet > *pRangePropSet = 0,
bool bExportLevels = true );
bool bExportLevels = true,
TextPNS eExtensionNS = TextPNS::ODF);
void exportParagraph(
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XTextContent > & rTextContent,
bool bAutoStyles, bool bProgress,
bool bExportParagraph,
MultiPropertySetHelper& rPropSetHelper);
MultiPropertySetHelper& rPropSetHelper,
TextPNS eExtensionNS = TextPNS::ODF);
virtual void exportTable(
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XTextContent > & rTextContent,
......@@ -568,7 +578,8 @@ public:
// This method exports the given OUString
void exportText(
const OUString& rText,
bool& rPrevCharWasSpace );
bool& rPrevCharWasSpace,
TextPNS eExtensionNS = TextPNS::ODF);
// This method collects all automatic styles for the given XText
void collectTextAutoStyles(
......@@ -610,9 +621,9 @@ public:
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XText > & rText,
bool bIsProgress = false,
bool bExportParagraph = true)
bool bExportParagraph = true, TextPNS eExtensionNS = TextPNS::ODF)
{
exportText( rText, false, bIsProgress, bExportParagraph );
exportText( rText, false, bIsProgress, bExportParagraph, eExtensionNS );
}
void exportText(
......@@ -621,9 +632,10 @@ public:
const ::com::sun::star::uno::Reference <
::com::sun::star::text::XTextSection > & rBaseSection,
bool bIsProgress = false,
bool bExportParagraph = true)
bool bExportParagraph = true,
TextPNS eExtensionNS = TextPNS::ODF)
{
exportText( rText, rBaseSection, false, bIsProgress, bExportParagraph );
exportText( rText, rBaseSection, false, bIsProgress, bExportParagraph, eExtensionNS );
}
void exportFramesBoundToPage( bool bIsProgress = false )
......
......@@ -1213,7 +1213,8 @@ SvXMLImportContext* SchXMLTitleContext::CreateChildContext(
{
SvXMLImportContext* pContext = 0;
if( nPrefix == XML_NAMESPACE_TEXT &&
if( (nPrefix == XML_NAMESPACE_TEXT ||
nPrefix == XML_NAMESPACE_LO_EXT) &&
IsXMLToken( rLocalName, XML_P ) )
{
pContext = new SchXMLParagraphContext( GetImport(), rLocalName, mrTitle );
......
......@@ -689,7 +689,8 @@ SvXMLImportContext* SchXMLTableCellContext::CreateChildContext(
mbReadText = false;//don't apply text from <text:p>
}
// <text:p> element - read text (and range from text:id old version)
else if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) )
else if( (nPrefix == XML_NAMESPACE_TEXT ||
nPrefix == XML_NAMESPACE_LO_EXT) && IsXMLToken( rLocalName, XML_P ) )
{
pContext = new SchXMLParagraphContext( GetImport(), rLocalName, maCellContent, &maRangeId );
}
......
......@@ -72,7 +72,8 @@ SvXMLImportContext* SchXMLListItemContext::CreateChildContext(
const uno::Reference< xml::sax::XAttributeList >& )
{
SvXMLImportContext* pContext = 0;
if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) )
if( (nPrefix == XML_NAMESPACE_TEXT ||
nPrefix == XML_NAMESPACE_LO_EXT) && IsXMLToken( rLocalName, XML_P ) )
pContext = new SchXMLParagraphContext( GetImport(), rLocalName, m_rText );
else
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
......
......@@ -1492,14 +1492,14 @@ bool XMLShapeExport::ImpExportPresentationAttributes( const uno::Reference< bean
return bIsEmpty;
}
void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xShape )
void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xShape, TextPNS eExtensionNS )
{
uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
if( xText.is() )
{
uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY );
if( xEnumAccess.is() && xEnumAccess->hasElements() )
mrExport.GetTextParagraphExport()->exportText( xText );
mrExport.GetTextParagraphExport()->exportText( xText, false, true, eExtensionNS );
}
}
......@@ -2804,7 +2804,7 @@ void XMLShapeExport::ImpExportOLE2Shape(
{
// #i118485# Add text export, the draw OLE shape allows text now
// fdo#58571 chart objects don't allow text:p
ImpExportText( xShape );
ImpExportText( xShape, TextPNS::EXTENSION );
}
if(!bExportEmbedded)
......
......@@ -73,7 +73,8 @@ SvXMLImportContext* XMLChangeInfoContext::CreateChildContext(
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
rLocalName, sDateTimeBuffer);
}
else if ( ( XML_NAMESPACE_TEXT == nPrefix ) &&
else if ( ( XML_NAMESPACE_TEXT == nPrefix ||
XML_NAMESPACE_LO_EXT == nPrefix ) &&
IsXMLToken( rLocalName, XML_P ) )
{
pContext = new XMLStringBufferImportContext(GetImport(), nPrefix,
......
......@@ -62,7 +62,8 @@ void XMLStringBufferImportContext::Characters(
void XMLStringBufferImportContext::EndElement()
{
// add return for paragraph elements
if ( (XML_NAMESPACE_TEXT == GetPrefix()) &&
if ( (XML_NAMESPACE_TEXT == GetPrefix() ||
XML_NAMESPACE_LO_EXT == GetPrefix()) &&
(IsXMLToken(GetLocalName(), XML_P)) )
{
rTextBuffer.append(sal_Unicode(0x0a));
......
......@@ -80,6 +80,7 @@ using namespace ::com::sun::star::ucb;
static const SvXMLTokenMapEntry aTextElemTokenMap[] =
{
{ XML_NAMESPACE_TEXT, XML_P, XML_TOK_TEXT_P },
{ XML_NAMESPACE_LO_EXT, XML_P, XML_TOK_TEXT_P },
{ XML_NAMESPACE_TEXT, XML_H, XML_TOK_TEXT_H },
{ XML_NAMESPACE_TEXT, XML_LIST, XML_TOK_TEXT_LIST },
{ XML_NAMESPACE_DRAW, XML_FRAME, XML_TOK_TEXT_FRAME_PAGE },
......
......@@ -1651,7 +1651,8 @@ void XMLTextParagraphExport::exportText(
const Reference < XText > & rText,
bool bAutoStyles,
bool bIsProgress,
bool bExportParagraph )
bool bExportParagraph,
TextPNS eExtensionNS)
{
if( bAutoStyles )
GetExport().GetShapeExport(); // make sure the graphics styles family
......@@ -1702,7 +1703,7 @@ void XMLTextParagraphExport::exportText(
if( !bAutoStyles && (pRedlineExport != NULL) )
pRedlineExport->ExportStartOrEndRedline( xPropertySet, true );
exportTextContentEnumeration( xParaEnum, bAutoStyles, xBaseSection,
bIsProgress, bExportParagraph, 0, bExportLevels );
bIsProgress, bExportParagraph, 0, bExportLevels, eExtensionNS );
if( !bAutoStyles && (pRedlineExport != NULL) )
pRedlineExport->ExportStartOrEndRedline( xPropertySet, false );
}
......@@ -1712,7 +1713,8 @@ void XMLTextParagraphExport::exportText(
const Reference < XTextSection > & rBaseSection,
bool bAutoStyles,
bool bIsProgress,
bool bExportParagraph )
bool bExportParagraph,
TextPNS /*eExtensionNS*/)
{
if( bAutoStyles )
GetExport().GetShapeExport(); // make sure the graphics styles family
......@@ -1745,7 +1747,7 @@ bool XMLTextParagraphExport::exportTextContentEnumeration(
bool bIsProgress,
bool bExportParagraph,
const Reference < XPropertySet > *pRangePropSet,
bool bExportLevels )
bool bExportLevels, TextPNS eExtensionNS )
{
DBG_ASSERT( rContEnum.is(), "No enumeration to export!" );
bool bHasMoreElements = rContEnum->hasMoreElements();
......@@ -1829,7 +1831,7 @@ bool XMLTextParagraphExport::exportTextContentEnumeration(
}
else
exportParagraph( xTxtCntnt, bAutoStyles, bIsProgress,
bExportParagraph, aPropSetHelper );
bExportParagraph, aPropSetHelper, eExtensionNS );
bHasContent = true;
}
else if( xServiceInfo->supportsService( sTableService ) )
......@@ -1907,7 +1909,7 @@ bool XMLTextParagraphExport::exportTextContentEnumeration(
void XMLTextParagraphExport::exportParagraph(
const Reference < XTextContent > & rTextContent,
bool bAutoStyles, bool bIsProgress, bool bExportParagraph,
MultiPropertySetHelper& rPropSetHelper)
MultiPropertySetHelper& rPropSetHelper, TextPNS eExtensionNS)
{
sal_Int16 nOutlineLevel = -1;
......@@ -2153,7 +2155,7 @@ void XMLTextParagraphExport::exportParagraph(
bool bPrevCharIsSpace = true;
enum XMLTokenEnum eElem =
0 < nOutlineLevel ? XML_H : XML_P;
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem,
SvXMLElementExport aElem( GetExport(), eExtensionNS == TextPNS::EXTENSION ? XML_NAMESPACE_LO_EXT : XML_NAMESPACE_TEXT, eElem,
true, false );
if( bHasContentEnum )
bPrevCharIsSpace = !exportTextContentEnumeration(
......@@ -3401,7 +3403,7 @@ void XMLTextParagraphExport::exportTextRange(
}
void XMLTextParagraphExport::exportText( const OUString& rText,
bool& rPrevCharIsSpace )
bool& rPrevCharIsSpace, TextPNS /*eExtensionNS*/ )
{
sal_Int32 nExpStartPos = 0;
sal_Int32 nEndPos = rText.getLength();
......
......@@ -2346,7 +2346,8 @@ SvXMLImportContext *XMLNumberedParaContext::CreateChildContext(
{
SvXMLImportContext *pContext( 0 );
if ( XML_NAMESPACE_TEXT == i_nPrefix )
if ( XML_NAMESPACE_TEXT == i_nPrefix ||
XML_NAMESPACE_LO_EXT == i_nPrefix )
{
bool bIsHeader( IsXMLToken( i_rLocalName, XML_H ) );
if ( bIsHeader || IsXMLToken( i_rLocalName, XML_P ) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment