diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-03-28 19:24:49 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-04-18 20:14:53 +0200 |
commit | 253e2035474b830c07bf327ca7204fa362312a47 (patch) | |
tree | cd7536d37cb85713bf3baaff9a5156804ab68555 /xmloff | |
parent | 3526b7c0db27cb8e333d30813b79982873aa4501 (diff) |
tdf#105286: Implement text rotation for Impress tables
Typo: TopToBotton -> TopToBottom
Change-Id: I1b4d3ab9ec1d1383d76a56c9662ffeeb9fe69655
Reviewed-on: https://gerrit.libreoffice.org/36014
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 334e6e2f1ad3da319be0849ec426aa64b18cb599)
Add SvxTextRotateItem inherited from SvxCharRotatItem
I will be use it later for text rotation inside a table.
Change-Id: I4cbaf05953b0e71331d2f3fdb45b7c4254a2b8cc
Reviewed-on: https://gerrit.libreoffice.org/36021
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 1e30d2aface12a31687e5a27126e2061efd4b0cd)
Introduce text rotation for Impress tables
* Introduce new table property for text rotation
* Support only two rotation angle (270° and 90°)
* Implement editing and rendering of 270° rotated
text (90° rotation was already implemented)
(cherry picked from commit c671094154ecec6f3ba5beea9d26ff0d2d4d86ad)
Change-Id: Ifc2e0f171e9c840e86b365e9af2c30aa97ecd92e
Implement RotateAngle API property for Impress table cells
(cherry picked from commit a0755ab8772d01797f4945016a978a2bbd8fdf20)
Change-Id: I01379c0fc21e8fe294bc882bf824f64502863ff4
tdf#100926: PPTX import of table with rotated text
(cherry picked from commit 2436cf17304f25c7d34da52a321d6da0e9011d19)
Change-Id: I05a8e979ac11b179e15784023032a56edc5b569b
ODF import / export of rotated text in Impress table
(cherry picked from commit bcb371b1a830442610ad7fda476eda5271427a50)
Change-Id: I57136e32ed2db5e405a45e8e4bad1b8d459b7ae8
Fix vertical text and bitmap bullet rendering
Change-Id: I881fce0511c81b164516d68f72c7e750687d4e0e
(cherry picked from commit 15ac3f9f4dc65fc0c6020284064e3725956f5d0a)
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmlsdtypes.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/draw/sdpropls.cxx | 64 | ||||
-rw-r--r-- | xmloff/source/table/XMLTableExport.cxx | 14 | ||||
-rw-r--r-- | xmloff/source/table/XMLTableImport.cxx | 1 | ||||
-rw-r--r-- | xmloff/source/table/table.hxx | 1 |
5 files changed, 81 insertions, 1 deletions
diff --git a/xmloff/inc/xmlsdtypes.hxx b/xmloff/inc/xmlsdtypes.hxx index 8e388cf032c7..86e81ba3ea5b 100644 --- a/xmloff/inc/xmlsdtypes.hxx +++ b/xmloff/inc/xmlsdtypes.hxx @@ -117,6 +117,8 @@ ////////////////////////////////////////////////////////////////////////////// +#define XML_SD_TYPE_CELL_ROTATION_ANGLE (XML_SD_TYPES_START + 79 ) + #define CTF_NUMBERINGRULES 1000 #define CTF_CONTROLWRITINGMODE 1001 #define CTF_WRITINGMODE 1002 diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 72d6315fa088..3afbf338176c 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/drawing/BitmapMode.hpp> #include <com/sun/star/text/WritingMode.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <xmloff/EnumPropertyHdl.hxx> #include <xmloff/NamedBoolPropertyHdl.hxx> #include <xmloff/WordWrapPropertyHdl.hxx> @@ -62,6 +63,7 @@ #include "XMLPercentOrMeasurePropertyHandler.hxx" #include "animations.hxx" #include <sax/tools/converter.hxx> +#include "xmlsdtypes.hxx" #include "sdxmlexp_impl.hxx" @@ -853,6 +855,52 @@ bool XMLSdHeaderFooterVisibilityTypeHdl::exportXML( return bRet; } +class XMLSdRotationAngleTypeHdl : public XMLPropertyHandler +{ +public: + virtual bool importXML(const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter) const override; + virtual bool exportXML(OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter) const override; +}; + +bool XMLSdRotationAngleTypeHdl::importXML( + const OUString& rStrImpValue, + css::uno::Any& rValue, + const SvXMLUnitConverter&) const +{ + sal_Int32 nValue; + bool const bRet = ::sax::Converter::convertNumber(nValue, rStrImpValue); + if (bRet) + { + nValue = (nValue % 360); + if (nValue < 0) + nValue = 360 + nValue; + sal_Int32 nAngle; + if (nValue < 45 || nValue > 315) + nAngle = 0; + else if (nValue < 180) + nAngle = 9000; + else /* if nValalue <= 315 ) */ + nAngle = 27000; + + rValue <<= nAngle; + } + return bRet; +} + +bool XMLSdRotationAngleTypeHdl::exportXML( + OUString& rStrExpValue, + const Any& rValue, + const SvXMLUnitConverter&) const +{ + sal_Int32 nAngle; + bool bRet = (rValue >>= nAngle) && nAngle != 0; + if (bRet) + { + rStrExpValue = OUString::number(nAngle / 100); + } + return bRet; +} + XMLSdPropHdlFactory::XMLSdPropHdlFactory( uno::Reference< frame::XModel > const & xModel, SvXMLImport& rImport ) : mxModel( xModel ), mpExport(nullptr), mpImport( &rImport ) { @@ -1154,6 +1202,9 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy case XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE: pHdl = new XMLSdHeaderFooterVisibilityTypeHdl(); break; + case XML_SD_TYPE_CELL_ROTATION_ANGLE: + pHdl = new XMLSdRotationAngleTypeHdl; + break; } if(pHdl) @@ -1276,7 +1327,18 @@ void XMLShapeExportPropertyMapper::ContextFilter( pControlWritingMode = property; break; case CTF_TEXTWRITINGMODE: - pTextWritingMode = property; + { + pTextWritingMode = property; + sal_Int32 eWritingMode; + if (property->maValue >>= eWritingMode) + { + if (text::WritingMode2::LR_TB == eWritingMode) + { + property->mnIndex = -1; + pTextWritingMode = nullptr; + } + } + } break; case CTF_REPEAT_OFFSET_X: pRepeatOffsetX = property; diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index 4a4785788837..12d75906e471 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -44,6 +44,7 @@ #include <xmloff/xmlexppr.hxx> #include <xmloff/xmlexp.hxx> #include <xmloff/xmltypes.hxx> +#include "xmlsdtypes.hxx" #include <xmloff/maptype.hxx> #include <xmloff/prhdlfac.hxx> #include <xmloff/txtprmap.hxx> @@ -62,6 +63,7 @@ using namespace ::com::sun::star::style; #define MAP_(name,prefix,token,type,context) { name, sizeof(name)-1, prefix, token, type, context, SvtSaveOptions::ODFVER_010, false } #define CMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_COLUMN,context) #define RMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_ROW,context) +#define CELLMAP(name,prefix,token,type,context) MAP_(name,prefix,token,type|XML_TYPE_PROP_TABLE_CELL,context) #define MAP_END { nullptr, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010, false } const XMLPropertyMapEntry* getColumnPropertiesMap() @@ -89,6 +91,17 @@ const XMLPropertyMapEntry* getRowPropertiesMap() return &aXMLRowProperties[0]; } +const XMLPropertyMapEntry* getCellPropertiesMap() +{ + static const XMLPropertyMapEntry aXMLCellProperties[] = + { + CELLMAP( "RotateAngle", XML_NAMESPACE_STYLE, XML_ROTATION_ANGLE, XML_SD_TYPE_CELL_ROTATION_ANGLE, 0), + MAP_END + }; + + return &aXMLCellProperties[0]; +} + class StringStatisticHelper { private: @@ -167,6 +180,7 @@ XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExp { mxCellExportPropertySetMapper = xExportPropertyMapper; mxCellExportPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp)); + mxCellExportPropertySetMapper->ChainExportMapper(new SvXMLExportPropertyMapper(new XMLPropertySetMapper(getCellPropertiesMap(), xFactoryRef.get(), true))); } mxRowExportPropertySetMapper = new SvXMLExportPropertyMapper( new XMLPropertySetMapper( getRowPropertiesMap(), xFactoryRef.get(), true ) ); diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index d844d2fcdb10..4a4d6d906069 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -219,6 +219,7 @@ XMLTableImport::XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLP { mxCellImportPropertySetMapper = new SvXMLImportPropertyMapper( xCellPropertySetMapper.get(), rImport ); mxCellImportPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(rImport)); + mxCellImportPropertySetMapper->ChainImportMapper(new SvXMLImportPropertyMapper(new XMLPropertySetMapper(getCellPropertiesMap(), xFactoryRef.get(), true), rImport)); } rtl::Reference < XMLPropertySetMapper > xRowMapper( new XMLPropertySetMapper( getRowPropertiesMap(), xFactoryRef.get(), false ) ); diff --git a/xmloff/source/table/table.hxx b/xmloff/source/table/table.hxx index cb00e7cb13f4..2eddd38d5b83 100644 --- a/xmloff/source/table/table.hxx +++ b/xmloff/source/table/table.hxx @@ -34,6 +34,7 @@ extern const TableStyleElement* getTableStyleMap(); extern const TableStyleElement* getWriterSpecificTableStyleMap(); extern const XMLPropertyMapEntry* getColumnPropertiesMap(); extern const XMLPropertyMapEntry* getRowPropertiesMap(); +extern const XMLPropertyMapEntry* getCellPropertiesMap(); #endif |