[Libreoffice-commits] core.git: include/xmloff xmloff/source

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Apr 8 06:40:35 PDT 2015


 include/xmloff/shapeexport.hxx                      |    3 +-
 include/xmloff/txtparae.hxx                         |   30 ++++++++++++++------
 xmloff/source/chart/SchXMLChartContext.cxx          |    3 +-
 xmloff/source/chart/SchXMLTableContext.cxx          |    3 +-
 xmloff/source/chart/SchXMLTextListContext.cxx       |    3 +-
 xmloff/source/draw/shapeexport.cxx                  |    6 ++--
 xmloff/source/text/XMLChangeInfoContext.cxx         |    3 +-
 xmloff/source/text/XMLStringBufferImportContext.cxx |    3 +-
 xmloff/source/text/txtimp.cxx                       |    1 
 xmloff/source/text/txtparae.cxx                     |   18 ++++++------
 xmloff/source/text/txtparai.cxx                     |    3 +-
 11 files changed, 49 insertions(+), 27 deletions(-)

New commits:
commit 6acc6c011d3afd6834efeee1b2efe43652a86f2e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Apr 6 15:26:28 2015 +0200

    text:p is not allowed as child element of draw:frame
    
    Regression from #i118485#.
    
    Change-Id: Ib242ca1417f46b731d62d117132cbed6c02448fb
    Reviewed-on: https://gerrit.libreoffice.org/15173
    Tested-by: Jenkins <ci at libreoffice.org>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/include/xmloff/shapeexport.hxx b/include/xmloff/shapeexport.hxx
index 64538e2..b957022 100644
--- a/include/xmloff/shapeexport.hxx
+++ b/include/xmloff/shapeexport.hxx
@@ -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 );
diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
index ca0c3b4..00dc25e 100644
--- a/include/xmloff/txtparae.hxx
+++ b/include/xmloff/txtparae.hxx
@@ -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 )
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index 6bd3aae..6902828 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -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 );
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index a443522..df2a6d7 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -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 );
     }
diff --git a/xmloff/source/chart/SchXMLTextListContext.cxx b/xmloff/source/chart/SchXMLTextListContext.cxx
index 871476f..1fd4f5c 100644
--- a/xmloff/source/chart/SchXMLTextListContext.cxx
+++ b/xmloff/source/chart/SchXMLTextListContext.cxx
@@ -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 );
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 2d0506c..96dfd64 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -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)
diff --git a/xmloff/source/text/XMLChangeInfoContext.cxx b/xmloff/source/text/XMLChangeInfoContext.cxx
index 6a169b9..4ec4943 100644
--- a/xmloff/source/text/XMLChangeInfoContext.cxx
+++ b/xmloff/source/text/XMLChangeInfoContext.cxx
@@ -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,
diff --git a/xmloff/source/text/XMLStringBufferImportContext.cxx b/xmloff/source/text/XMLStringBufferImportContext.cxx
index dbbfc41..a747245 100644
--- a/xmloff/source/text/XMLStringBufferImportContext.cxx
+++ b/xmloff/source/text/XMLStringBufferImportContext.cxx
@@ -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));
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 3eeec35..e1b3983 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -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     },
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index a3be715..3b1ab76 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -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();
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index b65135f..6a324b7 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -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 ) )


More information about the Libreoffice-commits mailing list