diff options
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 9 | ||||
-rw-r--r-- | editeng/source/items/frmitems.cxx | 6 | ||||
-rw-r--r-- | include/editeng/frmdir.hxx | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/text/WritingMode2.idl | 10 | ||||
-rw-r--r-- | oox/source/drawingml/textbodypropertiescontext.cxx | 7 | ||||
-rw-r--r-- | oox/source/drawingml/textparagraph.cxx | 10 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 2 | ||||
-rw-r--r-- | oox/source/shape/WpsContext.cxx | 14 |
8 files changed, 56 insertions, 5 deletions
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 51c922ce0b3f..54a7745eca7a 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -42,6 +42,7 @@ #include <editeng/wghtitem.hxx> #include <editeng/postitem.hxx> #include <editeng/langitem.hxx> +#include <editeng/frmdiritem.hxx> #include <editeng/scriptspaceitem.hxx> #include <editeng/charscaleitem.hxx> #include <editeng/numitem.hxx> @@ -694,6 +695,14 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) return false; } + //If the paragraph SvxFrameDirection is Stacked, use ONECHARPERLINE + const SvxFrameDirectionItem* pFrameDirItem = &GetParaAttrib(nPara, EE_PARA_WRITINGDIR); + bool bStacked = pFrameDirItem->GetValue() == SvxFrameDirection::Stacked; + if (bStacked) + maStatus.TurnOnFlags(EEControlBits::ONECHARPERLINE); + else + maStatus.TurnOffFlags(EEControlBits::ONECHARPERLINE); + // Initialization... // Always format for 100%: diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index e84ae2140e33..fa393ff4ccd8 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -4675,6 +4675,9 @@ bool SvxFrameDirectionItem::PutValue( const css::uno::Any& rVal, case text::WritingMode2::PAGE: SetValue( SvxFrameDirection::Environment ); break; + case text::WritingMode2::STACKED: + SetValue(SvxFrameDirection::Stacked); + break; default: bRet = false; break; @@ -4714,6 +4717,9 @@ bool SvxFrameDirectionItem::QueryValue( css::uno::Any& rVal, case SvxFrameDirection::Environment: nVal = text::WritingMode2::PAGE; break; + case SvxFrameDirection::Stacked: + nVal = text::WritingMode2::STACKED; + break; default: OSL_FAIL("Unknown SvxFrameDirection value!"); bRet = false; diff --git a/include/editeng/frmdir.hxx b/include/editeng/frmdir.hxx index 270ab62c626d..94972ebff0b0 100644 --- a/include/editeng/frmdir.hxx +++ b/include/editeng/frmdir.hxx @@ -56,6 +56,9 @@ enum class SvxFrameDirection /** Vertical, from top to bottom, from right to left (vert="vert"). */ Vertical_RL_TB90 = css::text::WritingMode2::TB_RL90, + + /** Stacked, from top to bottom, 1 char per line (vert="wordArtVert"). */ + Stacked = css::text::WritingMode2::STACKED, }; TranslateId getFrmDirResId(size_t nIndex); diff --git a/offapi/com/sun/star/text/WritingMode2.idl b/offapi/com/sun/star/text/WritingMode2.idl index f75108337a69..065912858de5 100644 --- a/offapi/com/sun/star/text/WritingMode2.idl +++ b/offapi/com/sun/star/text/WritingMode2.idl @@ -91,6 +91,16 @@ published constants WritingMode2 @since LibreOffice 7.5 */ const short TB_RL90 = 6; + + /** 'T' text within a line is written top-to-bottom, but characters are + 'E' not rotated. + 'X' This is like LR_TB where 1 Character fit in every line. + 'T' Only 1 line display is implemented. + This corresponds to OOXML attribute vert="wordArtVert" for shapes. + + @since LibreOffice 24.8 + */ + const short STACKED = 7; }; diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 46576c069c8e..a08ae8fb9f6d 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -146,7 +146,12 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons { mrTextBodyProp.maPropertyMap.setProperty(PROP_WritingMode, text::WritingMode2::BT_LR); } - else { + else if (tVert == XML_wordArtVert) // what about XML_wordArtVertRtl ? + { + mrTextBodyProp.maPropertyMap.setProperty(PROP_WritingMode, text::WritingMode2::STACKED); + } + else + { bool bRtl = rAttribs.getBool( XML_rtl, false ); mrTextBodyProp.maPropertyMap.setProperty( PROP_TextWritingMode, ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB )); diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx index e33cbb690ee9..860a9a4adf57 100644 --- a/oox/source/drawingml/textparagraph.cxx +++ b/oox/source/drawingml/textparagraph.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <com/sun/star/text/WritingMode2.hpp> #include <drawingml/textparagraph.hxx> #include <oox/drawingml/drawingmltypes.hxx> #include <drawingml/textcharacterproperties.hxx> @@ -31,6 +32,7 @@ #include <com/sun/star/text/ControlCharacter.hpp> #include <oox/token/properties.hxx> +using namespace ::com::sun::star; using namespace ::com::sun::star::text; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -175,6 +177,14 @@ void TextParagraph::insertAt( aioBulletList.setProperty( PROP_GraphicSize, aBulletSize); } + // If the shape is Stacked then set Stacked into the TextParagraphProperties + Reference<XPropertySet> xProps2(xText, UNO_QUERY); + sal_Int16 nWritingMode = xProps2->getPropertyValue("WritingMode").get<sal_Int16>(); + if (nWritingMode == text::WritingMode2::STACKED) + { + aParaProp.getTextParagraphPropertyMap().setProperty(PROP_WritingMode, nWritingMode); + } + float fCharacterSize = nCharHeight > 0 ? GetFontHeight ( nCharHeight ) : pTextParagraphStyle->getCharHeightPoints( 12 ); aParaProp.pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), true, fCharacterSize, true ); } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 9cd97d0b5f3e..20dba5b60de9 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3774,6 +3774,8 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo sWritingMode = "vert"; else if (nWritingMode == text::WritingMode2::TB_LR) sWritingMode = "mongolianVert"; + else if (nWritingMode == text::WritingMode2::STACKED) + sWritingMode = "wordArtVert"; } } diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index fae704856371..f0d5ed8133cf 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -607,20 +607,26 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken uno::Reference<lang::XServiceInfo> xServiceInfo(mxShape, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY); sal_Int32 nVert = rAttribs.getToken(XML_vert, XML_horz); - // Values 'wordArtVert' and 'wordArtVertRtl' are not implemented. - // Map them to other vert values. - if (nVert == XML_eaVert || nVert == XML_wordArtVertRtl) + if (nVert == XML_eaVert) { xPropertySet->setPropertyValue("TextWritingMode", uno::Any(text::WritingMode_TB_RL)); xPropertySet->setPropertyValue("WritingMode", uno::Any(text::WritingMode2::TB_RL)); } - else if (nVert == XML_mongolianVert || nVert == XML_wordArtVert) + else if (nVert == XML_mongolianVert) { xPropertySet->setPropertyValue("WritingMode", uno::Any(text::WritingMode2::TB_LR)); } + else if (nVert == XML_wordArtVert || nVert == XML_wordArtVertRtl) + { + // Multiline wordArtVert is not implemented yet. + // It will render all the text in 1 line. + // Map 'wordArtVertRtl' to 'wordArtVert', as they are the same now. + xPropertySet->setPropertyValue("WritingMode", + uno::Any(text::WritingMode2::STACKED)); + } else if (nVert != XML_horz) // cases XML_vert and XML_vert270 { // Hack to get same rendering as after the fix for tdf#87924. If shape rotation |