merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0344-oox-import-text-vert-anchor-and-anchorctr.diff
blobf6053e37484d1f4675cdc2f0c28bbf84e80bfc71
1 diff -rup oox-orig-1/inc/oox/drawingml/drawingmltypes.hxx oox/inc/oox/drawingml/drawingmltypes.hxx
2 --- oox-orig-1/inc/oox/drawingml/drawingmltypes.hxx 2009-10-12 15:04:52.000000000 +0200
3 +++ oox/inc/oox/drawingml/drawingmltypes.hxx 2009-10-12 15:10:19.000000000 +0200
4 @@ -33,6 +33,7 @@
6 #include <boost/shared_ptr.hpp>
7 #include <com/sun/star/style/TabAlign.hpp>
8 +#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
9 #include <com/sun/star/geometry/IntegerRectangle2D.hpp>
10 #include <com/sun/star/awt/Point.hpp>
11 #include <com/sun/star/awt/Size.hpp>
12 @@ -123,6 +124,8 @@ float GetTextSize( const ::rtl::OUString
13 sal_Int32 GetTextSpacingPoint( const ::rtl::OUString& sValue );
14 sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue );
16 +::com::sun::star::drawing::TextVerticalAdjust GetTextVerticalAdjust( sal_Int32 nToken );
18 /** */
19 ::com::sun::star::style::TabAlign GetTabAlign( ::sal_Int32 aToken );
21 diff -rup oox-orig-1/source/drawingml/drawingmltypes.cxx oox/source/drawingml/drawingmltypes.cxx
22 --- oox-orig-1/source/drawingml/drawingmltypes.cxx 2009-10-12 15:04:52.000000000 +0200
23 +++ oox/source/drawingml/drawingmltypes.cxx 2009-10-12 15:10:19.000000000 +0200
24 @@ -40,8 +40,9 @@ using ::rtl::OUString;
25 using ::com::sun::star::uno::Reference;
26 using ::com::sun::star::xml::sax::XFastAttributeList;
27 using namespace ::com::sun::star::awt;
28 -using namespace ::com::sun::star::style;
29 +using namespace ::com::sun::star::drawing;
30 using namespace ::com::sun::star::geometry;
31 +using namespace ::com::sun::star::style;
33 namespace oox {
34 namespace drawingml {
35 @@ -137,6 +138,22 @@ sal_Int32 GetTextSpacingPoint( const sal
36 return ( nValue * 254 + 360 ) / 720;
39 +TextVerticalAdjust GetTextVerticalAdjust( sal_Int32 nToken )
41 + TextVerticalAdjust rVal = TextVerticalAdjust_TOP;
43 + switch( nToken ) {
44 + case XML_b:
45 + rVal = TextVerticalAdjust_BOTTOM;
46 + break;
47 + case XML_ctr:
48 + rVal = TextVerticalAdjust_CENTER;
49 + break;
50 + }
52 + return rVal;
55 float GetFontHeight( sal_Int32 nHeight )
57 // convert 1/100 points to points
58 diff -rup oox-orig-1/source/drawingml/textbodypropertiescontext.cxx oox/source/drawingml/textbodypropertiescontext.cxx
59 --- oox-orig-1/source/drawingml/textbodypropertiescontext.cxx 2009-10-12 15:04:52.000000000 +0200
60 +++ oox/source/drawingml/textbodypropertiescontext.cxx 2009-10-12 15:15:56.000000000 +0200
61 @@ -30,7 +30,9 @@
63 #include "oox/drawingml/textbodypropertiescontext.hxx"
65 +#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
66 #include <com/sun/star/text/ControlCharacter.hpp>
67 +#include <com/sun/star/text/WritingMode.hpp>
68 #include "oox/drawingml/textbodyproperties.hxx"
69 #include "oox/drawingml/drawingmltypes.hxx"
70 #include "oox/helper/attributelist.hxx"
71 @@ -41,8 +43,9 @@
73 using ::rtl::OUString;
74 using namespace ::oox::core;
75 -using namespace ::com::sun::star::uno;
76 +using namespace ::com::sun::star::drawing;
77 using namespace ::com::sun::star::text;
78 +using namespace ::com::sun::star::uno;
79 using namespace ::com::sun::star::xml::sax;
81 namespace oox { namespace drawingml {
82 @@ -81,9 +84,12 @@ TextBodyPropertiesContext::TextBodyPrope
85 // ST_TextAnchoringType
86 -// sal_Int32 nAnchoringType = xAttributes->getOptionalValueToken( XML_anchor, XML_t );
87 + mrTextBodyProp.maPropertyMap[ PROP_TextVerticalAdjust ] <<= GetTextVerticalAdjust( xAttributes->getOptionalValueToken( XML_anchor, XML_t ) );
89 -// bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false );
90 + bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false );
91 + if( bAnchorCenter )
92 + mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<=
93 + TextHorizontalAdjust_CENTER;
95 // bool bCompatLineSpacing = aAttribs.getBool( XML_compatLnSpc, false );
96 // bool bForceAA = aAttribs.getBool( XML_forceAA, false );
97 @@ -108,6 +114,15 @@ TextBodyPropertiesContext::TextBodyPrope
99 // ST_TextVerticalType
100 mrTextBodyProp.moVert = aAttribs.getToken( XML_vert );
101 + bool bRtl = aAttribs.getBool( XML_rtl, false );
102 + if( mrTextBodyProp.moVert.get( XML_horz ) == XML_vert ) {
103 + mrTextBodyProp.maPropertyMap[ PROP_TextWritingMode ]
104 + <<= ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB );
105 + // workaround for TB_LR as using WritingMode2 doesn't work
106 + if( !bAnchorCenter )
107 + mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<=
108 + TextHorizontalAdjust_LEFT;
112 // --------------------------------------------------------------------
113 diff -rup oox-orig-1/source/token/properties.txt oox/source/token/properties.txt
114 --- oox-orig-1/source/token/properties.txt 2009-10-12 15:04:52.000000000 +0200
115 +++ oox/source/token/properties.txt 2009-10-12 15:12:32.000000000 +0200
116 @@ -367,12 +367,14 @@ TargetFrame
117 TextAutoGrowHeight
118 TextBreak
119 TextColor
120 +TextHorizontalAdjust
121 TextLeftDistance
122 TextLowerDistance
123 TextOverlap
124 TextRightDistance
125 TextRotation
126 TextUpperDistance
127 +TextVerticalAdjust
128 TextWordWrap
129 TextWritingMode
130 Toggle