summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-10-05 11:24:49 -0400
committerKohei Yoshida <kyoshida@novell.com>2010-10-05 11:24:49 -0400
commit2efcf2da2055ad1cb3b00031b19145f8b104b122 (patch)
tree3da09abcea30ffcc4b3160bcbe8fde8f97d3696b /editeng
parente0185db43409456a5ccf47bd1f879888a5b04783 (diff)
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.
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/editeng/editids.hrc4
-rw-r--r--editeng/inc/editeng/editrids.hrc20
-rw-r--r--editeng/inc/editeng/eeitem.hxx86
-rw-r--r--editeng/inc/editeng/justifyitem.hxx127
-rw-r--r--editeng/inc/editeng/memberids.hrc4
-rw-r--r--editeng/inc/editeng/svxenum.hxx9
-rw-r--r--editeng/source/editeng/editdoc.cxx16
-rw-r--r--editeng/source/editeng/eerdll.cxx93
-rwxr-xr-xediteng/source/editeng/impedit.hxx4
-rwxr-xr-xediteng/source/editeng/impedit2.cxx15
-rw-r--r--editeng/source/editeng/impedit3.cxx99
-rw-r--r--editeng/source/items/frmitems.cxx2
-rw-r--r--editeng/source/items/justifyitem.cxx484
-rw-r--r--editeng/source/items/makefile.mk1
-rw-r--r--editeng/source/items/svxitems.src51
15 files changed, 905 insertions, 110 deletions
diff --git a/editeng/inc/editeng/editids.hrc b/editeng/inc/editeng/editids.hrc
index 49629a46c2f9..b0cedbd29fa1 100644
--- a/editeng/inc/editeng/editids.hrc
+++ b/editeng/inc/editeng/editids.hrc
@@ -129,6 +129,10 @@
// this ID didn't exist prior to the svx split
#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 )
+#define SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD ( SID_EDIT_START + 69 )
+#define SID_ATTR_ALIGN_VER_JUSTIFY_METHOD ( SID_EDIT_START + 70 )
+#define SID_ATTR_ALIGN_HOR_JUSTIFY ( SID_EDIT_START + 71 )
+#define SID_ATTR_ALIGN_VER_JUSTIFY ( SID_EDIT_START + 72 )
/*
// planned, but not doable: changing value of SIDs will break code that uses them for WhichRanges
diff --git a/editeng/inc/editeng/editrids.hrc b/editeng/inc/editeng/editrids.hrc
index dcef661d01b8..1b539531ebd7 100644
--- a/editeng/inc/editeng/editrids.hrc
+++ b/editeng/inc/editeng/editrids.hrc
@@ -420,7 +420,25 @@
#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION (RID_EDIT_START + 314)
#define RID_SVXSTR_A11Y_IMAGEBULLET_NAME (RID_EDIT_START + 315)
-#if 315 > (RID_EDIT_END-RID_EDIT_START)
+// enum SvxCellHorJustify
+#define RID_SVXITEMS_HORJUST_STANDARD (RID_EDIT_START + 316)
+#define RID_SVXITEMS_HORJUST_LEFT (RID_EDIT_START + 317)
+#define RID_SVXITEMS_HORJUST_CENTER (RID_EDIT_START + 318)
+#define RID_SVXITEMS_HORJUST_RIGHT (RID_EDIT_START + 319)
+#define RID_SVXITEMS_HORJUST_BLOCK (RID_EDIT_START + 320)
+#define RID_SVXITEMS_HORJUST_REPEAT (RID_EDIT_START + 321)
+
+// enum SvxCellVerJustify
+#define RID_SVXITEMS_VERJUST_STANDARD (RID_EDIT_START + 322)
+#define RID_SVXITEMS_VERJUST_TOP (RID_EDIT_START + 323)
+#define RID_SVXITEMS_VERJUST_CENTER (RID_EDIT_START + 324)
+#define RID_SVXITEMS_VERJUST_BOTTOM (RID_EDIT_START + 325)
+
+// enum SvxCellJustifyMethod
+#define RID_SVXITEMS_JUSTMETHOD_AUTO (RID_EDIT_START + 326)
+#define RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE (RID_EDIT_START + 327)
+
+#if 327 > (RID_EDIT_END-RID_EDIT_START)
#error Resource-Ueberlauf in #line, #file
#endif
diff --git a/editeng/inc/editeng/eeitem.hxx b/editeng/inc/editeng/eeitem.hxx
index 3b4897fd86ed..87b4b35bbeef 100644
--- a/editeng/inc/editeng/eeitem.hxx
+++ b/editeng/inc/editeng/eeitem.hxx
@@ -30,7 +30,7 @@
#define EE_ITEMS_START 3989
-// Absatzattribute:
+// Paragraph attributes:
#define EE_PARA_START (EE_ITEMS_START+0)
#define EE_PARA_WRITINGDIR (EE_ITEMS_START+0)
#define EE_PARA_XMLATTRIBS (EE_ITEMS_START+1)
@@ -48,51 +48,53 @@
#define EE_PARA_SBL (EE_ITEMS_START+13)
#define EE_PARA_JUST (EE_ITEMS_START+14)
#define EE_PARA_TABS (EE_ITEMS_START+15)
-#define EE_PARA_END (EE_ITEMS_START+15)
+#define EE_PARA_JUST_METHOD (EE_ITEMS_START+16)
+#define EE_PARA_VER_JUST (EE_ITEMS_START+17)
+#define EE_PARA_END (EE_ITEMS_START+17)
-// Zeichenattribute:
-#define EE_CHAR_START (EE_ITEMS_START+16)
-#define EE_CHAR_COLOR (EE_ITEMS_START+16)
-#define EE_CHAR_FONTINFO (EE_ITEMS_START+17)
-#define EE_CHAR_FONTHEIGHT (EE_ITEMS_START+18)
-#define EE_CHAR_FONTWIDTH (EE_ITEMS_START+19)
-#define EE_CHAR_WEIGHT (EE_ITEMS_START+20)
-#define EE_CHAR_UNDERLINE (EE_ITEMS_START+21)
-#define EE_CHAR_STRIKEOUT (EE_ITEMS_START+22)
-#define EE_CHAR_ITALIC (EE_ITEMS_START+23)
-#define EE_CHAR_OUTLINE (EE_ITEMS_START+24)
-#define EE_CHAR_SHADOW (EE_ITEMS_START+25)
-#define EE_CHAR_ESCAPEMENT (EE_ITEMS_START+26)
-#define EE_CHAR_PAIRKERNING (EE_ITEMS_START+27)
-#define EE_CHAR_KERNING (EE_ITEMS_START+28)
-#define EE_CHAR_WLM (EE_ITEMS_START+29)
-#define EE_CHAR_LANGUAGE (EE_ITEMS_START+30)
-#define EE_CHAR_LANGUAGE_CJK (EE_ITEMS_START+31)
-#define EE_CHAR_LANGUAGE_CTL (EE_ITEMS_START+32)
-#define EE_CHAR_FONTINFO_CJK (EE_ITEMS_START+33)
-#define EE_CHAR_FONTINFO_CTL (EE_ITEMS_START+34)
-#define EE_CHAR_FONTHEIGHT_CJK (EE_ITEMS_START+35)
-#define EE_CHAR_FONTHEIGHT_CTL (EE_ITEMS_START+36)
-#define EE_CHAR_WEIGHT_CJK (EE_ITEMS_START+37)
-#define EE_CHAR_WEIGHT_CTL (EE_ITEMS_START+38)
-#define EE_CHAR_ITALIC_CJK (EE_ITEMS_START+39)
-#define EE_CHAR_ITALIC_CTL (EE_ITEMS_START+40)
-#define EE_CHAR_EMPHASISMARK (EE_ITEMS_START+41)
-#define EE_CHAR_RELIEF (EE_ITEMS_START+42)
-#define EE_CHAR_RUBI_DUMMY (EE_ITEMS_START+43)
-#define EE_CHAR_XMLATTRIBS (EE_ITEMS_START+44)
-#define EE_CHAR_OVERLINE (EE_ITEMS_START+45)
-#define EE_CHAR_END (EE_ITEMS_START+45)
+// Character attributes:
+#define EE_CHAR_START (EE_ITEMS_START+18)
+#define EE_CHAR_COLOR (EE_ITEMS_START+18)
+#define EE_CHAR_FONTINFO (EE_ITEMS_START+19)
+#define EE_CHAR_FONTHEIGHT (EE_ITEMS_START+20)
+#define EE_CHAR_FONTWIDTH (EE_ITEMS_START+21)
+#define EE_CHAR_WEIGHT (EE_ITEMS_START+22)
+#define EE_CHAR_UNDERLINE (EE_ITEMS_START+23)
+#define EE_CHAR_STRIKEOUT (EE_ITEMS_START+24)
+#define EE_CHAR_ITALIC (EE_ITEMS_START+25)
+#define EE_CHAR_OUTLINE (EE_ITEMS_START+26)
+#define EE_CHAR_SHADOW (EE_ITEMS_START+27)
+#define EE_CHAR_ESCAPEMENT (EE_ITEMS_START+28)
+#define EE_CHAR_PAIRKERNING (EE_ITEMS_START+29)
+#define EE_CHAR_KERNING (EE_ITEMS_START+30)
+#define EE_CHAR_WLM (EE_ITEMS_START+31)
+#define EE_CHAR_LANGUAGE (EE_ITEMS_START+32)
+#define EE_CHAR_LANGUAGE_CJK (EE_ITEMS_START+33)
+#define EE_CHAR_LANGUAGE_CTL (EE_ITEMS_START+34)
+#define EE_CHAR_FONTINFO_CJK (EE_ITEMS_START+35)
+#define EE_CHAR_FONTINFO_CTL (EE_ITEMS_START+36)
+#define EE_CHAR_FONTHEIGHT_CJK (EE_ITEMS_START+37)
+#define EE_CHAR_FONTHEIGHT_CTL (EE_ITEMS_START+38)
+#define EE_CHAR_WEIGHT_CJK (EE_ITEMS_START+39)
+#define EE_CHAR_WEIGHT_CTL (EE_ITEMS_START+40)
+#define EE_CHAR_ITALIC_CJK (EE_ITEMS_START+41)
+#define EE_CHAR_ITALIC_CTL (EE_ITEMS_START+42)
+#define EE_CHAR_EMPHASISMARK (EE_ITEMS_START+43)
+#define EE_CHAR_RELIEF (EE_ITEMS_START+44)
+#define EE_CHAR_RUBI_DUMMY (EE_ITEMS_START+45)
+#define EE_CHAR_XMLATTRIBS (EE_ITEMS_START+46)
+#define EE_CHAR_OVERLINE (EE_ITEMS_START+47)
+#define EE_CHAR_END (EE_ITEMS_START+47)
-#define EE_FEATURE_START (EE_ITEMS_START+46)
-#define EE_FEATURE_TAB (EE_ITEMS_START+46)
-#define EE_FEATURE_LINEBR (EE_ITEMS_START+47)
-#define EE_FEATURE_NOTCONV (EE_ITEMS_START+48)
-#define EE_FEATURE_FIELD (EE_ITEMS_START+49)
-#define EE_FEATURE_END (EE_ITEMS_START+49)
+#define EE_FEATURE_START (EE_ITEMS_START+48)
+#define EE_FEATURE_TAB (EE_ITEMS_START+48)
+#define EE_FEATURE_LINEBR (EE_ITEMS_START+49)
+#define EE_FEATURE_NOTCONV (EE_ITEMS_START+50)
+#define EE_FEATURE_FIELD (EE_ITEMS_START+51)
+#define EE_FEATURE_END (EE_ITEMS_START+51)
-#define EE_ITEMS_END (EE_ITEMS_START+49)
+#define EE_ITEMS_END (EE_ITEMS_START+51)
#define EDITITEMCOUNT ( EE_ITEMS_END - EE_ITEMS_START + 1 )
diff --git a/editeng/inc/editeng/justifyitem.hxx b/editeng/inc/editeng/justifyitem.hxx
new file mode 100644
index 000000000000..13b6d4205a49
--- /dev/null
+++ b/editeng/inc/editeng/justifyitem.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __EDITENG_JUSTIFYITEM_HXX__
+#define __EDITENG_JUSTIFYITEM_HXX__
+
+#include "editeng/editengdllapi.h"
+#include "editeng/svxenum.hxx"
+#include <svl/eitem.hxx>
+#include <sal/types.h>
+
+class EDITENG_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxHorJustifyItem( const USHORT nId );
+
+ SvxHorJustifyItem(
+ const SvxCellHorJustify eJustify /*= SVX_HOR_JUSTIFY_STANDARD*/,
+ const USHORT nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
+
+ virtual USHORT GetValueCount() const;
+ virtual String GetValueText( USHORT nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, USHORT nVer ) const;
+
+ inline SvxHorJustifyItem& operator=(const SvxHorJustifyItem& rHorJustify)
+ {
+ SetValue( rHorJustify.GetValue() );
+ return *this;
+ }
+};
+
+//------------------------------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxVerJustifyItem( const USHORT nId );
+
+ SvxVerJustifyItem(
+ const SvxCellVerJustify eJustify /*= SVX_VER_JUSTIFY_STANDARD*/,
+ const USHORT nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
+
+ virtual USHORT GetValueCount() const;
+ virtual String GetValueText( USHORT nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, USHORT nVer ) const;
+
+ inline SvxVerJustifyItem& operator=(const SvxVerJustifyItem& rVerJustify)
+ {
+ SetValue( rVerJustify.GetValue() );
+ return *this;
+ }
+};
+
+//------------------------------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxJustifyMethodItem: public SfxEnumItem
+{
+public:
+ SvxJustifyMethodItem( const USHORT nId );
+
+ SvxJustifyMethodItem(
+ const SvxCellJustifyMethod eMethod,
+ const USHORT nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText, const IntlWrapper * = 0 ) const;
+
+ virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
+ virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
+
+ virtual USHORT GetValueCount() const;
+ virtual String GetValueText( USHORT nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, USHORT nVer ) const;
+
+ SvxJustifyMethodItem& operator=(const SvxJustifyMethodItem& r);
+};
+
+#endif
diff --git a/editeng/inc/editeng/memberids.hrc b/editeng/inc/editeng/memberids.hrc
index 6bd88ebf164d..c98b726a6eb8 100644
--- a/editeng/inc/editeng/memberids.hrc
+++ b/editeng/inc/editeng/memberids.hrc
@@ -191,6 +191,8 @@
#define MID_CASEMAP_VARIANT 0
#define MID_CASEMAP_TRANS 1
-
+// SvxHorJustifyItem
+#define MID_HORJUST_HORJUST 0
+#define MID_HORJUST_ADJUST 1
#endif
diff --git a/editeng/inc/editeng/svxenum.hxx b/editeng/inc/editeng/svxenum.hxx
index 6222f6ac85a1..856aefd93e33 100644
--- a/editeng/inc/editeng/svxenum.hxx
+++ b/editeng/inc/editeng/svxenum.hxx
@@ -124,12 +124,19 @@ enum SvxCellHorJustify
SVX_HOR_JUSTIFY_REPEAT
};
+enum SvxCellJustifyMethod
+{
+ SVX_JUSTIFY_METHOD_AUTO,
+ SVX_JUSTIFY_METHOD_DISTRIBUTE
+};
+
enum SvxCellVerJustify
{
SVX_VER_JUSTIFY_STANDARD,
SVX_VER_JUSTIFY_TOP,
SVX_VER_JUSTIFY_CENTER,
- SVX_VER_JUSTIFY_BOTTOM
+ SVX_VER_JUSTIFY_BOTTOM,
+ SVX_VER_JUSTIFY_BLOCK
};
enum SvxCellOrientation
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 9ac179a2a47f..a1e9eddfc403 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -178,13 +178,15 @@ SfxItemInfo aItemInfos[EDITITEMCOUNT] = {
{ 0, SFX_ITEM_POOLABLE }, // EE_PARA_HYPHENATE
{ 0, SFX_ITEM_POOLABLE }, // EE_PARA_BULLETSTATE
{ 0, SFX_ITEM_POOLABLE }, // EE_PARA_OUTLLRSPACE
- { SID_ATTR_PARA_OUTLLEVEL, SFX_ITEM_POOLABLE },
- { SID_ATTR_PARA_BULLET, SFX_ITEM_POOLABLE },
- { SID_ATTR_LRSPACE, SFX_ITEM_POOLABLE },
- { SID_ATTR_ULSPACE, SFX_ITEM_POOLABLE },
- { SID_ATTR_PARA_LINESPACE, SFX_ITEM_POOLABLE },
- { SID_ATTR_PARA_ADJUST, SFX_ITEM_POOLABLE },
- { SID_ATTR_TABSTOP, SFX_ITEM_POOLABLE },
+ { SID_ATTR_PARA_OUTLLEVEL, SFX_ITEM_POOLABLE }, // EE_PARA_OUTLLEVEL
+ { SID_ATTR_PARA_BULLET, SFX_ITEM_POOLABLE }, // EE_PARA_BULLET
+ { SID_ATTR_LRSPACE, SFX_ITEM_POOLABLE }, // EE_PARA_LRSPACE
+ { SID_ATTR_ULSPACE, SFX_ITEM_POOLABLE }, // EE_PARA_ULSPACE
+ { SID_ATTR_PARA_LINESPACE, SFX_ITEM_POOLABLE }, // EE_PARA_SBL
+ { SID_ATTR_PARA_ADJUST, SFX_ITEM_POOLABLE }, // EE_PARA_JUST
+ { SID_ATTR_TABSTOP, SFX_ITEM_POOLABLE }, // EE_PARA_TABS
+ { SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SFX_ITEM_POOLABLE }, // EE_PARA_JUST_METHOD
+ { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEM_POOLABLE }, // EE_PARA_VER_JUST
{ SID_ATTR_CHAR_COLOR, SFX_ITEM_POOLABLE },
{ SID_ATTR_CHAR_FONT, SFX_ITEM_POOLABLE },
{ SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEM_POOLABLE },
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index 7d6df3f0fab4..886e8651a349 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -73,6 +73,7 @@
#include <editeng/frmdiritem.hxx>
#include <editeng/xmlcnitm.hxx>
#include <editeng/forbiddencharacterstable.hxx>
+#include <editeng/justifyitem.hxx>
#include <comphelper/processfactory.hxx>
static EditDLL* pDLL=0;
@@ -107,7 +108,7 @@ SfxPoolItem** GlobalEditData::GetDefItems()
{
ppDefItems = new SfxPoolItem*[EDITITEMCOUNT];
- // Absatzattribute:
+ // Paragraph attributes:
SvxNumRule aTmpNumRule( 0, 0, FALSE );
ppDefItems[0] = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR );
@@ -120,57 +121,59 @@ SfxPoolItem** GlobalEditData::GetDefItems()
ppDefItems[7] = new SfxBoolItem( EE_PARA_BULLETSTATE, TRUE );
ppDefItems[8] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE );
ppDefItems[9] = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 );
- ppDefItems[10] = new SvxBulletItem( EE_PARA_BULLET );
- ppDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE );
- ppDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE );
- ppDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL );
- ppDefItems[14] = new SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
- ppDefItems[15] = new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS );
-
- // Zeichenattribute:
- ppDefItems[16] = new SvxColorItem( Color( COL_AUTO ), EE_CHAR_COLOR );
- ppDefItems[17] = new SvxFontItem( EE_CHAR_FONTINFO );
- ppDefItems[18] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT );
- ppDefItems[19] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH );
- ppDefItems[20] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT );
- ppDefItems[21] = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE );
- ppDefItems[22] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT );
- ppDefItems[23] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC );
- ppDefItems[24] = new SvxContourItem( FALSE, EE_CHAR_OUTLINE );
- ppDefItems[25] = new SvxShadowedItem( FALSE, EE_CHAR_SHADOW );
- ppDefItems[26] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT );
- ppDefItems[27] = new SvxAutoKernItem( FALSE, EE_CHAR_PAIRKERNING );
- ppDefItems[28] = new SvxKerningItem( 0, EE_CHAR_KERNING );
- ppDefItems[29] = new SvxWordLineModeItem( FALSE, EE_CHAR_WLM );
- ppDefItems[30] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE );
- ppDefItems[31] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK );
- ppDefItems[32] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL );
- ppDefItems[33] = new SvxFontItem( EE_CHAR_FONTINFO_CJK );
- ppDefItems[34] = new SvxFontItem( EE_CHAR_FONTINFO_CTL );
- ppDefItems[35] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK );
- ppDefItems[36] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL );
- ppDefItems[37] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK );
- ppDefItems[38] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL );
- ppDefItems[39] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK );
- ppDefItems[40] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL );
- ppDefItems[41] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK );
- ppDefItems[42] = new SvxCharReliefItem( RELIEF_NONE, EE_CHAR_RELIEF );
- ppDefItems[43] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY );
+ ppDefItems[10] = new SvxBulletItem( EE_PARA_BULLET );
+ ppDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE );
+ ppDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE );
+ ppDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL );
+ ppDefItems[14] = new SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
+ ppDefItems[15] = new SvxTabStopItem( 0, 0, SVX_TAB_ADJUST_LEFT, EE_PARA_TABS );
+ ppDefItems[16] = new SvxJustifyMethodItem( SVX_JUSTIFY_METHOD_AUTO, EE_PARA_JUST_METHOD );
+ ppDefItems[17] = new SvxVerJustifyItem( SVX_VER_JUSTIFY_STANDARD, EE_PARA_VER_JUST );
+
+ // Character attributes:
+ ppDefItems[18] = new SvxColorItem( Color( COL_AUTO ), EE_CHAR_COLOR );
+ ppDefItems[19] = new SvxFontItem( EE_CHAR_FONTINFO );
+ ppDefItems[20] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT );
+ ppDefItems[21] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH );
+ ppDefItems[22] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT );
+ ppDefItems[23] = new SvxUnderlineItem( UNDERLINE_NONE, EE_CHAR_UNDERLINE );
+ ppDefItems[24] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT );
+ ppDefItems[25] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC );
+ ppDefItems[26] = new SvxContourItem( FALSE, EE_CHAR_OUTLINE );
+ ppDefItems[27] = new SvxShadowedItem( FALSE, EE_CHAR_SHADOW );
+ ppDefItems[28] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT );
+ ppDefItems[29] = new SvxAutoKernItem( FALSE, EE_CHAR_PAIRKERNING );
+ ppDefItems[30] = new SvxKerningItem( 0, EE_CHAR_KERNING );
+ ppDefItems[31] = new SvxWordLineModeItem( FALSE, EE_CHAR_WLM );
+ ppDefItems[32] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE );
+ ppDefItems[33] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK );
+ ppDefItems[34] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL );
+ ppDefItems[35] = new SvxFontItem( EE_CHAR_FONTINFO_CJK );
+ ppDefItems[36] = new SvxFontItem( EE_CHAR_FONTINFO_CTL );
+ ppDefItems[37] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK );
+ ppDefItems[38] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL );
+ ppDefItems[39] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK );
+ ppDefItems[40] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL );
+ ppDefItems[41] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK );
+ ppDefItems[42] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL );
+ ppDefItems[43] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK );
+ ppDefItems[44] = new SvxCharReliefItem( RELIEF_NONE, EE_CHAR_RELIEF );
+ ppDefItems[45] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY );
#ifndef SVX_LIGHT
- ppDefItems[44] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS );
+ ppDefItems[46] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS );
#else
// no need to have alien attributes persistent
- ppDefItems[44] = new SfxVoidItem( EE_CHAR_XMLATTRIBS );
+ ppDefItems[46] = new SfxVoidItem( EE_CHAR_XMLATTRIBS );
#endif // #ifndef SVX_LIGHT
- ppDefItems[45] = new SvxOverlineItem( UNDERLINE_NONE, EE_CHAR_OVERLINE );
+ ppDefItems[47] = new SvxOverlineItem( UNDERLINE_NONE, EE_CHAR_OVERLINE );
// Features
- ppDefItems[46] = new SfxVoidItem( EE_FEATURE_TAB );
- ppDefItems[47] = new SfxVoidItem( EE_FEATURE_LINEBR );
- ppDefItems[48] = new SvxCharSetColorItem( Color( COL_RED ), RTL_TEXTENCODING_DONTKNOW, EE_FEATURE_NOTCONV );
- ppDefItems[49] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD );
+ ppDefItems[48] = new SfxVoidItem( EE_FEATURE_TAB );
+ ppDefItems[49] = new SfxVoidItem( EE_FEATURE_LINEBR );
+ ppDefItems[50] = new SvxCharSetColorItem( Color( COL_RED ), RTL_TEXTENCODING_DONTKNOW, EE_FEATURE_NOTCONV );
+ ppDefItems[51] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD );
- DBG_ASSERT( EDITITEMCOUNT == 50, "ITEMCOUNT geaendert, DefItems nicht angepasst!" );
+ DBG_ASSERT( EDITITEMCOUNT == 52, "ITEMCOUNT geaendert, DefItems nicht angepasst!" );
// Init DefFonts:
GetDefaultFonts( *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START],
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 77e068f8fa9a..e185bcc9e3e5 100755
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -666,6 +666,8 @@ private:
void SetBackgroundColor( const Color& rColor ) { maBackgroundColor = rColor; }
Color GetBackgroundColor() const { return maBackgroundColor; }
+ long CalcVertLineSpacing(Point& rStartPos) const;
+
Color GetAutoColor() const;
void EnableAutoColor( BOOL b ) { bUseAutoColor = b; }
BOOL IsAutoColorEnabled() const { return bUseAutoColor; }
@@ -988,6 +990,8 @@ public:
const SvxLRSpaceItem& GetLRSpaceItem( ContentNode* pNode );
SvxAdjust GetJustification( USHORT nPara ) const;
+ SvxCellJustifyMethod GetJustifyMethod( USHORT nPara ) const;
+ SvxCellVerJustify GetVerJustification( USHORT nPara ) const;
void SetCharStretching( sal_uInt16 nX, sal_uInt16 nY );
inline void GetCharStretching( sal_uInt16& rX, sal_uInt16& rY );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 56b610c14436..cbc1d31bb217 100755
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -58,6 +58,7 @@
#include <editeng/scripttypeitem.hxx>
#include <editeng/frmdiritem.hxx>
#include <editeng/fontitem.hxx>
+#include <editeng/justifyitem.hxx>
#include <vcl/cmdevt.h>
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
@@ -2136,6 +2137,20 @@ SvxAdjust ImpEditEngine::GetJustification( USHORT nPara ) const
return eJustification;
}
+SvxCellJustifyMethod ImpEditEngine::GetJustifyMethod( USHORT nPara ) const
+{
+ const SvxJustifyMethodItem& rItem = static_cast<const SvxJustifyMethodItem&>(
+ GetParaAttrib(nPara, EE_PARA_JUST_METHOD));
+ return static_cast<SvxCellJustifyMethod>(rItem.GetEnumValue());
+}
+
+SvxCellVerJustify ImpEditEngine::GetVerJustification( USHORT nPara ) const
+{
+ const SvxVerJustifyItem& rItem = static_cast<const SvxVerJustifyItem&>(
+ GetParaAttrib(nPara, EE_PARA_VER_JUST));
+ return static_cast<SvxCellVerJustify>(rItem.GetEnumValue());
+}
+
// ----------------------------------------------------------------------
// Textaenderung
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index c74b0250917f..258d0326151e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -61,6 +61,7 @@
#include <editeng/scriptspaceitem.hxx>
#include <editeng/charscaleitem.hxx>
#include <editeng/numitem.hxx>
+#include <editeng/justifyitem.hxx>
#include <svtools/colorcfg.hxx>
#include <svl/ctloptions.hxx>
@@ -1427,9 +1428,10 @@ sal_Bool ImpEditEngine::CreateLines( USHORT nPara, sal_uInt32 nStartPosY )
break;
case SVX_ADJUST_BLOCK:
{
+ bool bDistLastLine = (GetJustifyMethod(nPara) == SVX_JUSTIFY_METHOD_DISTRIBUTE);
long nRemainingSpace = nMaxLineWidth - aTextSize.Width();
pLine->SetStartPosX( (sal_uInt16)nStartX );
- if ( !bEOC && ( nRemainingSpace > 0 ) ) // nicht die letzte Zeile...
+ if ( nRemainingSpace > 0 && (!bEOC || bDistLastLine) )
ImpAdjustBlocks( pParaPortion, pLine, nRemainingSpace );
}
break;
@@ -2003,22 +2005,42 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine,
// Search blanks or Kashidas...
SvUShorts aPositions;
- USHORT nChar;
- for ( nChar = nFirstChar; nChar <= nLastChar; nChar++ )
+ USHORT nLastScript = i18n::ScriptType::LATIN;
+ for ( USHORT nChar = nFirstChar; nChar <= nLastChar; nChar++ )
{
+ EditPaM aPaM( pNode, nChar+1 );
+ LanguageType eLang = GetLanguage(aPaM);
+ USHORT nScript = GetScriptType(aPaM);
+ if ( MsLangId::getPrimaryLanguage( eLang) == LANGUAGE_ARABIC_PRIMARY_ONLY )
+ // Arabic script is handled later.
+ continue;
+
if ( pNode->GetChar(nChar) == ' ' )
{
- // Don't use blank if language is arabic
- LanguageType eLang = GetLanguage( EditPaM( pNode, nChar ) );
- if ( MsLangId::getPrimaryLanguage( eLang) != LANGUAGE_ARABIC_PRIMARY_ONLY )
- aPositions.Insert( nChar, aPositions.Count() );
+ // Normal latin script.
+ aPositions.Insert( nChar, aPositions.Count() );
+ }
+ else if (nChar > nFirstChar)
+ {
+ if (nLastScript == i18n::ScriptType::ASIAN)
+ {
+ // Set break position between this and the last character if
+ // the last character is asian script.
+ aPositions.Insert( nChar-1, aPositions.Count() );
+ }
+ else if (nScript == i18n::ScriptType::ASIAN)
+ {
+ // Set break position between a latin script and asian script.
+ aPositions.Insert( nChar-1, aPositions.Count() );
+ }
}
+
+ nLastScript = nScript;
}
// Kashidas ?
ImpFindKashidas( pNode, nFirstChar, nLastChar, aPositions );
-
if ( !aPositions.Count() )
return;
@@ -2058,12 +2080,13 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine,
// Letztes Zeichen wird schon nicht mehr beachtet...
for ( USHORT n = 0; n < aPositions.Count(); n++ )
{
- nChar = aPositions[n];
+ USHORT nChar = aPositions[n];
if ( nChar < nLastChar )
{
USHORT nPortionStart, nPortion;
- nPortion = pParaPortion->GetTextPortions().FindPortion( nChar, nPortionStart );
+ nPortion = pParaPortion->GetTextPortions().FindPortion( nChar, nPortionStart, true );
TextPortion* pLastPortion = pParaPortion->GetTextPortions()[ nPortion ];
+ USHORT nPortionEnd = nPortionStart + pLastPortion->GetLen();
// Die Breite der Portion:
pLastPortion->GetSize().Width() += nMore4Everyone;
@@ -2072,7 +2095,7 @@ void ImpEditEngine::ImpAdjustBlocks( ParaPortion* pParaPortion, EditLine* pLine,
// Correct positions in array
// Even for kashidas just change positions, VCL will then draw the kashida automaticly
- USHORT nPortionEnd = nPortionStart + pLastPortion->GetLen();
+
for ( USHORT _n = nChar; _n < nPortionEnd; _n++ )
{
pLine->GetCharPosArray()[_n-nFirstChar] += nMore4Everyone;
@@ -2883,6 +2906,8 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
// if( GetStatus().DoOnlineSpelling() && pActiveView )
// aCurPos = pActiveView->pImpEditView->GetEditSelections().Max();
+ long nVertLineSpacing = CalcVertLineSpacing(aStartPos);
+
// --------------------------------------------------
// Ueber alle Absaetze...
// --------------------------------------------------
@@ -2931,12 +2956,16 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
aTmpPos.X() += pLine->GetStartPosX();
aTmpPos.Y() += pLine->GetMaxAscent();
aStartPos.Y() += pLine->GetHeight();
+ if (nLine != nLastLine)
+ aStartPos.Y() += nVertLineSpacing;
}
else
{
aTmpPos.Y() += pLine->GetStartPosX();
aTmpPos.X() -= pLine->GetMaxAscent();
aStartPos.X() -= pLine->GetHeight();
+ if (nLine != nLastLine)
+ aStartPos.X() -= nVertLineSpacing;
}
if ( ( !IsVertical() && ( aStartPos.Y() > aClipRec.Top() ) )
@@ -4038,6 +4067,54 @@ ParaPortion* ImpEditEngine::GetNextVisPortion( ParaPortion* pCurPortion )
return pPortion;
}
+long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const
+{
+ long nTotalOccupiedHeight = 0;
+ sal_uInt16 nTotalLineCount = 0;
+ const ParaPortionList& rParaPortions = GetParaPortions();
+ sal_uInt16 nParaCount = rParaPortions.Count();
+
+ for (sal_uInt16 i = 0; i < nParaCount; ++i)
+ {
+ if (GetVerJustification(i) != SVX_VER_JUSTIFY_BLOCK)
+ // All paragraphs must have the block justification set.
+ return 0;
+
+ ParaPortion* pPortion = rParaPortions.GetObject(i);
+ nTotalOccupiedHeight += pPortion->GetFirstLineOffset();
+
+ const SvxLineSpacingItem& rLSItem = (const SvxLineSpacingItem&)pPortion->GetNode()->GetContentAttribs().GetItem(EE_PARA_SBL);
+ sal_uInt16 nSBL = ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_FIX )
+ ? GetYValue( rLSItem.GetInterLineSpace() ) : 0;
+
+ const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pPortion->GetNode()->GetContentAttribs().GetItem(EE_PARA_ULSPACE);
+ long nUL = GetYValue( rULItem.GetLower() );
+
+ EditLineList& rLines = pPortion->GetLines();
+ sal_uInt16 nLineCount = rLines.Count();
+ nTotalLineCount += nLineCount;
+ for (sal_uInt16 j = 0; j < nLineCount; ++j)
+ {
+ EditLine* pLine = rLines.GetObject(j);
+ nTotalOccupiedHeight += pLine->GetHeight();
+ if (j < nLineCount-1)
+ nTotalOccupiedHeight += nSBL;
+ nTotalOccupiedHeight += nUL;
+ }
+ }
+
+ long nTotalSpace = IsVertical() ? aPaperSize.Width() : aPaperSize.Height();
+ nTotalSpace -= nTotalOccupiedHeight;
+ if (nTotalSpace <= 0 || nTotalLineCount <= 1)
+ return 0;
+
+ if (IsVertical())
+ // Shift the text to the right for the asian layout mode.
+ rStartPos.X() += nTotalSpace;
+
+ return nTotalSpace / (nTotalLineCount-1);
+}
+
EditPaM ImpEditEngine::InsertParagraph( sal_uInt16 nPara )
{
EditPaM aPaM;
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index af92ed6e41e3..effe1e71fcfb 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -32,14 +32,12 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/table/CellVertJustify.hpp>
#include <com/sun/star/table/ShadowLocation.hpp>
#include <com/sun/star/table/TableBorder.hpp>
#include <com/sun/star/table/ShadowFormat.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/table/CellContentType.hpp>
#include <com/sun/star/table/TableOrientation.hpp>
-#include <com/sun/star/table/CellHoriJustify.hpp>
#include <com/sun/star/util/SortField.hpp>
#include <com/sun/star/util/SortFieldType.hpp>
#include <com/sun/star/table/CellOrientation.hpp>
diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx
new file mode 100644
index 000000000000..65130b9990a7
--- /dev/null
+++ b/editeng/source/items/justifyitem.cxx
@@ -0,0 +1,484 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_editeng.hxx"
+
+// include ---------------------------------------------------------------
+
+#include "editeng/justifyitem.hxx"
+#include "editeng/memberids.hrc"
+#include "editeng/editrids.hrc"
+#include "editeng/eerdll.hxx"
+
+#include <tools/stream.hxx>
+
+#include <com/sun/star/table/CellHoriJustify.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/table/CellJustifyMethod.hpp>
+#include <com/sun/star/table/CellVertJustify2.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+
+// STATIC DATA -----------------------------------------------------------
+
+TYPEINIT1_FACTORY( SvxHorJustifyItem, SfxEnumItem, new SvxHorJustifyItem(SVX_HOR_JUSTIFY_STANDARD, 0) );
+TYPEINIT1_FACTORY( SvxVerJustifyItem, SfxEnumItem, new SvxVerJustifyItem(SVX_VER_JUSTIFY_STANDARD, 0) );
+
+using namespace ::com::sun::star;
+
+// class SvxHorJustifyItem -----------------------------------------------
+
+
+SvxHorJustifyItem::SvxHorJustifyItem( const USHORT nId ) :
+ SfxEnumItem( nId, (USHORT)SVX_HOR_JUSTIFY_STANDARD )
+{
+}
+
+SvxHorJustifyItem::SvxHorJustifyItem( const SvxCellHorJustify eJustify,
+ const USHORT nId ) :
+ SfxEnumItem( nId, (USHORT)eJustify )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxHorJustifyItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText, const IntlWrapper *) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetValueText( GetValue() );
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ default: ; //prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxHorJustifyItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_HORJUST_HORJUST:
+ {
+ table::CellHoriJustify eUno = table::CellHoriJustify_STANDARD;
+ switch ( (SvxCellHorJustify)GetValue() )
+ {
+ case SVX_HOR_JUSTIFY_STANDARD: eUno = table::CellHoriJustify_STANDARD; break;
+ case SVX_HOR_JUSTIFY_LEFT: eUno = table::CellHoriJustify_LEFT; break;
+ case SVX_HOR_JUSTIFY_CENTER: eUno = table::CellHoriJustify_CENTER; break;
+ case SVX_HOR_JUSTIFY_RIGHT: eUno = table::CellHoriJustify_RIGHT; break;
+ case SVX_HOR_JUSTIFY_BLOCK: eUno = table::CellHoriJustify_BLOCK; break;
+ case SVX_HOR_JUSTIFY_REPEAT: eUno = table::CellHoriJustify_REPEAT; break;
+ }
+ rVal <<= eUno;
+ }
+ break;
+ case MID_HORJUST_ADJUST:
+ {
+ // ParagraphAdjust values, as in SvxAdjustItem
+ // (same value for ParaAdjust and ParaLastLineAdjust)
+
+ sal_Int16 nAdjust = style::ParagraphAdjust_LEFT;
+ switch ( (SvxCellHorJustify)GetValue() )
+ {
+ // ParagraphAdjust_LEFT is used for STANDARD and REPEAT
+ case SVX_HOR_JUSTIFY_STANDARD:
+ case SVX_HOR_JUSTIFY_REPEAT:
+ case SVX_HOR_JUSTIFY_LEFT: nAdjust = style::ParagraphAdjust_LEFT; break;
+ case SVX_HOR_JUSTIFY_CENTER: nAdjust = style::ParagraphAdjust_CENTER; break;
+ case SVX_HOR_JUSTIFY_RIGHT: nAdjust = style::ParagraphAdjust_RIGHT; break;
+ case SVX_HOR_JUSTIFY_BLOCK: nAdjust = style::ParagraphAdjust_BLOCK; break;
+ }
+ rVal <<= nAdjust; // as sal_Int16
+ }
+ break;
+ }
+ return sal_True;
+}
+
+sal_Bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_HORJUST_HORJUST:
+ {
+ table::CellHoriJustify eUno;
+ if(!(rVal >>= eUno))
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return sal_False;
+ eUno = (table::CellHoriJustify)nValue;
+ }
+ SvxCellHorJustify eSvx = SVX_HOR_JUSTIFY_STANDARD;
+ switch (eUno)
+ {
+ case table::CellHoriJustify_STANDARD: eSvx = SVX_HOR_JUSTIFY_STANDARD; break;
+ case table::CellHoriJustify_LEFT: eSvx = SVX_HOR_JUSTIFY_LEFT; break;
+ case table::CellHoriJustify_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break;
+ case table::CellHoriJustify_RIGHT: eSvx = SVX_HOR_JUSTIFY_RIGHT; break;
+ case table::CellHoriJustify_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break;
+ case table::CellHoriJustify_REPEAT: eSvx = SVX_HOR_JUSTIFY_REPEAT; break;
+ default: ; //prevent warning
+ }
+ SetValue( (USHORT)eSvx );
+ }
+ break;
+ case MID_HORJUST_ADJUST:
+ {
+ // property contains ParagraphAdjust values as sal_Int16
+ sal_Int16 nVal = sal_Int16();
+ if(!(rVal >>= nVal))
+ return sal_False;
+
+ SvxCellHorJustify eSvx = SVX_HOR_JUSTIFY_STANDARD;
+ switch (nVal)
+ {
+ // STRETCH is treated as BLOCK
+ case style::ParagraphAdjust_LEFT: eSvx = SVX_HOR_JUSTIFY_LEFT; break;
+ case style::ParagraphAdjust_RIGHT: eSvx = SVX_HOR_JUSTIFY_RIGHT; break;
+ case style::ParagraphAdjust_STRETCH:
+ case style::ParagraphAdjust_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break;
+ case style::ParagraphAdjust_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break;
+ }
+ SetValue( (USHORT)eSvx );
+ }
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+XubString SvxHorJustifyItem::GetValueText( USHORT nVal ) const
+{
+ DBG_ASSERT( nVal <= SVX_HOR_JUSTIFY_REPEAT, "enum overflow!" );
+ return EE_RESSTR(RID_SVXITEMS_HORJUST_STANDARD + nVal);
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxHorJustifyItem::Clone( SfxItemPool* ) const
+{
+ return new SvxHorJustifyItem( *this );
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxHorJustifyItem::Create( SvStream& rStream, USHORT ) const
+{
+ USHORT nVal;
+ rStream >> nVal;
+ return new SvxHorJustifyItem( (SvxCellHorJustify)nVal, Which() );
+}
+//------------------------------------------------------------------------
+
+USHORT SvxHorJustifyItem::GetValueCount() const
+{
+ return SVX_HOR_JUSTIFY_REPEAT + 1; // letzter Enum-Wert + 1
+}
+
+// class SvxVerJustifyItem -----------------------------------------------
+
+SvxVerJustifyItem::SvxVerJustifyItem( const USHORT nId ) :
+ SfxEnumItem( nId, (USHORT)SVX_VER_JUSTIFY_STANDARD )
+{
+}
+
+SvxVerJustifyItem::SvxVerJustifyItem( const SvxCellVerJustify eJustify,
+ const USHORT nId ) :
+ SfxEnumItem( nId, (USHORT)eJustify )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxVerJustifyItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText,
+ const IntlWrapper * ) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetValueText( GetValue() );
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ default: ; //prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxVerJustifyItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_HORJUST_ADJUST:
+ {
+ style::VerticalAlignment eUno = style::VerticalAlignment_TOP;
+ switch ( (SvxCellVerJustify)GetValue() )
+ {
+ case SVX_VER_JUSTIFY_TOP: eUno = style::VerticalAlignment_TOP; break;
+ case SVX_VER_JUSTIFY_CENTER: eUno = style::VerticalAlignment_MIDDLE; break;
+ case SVX_VER_JUSTIFY_BOTTOM: eUno = style::VerticalAlignment_BOTTOM; break;
+ default: ; //prevent warning
+ }
+ rVal <<= eUno;
+ break;
+ }
+ default:
+ {
+ sal_Int32 nUno = table::CellVertJustify2::STANDARD;
+ switch ( (SvxCellVerJustify)GetValue() )
+ {
+ case SVX_VER_JUSTIFY_STANDARD: nUno = table::CellVertJustify2::STANDARD; break;
+ case SVX_VER_JUSTIFY_TOP: nUno = table::CellVertJustify2::TOP; break;
+ case SVX_VER_JUSTIFY_CENTER: nUno = table::CellVertJustify2::CENTER; break;
+ case SVX_VER_JUSTIFY_BOTTOM: nUno = table::CellVertJustify2::BOTTOM; break;
+ case SVX_VER_JUSTIFY_BLOCK: nUno = table::CellVertJustify2::BLOCK; break;
+ default: ; //prevent warning
+ }
+ rVal <<= nUno;
+ break;
+ }
+ }
+ return sal_True;
+}
+
+sal_Bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_HORJUST_ADJUST:
+ {
+ // property contains ParagraphAdjust values as sal_Int16
+ style::VerticalAlignment nVal = style::VerticalAlignment_TOP;
+ if(!(rVal >>= nVal))
+ return sal_False;
+
+ SvxCellVerJustify eSvx = SVX_VER_JUSTIFY_STANDARD;
+ switch (nVal)
+ {
+ case style::VerticalAlignment_TOP: eSvx = SVX_VER_JUSTIFY_TOP; break;
+ case style::VerticalAlignment_MIDDLE: eSvx = SVX_VER_JUSTIFY_CENTER; break;
+ case style::VerticalAlignment_BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break;
+ default:;
+ }
+ SetValue( (USHORT)eSvx );
+ break;
+ }
+ default:
+ {
+ sal_Int32 eUno;
+ if(!(rVal >>= eUno))
+ {
+ eUno = table::CellVertJustify2::STANDARD;
+ }
+
+ SvxCellVerJustify eSvx = SVX_VER_JUSTIFY_STANDARD;
+ switch (eUno)
+ {
+ case table::CellVertJustify2::STANDARD: eSvx = SVX_VER_JUSTIFY_STANDARD; break;
+ case table::CellVertJustify2::TOP: eSvx = SVX_VER_JUSTIFY_TOP; break;
+ case table::CellVertJustify2::CENTER: eSvx = SVX_VER_JUSTIFY_CENTER; break;
+ case table::CellVertJustify2::BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break;
+ case table::CellVertJustify2::BLOCK: eSvx = SVX_VER_JUSTIFY_BLOCK; break;
+ default: ; //prevent warning
+ }
+ SetValue( (USHORT)eSvx );
+ break;
+ }
+ }
+
+ return sal_True;
+}
+
+//------------------------------------------------------------------------
+
+XubString SvxVerJustifyItem::GetValueText( USHORT nVal ) const
+{
+ DBG_ASSERT( nVal <= SVX_VER_JUSTIFY_BOTTOM, "enum overflow!" );
+ return EE_RESSTR(RID_SVXITEMS_VERJUST_STANDARD + nVal);
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxVerJustifyItem::Clone( SfxItemPool* ) const
+{
+ return new SvxVerJustifyItem( *this );
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxVerJustifyItem::Create( SvStream& rStream, USHORT ) const
+{
+ USHORT nVal;
+ rStream >> nVal;
+ return new SvxVerJustifyItem( (SvxCellVerJustify)nVal, Which() );
+}
+
+//------------------------------------------------------------------------
+
+USHORT SvxVerJustifyItem::GetValueCount() const
+{
+ return SVX_VER_JUSTIFY_BOTTOM + 1; // letzter Enum-Wert + 1
+}
+
+
+// class SvxJustifyMethodItem -----------------------------------------------
+
+SvxJustifyMethodItem::SvxJustifyMethodItem( const USHORT nId ) :
+ SfxEnumItem( nId, (USHORT)SVX_JUSTIFY_METHOD_AUTO )
+{
+}
+
+SvxJustifyMethodItem::SvxJustifyMethodItem( const SvxCellJustifyMethod eJustify,
+ const USHORT nId ) :
+ SfxEnumItem( nId, (USHORT)eJustify )
+{
+}
+
+//------------------------------------------------------------------------
+
+SfxItemPresentation SvxJustifyMethodItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText,
+ const IntlWrapper * ) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ rText = GetValueText( GetValue() );
+ return SFX_ITEM_PRESENTATION_COMPLETE;
+ default: ; //prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//------------------------------------------------------------------------
+
+sal_Bool SvxJustifyMethodItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const
+{
+ sal_Int32 nUno = table::CellJustifyMethod::AUTO;
+ switch (static_cast<SvxCellJustifyMethod>(GetValue()))
+ {
+ case SVX_JUSTIFY_METHOD_AUTO: nUno = table::CellJustifyMethod::AUTO; break;
+ case SVX_JUSTIFY_METHOD_DISTRIBUTE: nUno = table::CellJustifyMethod::DISTRIBUTE; break;
+ default:;
+ }
+ rVal <<= nUno;
+ return true;
+}
+
+sal_Bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ )
+{
+ sal_Int32 nVal = table::CellJustifyMethod::AUTO;
+ if (!(rVal >>= nVal))
+ return false;
+
+ SvxCellJustifyMethod eSvx = SVX_JUSTIFY_METHOD_AUTO;
+ switch (nVal)
+ {
+ case table::CellJustifyMethod::AUTO:
+ eSvx = SVX_JUSTIFY_METHOD_AUTO;
+ break;
+ case table::CellJustifyMethod::DISTRIBUTE:
+ eSvx = SVX_JUSTIFY_METHOD_DISTRIBUTE;
+ break;
+ default:;
+ }
+ SetValue(static_cast<USHORT>(eSvx));
+ return true;
+}
+
+//------------------------------------------------------------------------
+
+XubString SvxJustifyMethodItem::GetValueText( USHORT nVal ) const
+{
+ DBG_ASSERT( nVal <= SVX_VER_JUSTIFY_BOTTOM, "enum overflow!" );
+ return EE_RESSTR(RID_SVXITEMS_JUSTMETHOD_AUTO + nVal);
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxJustifyMethodItem::Clone( SfxItemPool* ) const
+{
+ return new SvxJustifyMethodItem( *this );
+}
+
+//------------------------------------------------------------------------
+
+SfxPoolItem* SvxJustifyMethodItem::Create( SvStream& rStream, USHORT ) const
+{
+ USHORT nVal;
+ rStream >> nVal;
+ return new SvxJustifyMethodItem( (SvxCellJustifyMethod)nVal, Which() );
+}
+
+//------------------------------------------------------------------------
+
+USHORT SvxJustifyMethodItem::GetValueCount() const
+{
+ return SVX_JUSTIFY_METHOD_DISTRIBUTE + 1; // letzter Enum-Wert + 1
+}
+
+SvxJustifyMethodItem& SvxJustifyMethodItem::operator=(const SvxJustifyMethodItem& r)
+{
+ SetValue( r.GetValue() );
+ return *this;
+}
diff --git a/editeng/source/items/makefile.mk b/editeng/source/items/makefile.mk
index 512db7cc34bd..1a2424455ae6 100644
--- a/editeng/source/items/makefile.mk
+++ b/editeng/source/items/makefile.mk
@@ -56,6 +56,7 @@ SLOFILES= \
$(SLO)$/svdfield.obj \
$(SLO)$/writingmodeitem.obj \
$(SLO)$/frmitems.obj \
+ $(SLO)$/justifyitem.obj \
$(SLO)$/paraitem.obj \
$(SLO)$/textitem.obj \
$(SLO)$/flditem.obj \
diff --git a/editeng/source/items/svxitems.src b/editeng/source/items/svxitems.src
index d738a10a1ede..2158b97f66b5 100644
--- a/editeng/source/items/svxitems.src
+++ b/editeng/source/items/svxitems.src
@@ -1023,5 +1023,56 @@ String RID_SVXITEMS_CHARHIDDEN_TRUE
{
Text [ en-US ] = "Hidden";
};
+ // enum SvxCellHorJustify ----------------------------------------------------
+String RID_SVXITEMS_HORJUST_STANDARD
+{
+ Text [ en-US ] = "Horizontal alignment default" ;
+};
+String RID_SVXITEMS_HORJUST_LEFT
+{
+ Text [ en-US ] = "Align left" ;
+};
+String RID_SVXITEMS_HORJUST_CENTER
+{
+ Text [ en-US ] = "Centered horizontally" ;
+};
+String RID_SVXITEMS_HORJUST_RIGHT
+{
+ Text [ en-US ] = "Align right" ;
+};
+String RID_SVXITEMS_HORJUST_BLOCK
+{
+ Text [ en-US ] = "Justify" ;
+};
+String RID_SVXITEMS_HORJUST_REPEAT
+{
+ Text [ en-US ] = "Repeat alignment" ;
+};
+ // enum SvxCellVerJustify ----------------------------------------------------
+String RID_SVXITEMS_VERJUST_STANDARD
+{
+ Text [ en-US ] = "Vertical alignment default" ;
+};
+String RID_SVXITEMS_VERJUST_TOP
+{
+ Text [ en-US ] = "Align to top" ;
+};
+String RID_SVXITEMS_VERJUST_CENTER
+{
+ Text [ en-US ] = "Centered vertically" ;
+};
+String RID_SVXITEMS_VERJUST_BOTTOM
+{
+ Text [ en-US ] = "Align to bottom" ;
+};
+ // enum SvxCellJustifyMethod ----------------------------------------------------
+String RID_SVXITEMS_JUSTMETHOD_AUTO
+{
+ Text [ en-US ] = "Automatic" ;
+};
+String RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE
+{
+ Text [ en-US ] = "Distributed" ;
+};
// ********************************************************************** EOF