update ooo310-m15
[ooovba.git] / applied_patches / 0895-oox-pptx-export-para-linespacing.diff
blob054ba3f25218beea434fef6d0388649168ceb334
1 diff -rup oox-orig-4/inc/oox/export/drawingml.hxx oox/inc/oox/export/drawingml.hxx
2 --- oox-orig-4/inc/oox/export/drawingml.hxx 2009-06-04 11:55:03.000000000 +0200
3 +++ oox/inc/oox/export/drawingml.hxx 2009-06-04 12:36:30.000000000 +0200
4 @@ -20,6 +20,9 @@ namespace beans {
5 namespace drawing {
6 class XShape;
8 +namespace style {
9 + struct LineSpacing;
11 namespace text {
12 class XTextContent;
13 class XTextRange;
14 @@ -76,6 +79,7 @@ public:
15 void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String sURLPropName );
16 void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
17 void WriteStretch();
18 + void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
20 ::rtl::OUString WriteBlip( ::rtl::OUString& rURL );
21 void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
22 diff -rup oox-orig-4/source/export/drawingml.cxx oox/source/export/drawingml.cxx
23 --- oox-orig-4/source/export/drawingml.cxx 2009-06-04 11:55:07.000000000 +0200
24 +++ oox/source/export/drawingml.cxx 2009-06-04 16:11:34.000000000 +0200
25 @@ -42,6 +42,8 @@
26 #include <com/sun/star/awt/Gradient.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/beans/XPropertyState.hpp>
29 +#include <com/sun/star/beans/Property.hpp>
30 +#include <com/sun/star/beans/XPropertySetInfo.hpp>
31 #include <com/sun/star/container/XEnumerationAccess.hpp>
32 #include <com/sun/star/drawing/BitmapMode.hpp>
33 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
34 @@ -52,6 +54,8 @@
35 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
36 #include <com/sun/star/i18n/ScriptType.hpp>
37 #include <com/sun/star/io/XOutputStream.hpp>
38 +#include <com/sun/star/style/LineSpacing.hpp>
39 +#include <com/sun/star/style/LineSpacingMode.hpp>
40 #include <com/sun/star/style/ParagraphAdjust.hpp>
41 #include <com/sun/star/text/WritingMode.hpp>
42 #include <com/sun/star/text/XText.hpp>
43 @@ -71,10 +75,12 @@
44 #include <svx/svxenum.hxx>
46 using namespace ::com::sun::star;
47 -using namespace ::com::sun::star::uno;
48 +using namespace ::com::sun::star::beans;
49 using namespace ::com::sun::star::drawing;
50 -using namespace ::com::sun::star::text;
51 using namespace ::com::sun::star::i18n;
52 +using namespace ::com::sun::star::style;
53 +using namespace ::com::sun::star::text;
54 +using namespace ::com::sun::star::uno;
55 using ::com::sun::star::beans::PropertyState;
56 using ::com::sun::star::beans::PropertyValue;
57 using ::com::sun::star::beans::XPropertySet;
58 @@ -83,6 +89,7 @@ using ::com::sun::star::container::XEnum
59 using ::com::sun::star::container::XEnumerationAccess;
60 using ::com::sun::star::container::XIndexAccess;
61 using ::com::sun::star::io::XOutputStream;
62 +using ::com::sun::star::style::LineSpacing;
63 using ::com::sun::star::text::XText;
64 using ::com::sun::star::text::XTextContent;
65 using ::com::sun::star::text::XTextField;
66 @@ -107,6 +114,44 @@ namespace drawingml {
67 #define GET(variable, propName) \
68 if ( GETA(propName) ) \
69 mAny >>= variable;
70 +DBG(
71 +void lcl_dump_pset(Reference< XPropertySet > rXPropSet)
73 + Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
74 + Sequence< beans::Property > props = info->getProperties ();
76 + for (int i=0; i < props.getLength (); i++) {
77 + OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
78 + fprintf (stderr,"%30s = ", name.getStr() );
80 + try {
81 + Any value = rXPropSet->getPropertyValue( props [i].Name );
83 + OUString strValue;
84 + sal_Int32 intValue;
85 + bool boolValue;
86 + LineSpacing spacing;
87 +// RectanglePoint pointValue;
89 + if( value >>= strValue )
90 + fprintf (stderr,"\"%s\"\n", USS( strValue ) );
91 + else if( value >>= intValue )
92 + fprintf (stderr,"%d (hex: %x)\n", intValue, intValue);
93 + else if( value >>= boolValue )
94 + fprintf (stderr,"%d (bool)\n", boolValue);
95 + else if( value >>= spacing ) {
96 + fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height);
97 + }
98 +// else if( value >>= pointValue )
99 +// fprintf (stderr,"%d (RectanglePoint)\n", pointValue);
100 + else
101 + fprintf (stderr,"??? <unhandled type>\n");
102 + } catch(Exception e) {
103 + fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
109 // not thread safe
110 int DrawingML::mnImageCounter = 1;
111 @@ -1084,14 +1129,30 @@ const char* DrawingML::GetAlignment( sal
112 return sAlignment;
115 +void DrawingML::WriteLinespacing( LineSpacing& rSpacing )
117 + if( rSpacing.Mode == LineSpacingMode::PROP )
118 + mpFS->singleElementNS( XML_a, XML_spcPct,
119 + XML_val, I32S( ((sal_Int32)rSpacing.Height)*1000 ),
120 + FSEND );
121 + else
122 + mpFS->singleElementNS( XML_a, XML_spcPts,
123 + XML_val, I32S( rSpacing.Height ),
124 + FSEND );
127 void DrawingML::WriteParagraphProperties( Reference< XTextContent > rParagraph )
129 Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY );
130 Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY );
131 + PropertyState eState;
133 if( !rXPropSet.is() || !rXPropState.is() )
134 return;
136 + //OSL_TRACE("write paragraph properties pset");
137 + //DBG(lcl_dump_pset(rXPropSet));
139 sal_Int16 nLevel = -1;
140 GET( nLevel, NumberingLevel );
142 @@ -1102,15 +1163,27 @@ void DrawingML::WriteParagraphProperties
143 sal_Int16 nAlignment( style::ParagraphAdjust_LEFT );
144 GET( nAlignment, ParaAdjust );
146 + sal_Bool bHasLinespacing = sal_False;
147 + LineSpacing aLineSpacing;
148 + if( GETAD( ParaLineSpacing ) )
149 + bHasLinespacing = ( mAny >>= aLineSpacing );
151 if( nLevel != -1
152 - || nLeftMargin > 0
153 - || nAlignment != style::ParagraphAdjust_LEFT ) {
154 + || nLeftMargin > 0
155 + || nAlignment != style::ParagraphAdjust_LEFT
156 + || bHasLinespacing ) {
157 mpFS->startElementNS( XML_a, XML_pPr,
158 XML_lvl, nLevel > 0 ? I32S( nLevel ) : NULL,
159 XML_marL, nLeftMargin > 0 ? IS( nLeftMargin ) : NULL,
160 XML_algn, GetAlignment( nAlignment ),
161 FSEND );
163 + if( bHasLinespacing ) {
164 + mpFS->startElementNS( XML_a, XML_lnSpc, FSEND );
165 + WriteLinespacing( aLineSpacing );
166 + mpFS->endElementNS( XML_a, XML_lnSpc );
169 WriteParagraphNumbering( rXPropSet, nLevel );
171 mpFS->endElementNS( XML_a, XML_pPr );