summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-05-27 13:00:10 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-06-08 14:50:55 +0200
commit95ebd24a629b4c8cd62cc20c0701683512cc8fa0 (patch)
tree8bdeab41e8b4d0092f639e62fd3e20ae8243f199 /xmloff
parentc4f615b359be56e88e4fbf9aaaf30affb29d57e2 (diff)
editengine-columns: ODF support [API CHANGE]
This uses existing ODF markup, as used by Writer's text frame: style::columns child element of style:graphic-properties, its fo:column-count and fo:column-gap attributes. No ODF extension is required. Since currently only columns with same width and spacing are implemented, without additional settings, style:column child elements are exported, but ignored on import. This adds new property to css::drawing::TextProperties service: TextColumns (of type css::text::XTextColumns). Change-Id: I7e63293e5814b281ceec8a9632e696322d3629e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116035 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/XMLShapePropertySetContext.cxx3
-rw-r--r--xmloff/source/draw/sdpropls.cxx6
-rw-r--r--xmloff/source/text/XMLTextColumnsExport.cxx2
-rw-r--r--xmloff/source/text/txtprhdl.cxx3
4 files changed, 14 insertions, 0 deletions
diff --git a/xmloff/source/draw/XMLShapePropertySetContext.cxx b/xmloff/source/draw/XMLShapePropertySetContext.cxx
index 45c8ace61fc5..c702bccf9a91 100644
--- a/xmloff/source/draw/XMLShapePropertySetContext.cxx
+++ b/xmloff/source/draw/XMLShapePropertySetContext.cxx
@@ -18,6 +18,7 @@
*/
#include <XMLShapePropertySetContext.hxx>
+#include <XMLTextColumnsContext.hxx>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmlnumi.hxx>
#include <xmltabi.hxx>
@@ -78,6 +79,8 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLShapePropertySetCon
return new SvxXMLTabStopImportContext( GetImport(), nElement,
rProp,
rProperties );
+ case CTF_TEXTCOLUMNS:
+ return new XMLTextColumnsContext(GetImport(), nElement, xAttrList, rProp, rProperties);
}
return SvXMLPropertySetContext::createFastChildContext( nElement,
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index 2bb4be8cab20..c25062efb968 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -58,6 +58,7 @@
#include <XMLClipPropertyHandler.hxx>
#include <XMLIsPercentagePropertyHandler.hxx>
#include <XMLPercentOrMeasurePropertyHandler.hxx>
+#include <XMLTextColumnsPropertyHandler.hxx>
#include <animations.hxx>
#include <sax/tools/converter.hxx>
#include <xmlsdtypes.hxx>
@@ -145,6 +146,8 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
GMAP( "TextWordWrap", XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_WRAP_OPTION, 0 ),
GMAP( "TextChainNextName", XML_NAMESPACE_DRAW, XML_CHAIN_NEXT_NAME, XML_TYPE_STRING, 0 ),
+ GMAP( "TextColumns", XML_NAMESPACE_STYLE, XML_COLUMNS, XML_TYPE_TEXT_COLUMNS|MID_FLAG_ELEMENT_ITEM, CTF_TEXTCOLUMNS ),
+
// shadow attributes
GMAP( "Shadow", XML_NAMESPACE_DRAW, XML_SHADOW, XML_SD_TYPE_VISIBLE_HIDDEN, 0 ),
GMAP( "ShadowXDistance", XML_NAMESPACE_DRAW, XML_SHADOW_OFFSET_X, XML_TYPE_MEASURE, 0 ),
@@ -1275,6 +1278,9 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
case XML_SD_TYPE_CELL_ROTATION_ANGLE:
pHdl = new XMLSdRotationAngleTypeHdl;
break;
+ case XML_TYPE_TEXT_COLUMNS:
+ pHdl = new XMLTextColumnsPropertyHandler;
+ break;
}
if(pHdl)
diff --git a/xmloff/source/text/XMLTextColumnsExport.cxx b/xmloff/source/text/XMLTextColumnsExport.cxx
index 13f06fde36e6..017045d5f635 100644
--- a/xmloff/source/text/XMLTextColumnsExport.cxx
+++ b/xmloff/source/text/XMLTextColumnsExport.cxx
@@ -61,6 +61,8 @@ void XMLTextColumnsExport::exportXML( const Any& rAny )
{
Reference < XTextColumns > xColumns;
rAny >>= xColumns;
+ if (!xColumns)
+ return;
const Sequence < TextColumn > aColumns = xColumns->getColumns();
sal_Int32 nCount = aColumns.getLength();
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index addb880a1b3b..b8dc0a8a550f 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -656,6 +656,9 @@ bool XMLTextColumnsPropertyHandler::equals(
Reference < XTextColumns > xColumns2;
r2 >>= xColumns2;
+ if (!xColumns1 || !xColumns2)
+ return (!xColumns1 && !xColumns2);
+
if( xColumns1->getColumnCount() != xColumns2->getColumnCount() ||
xColumns1->getReferenceValue() != xColumns2->getReferenceValue() )
return false;