[ooo-build-commit] .: sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Oct 5 08:32:23 PDT 2010


 sc/inc/autoform.hxx                           |    1 
 sc/inc/scitems.hxx                            |  138 +++---
 sc/inc/unonames.hxx                           |    2 
 sc/source/core/data/attarray.cxx              |    1 
 sc/source/core/data/column2.cxx               |    1 
 sc/source/core/data/docpool.cxx               |    5 
 sc/source/core/data/dpoutput.cxx              |    1 
 sc/source/core/data/patattr.cxx               |    1 
 sc/source/core/data/stlpool.cxx               |    1 
 sc/source/core/data/table1.cxx                |    1 
 sc/source/core/tool/editutil.cxx              |    1 
 sc/source/core/tool/interpr1.cxx              |    1 
 sc/source/filter/excel/xestyle.cxx            |   27 +
 sc/source/filter/excel/xistyle.cxx            |    3 
 sc/source/filter/excel/xlstyle.cxx            |   12 
 sc/source/filter/html/htmlexp.cxx             |    1 
 sc/source/filter/html/htmlpars.cxx            |    1 
 sc/source/filter/inc/xlstyle.hxx              |    4 
 sc/source/filter/lotus/lotattr.cxx            |    1 
 sc/source/filter/lotus/memory.cxx             |    1 
 sc/source/filter/lotus/op.cxx                 |    1 
 sc/source/filter/lotus/tool.cxx               |    1 
 sc/source/filter/qpro/qprostyle.cxx           |    1 
 sc/source/filter/rtf/rtfexp.cxx               |    1 
 sc/source/filter/starcalc/scflt.cxx           |    1 
 sc/source/filter/xml/xmlstyle.cxx             |  144 +++++-
 sc/source/filter/xml/xmlstyle.hxx             |   37 +
 sc/source/ui/Accessibility/AccessibleText.cxx |    1 
 sc/source/ui/app/inputhdl.cxx                 |    1 
 sc/source/ui/app/transobj.cxx                 |    1 
 sc/source/ui/app/typemap.cxx                  |    1 
 sc/source/ui/docshell/docsh.cxx               |    1 
 sc/source/ui/undo/undoblk.cxx                 |    1 
 sc/source/ui/undo/undoblk3.cxx                |    1 
 sc/source/ui/unoobj/afmtuno.cxx               |    8 
 sc/source/ui/unoobj/cellsuno.cxx              |   39 +
 sc/source/ui/unoobj/styleuno.cxx              |    8 
 sc/source/ui/vba/vbaformat.cxx                |   22 -
 sc/source/ui/view/formatsh.cxx                |    1 
 sc/source/ui/view/gridwin.cxx                 |    1 
 sc/source/ui/view/output2.cxx                 |  557 +++++++++++++++++---------
 sc/source/ui/view/viewdata.cxx                |    1 
 sc/source/ui/view/viewfunc.cxx                |    1 
 43 files changed, 706 insertions(+), 329 deletions(-)

New commits:
commit 7ce3c5e1c8e32529eae6f7d9ebc71184dd7b8d9a
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Oct 5 11:19:10 2010 -0400

    Ported calc-distributed-cell-text-*.diff from ooo-build.
    
    This feature enables horizontal 'distributed' alignment and vertical
    'justified' and 'distributed' alignments for cell contents in Calc.
    Note that this feature relies on ODF 1.2 extended in order for the
    relevant cell attributes to be saved in ODS.

diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx
index 1fce4cb..3e4a94d 100644
--- a/sc/inc/autoform.hxx
+++ b/sc/inc/autoform.hxx
@@ -60,6 +60,7 @@ JP 20.07.95:
 #include <editeng/shdditem.hxx>
 #include <editeng/udlnitem.hxx>
 #include <editeng/wghtitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svx/rotmodit.hxx>
 #include <svl/intitem.hxx>
 #include <editeng/bolnitem.hxx>
diff --git a/sc/inc/scitems.hxx b/sc/inc/scitems.hxx
index dbdb5d3..2da2bf1 100644
--- a/sc/inc/scitems.hxx
+++ b/sc/inc/scitems.hxx
@@ -93,75 +93,77 @@
 #define ATTR_HANGPUNCTUATION	127
 #define ATTR_FORBIDDEN_RULES	128
 #define	ATTR_HOR_JUSTIFY		129
-#define ATTR_INDENT				130
-#define	ATTR_VER_JUSTIFY		131
-#define ATTR_STACKED            132
-#define ATTR_ROTATE_VALUE		133
-#define ATTR_ROTATE_MODE		134
-#define ATTR_VERTICAL_ASIAN		135
-#define ATTR_WRITINGDIR			136
-#define ATTR_LINEBREAK			137
-#define ATTR_SHRINKTOFIT        138
-#define ATTR_BORDER_TLBR        139
-#define ATTR_BORDER_BLTR        140
-#define ATTR_MARGIN             141
-#define ATTR_MERGE              142
-#define ATTR_MERGE_FLAG         143
-#define ATTR_VALUE_FORMAT       144
-#define ATTR_LANGUAGE_FORMAT    145
-#define ATTR_BACKGROUND         146
-#define ATTR_PROTECTION         147
-#define ATTR_BORDER             148
-#define ATTR_BORDER_INNER       149     // innen, wg. Vorlagen-EditDialog
-#define ATTR_SHADOW             150
-#define ATTR_VALIDDATA          151
-#define ATTR_CONDITIONAL        152
-
-#define ATTR_PATTERN_END        152     // Ende Zellattribut-Pattern
-
-#define ATTR_PATTERN            153
+#define ATTR_HOR_JUSTIFY_METHOD 130
+#define ATTR_INDENT				131
+#define	ATTR_VER_JUSTIFY		132
+#define ATTR_VER_JUSTIFY_METHOD 133
+#define ATTR_STACKED            134
+#define ATTR_ROTATE_VALUE		135
+#define ATTR_ROTATE_MODE		136
+#define ATTR_VERTICAL_ASIAN		137
+#define ATTR_WRITINGDIR			138
+#define ATTR_LINEBREAK			139
+#define ATTR_SHRINKTOFIT        140
+#define ATTR_BORDER_TLBR        141
+#define ATTR_BORDER_BLTR        142
+#define ATTR_MARGIN             143
+#define ATTR_MERGE              144
+#define ATTR_MERGE_FLAG         145
+#define ATTR_VALUE_FORMAT       146
+#define ATTR_LANGUAGE_FORMAT    147
+#define ATTR_BACKGROUND         148
+#define ATTR_PROTECTION         149
+#define ATTR_BORDER             150
+#define ATTR_BORDER_INNER       151     // innen, wg. Vorlagen-EditDialog
+#define ATTR_SHADOW             152
+#define ATTR_VALIDDATA          153
+#define ATTR_CONDITIONAL        154
+
+#define ATTR_PATTERN_END        154     // Ende Zellattribut-Pattern
+
+#define ATTR_PATTERN            155
                                         // Seitenattribute
-#define ATTR_LRSPACE            154     // Editor: PageDesc-TabPage
-#define ATTR_ULSPACE            155
-#define ATTR_PAGE               156
-#define ATTR_PAGE_PAPERTRAY     157
-#define ATTR_PAGE_PAPERBIN      158
-#define ATTR_PAGE_SIZE          159
-#define ATTR_PAGE_MAXSIZE       160
-#define ATTR_PAGE_HORCENTER     161
-#define ATTR_PAGE_VERCENTER     162
-
-#define ATTR_PAGE_ON            163     // Editor: Header/Footer-Page
-#define ATTR_PAGE_DYNAMIC       164
-#define ATTR_PAGE_SHARED        165
-
-#define ATTR_PAGE_NOTES         166     // Editor: Tabelle
-#define ATTR_PAGE_GRID          167
-#define ATTR_PAGE_HEADERS       168
-#define ATTR_PAGE_CHARTS        169
-#define ATTR_PAGE_OBJECTS       170
-#define ATTR_PAGE_DRAWINGS      171
-#define ATTR_PAGE_TOPDOWN       172
-#define ATTR_PAGE_SCALE         173
-#define ATTR_PAGE_SCALETOPAGES  174
-#define ATTR_PAGE_FIRSTPAGENO   175
-
-#define ATTR_PAGE_PRINTAREA     176     // Editor: Druckbereiche
-#define ATTR_PAGE_REPEATROW     177
-#define ATTR_PAGE_REPEATCOL     178
-#define ATTR_PAGE_PRINTTABLES   179
-
-#define ATTR_PAGE_HEADERLEFT    180     // Inhalte der Kopf-/
-#define ATTR_PAGE_FOOTERLEFT    181     // Fusszeilen (links)
-#define ATTR_PAGE_HEADERRIGHT   182     // Inhalte der Kopf-/
-#define ATTR_PAGE_FOOTERRIGHT   183     // Fusszeilen (rechts)
-#define ATTR_PAGE_HEADERSET     184     // die Sets dazu...
-#define ATTR_PAGE_FOOTERSET     185
-
-#define ATTR_PAGE_FORMULAS      186
-#define ATTR_PAGE_NULLVALS      187
-
-#define ATTR_PAGE_SCALETO       188     // #i8868# scale printout to with/height
+#define ATTR_LRSPACE            156     // Editor: PageDesc-TabPage
+#define ATTR_ULSPACE            157
+#define ATTR_PAGE               158
+#define ATTR_PAGE_PAPERTRAY     159
+#define ATTR_PAGE_PAPERBIN      160
+#define ATTR_PAGE_SIZE          161
+#define ATTR_PAGE_MAXSIZE       162
+#define ATTR_PAGE_HORCENTER     163
+#define ATTR_PAGE_VERCENTER     164
+
+#define ATTR_PAGE_ON            165     // Editor: Header/Footer-Page
+#define ATTR_PAGE_DYNAMIC       166
+#define ATTR_PAGE_SHARED        167
+
+#define ATTR_PAGE_NOTES         168     // Editor: Tabelle
+#define ATTR_PAGE_GRID          169
+#define ATTR_PAGE_HEADERS       170
+#define ATTR_PAGE_CHARTS        171
+#define ATTR_PAGE_OBJECTS       172
+#define ATTR_PAGE_DRAWINGS      173
+#define ATTR_PAGE_TOPDOWN       174
+#define ATTR_PAGE_SCALE         175
+#define ATTR_PAGE_SCALETOPAGES  176
+#define ATTR_PAGE_FIRSTPAGENO   177
+
+#define ATTR_PAGE_PRINTAREA     178     // Editor: Druckbereiche
+#define ATTR_PAGE_REPEATROW     179
+#define ATTR_PAGE_REPEATCOL     180
+#define ATTR_PAGE_PRINTTABLES   181
+
+#define ATTR_PAGE_HEADERLEFT    182     // Inhalte der Kopf-/
+#define ATTR_PAGE_FOOTERLEFT    183     // Fusszeilen (links)
+#define ATTR_PAGE_HEADERRIGHT   184     // Inhalte der Kopf-/
+#define ATTR_PAGE_FOOTERRIGHT   185     // Fusszeilen (rechts)
+#define ATTR_PAGE_HEADERSET     186     // die Sets dazu...
+#define ATTR_PAGE_FOOTERSET     187
+
+#define ATTR_PAGE_FORMULAS      188
+#define ATTR_PAGE_NULLVALS      189
+
+#define ATTR_PAGE_SCALETO       190     // #i8868# scale printout to with/height
 
 #define ATTR_ENDINDEX           ATTR_PAGE_SCALETO        // Ende Pool-Range
 
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index fabd595..c12e4da 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -106,6 +106,8 @@
 #define SC_UNONAME_CELLPRO			"CellProtection"
 #define SC_UNONAME_CELLHJUS			"HoriJustify"
 #define SC_UNONAME_CELLVJUS			"VertJustify"
+#define SC_UNONAME_CELLHJUS_METHOD  "HoriJustifyMethod"
+#define SC_UNONAME_CELLVJUS_METHOD  "VertJustifyMethod"
 #define SC_UNONAME_CELLORI			"Orientation"
 #define SC_UNONAME_NUMFMT			"NumberFormat"
 #define SC_UNONAME_SHADOW			"ShadowFormat"
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 36886ea..b0ed941 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -39,6 +39,7 @@
 #include <editeng/frmdiritem.hxx>
 #include <editeng/shaditem.hxx>
 #include <editeng/editobj.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svl/poolcach.hxx>
 #include <editeng/fontitem.hxx>
 #include <unotools/fontcvt.hxx>
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 1663711..a5d3dbc 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -44,6 +44,7 @@
 #include <svx/rotmodit.hxx>
 #include <editeng/scripttypeitem.hxx>
 #include <editeng/unolingu.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/broadcast.hxx>
 #include <svl/listeneriter.hxx>
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index a879fcc..4ff6668 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -67,6 +67,7 @@
 #include <editeng/wghtitem.hxx>
 #include <editeng/wrlmitem.hxx>
 #include <editeng/xmlcnitm.hxx>
+#include <editeng/justifyitem.hxx>
 
 #include "docpool.hxx"
 #include "global.hxx"
@@ -127,8 +128,10 @@ static SfxItemInfo __READONLY_DATA  aItemInfos[] =
     { 0,							SFX_ITEM_POOLABLE },	// ATTR_HANGPUNCTUATION		from 614d
     { SID_ATTR_PARA_FORBIDDEN_RULES,SFX_ITEM_POOLABLE },	// ATTR_FORBIDDEN_RULES		from 614d
     { SID_ATTR_ALIGN_HOR_JUSTIFY,	SFX_ITEM_POOLABLE },	// ATTR_HOR_JUSTIFY
+    { SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SFX_ITEM_POOLABLE }, // ATTR_HOR_JUSTIFY_METHOD
     { SID_ATTR_ALIGN_INDENT,		SFX_ITEM_POOLABLE },	// ATTR_INDENT			ab 350
     { SID_ATTR_ALIGN_VER_JUSTIFY,	SFX_ITEM_POOLABLE },	// ATTR_VER_JUSTIFY
+    { SID_ATTR_ALIGN_VER_JUSTIFY_METHOD, SFX_ITEM_POOLABLE }, // ATTR_VER_JUSTIFY_METHOD
     { SID_ATTR_ALIGN_STACKED,       SFX_ITEM_POOLABLE },    // ATTR_STACKED         from 680/dr14 (replaces ATTR_ORIENTATION)
     { SID_ATTR_ALIGN_DEGREES,		SFX_ITEM_POOLABLE },	// ATTR_ROTATE_VALUE	ab 367
     { SID_ATTR_ALIGN_LOCKPOS,		SFX_ITEM_POOLABLE },	// ATTR_ROTATE_MODE		ab 367
@@ -260,8 +263,10 @@ ScDocumentPool::ScDocumentPool( SfxItemPool* pSecPool, BOOL bLoadRefCounts )
     ppPoolDefaults[ ATTR_HANGPUNCTUATION - ATTR_STARTINDEX ] = new SvxHangingPunctuationItem( sal_False, ATTR_HANGPUNCTUATION);
     ppPoolDefaults[ ATTR_FORBIDDEN_RULES - ATTR_STARTINDEX ] = new SvxForbiddenRuleItem( sal_False, ATTR_FORBIDDEN_RULES);
     ppPoolDefaults[ ATTR_HOR_JUSTIFY     - ATTR_STARTINDEX ] = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY);
+    ppPoolDefaults[ ATTR_HOR_JUSTIFY_METHOD - ATTR_STARTINDEX ] = new SvxJustifyMethodItem( SVX_JUSTIFY_METHOD_AUTO, ATTR_HOR_JUSTIFY_METHOD);
     ppPoolDefaults[	ATTR_INDENT			 - ATTR_STARTINDEX ] = new SfxUInt16Item( ATTR_INDENT, 0 );
     ppPoolDefaults[ ATTR_VER_JUSTIFY     - ATTR_STARTINDEX ] = new SvxVerJustifyItem( SVX_VER_JUSTIFY_STANDARD, ATTR_VER_JUSTIFY);
+    ppPoolDefaults[ ATTR_VER_JUSTIFY_METHOD - ATTR_STARTINDEX ] = new SvxJustifyMethodItem( SVX_JUSTIFY_METHOD_AUTO, ATTR_VER_JUSTIFY_METHOD);
     ppPoolDefaults[ ATTR_STACKED         - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_STACKED, FALSE );
     ppPoolDefaults[	ATTR_ROTATE_VALUE	 - ATTR_STARTINDEX ] = new SfxInt32Item( ATTR_ROTATE_VALUE, 0 );
     ppPoolDefaults[	ATTR_ROTATE_MODE	 - ATTR_STARTINDEX ] = new SvxRotateModeItem( SVX_ROTATE_MODE_BOTTOM, ATTR_ROTATE_MODE );
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index 16f1be0..b46f3ad 100755
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -37,6 +37,7 @@
 #include <editeng/boxitem.hxx>
 #include <editeng/brshitem.hxx>
 #include <editeng/wghtitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <unotools/transliterationwrapper.hxx>
 
 #include "dpoutput.hxx"
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 1c0dc37..8f5c2a8 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -57,6 +57,7 @@
 #include <editeng/udlnitem.hxx>
 #include <editeng/wghtitem.hxx>
 #include <editeng/wrlmitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svl/intitem.hxx>
 #include <svl/zforlist.hxx>
 #include <vcl/outdev.hxx>
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 818845a..d292d9f 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -46,6 +46,7 @@
 #include <editeng/postitem.hxx>
 #include <editeng/udlnitem.hxx>
 #include <editeng/wghtitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svl/itemset.hxx>
 #include <svl/zforlist.hxx>
 #include <unotools/charclass.hxx>
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index bf747e9..d3d707f 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -30,6 +30,7 @@
 
 #include "scitems.hxx"
 #include <svx/algitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <unotools/textsearch.hxx>
 #include <sfx2/objsh.hxx>
 
diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx
index 66a275d..61ad3f8 100644
--- a/sc/source/core/tool/editutil.cxx
+++ b/sc/source/core/tool/editutil.cxx
@@ -44,6 +44,7 @@
 #include <editeng/escpitem.hxx>
 #include <editeng/flditem.hxx>
 #include <editeng/numitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/outdev.hxx>
 #include <svl/inethist.hxx>
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2249ff2..d4c48f3 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -32,6 +32,7 @@
 
 #include "scitems.hxx"
 #include <editeng/langitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svx/algitem.hxx>
 #include <unotools/textsearch.hxx>
 #include <svl/zforlist.hxx>
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 15655ad..6cfec99 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -47,6 +47,7 @@
 #include <editeng/frmdiritem.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/escpitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include "document.hxx"
 #include "stlpool.hxx"
 #include "stlsheet.hxx"
@@ -1379,6 +1380,8 @@ bool XclExpCellAlign::FillFromItemSet(
         const SfxItemSet& rItemSet, bool bForceLineBreak, XclBiff eBiff, bool bStyle )
 {
     bool bUsed = false;
+    SvxCellHorJustify eHorAlign = GETITEMVALUE( rItemSet, SvxHorJustifyItem, ATTR_HOR_JUSTIFY, SvxCellHorJustify );
+    SvxCellVerJustify eVerAlign = GETITEMVALUE( rItemSet, SvxVerJustifyItem, ATTR_VER_JUSTIFY, SvxCellVerJustify );
 
     switch( eBiff )
     {
@@ -1405,7 +1408,7 @@ bool XclExpCellAlign::FillFromItemSet(
         case EXC_BIFF4: // attributes new in BIFF4
         {
             // vertical alignment
-            SetScVerAlign( GETITEMVALUE( rItemSet, SvxVerJustifyItem, ATTR_VER_JUSTIFY, SvxCellVerJustify ) );
+            SetScVerAlign( eVerAlign );
             bUsed |= ScfTools::CheckItem( rItemSet, ATTR_VER_JUSTIFY, bStyle );
 
             // stacked/rotation
@@ -1435,7 +1438,7 @@ bool XclExpCellAlign::FillFromItemSet(
         case EXC_BIFF2: // attributes new in BIFF2
         {
             // horizontal alignment
-            SetScHorAlign( GETITEMVALUE( rItemSet, SvxHorJustifyItem, ATTR_HOR_JUSTIFY, SvxCellHorJustify ) );
+            SetScHorAlign( eHorAlign );
             bUsed |= ScfTools::CheckItem( rItemSet, ATTR_HOR_JUSTIFY, bStyle );
         }
 
@@ -1443,6 +1446,26 @@ bool XclExpCellAlign::FillFromItemSet(
         default:    DBG_ERROR_BIFF();
     }
 
+    if (eBiff == EXC_BIFF8)
+    {
+        // Adjust for distributed alignments.
+        if (eHorAlign == SVX_HOR_JUSTIFY_BLOCK)
+        {
+            SvxCellJustifyMethod eHorJustMethod = GETITEMVALUE(
+                rItemSet, SvxJustifyMethodItem, ATTR_HOR_JUSTIFY_METHOD, SvxCellJustifyMethod);
+            if (eHorJustMethod == SVX_JUSTIFY_METHOD_DISTRIBUTE)
+                mnHorAlign = EXC_XF_HOR_DISTRIB;
+        }
+
+        if (eVerAlign == SVX_VER_JUSTIFY_BLOCK)
+        {
+            SvxCellJustifyMethod eVerJustMethod = GETITEMVALUE(
+                rItemSet, SvxJustifyMethodItem, ATTR_VER_JUSTIFY_METHOD, SvxCellJustifyMethod);
+            if (eVerJustMethod == SVX_JUSTIFY_METHOD_DISTRIBUTE)
+                mnVerAlign = EXC_XF_VER_DISTRIB;
+        }
+    }
+
     return bUsed;
 }
 
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 9fa8158..8824e2f 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -51,6 +51,7 @@
 #include <editeng/frmdiritem.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/flstitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include "document.hxx"
 #include "docpool.hxx"
 #include "attrib.hxx"
@@ -688,6 +689,7 @@ void XclImpCellAlign::FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFo
 {
     // horizontal alignment
     ScfTools::PutItem( rItemSet, SvxHorJustifyItem( GetScHorAlign(), ATTR_HOR_JUSTIFY ), bSkipPoolDefs );
+    ScfTools::PutItem( rItemSet, SvxJustifyMethodItem( GetScHorJustifyMethod(), ATTR_HOR_JUSTIFY_METHOD ), bSkipPoolDefs );
 
     // text wrap (#i74508# always if vertical alignment is justified or distributed)
     bool bLineBreak = mbLineBreak || (mnVerAlign == EXC_XF_VER_JUSTIFY) || (mnVerAlign == EXC_XF_VER_DISTRIB);
@@ -695,6 +697,7 @@ void XclImpCellAlign::FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFo
 
     // vertical alignment
     ScfTools::PutItem( rItemSet, SvxVerJustifyItem( GetScVerAlign(), ATTR_VER_JUSTIFY ), bSkipPoolDefs );
+    ScfTools::PutItem( rItemSet, SvxJustifyMethodItem( GetScVerJustifyMethod(), ATTR_VER_JUSTIFY_METHOD ), bSkipPoolDefs );
 
     // indent
     sal_uInt16 nScIndent = mnIndent * 200; // 1 Excel unit == 10 pt == 200 twips
diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx
index 294f872..ac8861d 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -1596,6 +1596,11 @@ SvxCellHorJustify XclCellAlign::GetScHorAlign() const
     return eHorJust;
 }
 
+SvxCellJustifyMethod XclCellAlign::GetScHorJustifyMethod() const
+{
+    return (mnHorAlign == EXC_XF_HOR_DISTRIB) ? SVX_JUSTIFY_METHOD_DISTRIBUTE : SVX_JUSTIFY_METHOD_AUTO;
+}
+
 SvxCellVerJustify XclCellAlign::GetScVerAlign() const
 {
     SvxCellVerJustify eVerJust = SVX_VER_JUSTIFY_STANDARD;
@@ -1605,12 +1610,17 @@ SvxCellVerJustify XclCellAlign::GetScVerAlign() const
         case EXC_XF_VER_CENTER:     eVerJust = SVX_VER_JUSTIFY_CENTER;      break;
         case EXC_XF_VER_BOTTOM:     eVerJust = SVX_VER_JUSTIFY_STANDARD;    break;
         case EXC_XF_VER_JUSTIFY:
-        case EXC_XF_VER_DISTRIB:    eVerJust = SVX_VER_JUSTIFY_TOP;         break;
+        case EXC_XF_VER_DISTRIB:    eVerJust = SVX_VER_JUSTIFY_BLOCK;       break;
         default:    DBG_ERRORFILE( "XclCellAlign::GetScVerAlign - unknown vertical alignment" );
     }
     return eVerJust;
 }
 
+SvxCellJustifyMethod XclCellAlign::GetScVerJustifyMethod() const
+{
+    return (mnVerAlign == EXC_XF_VER_DISTRIB) ? SVX_JUSTIFY_METHOD_DISTRIBUTE : SVX_JUSTIFY_METHOD_AUTO;
+}
+
 SvxFrameDirection XclCellAlign::GetScFrameDir() const
 {
     SvxFrameDirection eFrameDir = FRMDIR_ENVIRONMENT;
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index d5f0d3c..1dbea16 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -48,6 +48,7 @@
 #include <editeng/postitem.hxx>
 #include <editeng/udlnitem.hxx>
 #include <editeng/wghtitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svx/xoutbmp.hxx>
 #include <editeng/editeng.hxx>
 #include <svtools/htmlcfg.hxx>
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 64733eb..6351361 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -45,6 +45,7 @@
 #include <editeng/udlnitem.hxx>
 #include <editeng/wghtitem.hxx>
 #include <editeng/boxitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <sfx2/objsh.hxx>
 #include <svl/eitem.hxx>
 #include <svtools/filter.hxx>
diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx
index b8f63c0..f06ac94 100644
--- a/sc/source/filter/inc/xlstyle.hxx
+++ b/sc/source/filter/inc/xlstyle.hxx
@@ -516,8 +516,12 @@ struct XclCellAlign
 
     /** Returns the Calc horizontal alignment. */
     SvxCellHorJustify   GetScHorAlign() const;
+    /** Returns horizontal justification method as Calc's attribute. */
+    SvxCellJustifyMethod GetScHorJustifyMethod() const;
     /** Returns the Calc vertical alignment. */
     SvxCellVerJustify   GetScVerAlign() const;
+    /** Returns vertical justification method as Calc's attribute. */
+    SvxCellJustifyMethod GetScVerJustifyMethod() const;
     /** Returns the Calc frame direction. */
     SvxFrameDirection   GetScFrameDir() const;
 
diff --git a/sc/source/filter/lotus/lotattr.cxx b/sc/source/filter/lotus/lotattr.cxx
index 2253e51..72254e6 100644
--- a/sc/source/filter/lotus/lotattr.cxx
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -36,6 +36,7 @@
 #include <svx/algitem.hxx>
 #include <editeng/boxitem.hxx>
 #include <editeng/brshitem.hxx>
+#include <editeng/justifyitem.hxx>
 
 #include "document.hxx"
 #include "patattr.hxx"
diff --git a/sc/source/filter/lotus/memory.cxx b/sc/source/filter/lotus/memory.cxx
index f158d84..6eae5cc 100644
--- a/sc/source/filter/lotus/memory.cxx
+++ b/sc/source/filter/lotus/memory.cxx
@@ -35,6 +35,7 @@
 
 #include "scitems.hxx"
 #include <svx/algitem.hxx>
+#include <editeng/justifyitem.hxx>
 
 #include "attrib.hxx"
 
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index d47d70c..1b2bea5 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -48,6 +48,7 @@
 #include <editeng/postitem.hxx>
 #include <editeng/udlnitem.hxx>
 #include <editeng/wghtitem.hxx>
+#include <editeng/justifyitem.hxx>
 
 #include "cell.hxx"
 #include "rangenam.hxx"
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index 5951523..fe2c5fa 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -34,6 +34,7 @@
 
 #include "scitems.hxx"
 #include <svx/algitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svl/zforlist.hxx>
 #include <tools/solar.h>
 
diff --git a/sc/source/filter/qpro/qprostyle.cxx b/sc/source/filter/qpro/qprostyle.cxx
index 8e1b13b..fb0de1d 100644
--- a/sc/source/filter/qpro/qprostyle.cxx
+++ b/sc/source/filter/qpro/qprostyle.cxx
@@ -46,6 +46,7 @@
 #include <editeng/crsditem.hxx>
 #include <editeng/fhgtitem.hxx>
 #include <editeng/fontitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <map>
 
 #include "global.hxx"
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index 7b8ba5c..a6c41e4 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -40,6 +40,7 @@
 #include <editeng/udlnitem.hxx>
 #include <editeng/fontitem.hxx>
 #include <editeng/fhgtitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svl/style.hxx>
 #include <svtools/rtfout.hxx>
 #include <svtools/rtfkeywd.hxx>
diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx
index d4a1f3d..8c56534 100644
--- a/sc/source/filter/starcalc/scflt.cxx
+++ b/sc/source/filter/starcalc/scflt.cxx
@@ -52,6 +52,7 @@
 #include <editeng/udlnitem.hxx>
 #include <editeng/ulspitem.hxx>
 #include <editeng/wghtitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/PasswordHelper.hxx>
 #include <stdio.h>
diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx
index af1fdac..ba9c4c7 100644
--- a/sc/source/filter/xml/xmlstyle.cxx
+++ b/sc/source/filter/xml/xmlstyle.cxx
@@ -35,6 +35,7 @@
 
 #include "XMLConverter.hxx"
 #include "rangeutl.hxx"
+#include "unonames.hxx"
 
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/xmluconv.hxx>
@@ -49,8 +50,9 @@
 #include <tools/debug.hxx>
 #include <com/sun/star/util/CellProtection.hpp>
 #include <com/sun/star/table/CellOrientation.hpp>
-#include <com/sun/star/table/CellVertJustify.hpp>
+#include <com/sun/star/table/CellVertJustify2.hpp>
 #include <com/sun/star/table/CellHoriJustify.hpp>
+#include <com/sun/star/table/CellJustifyMethod.hpp>
 #include <com/sun/star/table/TableBorder.hpp>
 #include <com/sun/star/sheet/XSheetConditionalEntries.hpp>
 #include <com/sun/star/sheet/XSheetConditionalEntry.hpp>
@@ -89,6 +91,7 @@ const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
     MAP( "HoriJustify", XML_NAMESPACE_FO, XML_TEXT_ALIGN, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY|MID_FLAG_MERGE_PROPERTY, 0 ),
     MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_TEXT_ALIGN_SOURCE, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYSOURCE|MID_FLAG_MERGE_PROPERTY, 0 ),
     MAP( "HoriJustify", XML_NAMESPACE_STYLE, XML_REPEAT_CONTENT, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_HORIJUSTIFYREPEAT|MID_FLAG_MERGE_PROPERTY, 0 ),
+    MAP( SC_UNONAME_CELLHJUS_METHOD, XML_NAMESPACE_CSS3TEXT, XML_TEXT_JUSTIFY, XML_TYPE_PROP_PARAGRAPH|XML_SC_TYPE_HORIJUSTIFY_METHOD, 0 ),
     MAP( "IsCellBackgroundTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ISTRANSPARENT|MID_FLAG_MULTI_PROPERTY|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
     MAP( "IsTextWrapped", XML_NAMESPACE_FO, XML_WRAP_OPTION, XML_TYPE_PROP_TABLE_CELL|XML_SC_ISTEXTWRAPPED, 0 ),
     MAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BORDER, CTF_SC_ALLBORDER ),
@@ -116,7 +119,9 @@ const XMLPropertyMapEntry aXMLScCellStylesProperties[] =
     MAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ),
     MAP( "ValidationXML", XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TYPE_PROP_TABLE_CELL|XML_TYPE_BUILDIN_CMP_ONLY, CTF_SC_VALIDATION ),
     MAP( "VertJustify", XML_NAMESPACE_STYLE, XML_VERTICAL_ALIGN, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY, 0),
+    MAP( SC_UNONAME_CELLVJUS_METHOD, XML_NAMESPACE_STYLE, XML_VERTICAL_JUSTIFY, XML_TYPE_PROP_TABLE_CELL|XML_SC_TYPE_VERTJUSTIFY_METHOD, 0 ),
 //    MAP( "WritingMode", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_PROP_PARAGRAPH|XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT, 0 ),
+
     MAP_END()
 };
 
@@ -877,6 +882,12 @@ const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nTy
                 pHdl = new XmlScPropHdl_PrintContent;
             }
             break;
+            case XML_SC_TYPE_HORIJUSTIFY_METHOD:
+            case XML_SC_TYPE_VERTJUSTIFY_METHOD:
+            {
+                pHdl = new XmlScPropHdl_JustifyMethod;
+            }
+            break;
             case XML_SC_TYPE_HORIJUSTIFY :
             {
                 pHdl = new XmlScPropHdl_HoriJustify;
@@ -1152,6 +1163,81 @@ sal_Bool XmlScPropHdl_PrintContent::exportXML(
     return bRetval;
 }
 
+
+XmlScPropHdl_JustifyMethod::~XmlScPropHdl_JustifyMethod()
+{
+}
+
+bool XmlScPropHdl_JustifyMethod::equals(
+    const ::com::sun::star::uno::Any& r1,
+    const ::com::sun::star::uno::Any& r2 ) const
+{
+    sal_Int32 nVal1, nVal2;
+
+    if((r1 >>= nVal1) && (r2 >>= nVal2))
+        return (nVal1 == nVal2);
+    return sal_False;
+}
+
+sal_Bool XmlScPropHdl_JustifyMethod::importXML(
+    const ::rtl::OUString& rStrImpValue,
+    ::com::sun::star::uno::Any& rValue,
+    const SvXMLUnitConverter& /* rUnitConverter */ ) const
+{
+    bool bRetval = false;
+
+    sal_Int32 nValue = table::CellJustifyMethod::AUTO;
+    if (IsXMLToken(rStrImpValue, XML_AUTO))
+    {
+        nValue = table::CellJustifyMethod::AUTO;
+        rValue <<= nValue;
+        bRetval = true;
+    }
+    else if (IsXMLToken(rStrImpValue, XML_DISTRIBUTE))
+    {
+        nValue = table::CellJustifyMethod::DISTRIBUTE;
+        rValue <<= nValue;
+        bRetval = true;
+    }
+    else
+        bRetval = true;
+
+    return bRetval;
+}
+
+sal_Bool XmlScPropHdl_JustifyMethod::exportXML(
+    ::rtl::OUString& rStrExpValue,
+    const ::com::sun::star::uno::Any& rValue,
+    const SvXMLUnitConverter& /* rUnitConverter */ ) const
+{
+    sal_Int32 nVal;
+    bool bRetval = false;
+
+    if (rValue >>= nVal)
+    {
+        switch (nVal)
+        {
+            case table::CellJustifyMethod::AUTO:
+            {
+                rStrExpValue = GetXMLToken(XML_AUTO);
+                bRetval = true;
+            }
+            break;
+            case table::CellJustifyMethod::DISTRIBUTE:
+            {
+                rStrExpValue = GetXMLToken(XML_DISTRIBUTE);
+                bRetval = true;
+            }
+            break;
+            default:
+            {
+                // added to avoid warnings
+            }
+        }
+    }
+    return bRetval;
+}
+
 XmlScPropHdl_HoriJustify::~XmlScPropHdl_HoriJustify()
 {
 }
@@ -1507,7 +1593,7 @@ bool XmlScPropHdl_RotateReference::equals(
     const ::com::sun::star::uno::Any& r1,
     const ::com::sun::star::uno::Any& r2 ) const
 {
-    table::CellVertJustify aReference1, aReference2;
+    sal_Int32 aReference1, aReference2;
 
     if((r1 >>= aReference1) && (r2 >>= aReference2))
         return (aReference1 == aReference2);
@@ -1521,28 +1607,28 @@ sal_Bool XmlScPropHdl_RotateReference::importXML(
 {
     sal_Bool bRetval(sal_False);
 
-    table::CellVertJustify nValue;
+    sal_Int32 nValue;
     if (IsXMLToken(rStrImpValue, XML_NONE))
     {
-        nValue = table::CellVertJustify_STANDARD;
+        nValue = table::CellVertJustify2::STANDARD;
         rValue <<= nValue;
         bRetval = sal_True;
     }
     else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
     {
-        nValue = table::CellVertJustify_BOTTOM;
+        nValue = table::CellVertJustify2::BOTTOM;
         rValue <<= nValue;
         bRetval = sal_True;
     }
     else if (IsXMLToken(rStrImpValue, XML_TOP))
     {
-        nValue = table::CellVertJustify_TOP;
+        nValue = table::CellVertJustify2::TOP;
         rValue <<= nValue;
         bRetval = sal_True;
     }
     else if (IsXMLToken(rStrImpValue, XML_CENTER))
     {
-        nValue = table::CellVertJustify_CENTER;
+        nValue = table::CellVertJustify2::CENTER;
         rValue <<= nValue;
         bRetval = sal_True;
     }
@@ -1555,32 +1641,32 @@ sal_Bool XmlScPropHdl_RotateReference::exportXML(
     const ::com::sun::star::uno::Any& rValue,
     const SvXMLUnitConverter& /* rUnitConverter */ ) const
 {
-    table::CellVertJustify nVal;
+    sal_Int32 nVal;
     sal_Bool bRetval(sal_False);
 
     if(rValue >>= nVal)
     {
         switch (nVal)
         {
-            case table::CellVertJustify_BOTTOM :
+            case table::CellVertJustify2::BOTTOM :
             {
                 rStrExpValue = GetXMLToken(XML_BOTTOM);
                 bRetval = sal_True;
             }
             break;
-            case table::CellVertJustify_CENTER :
+            case table::CellVertJustify2::CENTER :
             {
                 rStrExpValue = GetXMLToken(XML_CENTER);
                 bRetval = sal_True;
             }
             break;
-            case table::CellVertJustify_STANDARD :
+            case table::CellVertJustify2::STANDARD :
             {
                 rStrExpValue = GetXMLToken(XML_NONE);
                 bRetval = sal_True;
             }
             break;
-            case table::CellVertJustify_TOP :
+            case table::CellVertJustify2::TOP :
             {
                 rStrExpValue = GetXMLToken(XML_TOP);
                 bRetval = sal_True;
@@ -1604,7 +1690,7 @@ bool XmlScPropHdl_VertJustify::equals(
     const ::com::sun::star::uno::Any& r1,
     const ::com::sun::star::uno::Any& r2 ) const
 {
-    table::CellVertJustify aReference1, aReference2;
+    sal_Int32 aReference1, aReference2;
 
     if((r1 >>= aReference1) && (r2 >>= aReference2))
         return (aReference1 == aReference2);
@@ -1618,28 +1704,34 @@ sal_Bool XmlScPropHdl_VertJustify::importXML(
 {
     sal_Bool bRetval(sal_False);
 
-    table::CellVertJustify nValue;
+    sal_Int32 nValue;
     if (IsXMLToken(rStrImpValue, XML_AUTOMATIC))
     {
-        nValue = table::CellVertJustify_STANDARD;
+        nValue = table::CellVertJustify2::STANDARD;
         rValue <<= nValue;
         bRetval = sal_True;
     }
     else if (IsXMLToken(rStrImpValue, XML_BOTTOM))
     {
-        nValue = table::CellVertJustify_BOTTOM;
+        nValue = table::CellVertJustify2::BOTTOM;
         rValue <<= nValue;
         bRetval = sal_True;
     }
     else if (IsXMLToken(rStrImpValue, XML_TOP))
     {
-        nValue = table::CellVertJustify_TOP;
+        nValue = table::CellVertJustify2::TOP;
         rValue <<= nValue;
         bRetval = sal_True;
     }
     else if (IsXMLToken(rStrImpValue, XML_MIDDLE))
     {
-        nValue = table::CellVertJustify_CENTER;
+        nValue = table::CellVertJustify2::CENTER;
+        rValue <<= nValue;
+        bRetval = sal_True;
+    }
+    else if (IsXMLToken(rStrImpValue, XML_JUSTIFY))
+    {
+        nValue = table::CellVertJustify2::BLOCK;
         rValue <<= nValue;
         bRetval = sal_True;
     }
@@ -1652,37 +1744,43 @@ sal_Bool XmlScPropHdl_VertJustify::exportXML(
     const ::com::sun::star::uno::Any& rValue,
     const SvXMLUnitConverter& /* rUnitConverter */ ) const
 {
-    table::CellVertJustify nVal;
+    sal_Int32 nVal;
     sal_Bool bRetval(sal_False);
 
     if(rValue >>= nVal)
     {
         switch (nVal)
         {
-            case table::CellVertJustify_BOTTOM :
+            case table::CellVertJustify2::BOTTOM :
             {
                 rStrExpValue = GetXMLToken(XML_BOTTOM);
                 bRetval = sal_True;
             }
             break;
-            case table::CellVertJustify_CENTER :
+            case table::CellVertJustify2::CENTER :
             {
                 rStrExpValue = GetXMLToken(XML_MIDDLE);
                 bRetval = sal_True;
             }
             break;
-            case table::CellVertJustify_STANDARD :
+            case table::CellVertJustify2::STANDARD :
             {
                 rStrExpValue = GetXMLToken(XML_AUTOMATIC);
                 bRetval = sal_True;
             }
             break;
-            case table::CellVertJustify_TOP :
+            case table::CellVertJustify2::TOP :
             {
                 rStrExpValue = GetXMLToken(XML_TOP);
                 bRetval = sal_True;
             }
             break;
+            case table::CellVertJustify2::BLOCK :
+            {
+                rStrExpValue = GetXMLToken(XML_JUSTIFY);
+                bRetval = sal_True;
+            }
+            break;
             default:
             {
                 // added to avoid warnings
diff --git a/sc/source/filter/xml/xmlstyle.hxx b/sc/source/filter/xml/xmlstyle.hxx
index 3199ccb..b41ea76 100644
--- a/sc/source/filter/xml/xmlstyle.hxx
+++ b/sc/source/filter/xml/xmlstyle.hxx
@@ -48,19 +48,21 @@ extern const XMLPropertyMapEntry aXMLScTableStylesImportProperties[];
 #define	XML_SC_TYPE_CELLPROTECTION					(XML_SC_TYPES_START +  1)
 #define	XML_SC_TYPE_PRINTCONTENT					(XML_SC_TYPES_START +  2)
 #define XML_SC_TYPE_HORIJUSTIFY						(XML_SC_TYPES_START +  3)
-#define XML_SC_TYPE_HORIJUSTIFYSOURCE				(XML_SC_TYPES_START +  4)
-#define XML_SC_TYPE_HORIJUSTIFYREPEAT               (XML_SC_TYPES_START +  5)
-#define XML_SC_TYPE_ORIENTATION						(XML_SC_TYPES_START +  6)
-#define XML_SC_TYPE_ROTATEANGLE						(XML_SC_TYPES_START +  7)
-#define XML_SC_TYPE_ROTATEREFERENCE					(XML_SC_TYPES_START +  8)
-#define XML_SC_TYPE_BORDERLEFT						(XML_SC_TYPES_START +  9)
-#define XML_SC_TYPE_BORDERRIGHT						(XML_SC_TYPES_START + 10)
-#define XML_SC_TYPE_BORDERTOP						(XML_SC_TYPES_START + 11)
-#define XML_SC_TYPE_BORDERBOTTOM					(XML_SC_TYPES_START + 12)
-#define XML_SC_TYPE_VERTJUSTIFY						(XML_SC_TYPES_START + 13)
-#define XML_SC_ISTEXTWRAPPED						(XML_SC_TYPES_START + 14)
-#define XML_SC_TYPE_EQUAL							(XML_SC_TYPES_START + 15)
-#define XML_SC_TYPE_VERTICAL						(XML_SC_TYPES_START + 16)
+#define XML_SC_TYPE_HORIJUSTIFY_METHOD              (XML_SC_TYPES_START +  4)
+#define XML_SC_TYPE_HORIJUSTIFYSOURCE               (XML_SC_TYPES_START +  5)
+#define XML_SC_TYPE_HORIJUSTIFYREPEAT               (XML_SC_TYPES_START +  6)
+#define XML_SC_TYPE_ORIENTATION                     (XML_SC_TYPES_START +  7)
+#define XML_SC_TYPE_ROTATEANGLE                     (XML_SC_TYPES_START +  8)
+#define XML_SC_TYPE_ROTATEREFERENCE                 (XML_SC_TYPES_START +  9)
+#define XML_SC_TYPE_BORDERLEFT                      (XML_SC_TYPES_START + 10)
+#define XML_SC_TYPE_BORDERRIGHT                     (XML_SC_TYPES_START + 11)
+#define XML_SC_TYPE_BORDERTOP                       (XML_SC_TYPES_START + 12)
+#define XML_SC_TYPE_BORDERBOTTOM                    (XML_SC_TYPES_START + 13)
+#define XML_SC_TYPE_VERTJUSTIFY                     (XML_SC_TYPES_START + 14)
+#define XML_SC_TYPE_VERTJUSTIFY_METHOD              (XML_SC_TYPES_START + 15)
+#define XML_SC_ISTEXTWRAPPED                        (XML_SC_TYPES_START + 16)
+#define XML_SC_TYPE_EQUAL                           (XML_SC_TYPES_START + 17)
+#define XML_SC_TYPE_VERTICAL                        (XML_SC_TYPES_START + 18)
 
 #define CTF_SC_HORIJUSTIFY							(XML_SC_CTF_START +  1)
 #define CTF_SC_HORIJUSTIFY_SOURCE					(XML_SC_CTF_START +  2)
@@ -247,6 +249,15 @@ public:
     virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
 };
 
+class XmlScPropHdl_JustifyMethod : public XMLPropertyHandler
+{
+public:
+    virtual ~XmlScPropHdl_JustifyMethod();
+    virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+    virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+    virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
 class XmlScPropHdl_HoriJustify : public XMLPropertyHandler
 {
 public:
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 1821068..e37492d 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -51,6 +51,7 @@
 #include <vcl/virdev.hxx>
 #include <editeng/editobj.hxx>
 #include <editeng/adjitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/algitem.hxx>
 
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 1e71912..fd47d61 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -49,6 +49,7 @@
 #include <editeng/svxacorr.hxx>
 #include <editeng/unolingu.hxx>
 #include <editeng/wghtitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index ae3b9ec..c3454eb 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -34,6 +34,7 @@
 
 #include "scitems.hxx"
 #include <editeng/eeitem.hxx>
+#include <editeng/justifyitem.hxx>
 
 
 #include <com/sun/star/uno/Sequence.hxx>
diff --git a/sc/source/ui/app/typemap.cxx b/sc/source/ui/app/typemap.cxx
index 33a8069..0378500 100644
--- a/sc/source/ui/app/typemap.cxx
+++ b/sc/source/ui/app/typemap.cxx
@@ -105,6 +105,7 @@
 #include <svx/xftshxy.hxx>
 #include <svx/xftsfit.hxx>
 #include <editeng/langitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svx/grafctrl.hxx>
 #include <editeng/shdditem.hxx>
 #include <editeng/shaditem.hxx>
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 0418be9..4426f7a 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -32,6 +32,7 @@
 #include "scitems.hxx"
 #include <editeng/eeitem.hxx>
 #include <editeng/svxenum.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svx/algitem.hxx>
 
 #include <sot/clsids.hxx>
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 5bb2da7..9a2302e 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -38,6 +38,7 @@
 #include <vcl/virdev.hxx>
 #include <vcl/waitobj.hxx>
 #include <editeng/boxitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <sfx2/app.hxx>
 
 #include "undoblk.hxx"
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 5152fff..88262e3 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -33,6 +33,7 @@
 #include "scitems.hxx"
 #include <svx/algitem.hxx>
 #include <editeng/boxitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svl/srchitem.hxx>
 #include <sfx2/linkmgr.hxx>
 #include <sfx2/bindings.hxx>
diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index 0a174c0..0e440f0 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -39,7 +39,7 @@
 #include "unowids.hxx"
 #include <rtl/uuid.h>
 #include <com/sun/star/table/BorderLine.hpp>
-#include <com/sun/star/table/CellVertJustify.hpp>
+#include <com/sun/star/table/CellVertJustify2.hpp>
 #include <com/sun/star/table/ShadowLocation.hpp>
 #include <com/sun/star/table/TableBorder.hpp>
 #include <com/sun/star/table/ShadowFormat.hpp>
@@ -139,6 +139,7 @@ const SfxItemPropertyMapEntry* lcl_GetAutoFieldMap()
         {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT),  ATTR_CJK_FONT_WEIGHT,   &::getCppuType((float*)0),                  0, MID_WEIGHT },
         {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT),  ATTR_CTL_FONT_WEIGHT,   &::getCppuType((float*)0),                  0, MID_WEIGHT },
         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY,       &::getCppuType((const table::CellHoriJustify*)0),   0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND,        &::getBooleanCppuType(),                    0, MID_GRAPHIC_TRANSPARENT },
         {MAP_CHAR_LEN(SC_UNONAME_WRAP),     ATTR_LINEBREAK,         &::getBooleanCppuType(),                    0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLORI),  ATTR_STACKED,           &::getCppuType((const table::CellOrientation*)0),   0, 0 },
@@ -147,8 +148,9 @@ const SfxItemPropertyMapEntry* lcl_GetAutoFieldMap()
         {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN,            &::getCppuType((const sal_Int32*)0),        0, MID_MARGIN_R_MARGIN  | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN,            &::getCppuType((const sal_Int32*)0),        0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),   ATTR_ROTATE_VALUE,      &::getCppuType((const sal_Int32*)0),        0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),   ATTR_ROTATE_MODE,       &::getCppuType((const table::CellVertJustify*)0),   0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY,       &::getCppuType((const table::CellVertJustify*)0),   0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),   ATTR_ROTATE_MODE,       &::getCppuType((const sal_Int32*)0),   0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY,       &::getCppuType((const sal_Int32*)0),   0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {0,0,0,0,0,0}
     };
     return aAutoFieldMap_Impl;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 3a6d7ca..45d9deb 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -38,6 +38,7 @@
 #include <editeng/brshitem.hxx>
 #include <editeng/editeng.hxx>
 #include <editeng/flditem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svx/fmdpage.hxx>
 #include <editeng/langitem.hxx>
 #include <sfx2/linkmgr.hxx>
@@ -56,7 +57,7 @@
 #include <com/sun/star/util/CellProtection.hpp>
 #include <com/sun/star/table/CellHoriJustify.hpp>
 #include <com/sun/star/table/CellOrientation.hpp>
-#include <com/sun/star/table/CellVertJustify.hpp>
+#include <com/sun/star/table/CellVertJustify2.hpp>
 #include <com/sun/star/table/ShadowFormat.hpp>
 #include <com/sun/star/table/TableBorder.hpp>
 #include <com/sun/star/sheet/CellFlags.hpp>
@@ -214,6 +215,7 @@ const SfxItemPropertySet* lcl_GetCellsPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS),	ATTR_HOR_JUSTIFY,	&getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN),	ATTR_BACKGROUND,	&getBooleanCppuType(),					0, MID_GRAPHIC_TRANSPARENT },
         {MAP_CHAR_LEN(SC_UNONAME_WRAP),		ATTR_LINEBREAK,		&getBooleanCppuType(),					0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
@@ -233,7 +235,7 @@ const SfxItemPropertySet* lcl_GetCellsPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN),	ATTR_MARGIN,		&getCppuType((sal_Int32*)0),			0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),	ATTR_ROTATE_VALUE,	&getCppuType((sal_Int32*)0),			0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((sal_Int32*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),	ATTR_SHADOW,		&getCppuType((table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),			    0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD),	SC_WID_UNO_TBLBORD,	&getCppuType((table::TableBorder*)0),	0, 0 | CONVERT_TWIPS },
@@ -242,7 +244,8 @@ const SfxItemPropertySet* lcl_GetCellsPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),	SC_WID_UNO_VALIDAT,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),	SC_WID_UNO_VALILOC,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),	SC_WID_UNO_VALIXML,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((sal_Int32*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_WRITING),	ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
         {0,0,0,0,0,0}
     };
@@ -313,6 +316,7 @@ const SfxItemPropertySet* lcl_GetRangePropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS),	ATTR_HOR_JUSTIFY,	&getCppuType((table::CellHoriJustify*)0),	0, MID_HORJUST_HORJUST },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN),	ATTR_BACKGROUND,	&getBooleanCppuType(),					0, MID_GRAPHIC_TRANSPARENT },
         {MAP_CHAR_LEN(SC_UNONAME_WRAP),		ATTR_LINEBREAK,		&getBooleanCppuType(),					0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
@@ -333,7 +337,7 @@ const SfxItemPropertySet* lcl_GetRangePropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_POS),		SC_WID_UNO_POS,		&getCppuType((awt::Point*)0),			0 | beans::PropertyAttribute::READONLY, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),	ATTR_ROTATE_VALUE,	&getCppuType((sal_Int32*)0),			0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((sal_Int32*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),	ATTR_SHADOW,		&getCppuType((table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),			    0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SIZE),		SC_WID_UNO_SIZE,	&getCppuType((awt::Size*)0),			0 | beans::PropertyAttribute::READONLY, 0 },
@@ -343,7 +347,8 @@ const SfxItemPropertySet* lcl_GetRangePropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),	SC_WID_UNO_VALIDAT,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),	SC_WID_UNO_VALILOC,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),	SC_WID_UNO_VALIXML,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((sal_Int32*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_WRITING),	ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
         {0,0,0,0,0,0}
     };
@@ -416,6 +421,7 @@ const SfxItemPropertySet* lcl_GetCellPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_FORMLOC),	SC_WID_UNO_FORMLOC,	&getCppuType((rtl::OUString*)0),		0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_FORMRT),	SC_WID_UNO_FORMRT,	&getCppuType((table::CellContentType*)0), 0 | beans::PropertyAttribute::READONLY, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS),	ATTR_HOR_JUSTIFY,	&getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN),	ATTR_BACKGROUND,	&getBooleanCppuType(),					0, MID_GRAPHIC_TRANSPARENT },
         {MAP_CHAR_LEN(SC_UNONAME_WRAP),		ATTR_LINEBREAK,		&getBooleanCppuType(),					0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
@@ -436,7 +442,7 @@ const SfxItemPropertySet* lcl_GetCellPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_POS),		SC_WID_UNO_POS,		&getCppuType((awt::Point*)0),			0 | beans::PropertyAttribute::READONLY, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),	ATTR_ROTATE_VALUE,	&getCppuType((sal_Int32*)0),			0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((sal_Int32*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),	ATTR_SHADOW,		&getCppuType((table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),			    0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SIZE),		SC_WID_UNO_SIZE,	&getCppuType((awt::Size*)0),			0 | beans::PropertyAttribute::READONLY, 0 },
@@ -446,7 +452,8 @@ const SfxItemPropertySet* lcl_GetCellPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),	SC_WID_UNO_VALIDAT,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),	SC_WID_UNO_VALILOC,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),	SC_WID_UNO_VALIXML,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((sal_Int32*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_WRITING),	ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
         {0,0,0,0,0,0}
     };
@@ -517,6 +524,7 @@ const SfxItemPropertySet* lcl_GetColumnPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS),	ATTR_HOR_JUSTIFY,	&getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN),	ATTR_BACKGROUND,	&getBooleanCppuType(),					0, MID_GRAPHIC_TRANSPARENT },
 //		{MAP_CHAR_LEN(SC_UNONAME_CELLFILT),	SC_WID_UNO_CELLFILT,&getBooleanCppuType(),					0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_MANPAGE),	SC_WID_UNO_MANPAGE,	&getBooleanCppuType(),					0, 0 },
@@ -542,7 +550,7 @@ const SfxItemPropertySet* lcl_GetColumnPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_POS),		SC_WID_UNO_POS,		&getCppuType((awt::Point*)0),			0 | beans::PropertyAttribute::READONLY, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),	ATTR_ROTATE_VALUE,	&getCppuType((sal_Int32*)0),			0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((sal_Int32*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),	ATTR_SHADOW,		&getCppuType((table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),			    0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SIZE),		SC_WID_UNO_SIZE,	&getCppuType((awt::Size*)0),			0 | beans::PropertyAttribute::READONLY, 0 },
@@ -552,7 +560,8 @@ const SfxItemPropertySet* lcl_GetColumnPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),	SC_WID_UNO_VALIDAT,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),	SC_WID_UNO_VALILOC,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),	SC_WID_UNO_VALIXML,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((sal_Int32*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLWID),	SC_WID_UNO_CELLWID,	&getCppuType((sal_Int32*)0),			0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_WRITING),	ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
         {0,0,0,0,0,0}
@@ -622,6 +631,7 @@ const SfxItemPropertySet* lcl_GetRowPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_CELLHGT),	SC_WID_UNO_CELLHGT,	&getCppuType((sal_Int32*)0),			0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS),	ATTR_HOR_JUSTIFY,	&getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN),	ATTR_BACKGROUND,	&getBooleanCppuType(),					0, MID_GRAPHIC_TRANSPARENT },
         {MAP_CHAR_LEN(SC_UNONAME_CELLFILT),	SC_WID_UNO_CELLFILT,&getBooleanCppuType(),					0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_MANPAGE),	SC_WID_UNO_MANPAGE,	&getBooleanCppuType(),					0, 0 },
@@ -647,7 +657,7 @@ const SfxItemPropertySet* lcl_GetRowPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_POS),		SC_WID_UNO_POS,		&getCppuType((awt::Point*)0),			0 | beans::PropertyAttribute::READONLY, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),	ATTR_ROTATE_VALUE,	&getCppuType((sal_Int32*)0),			0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((sal_Int32*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),	ATTR_SHADOW,		&getCppuType((table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),			    0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SIZE),		SC_WID_UNO_SIZE,	&getCppuType((awt::Size*)0),			0 | beans::PropertyAttribute::READONLY, 0 },
@@ -657,7 +667,8 @@ const SfxItemPropertySet* lcl_GetRowPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),	SC_WID_UNO_VALIDAT,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),	SC_WID_UNO_VALILOC,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),	SC_WID_UNO_VALIXML,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((sal_Int32*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_WRITING),	ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
         {0,0,0,0,0,0}
     };
@@ -730,6 +741,7 @@ const SfxItemPropertySet* lcl_GetSheetPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS),	ATTR_HOR_JUSTIFY,	&getCppuType((table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_ISACTIVE),	SC_WID_UNO_ISACTIVE,&getBooleanCppuType(),					0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN),	ATTR_BACKGROUND,	&getBooleanCppuType(),					0, MID_GRAPHIC_TRANSPARENT },
         {MAP_CHAR_LEN(SC_UNONAME_WRAP),		ATTR_LINEBREAK,		&getBooleanCppuType(),					0, 0 },
@@ -757,7 +769,7 @@ const SfxItemPropertySet* lcl_GetSheetPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_PROTECT),  SC_WID_UNO_PROTECT,	&getBooleanCppuType(),					0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),	ATTR_ROTATE_VALUE,	&getCppuType((sal_Int32*)0),			0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&getCppuType((sal_Int32*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),	ATTR_SHADOW,		&getCppuType((table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_SHOWBORD), SC_WID_UNO_SHOWBORD,&getBooleanCppuType(),					0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),               0, 0 },
@@ -769,7 +781,8 @@ const SfxItemPropertySet* lcl_GetSheetPropertySet()
         {MAP_CHAR_LEN(SC_UNONAME_VALIDAT),	SC_WID_UNO_VALIDAT,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALILOC),	SC_WID_UNO_VALILOC,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_VALIXML),	SC_WID_UNO_VALIXML,	&getCppuType((uno::Reference<beans::XPropertySet>*)0), 0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((table::CellVertJustify*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&getCppuType((sal_Int32*)0), 0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_WRITING),	ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_TABCOLOR), SC_WID_UNO_TABCOLOR, &getCppuType((sal_Int32*)0), 0, 0 },
         {MAP_CHAR_LEN(SC_UNO_CODENAME),        SC_WID_UNO_CODENAME, &getCppuType(static_cast< const rtl::OUString * >(0)),    0, 0},
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 6a16bf3..99bd659 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -50,7 +50,7 @@
 #include <rtl/uuid.h>
 
 #include <com/sun/star/table/BorderLine.hpp>
-#include <com/sun/star/table/CellVertJustify.hpp>
+#include <com/sun/star/table/CellVertJustify2.hpp>
 #include <com/sun/star/table/TableBorder.hpp>
 #include <com/sun/star/table/ShadowFormat.hpp>
 #include <com/sun/star/table/CellHoriJustify.hpp>
@@ -136,6 +136,7 @@ const SfxItemPropertySet* lcl_GetCellStyleSet()
         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_DISPNAME),	SC_WID_UNO_DISPNAME,&::getCppuType((rtl::OUString*)0),	beans::PropertyAttribute::READONLY, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS),	ATTR_HOR_JUSTIFY,	&::getCppuType((const table::CellHoriJustify*)0),	0, MID_HORJUST_HORJUST },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD), ATTR_HOR_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN),	ATTR_BACKGROUND,	&::getBooleanCppuType(),			0, MID_GRAPHIC_TRANSPARENT },
         {MAP_CHAR_LEN(SC_UNONAME_WRAP),		ATTR_LINEBREAK,		&::getBooleanCppuType(),			0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, LEFT_BORDER | CONVERT_TWIPS },
@@ -155,13 +156,14 @@ const SfxItemPropertySet* lcl_GetCellStyleSet()
         {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN),	ATTR_MARGIN,		&::getCppuType((const sal_Int32*)0),			0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, RIGHT_BORDER | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_ROTANG),	ATTR_ROTATE_VALUE,	&::getCppuType((const sal_Int32*)0),			0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&::getCppuType((const table::CellVertJustify*)0),	0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&::getCppuType((const sal_Int32*)0),	0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_SHADOW),	ATTR_SHADOW,		&::getCppuType((const table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),               0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_TBLBORD),	SC_WID_UNO_TBLBORD,	&::getCppuType((const table::TableBorder*)0),		0, 0 | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, TOP_BORDER | CONVERT_TWIPS },
         {MAP_CHAR_LEN(SC_UNONAME_USERDEF),	ATTR_USERDEF,		&getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
-        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&::getCppuType((const table::CellVertJustify*)0),	0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&::getCppuType((const sal_Int32*)0),	0, 0 },
+        {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD), ATTR_VER_JUSTIFY_METHOD, &::getCppuType((const sal_Int32*)0),   0, 0 },
         {MAP_CHAR_LEN(SC_UNONAME_WRITING),	ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
         {0,0,0,0,0,0}
     };
diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx
index c9df5c2..daad19d 100644
--- a/sc/source/ui/vba/vbaformat.cxx
+++ b/sc/source/ui/vba/vbaformat.cxx
@@ -31,7 +31,7 @@
 #include <ooo/vba/excel/XlOrientation.hpp>
 #include <ooo/vba/excel/Constants.hpp>
 #include <ooo/vba/excel/XRange.hpp>
-#include <com/sun/star/table/CellVertJustify.hpp>
+#include <com/sun/star/table/CellVertJustify2.hpp>
 #include <com/sun/star/table/CellHoriJustify.hpp>
 #include <com/sun/star/table/CellOrientation.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
@@ -86,21 +86,21 @@ ScVbaFormat<Ifc1>::setVerticalAlignment( const uno::Any& _oAlignment)   throw (s
         switch (nAlignment) 
         {
             case excel::XlVAlign::xlVAlignBottom :
-                aVal =  uno::makeAny( table::CellVertJustify_BOTTOM );
+                aVal =  uno::makeAny( table::CellVertJustify2::BOTTOM );
                 break;
             case excel::XlVAlign::xlVAlignCenter :
-                aVal = uno::makeAny( table::CellVertJustify_CENTER );
+                aVal = uno::makeAny( table::CellVertJustify2::CENTER );
                 break;
             case excel::XlVAlign::xlVAlignDistributed:
             case excel::XlVAlign::xlVAlignJustify:
-                aVal = uno::makeAny( table::CellVertJustify_STANDARD );
+                aVal = uno::makeAny( table::CellVertJustify2::STANDARD );
                 break;
     
             case excel::XlVAlign::xlVAlignTop:
-                aVal = uno::makeAny( table::CellVertJustify_TOP);
+                aVal = uno::makeAny( table::CellVertJustify2::TOP);
                 break;
             default:
-                aVal = uno::makeAny( table::CellVertJustify_STANDARD ); 
+                aVal = uno::makeAny( table::CellVertJustify2::STANDARD );
                 break;
         }
         mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLVJUS ) ), aVal );
@@ -120,20 +120,20 @@ ScVbaFormat<Ifc1>::getVerticalAlignment(  ) throw (script::BasicErrorException,
     {
         if (!isAmbiguous( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLVJUS ) ) ) )
         {
-            table::CellVertJustify aAPIAlignment;
+            sal_Int32 aAPIAlignment;
             mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLVJUS ) ) ) >>= aAPIAlignment;
             switch( aAPIAlignment )
             {
-                case table::CellVertJustify_BOTTOM:
+                case table::CellVertJustify2::BOTTOM:
                     aResult = uno::makeAny( excel::XlVAlign::xlVAlignBottom );
                     break;
-                case table::CellVertJustify_CENTER:
+                case table::CellVertJustify2::CENTER:
                     aResult = uno::makeAny( excel::XlVAlign::xlVAlignCenter );
                     break;
-                case table::CellVertJustify_STANDARD:
+                case table::CellVertJustify2::STANDARD:
                     aResult = uno::makeAny( excel::XlVAlign::xlVAlignBottom );
                     break;
-                case table::CellVertJustify_TOP:
+                case table::CellVertJustify2::TOP:
                     aResult = uno::makeAny( excel::XlVAlign::xlVAlignTop );
                     break;
                 default:
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index da9ea59..6ecc710 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -83,6 +83,7 @@
 #include <editeng/scripttypeitem.hxx>
 #include <svtools/colorcfg.hxx>
 #include <editeng/shaditem.hxx>
+#include <editeng/justifyitem.hxx>
 
 #include "formatsh.hxx"
 #include "sc.hrc"
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index b3c73b7..d9beec0 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -37,6 +37,7 @@
 #include <editeng/editview.hxx>
 #include <editeng/editstat.hxx>
 #include <editeng/flditem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svx/svdetc.hxx>
 #include <editeng/editobj.hxx>
 #include <sfx2/dispatch.hxx>
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index b717f7d..8c96d95 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -48,6 +48,7 @@
 #include <editeng/forbiddencharacterstable.hxx>
 #include <editeng/frmdiritem.hxx>
 #include <editeng/langitem.hxx>
+#include <editeng/justifyitem.hxx>
 #include <svx/rotmodit.hxx>
 #include <editeng/scripttypeitem.hxx>
 #include <editeng/udlnitem.hxx>
@@ -104,6 +105,8 @@ class ScDrawStringsVars
     SvxCellOrientation	eAttrOrient;
     SvxCellHorJustify	eAttrHorJust;
     SvxCellVerJustify	eAttrVerJust;
+    SvxCellJustifyMethod eAttrHorJustMethod;
+    SvxCellJustifyMethod eAttrVerJustMethod;
     const SvxMarginItem* pMargin;
     USHORT				nIndent;
     BOOL				bRotated;
@@ -146,6 +149,8 @@ public:
     SvxCellOrientation		GetOrient() const		{ return eAttrOrient; }
     SvxCellHorJustify		GetHorJust() const		{ return eAttrHorJust; }
     SvxCellVerJustify		GetVerJust() const		{ return eAttrVerJust; }
+    SvxCellJustifyMethod    GetHorJustMethod() const { return eAttrHorJustMethod; }
+    SvxCellJustifyMethod    GetVerJustMethod() const { return eAttrVerJustMethod; }
     const SvxMarginItem*	GetMargin() const		{ return pMargin; }
 
     USHORT	GetLeftTotal() const		{ return pMargin->GetLeftMargin() + nIndent; }
@@ -187,6 +192,8 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, BOOL bPTL) :
     eAttrOrient	( SVX_ORIENTATION_STANDARD ),
     eAttrHorJust( SVX_HOR_JUSTIFY_STANDARD ),
     eAttrVerJust( SVX_VER_JUSTIFY_BOTTOM ),
+    eAttrHorJustMethod( SVX_JUSTIFY_METHOD_AUTO ),
+    eAttrVerJustMethod( SVX_JUSTIFY_METHOD_AUTO ),
     pMargin		( NULL ),
     nIndent		( 0 ),
     bRotated	( FALSE ),
@@ -258,6 +265,22 @@ void ScDrawStringsVars::SetShrinkScale( long nScale, BYTE nScript )
     SetAutoText( aString );     // same text again, to get text size
 }
 
+namespace {
+
+template<typename _ItemType, typename _EnumType>
+_EnumType lcl_GetValue(const ScPatternAttr& rPattern, USHORT nWhich, const SfxItemSet* pCondSet)
+{
+    const _ItemType& rItem = static_cast<const _ItemType&>(rPattern.GetItem(nWhich, pCondSet));
+    return static_cast<_EnumType>(rItem.GetValue());
+}
+
+bool lcl_GetBoolValue(const ScPatternAttr& rPattern, USHORT nWhich, const SfxItemSet* pCondSet)
+{
+    return lcl_GetValue<SfxBoolItem, bool>(rPattern, nWhich, pCondSet);
+}
+
+}
+
 void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet* pSet,
                                     ScBaseCell* pCell, BYTE nScript )
 {
@@ -308,6 +331,11 @@ void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet*
     if ( eAttrVerJust == SVX_VER_JUSTIFY_STANDARD )
         eAttrVerJust = SVX_VER_JUSTIFY_BOTTOM;
 
+    // justification method
+
+    eAttrHorJustMethod = lcl_GetValue<SvxJustifyMethodItem, SvxCellJustifyMethod>(*pPattern, ATTR_HOR_JUSTIFY_METHOD, pCondSet);
+    eAttrVerJustMethod = lcl_GetValue<SvxJustifyMethodItem, SvxCellJustifyMethod>(*pPattern, ATTR_VER_JUSTIFY_METHOD, pCondSet);
+
     //	line break
 
     bLineBreak = ((const SfxBoolItem&)pPattern->GetItem( ATTR_LINEBREAK, pCondSet )).GetValue();
@@ -956,8 +984,12 @@ inline BOOL StringDiffer( const ScPatternAttr*& rpOldPattern, const ScPatternAtt
         return TRUE;
     else if ( &rpNewPattern->GetItem( ATTR_HOR_JUSTIFY ) != &rpOldPattern->GetItem( ATTR_HOR_JUSTIFY ) )
         return TRUE;
+    else if ( &rpNewPattern->GetItem( ATTR_HOR_JUSTIFY_METHOD ) != &rpOldPattern->GetItem( ATTR_HOR_JUSTIFY_METHOD ) )
+        return TRUE;
     else if ( &rpNewPattern->GetItem( ATTR_VER_JUSTIFY ) != &rpOldPattern->GetItem( ATTR_VER_JUSTIFY ) )
         return TRUE;
+    else if ( &rpNewPattern->GetItem( ATTR_VER_JUSTIFY_METHOD ) != &rpOldPattern->GetItem( ATTR_VER_JUSTIFY_METHOD ) )
+        return TRUE;
     else if ( &rpNewPattern->GetItem( ATTR_STACKED ) != &rpOldPattern->GetItem( ATTR_STACKED ) )
         return TRUE;
     else if ( &rpNewPattern->GetItem( ATTR_LINEBREAK ) != &rpOldPattern->GetItem( ATTR_LINEBREAK ) )
@@ -1643,6 +1675,12 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
                             bNeedEdit = ( nHeight > aAreaParam.maClipRect.GetHeight() );
                         }
                     }
+                    if (!bNeedEdit)
+                    {
+                        bNeedEdit =
+                            aVars.GetHorJust() == SVX_HOR_JUSTIFY_BLOCK &&
+                            aVars.GetHorJustMethod() == SVX_JUSTIFY_METHOD_DISTRIBUTE;
+                    }
                 }
                 if (bNeedEdit)
                 {
@@ -1735,6 +1773,7 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
                         switch (aVars.GetVerJust())
                         {
                             case SVX_VER_JUSTIFY_TOP:
+                            case SVX_VER_JUSTIFY_BLOCK:
                                 {
                                     long nTop = (long)( aVars.GetMargin()->GetTopMargin() * nPPTY );
                                     nJustPosY += nTop;
@@ -2081,10 +2120,267 @@ void ScOutputData::ShrinkEditEngine( EditEngine& rEngine, const Rectangle& rAlig
     }
 }
 
+namespace {
+
+class EditAlignmentParam
+{
+public:
+    SvxCellHorJustify       meHorJust;
+    SvxCellVerJustify       meVerJust;
+    SvxCellJustifyMethod    meHorJustMethod;
+    SvxCellJustifyMethod    meVerJustMethod;
+    SvxCellOrientation      meOrient;
+    bool                    mbBreak;
+    bool                    mbCellIsValue;
+    bool                    mbAsianVertical;
+
+    explicit EditAlignmentParam(const ScPatternAttr* pPattern, const SfxItemSet* pCondSet, bool bCellIsValue);
+
+    void calcMargins(long& rTop, long& rLeft, long& rBottom, long& rRight, double nPPTX, double nPPTY) const;
+    void calcPaperSize(Size& rPaperSize, const Rectangle& rAlignRect, double nPPTX, double nPPTY) const;
+    void getEngineSize(ScFieldEditEngine* pEngine, long& rWidth, long& rHeight) const;
+    long getEngineWidth(ScFieldEditEngine* pEngine) const;
+    bool hasLineBreak() const;
+
+    /**
+     * When the text is vertically oriented, the text is either rotated 90
+     * degrees to the right or 90 degrees to the left.   Note that this is
+     * different from being vertically stacked.
+     */
+    bool isVerticallyOriented() const;
+
+    void setAlignmentItems(ScFieldEditEngine* pEngine, ScBaseCell* pCell);
+    bool adjustHorAlignment(ScFieldEditEngine* pEngine);
+
+private:
+    const ScPatternAttr*    mpPattern;
+    const SfxItemSet*       mpCondSet;
+};
+
+EditAlignmentParam::EditAlignmentParam(const ScPatternAttr* pPattern, const SfxItemSet* pCondSet, bool bCellIsValue) :
+    meHorJust( lcl_GetValue<SvxHorJustifyItem, SvxCellHorJustify>(*pPattern, ATTR_HOR_JUSTIFY, pCondSet) ),
+    meVerJust( lcl_GetValue<SvxVerJustifyItem, SvxCellVerJustify>(*pPattern, ATTR_VER_JUSTIFY, pCondSet) ),
+    meHorJustMethod( lcl_GetValue<SvxJustifyMethodItem, SvxCellJustifyMethod>(*pPattern, ATTR_HOR_JUSTIFY_METHOD, pCondSet) ),
+    meVerJustMethod( lcl_GetValue<SvxJustifyMethodItem, SvxCellJustifyMethod>(*pPattern, ATTR_VER_JUSTIFY_METHOD, pCondSet) ),
+    meOrient( pPattern->GetCellOrientation(pCondSet) ),
+    mbBreak( (meHorJust == SVX_HOR_JUSTIFY_BLOCK) || lcl_GetBoolValue(*pPattern, ATTR_LINEBREAK, pCondSet) ),
+    mbCellIsValue(bCellIsValue),
+    mpPattern(pPattern),
+    mpCondSet(pCondSet)
+{}
+
+void EditAlignmentParam::calcMargins(long& rTopM, long& rLeftM, long& rBottomM, long& rRightM, double nPPTX, double nPPTY) const
+{
+    const SvxMarginItem& rMargin =
+        static_cast<const SvxMarginItem&>(mpPattern->GetItem(ATTR_MARGIN, mpCondSet));
+
+    USHORT nIndent = 0;
+    if (meHorJust == SVX_HOR_JUSTIFY_LEFT)
+        nIndent = lcl_GetValue<SfxUInt16Item, USHORT>(*mpPattern, ATTR_INDENT, mpCondSet);
+
+    rLeftM   = static_cast<long>(((rMargin.GetLeftMargin() + nIndent) * nPPTX));
+    rTopM    = static_cast<long>((rMargin.GetTopMargin() * nPPTY));
+    rRightM  = static_cast<long>((rMargin.GetRightMargin() * nPPTX));
+    rBottomM = static_cast<long>((rMargin.GetBottomMargin() * nPPTY));
+}
+
+void EditAlignmentParam::calcPaperSize(
+    Size& rPaperSize, const Rectangle& rAlignRect, double nPPTX, double nPPTY) const
+{
+    long nTopM, nLeftM, nBottomM, nRightM;
+    calcMargins(nTopM, nLeftM, nBottomM, nRightM, nPPTX, nPPTY);
+
+    if (isVerticallyOriented())
+    {
+        rPaperSize.Width() = rAlignRect.GetHeight() - nTopM - nBottomM;
+        rPaperSize.Height() = rAlignRect.GetWidth() - nLeftM - nRightM;
+    }
+    else
+    {
+        rPaperSize.Width() = rAlignRect.GetWidth() - nLeftM - nRightM;
+        rPaperSize.Height() = rAlignRect.GetHeight() - nTopM - nBottomM;
+    }
+
+    if (mbAsianVertical)
+    {
+        rPaperSize.Height() = rAlignRect.GetHeight() - nTopM - nBottomM;
+        // Subtract some extra value from the height or else the text would go
+        // outside the cell area.  The value of 5 is arbitrary, and is based
+        // entirely on heuristics.
+        rPaperSize.Height() -= 5;
+    }
+}
+
+void EditAlignmentParam::getEngineSize(ScFieldEditEngine* pEngine, long& rWidth, long& rHeight) const
+{
+    long nEngineWidth = 0;
+    if (!mbBreak || meOrient == SVX_ORIENTATION_STACKED || mbAsianVertical)
+        nEngineWidth = static_cast<long>(pEngine->CalcTextWidth());
+
+    long nEngineHeight = pEngine->GetTextHeight();
+
+    if (isVerticallyOriented())
+    {
+        long nTemp = nEngineWidth;
+        nEngineWidth = nEngineHeight;
+        nEngineHeight = nTemp;
+    }
+
+    if (meOrient == SVX_ORIENTATION_STACKED)
+        nEngineWidth = nEngineWidth * 11 / 10;
+
+    rWidth = nEngineWidth;
+    rHeight = nEngineHeight;
+}
+
+long EditAlignmentParam::getEngineWidth(ScFieldEditEngine* pEngine) const
+{
+    if (mbBreak && meOrient != SVX_ORIENTATION_STACKED && !mbAsianVertical)
+        return 0;
+    else
+        return static_cast<long>(pEngine->CalcTextWidth());
+}
+
+bool EditAlignmentParam::hasLineBreak() const
+{
+    return (mbBreak || (meOrient == SVX_ORIENTATION_STACKED) || mbAsianVertical);
+}
+
+bool EditAlignmentParam::isVerticallyOriented() const
+{
+    return (meOrient == SVX_ORIENTATION_TOPBOTTOM || meOrient == SVX_ORIENTATION_BOTTOMTOP);
+}
+
+void EditAlignmentParam::setAlignmentItems(ScFieldEditEngine* pEngine, ScBaseCell* pCell)
+{
+    if (isVerticallyOriented() || mbAsianVertical)
+    {
+        SvxAdjust eSvxAdjust = SVX_ADJUST_LEFT;
+        switch (meVerJust)
+        {
+            case SVX_VER_JUSTIFY_TOP:
+                eSvxAdjust = (meOrient == SVX_ORIENTATION_TOPBOTTOM || mbAsianVertical) ?
+                            SVX_ADJUST_LEFT : SVX_ADJUST_RIGHT;
+                break;
+            case SVX_VER_JUSTIFY_CENTER:
+                eSvxAdjust = SVX_ADJUST_CENTER;
+                break;
+            case SVX_VER_JUSTIFY_BOTTOM:
+            case SVX_VER_JUSTIFY_STANDARD:
+                eSvxAdjust = (meOrient == SVX_ORIENTATION_TOPBOTTOM || mbAsianVertical) ?
+                            SVX_ADJUST_RIGHT : SVX_ADJUST_LEFT;
+                break;
+            case SVX_VER_JUSTIFY_BLOCK:
+                eSvxAdjust = SVX_ADJUST_BLOCK;
+                break;
+        }
+
+        pEngine->SetDefaultItem( SvxAdjustItem(eSvxAdjust, EE_PARA_JUST) );
+        pEngine->SetDefaultItem( SvxJustifyMethodItem(meVerJustMethod, EE_PARA_JUST_METHOD) );
+
+        if (meHorJust == SVX_HOR_JUSTIFY_BLOCK)
+            pEngine->SetDefaultItem( SvxVerJustifyItem(SVX_VER_JUSTIFY_BLOCK, EE_PARA_VER_JUST) );
+    }
+    else
+    {
+        //	horizontal alignment now may depend on cell content
+        //	(for values with number formats with mixed script types)
+        //	-> always set adjustment
+
+        SvxAdjust eSvxAdjust = SVX_ADJUST_LEFT;
+        if (meOrient == SVX_ORIENTATION_STACKED)
+            eSvxAdjust = SVX_ADJUST_CENTER;
+        else if (mbBreak)
+        {
+            if (meOrient == SVX_ORIENTATION_STANDARD)
+                switch (meHorJust)
+                {
+                    case SVX_HOR_JUSTIFY_STANDARD:
+                        eSvxAdjust = mbCellIsValue ? SVX_ADJUST_RIGHT : SVX_ADJUST_LEFT;
+                        break;
+                    case SVX_HOR_JUSTIFY_LEFT:
+                    case SVX_HOR_JUSTIFY_REPEAT:			// nicht implementiert
+                        eSvxAdjust = SVX_ADJUST_LEFT;
+                        break;
+                    case SVX_HOR_JUSTIFY_RIGHT:
+                        eSvxAdjust = SVX_ADJUST_RIGHT;
+                        break;
+                    case SVX_HOR_JUSTIFY_CENTER:
+                        eSvxAdjust = SVX_ADJUST_CENTER;
+                        break;
+                    case SVX_HOR_JUSTIFY_BLOCK:
+                        eSvxAdjust = SVX_ADJUST_BLOCK;
+                        break;
+                }
+            else
+                switch (meVerJust)
+                {
+                    case SVX_VER_JUSTIFY_TOP:
+                        eSvxAdjust = SVX_ADJUST_RIGHT;
+                        break;
+                    case SVX_VER_JUSTIFY_CENTER:
+                        eSvxAdjust = SVX_ADJUST_CENTER;
+                        break;
+                    case SVX_VER_JUSTIFY_BOTTOM:
+                    case SVX_VER_JUSTIFY_STANDARD:
+                        eSvxAdjust = SVX_ADJUST_LEFT;
+                        break;
+                    case SVX_VER_JUSTIFY_BLOCK:
+                        eSvxAdjust = SVX_ADJUST_BLOCK;
+                        break;
+                }
+        }
+
+        pEngine->SetDefaultItem( SvxAdjustItem(eSvxAdjust, EE_PARA_JUST) );
+
+        if (mbAsianVertical)
+        {
+            pEngine->SetDefaultItem( SvxJustifyMethodItem(meVerJustMethod, EE_PARA_JUST_METHOD) );
+            if (meHorJust == SVX_HOR_JUSTIFY_BLOCK)
+                pEngine->SetDefaultItem( SvxVerJustifyItem(SVX_VER_JUSTIFY_BLOCK, EE_PARA_VER_JUST) );
+        }
+        else
+        {
+            pEngine->SetDefaultItem( SvxJustifyMethodItem(meHorJustMethod, EE_PARA_JUST_METHOD) );
+            if (meVerJust == SVX_VER_JUSTIFY_BLOCK)
+                pEngine->SetDefaultItem( SvxVerJustifyItem(SVX_VER_JUSTIFY_BLOCK, EE_PARA_VER_JUST) );
+        }
+    }
+
+    pEngine->SetVertical(mbAsianVertical);
+    if (pCell && pCell->GetCellType() == CELLTYPE_EDIT)
+    {
+        // We need to synchronize the vertical mode in the EditTextObject
+        // instance too.  No idea why we keep this state in two separate
+        // instances.
+        ScEditCell* pEditCell = static_cast<ScEditCell*>(pCell);
+        const EditTextObject* pData = pEditCell->GetData();
+        if (pData)
+            const_cast<EditTextObject*>(pData)->SetVertical(mbAsianVertical);
+    }
+}
+
+bool EditAlignmentParam::adjustHorAlignment(ScFieldEditEngine* pEngine)
+{
+    if (meHorJust == SVX_HOR_JUSTIFY_RIGHT || meHorJust == SVX_HOR_JUSTIFY_CENTER ||
+        (meHorJust == SVX_HOR_JUSTIFY_STANDARD && mbCellIsValue))
+    {
+        SvxAdjust eEditAdjust = (meHorJust == SVX_HOR_JUSTIFY_CENTER) ?
+            SVX_ADJUST_CENTER : SVX_ADJUST_RIGHT;
+
+        pEngine->SetUpdateMode(false);
+        pEngine->SetDefaultItem( SvxAdjustItem(eEditAdjust, EE_PARA_JUST) );
+        pEngine->SetUpdateMode(true);
+        return true;
+    }
+    return false;
+}
+
+}
+
 void ScOutputData::DrawEdit(BOOL bPixelToLogic)
 {
     vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, pDev->GetExtOutDevData() );
-
     Size aMinSize = pRefDevice->PixelToLogic(Size(0,100));		// erst darueber wird ausgegeben
 //    UINT32 nMinHeight = aMinSize.Height() / 200;                // 1/2 Pixel
 
@@ -2233,86 +2529,55 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
                         else
                             lcl_ClearEdit( *pEngine );		// also calls SetUpdateMode(FALSE)
 
+                        EditAlignmentParam aAlignParam(pPattern, pCondSet, lcl_SafeIsValue(pCell));
 
-                        BOOL bCellIsValue = lcl_SafeIsValue(pCell);
+                        bool bRepeat = (aAlignParam.meHorJust == SVX_HOR_JUSTIFY_REPEAT && !aAlignParam.mbBreak);
+                        bool bShrink = !aAlignParam.mbBreak && !bRepeat && lcl_GetBoolValue(*pPattern, ATTR_SHRINKTOFIT, pCondSet);
+                        long nAttrRotate = lcl_GetValue<SfxInt32Item, long>(*pPattern, ATTR_ROTATE_VALUE, pCondSet);
 
-                        SvxCellHorJustify eHorJust = (SvxCellHorJustify)((const SvxHorJustifyItem&)
-                                            pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet)).GetValue();
-                        BOOL bBreak = ( eHorJust == SVX_HOR_JUSTIFY_BLOCK ) ||
-                                        ((const SfxBoolItem&)pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue();
-                        BOOL bRepeat = ( eHorJust == SVX_HOR_JUSTIFY_REPEAT && !bBreak );
-                        BOOL bShrink = !bBreak && !bRepeat && static_cast<const SfxBoolItem&>
-                                        (pPattern->GetItem( ATTR_SHRINKTOFIT, pCondSet )).GetValue();
-                        SvxCellOrientation eOrient = pPattern->GetCellOrientation( pCondSet );
-                        long nAttrRotate = ((const SfxInt32Item&)pPattern->
-                                            GetItem(ATTR_ROTATE_VALUE, pCondSet)).GetValue();
-                        if ( eHorJust == SVX_HOR_JUSTIFY_REPEAT )
+                        if ( aAlignParam.meHorJust == SVX_HOR_JUSTIFY_REPEAT )
                         {
                             // ignore orientation/rotation if "repeat" is active
-                            eOrient = SVX_ORIENTATION_STANDARD;
+                            aAlignParam.meOrient = SVX_ORIENTATION_STANDARD;
                             nAttrRotate = 0;
 
                             // #i31843# "repeat" with "line breaks" is treated as default alignment
                             // (but rotation is still disabled)
-                            if ( bBreak )
-                                eHorJust = SVX_HOR_JUSTIFY_STANDARD;
+                            if ( aAlignParam.mbBreak )
+                                aAlignParam.meHorJust = SVX_HOR_JUSTIFY_STANDARD;
                         }
-                        if ( eOrient==SVX_ORIENTATION_STANDARD && nAttrRotate )
+                        if ( aAlignParam.meOrient==SVX_ORIENTATION_STANDARD && nAttrRotate )
                         {
                             //!	Flag setzen, um die Zelle in DrawRotated wiederzufinden ?
                             //!	(oder Flag schon bei DrawBackground, dann hier keine Abfrage)
                             bHidden = TRUE;		// gedreht wird getrennt ausgegeben
                         }
 
-                        BOOL bAsianVertical = ( eOrient == SVX_ORIENTATION_STACKED &&
-                                ((const SfxBoolItem&)pPattern->GetItem( ATTR_VERTICAL_ASIAN, pCondSet )).GetValue() );
-                        if ( bAsianVertical )
+                        aAlignParam.mbAsianVertical = (aAlignParam.meOrient == SVX_ORIENTATION_STACKED) &&
+                            lcl_GetBoolValue(*pPattern, ATTR_VERTICAL_ASIAN, pCondSet);
+
+                        if ( aAlignParam.mbAsianVertical )
                         {
                             // in asian mode, use EditEngine::SetVertical instead of EE_CNTRL_ONECHARPERLINE
-                            eOrient = SVX_ORIENTATION_STANDARD;
+                            aAlignParam.meOrient = SVX_ORIENTATION_STANDARD;
                             // default alignment for asian vertical mode is top-right
-                            if ( eHorJust == SVX_HOR_JUSTIFY_STANDARD )
-                                eHorJust = SVX_HOR_JUSTIFY_RIGHT;
+                            if ( aAlignParam.meHorJust == SVX_HOR_JUSTIFY_STANDARD )
+                                aAlignParam.meHorJust = SVX_HOR_JUSTIFY_RIGHT;
                         }
 
-
-
                         SvxCellHorJustify eOutHorJust =
-                            ( eHorJust != SVX_HOR_JUSTIFY_STANDARD ) ? eHorJust :
-                            ( bCellIsValue ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT );
+                            ( aAlignParam.meHorJust != SVX_HOR_JUSTIFY_STANDARD ) ? aAlignParam.meHorJust :
+                            ( aAlignParam.mbCellIsValue ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT );
 
                         if ( eOutHorJust == SVX_HOR_JUSTIFY_BLOCK || eOutHorJust == SVX_HOR_JUSTIFY_REPEAT )
                             eOutHorJust = SVX_HOR_JUSTIFY_LEFT;		// repeat is not yet implemented
 
-
-//!						if ( !bHidden && eType == OUTTYPE_PRINTER &&
-//!							pDev->GetOutDevType() == OUTDEV_WINDOW &&
-//!							((const SvxFontHeightItem&)pPattern->
-//!							GetItem(ATTR_FONT_HEIGHT)).GetHeight() <= nMinHeight )
-//!						{
-//!							Point aPos( nStartX, nStartY );
-//!							pDev->DrawPixel( aPos,
-//!											((const SvxColorItem&)pPattern->
-//!											GetItem( ATTR_FONT_COLOR )).GetValue() );
-//!							bHidden = TRUE;
-//!						}
-
                         if (!bHidden)
                         {
                             //!	mirror margin values for RTL?
                             //!	move margin down to after final GetOutputArea call
-
-                            const SvxMarginItem* pMargin = (const SvxMarginItem*)
-                                                    &pPattern->GetItem(ATTR_MARGIN, pCondSet);
-                            USHORT nIndent = 0;
-                            if ( eHorJust == SVX_HOR_JUSTIFY_LEFT )
-                                nIndent = ((const SfxUInt16Item&)pPattern->
-                                                    GetItem(ATTR_INDENT, pCondSet)).GetValue();
-
-                            long nLeftM = (long) ( (pMargin->GetLeftMargin() + nIndent) * nPPTX );
-                            long nTopM  = (long) ( pMargin->GetTopMargin() * nPPTY );
-                            long nRightM = (long) ( pMargin->GetRightMargin() * nPPTX );
-                            long nBottomM = (long) ( pMargin->GetBottomMargin() * nPPTY );
+                            long nTopM, nLeftM, nBottomM, nRightM;
+                            aAlignParam.calcMargins(nTopM, nLeftM, nBottomM, nRightM, nPPTX, nPPTY);
 
                             SCCOL nXForPos = nX;
                             if ( nXForPos < nX1 )
@@ -2334,36 +2599,22 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
                             //
 
                             Size aPaperSize = Size( 1000000, 1000000 );
-                            if ( bBreak || eOrient == SVX_ORIENTATION_STACKED || bAsianVertical )
+                            if (aAlignParam.hasLineBreak())
                             {
-                                //!	also stacked, AsianVertical
-
                                 //	call GetOutputArea with nNeeded=0, to get only the cell width
 
                                 //!	handle nArrY == 0
                                 GetOutputArea( nXForPos, nArrYForPos, nPosX, nPosY, nCellX, nCellY, 0,
                                                *pPattern, sal::static_int_cast<USHORT>(eOutHorJust),
-                                               bCellIsValue, true, false, aAreaParam );
+                                               aAlignParam.mbCellIsValue, true, false, aAreaParam );
 
                                 //! special ScEditUtil handling if formatting for printer
-
-                                if ( eOrient == SVX_ORIENTATION_TOPBOTTOM || eOrient == SVX_ORIENTATION_BOTTOMTOP )
-                                    aPaperSize.Width() = aAreaParam.maAlignRect.GetHeight() - nTopM - nBottomM;
-                                else
-                                    aPaperSize.Width() = aAreaParam.maAlignRect.GetWidth() - nLeftM - nRightM;
-
-                                if (bAsianVertical && bBreak)
-                                {
-                                    //	add some extra height (default margin value) for safety
-                                    //	as long as GetEditArea isn't used below
-                                    long nExtraHeight = (long)( 20 * nPPTY );
-                                    aPaperSize.Height() = aAreaParam.maAlignRect.GetHeight() - nTopM - nBottomM + nExtraHeight;
-                                }
+                                aAlignParam.calcPaperSize(aPaperSize, aAreaParam.maAlignRect, nPPTX, nPPTY);
                             }
                             if (bPixelToLogic)
                             {
                                 Size aLogicSize = pRefDevice->PixelToLogic(aPaperSize);
-                                if ( bBreak && !bAsianVertical && pRefDevice != pFmtDevice )
+                                if ( aAlignParam.mbBreak && !aAlignParam.mbAsianVertical && pRefDevice != pFmtDevice )
                                 {
                                     // #i85342# screen display and formatting for printer,
                                     // use same GetEditArea call as in ScViewData::SetEditEngine
@@ -2382,12 +2633,9 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
                             //	Fill the EditEngine (cell attributes and text)
                             //
 
-                            SvxCellVerJustify eVerJust = (SvxCellVerJustify)((const SvxVerJustifyItem&)
-                                                pPattern->GetItem(ATTR_VER_JUSTIFY, pCondSet)).GetValue();
-
                             // default alignment for asian vertical mode is top-right
-                            if ( bAsianVertical && eVerJust == SVX_VER_JUSTIFY_STANDARD )
-                                eVerJust = SVX_VER_JUSTIFY_TOP;
+                            if ( aAlignParam.mbAsianVertical && aAlignParam.meVerJust == SVX_VER_JUSTIFY_STANDARD )
+                                aAlignParam.meVerJust = SVX_VER_JUSTIFY_TOP;
 
                             // syntax highlighting mode is ignored here
                             // StringDiffer doesn't look at hyphenate, language items
@@ -2401,7 +2649,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
                                 pOldCondSet = pCondSet;
 
                                 ULONG nControl = pEngine->GetControlWord();
-                                if (eOrient==SVX_ORIENTATION_STACKED)
+                                if (aAlignParam.meOrient==SVX_ORIENTATION_STACKED)
                                     nControl |= EE_CNTRL_ONECHARPERLINE;
                                 else
                                     nControl &= ~EE_CNTRL_ONECHARPERLINE;
@@ -2422,53 +2670,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
                                 pEngine->SetBackgroundColor( aBackCol );
                             }
 
-                            //	horizontal alignment now may depend on cell content
-                            //	(for values with number formats with mixed script types)
-                            //	-> always set adjustment
-
-                            SvxAdjust eSvxAdjust = SVX_ADJUST_LEFT;
-                            if (eOrient==SVX_ORIENTATION_STACKED)
-                                eSvxAdjust = SVX_ADJUST_CENTER;
-                            else if (bBreak)
-                            {
-                                if (eOrient==SVX_ORIENTATION_STANDARD && !bAsianVertical)
-                                    switch (eHorJust)
-                                    {
-                                        case SVX_HOR_JUSTIFY_STANDARD:
-                                            eSvxAdjust = bCellIsValue ? SVX_ADJUST_RIGHT : SVX_ADJUST_LEFT;
-                                            break;
-                                        case SVX_HOR_JUSTIFY_LEFT:
-                                        case SVX_HOR_JUSTIFY_REPEAT:			// nicht implementiert
-                                            eSvxAdjust = SVX_ADJUST_LEFT;
-                                            break;
-                                        case SVX_HOR_JUSTIFY_RIGHT:
-                                            eSvxAdjust = SVX_ADJUST_RIGHT;
-                                            break;
-                                        case SVX_HOR_JUSTIFY_CENTER:
-                                            eSvxAdjust = SVX_ADJUST_CENTER;
-                                            break;
-                                        case SVX_HOR_JUSTIFY_BLOCK:
-                                            eSvxAdjust = SVX_ADJUST_BLOCK;
-                                            break;
-                                    }
-                                else
-                                    switch (eVerJust)
-                                    {
-                                        case SVX_VER_JUSTIFY_TOP:
-                                            eSvxAdjust = (eOrient==SVX_ORIENTATION_TOPBOTTOM || bAsianVertical) ?
-                                                        SVX_ADJUST_LEFT : SVX_ADJUST_RIGHT;
-                                            break;
-                                        case SVX_VER_JUSTIFY_CENTER:
-                                            eSvxAdjust = SVX_ADJUST_CENTER;
-                                            break;
-                                        case SVX_VER_JUSTIFY_BOTTOM:
-                                        case SVX_HOR_JUSTIFY_STANDARD:
-                                            eSvxAdjust = (eOrient==SVX_ORIENTATION_TOPBOTTOM || bAsianVertical) ?
-                                                        SVX_ADJUST_RIGHT : SVX_ADJUST_LEFT;
-                                            break;
-                                    }
-                            }
-                            pEngine->SetDefaultItem( SvxAdjustItem( eSvxAdjust, EE_PARA_JUST ) );
+                            aAlignParam.setAlignmentItems(pEngine, pCell);
 
                             //	Read content from cell
 
@@ -2484,7 +2686,7 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
                                     {
                                         pEngine->SetText(*pData);
 
-                                        if ( bBreak && !bAsianVertical && pData->HasField() )
+                                        if ( aAlignParam.mbBreak && !aAlignParam.mbAsianVertical && pData->HasField() )
                                         {
                                             //	Fields aren't wrapped, so clipping is enabled to prevent
                                             //	a field from being drawn beyond the cell size
@@ -2525,53 +2727,36 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
                                 DBG_ERROR("pCell == NULL");
                             }
 
-                            pEngine->SetVertical( bAsianVertical );
                             pEngine->SetUpdateMode( TRUE );		// after SetText, before CalcTextWidth/GetTextHeight
 
                             //
                             //	Get final output area using the calculated width
                             //
 
-                            long nEngineWidth;

... etc. - the rest is truncated


More information about the ooo-build-commit mailing list