include/oox/drawingml/drawingmltypes.hxx | 6 + include/svx/sdtaitm.hxx | 1 include/xmloff/xmltypes.hxx | 1 offapi/com/sun/star/text/BaseFrameProperties.idl | 8 ++ oox/source/drawingml/drawingmltypes.cxx | 39 +++++++++ oox/source/drawingml/fillpropertiesgroupcontext.cxx | 10 -- oox/source/drawingml/textbodypropertiescontext.cxx | 13 --- oox/source/export/drawingml.cxx | 17 ---- oox/source/shape/WpsContext.cxx | 8 ++ sw/inc/format.hxx | 1 sw/inc/frmatr.hxx | 4 + sw/inc/hintids.hxx | 47 ++++++------ sw/inc/swatrset.hxx | 2 sw/inc/unoprnms.hxx | 1 sw/qa/extras/odfexport/data/textframe-vertadjust.odt |binary sw/qa/extras/odfexport/odfexport.cxx | 15 +++ sw/qa/extras/ooxmlexport/data/dml-textframe-vertadjust.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 16 ++++ sw/source/core/bastyp/init.cxx | 3 sw/source/core/unocore/unoframe.cxx | 13 +++ sw/source/core/unocore/unomap.cxx | 5 + sw/source/filter/html/css1atr.cxx | 2 sw/source/filter/html/htmlatr.cxx | 2 sw/source/filter/ww8/docxsdrexport.cxx | 6 + xmloff/source/text/txtprhdl.cxx | 17 +++- xmloff/source/text/txtprmap.cxx | 1 26 files changed, 179 insertions(+), 59 deletions(-)
New commits: commit 38ce69a1d10bd18b45b192ee4a5e650f817be676 Author: Zolnai Tamás <[email protected]> Date: Sat Feb 8 00:15:02 2014 +0100 drawingML: remove code duplication: use GetRelativeRect() Change-Id: I7368ad15292c82e5320deb9ab60e04f70d0c92b8 diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx index 8483e81..ad8cf41 100644 --- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx +++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx @@ -229,15 +229,7 @@ ContextHandlerRef BlipFillContext::onCreateContext( return new BlipContext( *this, rAttribs, mrBlipProps ); case A_TOKEN( srcRect ): - { - OUString aDefault( "0" ); - ::com::sun::star::geometry::IntegerRectangle2D aClipRect; - aClipRect.X1 = GetPercent( rAttribs.getString( XML_l, aDefault ) ); - aClipRect.Y1 = GetPercent( rAttribs.getString( XML_t, aDefault ) ); - aClipRect.X2 = GetPercent( rAttribs.getString( XML_r, aDefault ) ); - aClipRect.Y2 = GetPercent( rAttribs.getString( XML_b, aDefault ) ); - mrBlipProps.moClipRect = aClipRect; - } + mrBlipProps.moClipRect = GetRelativeRect( rAttribs.getFastAttributeList() ); break; case A_TOKEN( tile ): commit aec959dea00bfb362377fe1007da1f381f45559e Author: Zolnai Tamás <[email protected]> Date: Sat Feb 8 00:07:03 2014 +0100 drawingML: remove code duplication: use WriteStretch() Change-Id: I0d589da01bf6afed86b5811d6b27f72f6e1bb160 diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index f2dd046..22a1d97 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -828,9 +828,7 @@ void DrawingML::WriteBlipMode( Reference< XPropertySet > rXPropSet ) mpFS->singleElementNS( XML_a, XML_tile, FSEND ); break; case BitmapMode_STRETCH: - mpFS->startElementNS( XML_a, XML_stretch, FSEND ); - mpFS->singleElementNS( XML_a, XML_fillRect, FSEND ); - mpFS->endElementNS( XML_a, XML_stretch ); + WriteStretch(); break; default: ; commit feae30c4ce1a1aa303500371b858f871d4ef88fc Author: Zolnai Tamás <[email protected]> Date: Sat Feb 8 01:50:55 2014 +0100 ODF export/import: text vertical adjustment attribute of text frames ODF standard handle 'textarea-vertical-align' as a 'graphic-property' which "specifies formatting properties for chart, draw, graphic, and frame elements". So this change fit to the standard. Change-Id: I956f512953380983c2c882e943178335fd4dbfeb diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx index 55cac83..3c8d737 100644 --- a/include/xmloff/xmltypes.hxx +++ b/include/xmloff/xmltypes.hxx @@ -276,6 +276,7 @@ #define XML_TYPE_CHAR_SCRIPT (XML_TEXT_TYPES_START + 116) #define XML_TYPE_CHAR_RFC_LANGUAGE_TAG (XML_TEXT_TYPES_START + 117) +#define XML_TYPE_VERTICAL_ALIGN (XML_TEXT_TYPES_START + 118) #define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT) #define XML_PM_TYPES_START (0x5 << XML_TYPE_APP_SHIFT) // page master diff --git a/sw/qa/extras/odfexport/data/textframe-vertadjust.odt b/sw/qa/extras/odfexport/data/textframe-vertadjust.odt new file mode 100644 index 0000000..bbf3416 Binary files /dev/null and b/sw/qa/extras/odfexport/data/textframe-vertadjust.odt differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index c2e5c0c..db75204 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -14,6 +14,7 @@ #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/text/RelOrientation.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> class Test : public SwModelTestBase { @@ -335,6 +336,20 @@ DECLARE_ODFEXPORT_TEST(testRelwPage, "relw-page.odt") CPPUNIT_ASSERT_EQUAL(sal_Int32(4896), parseDump("/root/page/body/txt/anchored/fly/infos/bounds", "width").toInt32()); } +DECLARE_ODFEXPORT_TEST(testTextFrameVertAdjust, "textframe-vertadjust.odt") +{ + // Test import/export of new frame attribute called TextVerticalAdjust + + // 1st frame's context is adjusted to the top + uno::Reference<beans::XPropertySet> xFrame(getTextFrameByName("Rectangle 1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust")); + // 2nd frame's context is adjusted to the center + xFrame.set(getTextFrameByName("Rectangle 2"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_CENTER, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust")); + // 3rd frame's context is adjusted to the bottom + xFrame.set(getTextFrameByName("Rectangle 3"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust")); +} #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx index 951fa1f..032a055 100644 --- a/xmloff/source/text/txtprhdl.cxx +++ b/xmloff/source/text/txtprhdl.cxx @@ -45,6 +45,7 @@ #include "txtprhdl.hxx" // OD 2004-05-05 #i28701# #include <com/sun/star/text/WrapInfluenceOnPosition.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -211,7 +212,7 @@ static SvXMLEnumMapEntry const pXML_FontRelief_Enum[] = { XML_TOKEN_INVALID, 0 } }; -static SvXMLEnumMapEntry const pXML_VerticalAlign_Enum[] = +static SvXMLEnumMapEntry const pXML_ParaVerticalAlign_Enum[] = { { XML_TOP, ParagraphVertAlign::TOP }, { XML_MIDDLE, ParagraphVertAlign::CENTER }, @@ -231,6 +232,15 @@ static SvXMLEnumMapEntry const pXML_WrapInfluenceOnPosition_Enum[] = { XML_TOKEN_INVALID, 0 } }; +static SvXMLEnumMapEntry const pXML_VerticalAlign_Enum[] = +{ + { XML_TOP, drawing::TextVerticalAdjust_TOP }, + { XML_MIDDLE, drawing::TextVerticalAdjust_CENTER }, + { XML_BOTTOM, drawing::TextVerticalAdjust_BOTTOM }, + { XML_JUSTIFY, drawing::TextVerticalAdjust_BLOCK }, + { XML_TOKEN_INVALID, 0 } +}; + static SvXMLEnumMapEntry const pXML_FillStyle_Enum[] = { { XML_NONE, drawing::FillStyle_NONE }, @@ -1347,7 +1357,7 @@ const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler GetXMLToken( XML_LINE_HEIGHT ) ); break; case XML_TYPE_TEXT_VERTICAL_ALIGN: - pHdl = new XMLConstantsPropertyHandler( pXML_VerticalAlign_Enum, XML_TOKEN_INVALID ); + pHdl = new XMLConstantsPropertyHandler( pXML_ParaVerticalAlign_Enum, XML_TOKEN_INVALID ); break; case XML_TYPE_TEXT_RUBY_POSITION: pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_ABOVE, @@ -1383,6 +1393,9 @@ const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler case XML_TYPE_FILLSTYLE: pHdl = new XMLConstantsPropertyHandler( pXML_FillStyle_Enum, XML_TOKEN_INVALID ); break; + case XML_TYPE_VERTICAL_ALIGN: + pHdl = new XMLConstantsPropertyHandler( pXML_VerticalAlign_Enum, XML_TOKEN_INVALID ); + break; } return pHdl; diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index a1f9898..90cb26e 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -786,6 +786,7 @@ XMLPropertyMapEntry aXMLFramePropMap[] = MG_E( "UserDefinedAttributes", TEXT, XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ), MAP_EXT("RelativeWidthRelation", XML_NAMESPACE_LO_EXT, XML_REL_WIDTH_REL, XML_TYPE_TEXT_HORIZONTAL_REL|XML_TYPE_PROP_GRAPHIC, CTF_RELWIDTHREL), MAP_EXT("RelativeHeightRelation", XML_NAMESPACE_LO_EXT, XML_REL_HEIGHT_REL, XML_TYPE_TEXT_VERTICAL_REL|XML_TYPE_PROP_GRAPHIC, CTF_RELHEIGHTREL), + MG_E("TextVerticalAdjust", DRAW, TEXTAREA_VERTICAL_ALIGN, XML_TYPE_VERTICAL_ALIGN, 0), M_END() }; commit 718203e37025fc1cc1e28f9e52f05bee79684811 Author: Zolnai Tamás <[email protected]> Date: Sat Feb 8 01:49:39 2014 +0100 drawingML export/import: text frames with vertical alignment Change-Id: I469da0a8234dd2979facfed3d66907aad1a138ab diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index aa00f2a..20c8c98 100644 --- a/include/oox/drawingml/drawingmltypes.hxx +++ b/include/oox/drawingml/drawingmltypes.hxx @@ -126,6 +126,12 @@ sal_Int16 GetCaseMap( sal_Int32 nToken ); /** converts a paragraph align to a ParaAdjust */ sal_Int16 GetParaAdjust( sal_Int32 nAlign ); +// Convert vertical adjust tokens to a TextVerticalAdjust item +::com::sun::star::drawing::TextVerticalAdjust GetTextVerticalAdjust( sal_Int32 nToken ); + +// Convert a TextVerticalAdjust item to string value appearing in ooxml +SAL_DLLPUBLIC const char* GetTextVerticalAdjust( ::com::sun::star::drawing::TextVerticalAdjust eAdjust ); + // ============================================================================ // CT_IndexRange diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx index 9dd42eb..a96eaf3 100644 --- a/oox/source/drawingml/drawingmltypes.cxx +++ b/oox/source/drawingml/drawingmltypes.cxx @@ -187,6 +187,45 @@ sal_Int16 GetParaAdjust( sal_Int32 nAlign ) return nEnum; } +TextVerticalAdjust GetTextVerticalAdjust( sal_Int32 nToken ) +{ + TextVerticalAdjust aVertAdjust; + switch( nToken ) + { + case XML_b: + aVertAdjust = TextVerticalAdjust_BOTTOM; + break; + case XML_dist: + case XML_just: + case XML_ctr: + aVertAdjust = TextVerticalAdjust_CENTER; + break; + case XML_t: + default: + aVertAdjust = TextVerticalAdjust_TOP; + break; + } + return aVertAdjust; +} + +const char* GetTextVerticalAdjust( TextVerticalAdjust eAdjust ) +{ + const char* sVerticalAdjust = 0; + switch( eAdjust ) + { + case TextVerticalAdjust_BOTTOM: + sVerticalAdjust = "b"; + break; + case TextVerticalAdjust_CENTER: + sVerticalAdjust = "ctr"; + break; + case TextVerticalAdjust_TOP: + default: + sVerticalAdjust = "t"; + break; + } + return sVerticalAdjust; +} TabAlign GetTabAlign( sal_Int32 aToken ) { diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 358db9f..81a99e82 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -96,16 +96,9 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper& rPa } // ST_TextAnchoringType - if( rAttribs.hasAttribute( XML_anchor ) ) { - switch( rAttribs.getToken( XML_anchor, XML_t ) ) - { - case XML_b : mrTextBodyProp.meVA = drawing::TextVerticalAdjust_BOTTOM; break; - case XML_dist : - case XML_just : - case XML_ctr : mrTextBodyProp.meVA = drawing::TextVerticalAdjust_CENTER; break; - default: - case XML_t : mrTextBodyProp.meVA = drawing::TextVerticalAdjust_TOP; break; - } + if( rAttribs.hasAttribute( XML_anchor ) ) + { + mrTextBodyProp.meVA = GetTextVerticalAdjust( rAttribs.getToken( XML_anchor, XML_t ) ); mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= mrTextBodyProp.meVA; } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 11fd26a..f2dd046 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1541,17 +1541,8 @@ void DrawingML::WriteText( Reference< XInterface > rXIface, bool bBodyPr, bool b TextVerticalAdjust eVerticalAlignment( TextVerticalAdjust_TOP ); const char* sVerticalAlignment = NULL; GET( eVerticalAlignment, TextVerticalAdjust ); - switch( eVerticalAlignment ) { - case TextVerticalAdjust_BOTTOM: - sVerticalAlignment = "b"; - break; - case TextVerticalAdjust_CENTER: - sVerticalAlignment = "ctr"; - break; - case TextVerticalAdjust_TOP: - default: - ; - } + if( eVerticalAlignment != TextVerticalAdjust_TOP ) + sVerticalAlignment = GetTextVerticalAdjust(eVerticalAlignment); const char* sWritingMode = NULL; sal_Bool bVertical = sal_False; diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 04e8a23..7d37fc1 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -11,6 +11,7 @@ #include <oox/drawingml/shapepropertiescontext.hxx> #include <oox/drawingml/shapestylecontext.hxx> #include <com/sun/star/beans/XPropertyState.hpp> +#include <oox/drawingml/drawingmltypes.hxx> using namespace com::sun::star; @@ -86,6 +87,13 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken for (size_t i = 0; i < SAL_N_ELEMENTS(aProps); ++i) if (oInsets[i]) xPropertySet->setPropertyValue(aProps[i], uno::makeAny(*oInsets[i])); + + // Handle text vertical adjustment inside a text frame + if( rAttribs.hasAttribute( XML_anchor ) ) + { + drawing::TextVerticalAdjust eAdjust = drawingml::GetTextVerticalAdjust( rAttribs.getToken( XML_anchor, XML_t ) ); + xPropertySet->setPropertyValue("TextVerticalAdjust", uno::makeAny(eAdjust)); + } return this; } break; diff --git a/sw/qa/extras/ooxmlexport/data/dml-textframe-vertadjust.docx b/sw/qa/extras/ooxmlexport/data/dml-textframe-vertadjust.docx new file mode 100644 index 0000000..bf5dcdd Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/dml-textframe-vertadjust.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 1284699..27fba45 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <libxml/xpathInternals.h> #include <libxml/parserInternals.h> @@ -2868,6 +2869,21 @@ DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx") CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").match("6138")); } +DECLARE_OOXMLEXPORT_TEST(testDMLTextFrameVertAdjust, "dml-textframe-vertadjust.docx") +{ + // DOCX textboxes with text are imported as text frames but in Writer text frames did not have + // TextVerticalAdjust attribute so far. + + // 1st frame's context is adjusted to the top + uno::Reference<beans::XPropertySet> xFrame(getTextFrameByName("Rectangle 1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust")); + // 2nd frame's context is adjusted to the center + xFrame.set(getTextFrameByName("Rectangle 2"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_CENTER, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust")); + // 3rd frame's context is adjusted to the bottom + xFrame.set(getTextFrameByName("Rectangle 3"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xFrame, "TextVerticalAdjust")); +} #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index cd2bd55..6278a29 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -881,6 +881,12 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId) FSEND); m_pImpl->m_bDMLTextFrameSyntax = true; m_pImpl->m_pBodyPrAttrList = pFS->createAttrList(); + { + drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP; + if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("TextVerticalAdjust") ) + xPropertySet->getPropertyValue("TextVerticalAdjust") >>= eAdjust; + m_pImpl->m_pBodyPrAttrList->add(XML_anchor, oox::drawingml::GetTextVerticalAdjust(eAdjust)); + } m_pImpl->m_rExport.OutputFormat(pParentFrame->GetFrmFmt(), false, false, true); m_pImpl->m_bDMLTextFrameSyntax = false; writeDMLEffectLst(rFrmFmt); commit cf9d8194932318d5e8b27ec8188cf32938670abc Author: Zolnai Tamás <[email protected]> Date: Sat Feb 8 02:06:32 2014 +0100 New frame attribute: TextVerticalAdjust <-> RES_TEXT_VERT_ADJUST By now this property is added for MS Word interoperability. With it we can make DOCX import/export working. I use this solution instead of InteropGrabBag because vertical adjustment would be a good thing to have for text frames too. So later it can be the first step of an enhanchement. Change-Id: I9dcfdc8ae56ce443f0c286c51136e1d006951938 diff --git a/include/svx/sdtaitm.hxx b/include/svx/sdtaitm.hxx index 0cd3589..cab0d06 100644 --- a/include/svx/sdtaitm.hxx +++ b/include/svx/sdtaitm.hxx @@ -37,6 +37,7 @@ class SVX_DLLPUBLIC SdrTextVertAdjustItem: public SfxEnumItem { public: TYPEINFO(); SdrTextVertAdjustItem(SdrTextVertAdjust eAdj=SDRTEXTVERTADJUST_TOP): SfxEnumItem(SDRATTR_TEXT_VERTADJUST,(sal_uInt16)eAdj) {} + SdrTextVertAdjustItem(SdrTextVertAdjust eAdj, sal_uInt16 nWhich): SfxEnumItem(nWhich,(sal_uInt16)eAdj) {} SdrTextVertAdjustItem(SvStream& rIn) : SfxEnumItem(SDRATTR_TEXT_VERTADJUST,rIn) {} virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const; virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const; diff --git a/offapi/com/sun/star/text/BaseFrameProperties.idl b/offapi/com/sun/star/text/BaseFrameProperties.idl index 9038d48..2a1f25c 100644 --- a/offapi/com/sun/star/text/BaseFrameProperties.idl +++ b/offapi/com/sun/star/text/BaseFrameProperties.idl @@ -29,6 +29,7 @@ #include <com/sun/star/xml/UserDefinedAttributesSupplier.idl> #include <com/sun/star/drawing/FillStyle.idl> #include <com/sun/star/awt/Gradient.idl> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> module com { module sun { module star { module text { @@ -351,6 +352,13 @@ published service BaseFrameProperties @since LibreOffice 4.3 */ [optional, property] short RelativeWidthRelation; + + /** adjusts the vertical position of the text inside of the frame. + + @see com::sun::star::drawing::TextVerticalAdjust + @since LibreOffice 4.3 + */ + [optional, property] com::sun::star::drawing::TextVerticalAdjust TextVerticalAdjust; }; diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index e92f8e3..cb79ce4 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -258,6 +258,7 @@ public: inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const; // #i28701# inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const; + inline const SdrTextVertAdjustItem& GetTextVertAdjust(sal_Bool = sal_True) const; /// Graphics-attributes - implemented in grfatr.hxx inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const; diff --git a/sw/inc/frmatr.hxx b/sw/inc/frmatr.hxx index 977680c..772eb0c 100644 --- a/sw/inc/frmatr.hxx +++ b/sw/inc/frmatr.hxx @@ -56,6 +56,8 @@ inline const SvxMacroItem &SwAttrSet::GetMacro(sal_Bool bInP) const { return (const SvxMacroItem&)Get( RES_FRMMACRO,bInP); } inline const SvxFrameDirectionItem &SwAttrSet::GetFrmDir(sal_Bool bInP) const { return (const SvxFrameDirectionItem&)Get( RES_FRAMEDIR,bInP); } +inline const SdrTextVertAdjustItem &SwAttrSet::GetTextVertAdjust(sal_Bool bInP) const + { return (const SdrTextVertAdjustItem&)Get( RES_TEXT_VERT_ADJUST,bInP); } // Implementation of FrameAttribute methods of SwFmt. @@ -85,6 +87,8 @@ inline const SvxMacroItem &SwFmt::GetMacro(sal_Bool bInP) const { return aSet.GetMacro(bInP); } inline const SvxFrameDirectionItem &SwFmt::GetFrmDir(sal_Bool bInP) const { return aSet.GetFrmDir(bInP); } +inline const SdrTextVertAdjustItem &SwFmt::GetTextVertAdjust(sal_Bool bInP) const + { return aSet.GetTextVertAdjust(bInP); } #endif // INCLUDED_SW_INC_FRMATR_HXX diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index eef0557..cf911ab 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -232,47 +232,48 @@ RES_FRMATR_BEGIN = RES_PARATR_LIST_END, RES_FILL_STYLE, // 127 RES_FILL_GRADIENT, // 128 RES_FRMATR_GRABBAG, // 129 + RES_TEXT_VERT_ADJUST, // 130 RES_FRMATR_END }; enum RES_GRFATR { RES_GRFATR_BEGIN = RES_FRMATR_END, - RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN, // 130 - RES_GRFATR_CROPGRF, // 131 - - RES_GRFATR_ROTATION, // 132 - RES_GRFATR_LUMINANCE, // 133 - RES_GRFATR_CONTRAST, // 134 - RES_GRFATR_CHANNELR, // 135 - RES_GRFATR_CHANNELG, // 136 - RES_GRFATR_CHANNELB, // 137 - RES_GRFATR_GAMMA, // 138 - RES_GRFATR_INVERT, // 139 - RES_GRFATR_TRANSPARENCY, // 140 - RES_GRFATR_DRAWMODE, // 141 - - RES_GRFATR_DUMMY1, // 142 - RES_GRFATR_DUMMY2, // 143 - RES_GRFATR_DUMMY3, // 144 - RES_GRFATR_DUMMY4, // 145 - RES_GRFATR_DUMMY5, // 146 + RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN, // 131 + RES_GRFATR_CROPGRF, // 132 + + RES_GRFATR_ROTATION, // 133 + RES_GRFATR_LUMINANCE, // 134 + RES_GRFATR_CONTRAST, // 135 + RES_GRFATR_CHANNELR, // 136 + RES_GRFATR_CHANNELG, // 137 + RES_GRFATR_CHANNELB, // 138 + RES_GRFATR_GAMMA, // 139 + RES_GRFATR_INVERT, // 140 + RES_GRFATR_TRANSPARENCY, // 141 + RES_GRFATR_DRAWMODE, // 142 + + RES_GRFATR_DUMMY1, // 143 + RES_GRFATR_DUMMY2, // 144 + RES_GRFATR_DUMMY3, // 145 + RES_GRFATR_DUMMY4, // 146 + RES_GRFATR_DUMMY5, // 147 RES_GRFATR_END }; enum RES_BOXATR { RES_BOXATR_BEGIN = RES_GRFATR_END, - RES_BOXATR_FORMAT = RES_BOXATR_BEGIN, // 147 - RES_BOXATR_FORMULA, // 148 - RES_BOXATR_VALUE, // 149 + RES_BOXATR_FORMAT = RES_BOXATR_BEGIN, // 148 + RES_BOXATR_FORMULA, // 149 + RES_BOXATR_VALUE, // 150 RES_BOXATR_END }; enum RES_UNKNOWNATR { RES_UNKNOWNATR_BEGIN = RES_BOXATR_END, - RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 150 + RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 151 RES_UNKNOWNATR_END }; diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx index 72e77cf..edad754 100644 --- a/sw/inc/swatrset.hxx +++ b/sw/inc/swatrset.hxx @@ -96,6 +96,7 @@ class SwTextGridItem; class SwHeaderAndFooterEatSpacingItem; class SwFmtFollowTextFlow; class SwFmtWrapInfluenceOnObjPos; +class SdrTextVertAdjustItem; // Graphic attributes class SwMirrorGrf; @@ -293,6 +294,7 @@ public: inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const; inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const; inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const; + inline const SdrTextVertAdjustItem& GetTextVertAdjust(sal_Bool = sal_True) const; // Graphic attributes - implementation in grfatr.hxx inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 369d3d3..0be3cf7 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -813,6 +813,7 @@ #define UNO_NAME_CHAR_HIGHLIGHT "CharHighlight" #define UNO_NAME_STYLE_INTEROP_GRAB_BAG "StyleInteropGrabBag" #define UNO_NAME_CHAR_INTEROP_GRAB_BAG "CharInteropGrabBag" +#define UNO_NAME_TEXT_VERT_ADJUST "TextVerticalAdjust" #endif diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 4258612..1bfecbe 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -113,6 +113,7 @@ #include <svx/dialogs.hrc> #include <svx/xfillit0.hxx> #include <svx/xflgrit.hxx> +#include <svx/sdtaitm.hxx> #include <swcalwrp.hxx> #include <SwStyleNameMapper.hxx> #include <tblafmt.hxx> @@ -390,6 +391,7 @@ SfxItemInfo aSlotTab[] = { SID_SW_ATTR_FILL_STYLE, SFX_ITEM_POOLABLE }, // RES_FILL_STYLE { SID_SW_ATTR_FILL_GRADIENT, SFX_ITEM_POOLABLE }, // RES_FILL_GRADIENT { 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_GRABBAG + { 0, SFX_ITEM_POOLABLE }, // RES_TEXT_VERT_ADJUST { 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_MIRRORGRF { SID_ATTR_GRAF_CROP, SFX_ITEM_POOLABLE }, // RES_GRFATR_CROPGRF @@ -607,6 +609,7 @@ void _InitCore() aAttrTab[ RES_FILL_STYLE - POOLATTR_BEGIN ] = new XFillStyleItem(XFILL_SOLID, RES_FILL_STYLE); aAttrTab[ RES_FILL_GRADIENT - POOLATTR_BEGIN ] = new XFillGradientItem(RES_FILL_GRADIENT); aAttrTab[ RES_FRMATR_GRABBAG - POOLATTR_BEGIN ] = new SfxGrabBagItem(RES_FRMATR_GRABBAG); + aAttrTab[ RES_TEXT_VERT_ADJUST - POOLATTR_BEGIN ] = new SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP,RES_TEXT_VERT_ADJUST); aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf; aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index a295b82..9d204bf 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -27,9 +27,11 @@ #include <com/sun/star/embed/EmbedStates.hpp> #include <com/sun/star/embed/Aspects.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <svx/svxids.hrc> #include <svx/xfillit0.hxx> #include <svx/xflgrit.hxx> +#include <svx/sdtaitm.hxx> #include <editeng/memberids.hrc> #include <swtypes.hxx> @@ -587,6 +589,17 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SwDoc* pDoc, SfxItemSet& rToSe rToSet.Put(aFmtWrapInfluenceOnObjPos); } + { + const ::uno::Any* pTextVertAdjust = 0; + GetProperty(RES_TEXT_VERT_ADJUST, 0, pTextVertAdjust); + if ( pTextVertAdjust ) + { + SdrTextVertAdjustItem aTextVertAdjust(static_cast <const :: SdrTextVertAdjustItem & > ( rFromSet.Get ( RES_TEXT_VERT_ADJUST ) )); + bRet &= ((SfxPoolItem&)aTextVertAdjust).PutValue(*pTextVertAdjust); + rToSet.Put(aTextVertAdjust); + } + } + return bRet; } diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index a8b15f5..eac4e79 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/drawing/PointSequenceSequence.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/graphic/XGraphic.hpp> @@ -409,7 +410,8 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() { OUString(UNO_NAME_DESCRIPTION), FN_UNO_DESCRIPTION, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, \ { OUString(UNO_NAME_LAYOUT_SIZE), WID_LAYOUT_SIZE, cppu::UnoType<css::awt::Size>::get(), PropertyAttribute::MAYBEVOID | PropertyAttribute::READONLY, 0 }, \ { OUString(UNO_NAME_LINE_STYLE), RES_BOX, cppu::UnoType<css::drawing::LineStyle>::get(), 0, LINE_STYLE }, \ - { OUString(UNO_NAME_LINE_WIDTH), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, LINE_WIDTH |CONVERT_TWIPS }, + { OUString(UNO_NAME_LINE_WIDTH), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, LINE_WIDTH |CONVERT_TWIPS }, \ + { OUString(UNO_NAME_TEXT_VERT_ADJUST), RES_TEXT_VERT_ADJUST, cppu::UnoType<css::drawing::TextVerticalAdjust>::get(), PROPERTY_NONE ,0}, @@ -874,6 +876,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { OUString(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, cppu::UnoType<sal_Int8>::get(), PROPERTY_NONE, MID_WRAP_INFLUENCE}, { OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 }, { OUString(UNO_NAME_HIDDEN), FN_UNO_HIDDEN, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, + { OUString(UNO_NAME_TEXT_VERT_ADJUST), RES_TEXT_VERT_ADJUST, cppu::UnoType<css::drawing::TextVerticalAdjust>::get(), PROPERTY_NONE ,0}, { OUString(), 0, css::uno::Type(), 0, 0 } }; aMapEntriesArr[nPropertyId] = aFrameStyleMap; diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index d251ef8..1919377 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -3735,6 +3735,8 @@ SwAttrFnTab aCSS1AttrFnTab = { /* RES_FRMATR_CONDITIONAL_STYLE_NAME */ 0, /* RES_FILL_STYLE */ 0, /* RES_FILL_GRADIENT */ 0, +/* RES_FRMATR_GRABBAG */ 0, +/* RES_TEXT_VERT_ADJUST */ 0, /* RES_GRFATR_MIRRORGRF */ 0, /* RES_GRFATR_CROPGRF */ 0, diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 351d4ff..f15a9ab 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -3369,6 +3369,8 @@ SwAttrFnTab aHTMLAttrFnTab = { /* RES_FRMATR_CONDITIONAL_STYLE_NAME */ 0, /* RES_FILL_STYLE */ 0, /* RES_FILL_GRADIENT */ 0, +/* RES_FRMATR_GRABBAG */ 0, +/* RES_TEXT_VERT_ADJUST */ 0, /* RES_GRFATR_MIRRORGRF */ 0, /* RES_GRFATR_CROPGRF */ 0,
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
