summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/xmlsdtypes.hxx2
-rw-r--r--xmloff/source/core/xmltoken.cxx1
-rw-r--r--xmloff/source/draw/sdpropls.cxx37
-rw-r--r--xmloff/source/draw/shapeexport.cxx30
-rw-r--r--xmloff/source/style/prhdlfac.cxx3
-rw-r--r--xmloff/source/style/xmlexppr.cxx3
-rw-r--r--xmloff/source/token/tokens.txt1
7 files changed, 72 insertions, 5 deletions
diff --git a/xmloff/inc/xmlsdtypes.hxx b/xmloff/inc/xmlsdtypes.hxx
index 898c475bd7ef..c6e0ad315e22 100644
--- a/xmloff/inc/xmlsdtypes.hxx
+++ b/xmloff/inc/xmlsdtypes.hxx
@@ -118,6 +118,7 @@
//////////////////////////////////////////////////////////////////////////////
#define XML_SD_TYPE_CELL_ROTATION_ANGLE (XML_SD_TYPES_START + 79 )
+#define XML_SD_TYPE_WRITINGMODE2 (XML_SD_TYPES_START + 80 )
#define CTF_NUMBERINGRULES 1000
#define CTF_CONTROLWRITINGMODE 1001
@@ -200,5 +201,6 @@
#define CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT 1063
//////////////////////////////////////////////////////////////////////////////
+#define CTF_WRITINGMODE2 1064
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 30158b20660e..ca5c7ec21b08 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -2299,6 +2299,7 @@ namespace xmloff::token {
TOKEN( "lr", XML_LR ),
TOKEN( "rl", XML_RL ),
TOKEN( "tb", XML_TB ),
+ TOKEN( "tb-rl90", XML_TB_RL90 ),
TOKEN( "layout-grid-color", XML_LAYOUT_GRID_COLOR ),
TOKEN( "layout-grid-lines", XML_LAYOUT_GRID_LINES ),
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index a72a57261b58..3490625e1e8b 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -317,6 +317,9 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
// misc object properties
GMAP( "MoveProtect", XML_NAMESPACE_STYLE, XML_PROTECT, XML_SD_TYPE_MOVE_PROTECT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, CTF_SD_MOVE_PROTECT ),
GMAP( "SizeProtect", XML_NAMESPACE_STYLE, XML_PROTECT, XML_SD_TYPE_SIZE_PROTECT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, CTF_SD_SIZE_PROTECT ),
+ GMAP( "WritingMode", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_SD_TYPE_WRITINGMODE2, CTF_WRITINGMODE2 ),
+ {"WritingMode", XML_NAMESPACE_LO_EXT, XML_WRITING_MODE, XML_SD_TYPE_WRITINGMODE2|XML_TYPE_PROP_GRAPHIC, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED, true},
+
MAP_END()
};
@@ -589,6 +592,18 @@ SvXMLEnumMapEntry<text::WritingMode> const aXML_WritingMode_EnumMap[] =
{ XML_TOKEN_INVALID, text::WritingMode(0) }
};
+SvXMLEnumMapEntry<sal_Int16> const aXML_WritingMode2_EnumMap[] =
+{
+ { XML_LR_TB, text::WritingMode2::LR_TB },
+ { XML_RL_TB, text::WritingMode2::RL_TB },
+ { XML_TB_RL, text::WritingMode2::TB_RL },
+ { XML_TB_LR, text::WritingMode2::TB_LR },
+ { XML_PAGE, text::WritingMode2::CONTEXT },
+ { XML_BT_LR, text::WritingMode2::BT_LR },
+ { XML_TB_RL90, text::WritingMode2::TB_RL90 },
+ { XML_TOKEN_INVALID, text::WritingMode2::LR_TB }
+};
+
SvXMLEnumMapEntry<drawing::TextAnimationKind> const pXML_TextAnimation_Enum[] =
{
{ XML_NONE, drawing::TextAnimationKind_NONE },
@@ -1061,6 +1076,11 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
pHdl = new XMLEnumPropertyHdl( aXML_WritingMode_EnumMap );
break;
}
+ case XML_SD_TYPE_WRITINGMODE2 :
+ {
+ pHdl = new XMLConstantsPropertyHandler ( aXML_WritingMode2_EnumMap, XML_LR_TB );
+ break;
+ }
case XML_SD_TYPE_PRESPAGE_VISIBILITY :
{
pHdl = new XMLNamedBoolPropertyHdl( GetXMLToken(XML_VISIBLE), GetXMLToken(XML_HIDDEN) );
@@ -1360,6 +1380,7 @@ void XMLShapeExportPropertyMapper::ContextFilter(
XMLPropertyState* pClip11State = nullptr;
XMLPropertyState* pClipState = nullptr;
+ XMLPropertyState* pGraphicWritingMode2 = nullptr;
XMLPropertyState* pShapeWritingMode = nullptr;
XMLPropertyState* pTextWritingMode = nullptr;
XMLPropertyState* pControlWritingMode = nullptr;
@@ -1391,6 +1412,9 @@ void XMLShapeExportPropertyMapper::ContextFilter(
property->mnIndex = -1;
}
break;
+ case CTF_WRITINGMODE2:
+ pGraphicWritingMode2 = property;
+ break;
case CTF_WRITINGMODE:
pShapeWritingMode = property;
break;
@@ -1484,6 +1508,19 @@ void XMLShapeExportPropertyMapper::ContextFilter(
}
}
+ if (pGraphicWritingMode2)
+ {
+ // A style:writing-mode attribute G in graphic-properties is only evaluated if there is no
+ // style:writing-mode attribute P in the paragraph-properties of the same graphic style.
+ // Otherwise the value of P is used. For values lr-tb, rl-tb and tb-rl the values G and P
+ // should be the same. But other values in G cannot be expressed in P and would produce default
+ // 0 value in P, preventing evaluation of G.
+ sal_Int16 eGraphicWritingMode;
+ if ((pGraphicWritingMode2->maValue >>= eGraphicWritingMode)
+ && eGraphicWritingMode >= text::WritingMode2::TB_LR && pShapeWritingMode)
+ pShapeWritingMode->mnIndex = -1;
+ }
+
// check for duplicate writing mode
if( pShapeWritingMode && (pTextWritingMode || pControlWritingMode) )
{
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index c44349184770..a9f0291a53b8 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -80,6 +80,7 @@
#include <com/sun/star/presentation/ClickAction.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/text/XText.hpp>
#include <comphelper/classids.hxx>
@@ -4313,7 +4314,8 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc
OUString aStr;
OUStringBuffer aStrBuffer;
- double fTextRotateAngle(0.0); // sum TextRotateAngle and TextPreRotateAngle
+ double fTextRotateAngle(0.0);
+ double fTextPreRotateAngle(0.0); // will be consolidated with fTextRotateAngle at the end
SvXMLUnitConverter& rUnitConverter = rExport.GetMM100UnitConverter();
uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
@@ -4366,11 +4368,13 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc
}
break;
case EAS_TextPreRotateAngle :
+ {
+ rGeoProp.Value >>= fTextPreRotateAngle;
+ }
+ break;
case EAS_TextRotateAngle :
{
- double fAngle = 0.0;
- rGeoProp.Value >>= fAngle;
- fTextRotateAngle += fAngle;
+ rGeoProp.Value >>= fTextRotateAngle;
}
break;
case EAS_Extrusion :
@@ -4947,12 +4951,30 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc
break;
}
} // for
+
+ // ToDo: Where is TextPreRotateAngle still used? We cannot save it in ODF.
+ fTextRotateAngle += fTextPreRotateAngle;
+ // Workaround for writing-mode bt-lr and tb-rl90 in ODF strict,
+ // otherwise loext:writing-mode is used in style export.
+ if (!(rExport.getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED))
+ {
+ if (xPropSetInfo->hasPropertyByName(u"WritingMode"))
+ {
+ sal_Int16 nDirection;
+ xPropSet->getPropertyValue(u"WritingMode") >>= nDirection;
+ if (nDirection == text::WritingMode2::TB_RL90)
+ fTextRotateAngle -= 90;
+ else if (nDirection == text::WritingMode2::BT_LR)
+ fTextRotateAngle -= 270;
+ }
+ }
if (fTextRotateAngle != 0)
{
::sax::Converter::convertDouble( aStrBuffer, fTextRotateAngle );
aStr = aStrBuffer.makeStringAndClear();
rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_ROTATE_ANGLE, aStr );
}
+
rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TYPE, aCustomShapeType );
// adjustments
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx
index ca96e0421552..3b8cbe371000 100644
--- a/xmloff/source/style/prhdlfac.cxx
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -99,6 +99,9 @@ SvXMLEnumMapEntry<sal_uInt16> const aXML_WritingDirection_Enum[] =
{ XML_RL, text::WritingMode2::RL_TB },
{ XML_TB, text::WritingMode2::TB_RL },
+ // vertical as clockwise 90deg rotation, for OOXML vert="vert"
+ { XML_TB_RL90, text::WritingMode2::TB_RL90 },
+
{ XML_TOKEN_INVALID, 0 }
};
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 412b578c42a9..d2088cfea601 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -938,7 +938,8 @@ namespace
sal_Int8 CheckExtendedNamespace(std::u16string_view sXMLAttributeName, std::u16string_view sValue,
const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion)
{
- if (IsXMLToken(sXMLAttributeName, XML_WRITING_MODE) && IsXMLToken(sValue, XML_BT_LR))
+ if (IsXMLToken(sXMLAttributeName, XML_WRITING_MODE)
+ && (IsXMLToken(sValue, XML_BT_LR) || IsXMLToken(sValue, XML_TB_RL90)))
return nODFVersion & SvtSaveOptions::ODFSVER_EXTENDED ? 1 : -1;
else if (IsXMLToken(sXMLAttributeName, XML_VERTICAL_REL)
&& (IsXMLToken(sValue, XML_PAGE_CONTENT_BOTTOM)
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 918ab44981c4..506b9a4cb0e4 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -2183,6 +2183,7 @@ bt-lr
lr
rl
tb
+tb-rl90
layout-grid-color
layout-grid-lines
layout-grid-base-height