summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-02-08 02:06:32 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-02-08 02:59:50 +0100
commitcf9d8194932318d5e8b27ec8188cf32938670abc (patch)
tree1eb393698728b9821fe61e2aa258bc24e9bff1fe
parentebd0d0056d89a6a69d2cb75e28758132cb5c236b (diff)
New frame attribute: TextVerticalAdjust <-> RES_TEXT_VERT_ADJUST
By now this property is added for MS Word interoperability. With it we can make DOCX import/export working. I use this solution instead of InteropGrabBag because vertical adjustment would be a good thing to have for text frames too. So later it can be the first step of an enhanchement. Change-Id: I9dcfdc8ae56ce443f0c286c51136e1d006951938
-rw-r--r--include/svx/sdtaitm.hxx1
-rw-r--r--offapi/com/sun/star/text/BaseFrameProperties.idl8
-rw-r--r--sw/inc/format.hxx1
-rw-r--r--sw/inc/frmatr.hxx4
-rw-r--r--sw/inc/hintids.hxx47
-rw-r--r--sw/inc/swatrset.hxx2
-rw-r--r--sw/inc/unoprnms.hxx1
-rw-r--r--sw/source/core/bastyp/init.cxx3
-rw-r--r--sw/source/core/unocore/unoframe.cxx13
-rw-r--r--sw/source/core/unocore/unomap.cxx5
-rw-r--r--sw/source/filter/html/css1atr.cxx2
-rw-r--r--sw/source/filter/html/htmlatr.cxx2
12 files changed, 65 insertions, 24 deletions
diff --git a/include/svx/sdtaitm.hxx b/include/svx/sdtaitm.hxx
index 0cd3589049b8..cab0d069ade3 100644
--- a/include/svx/sdtaitm.hxx
+++ b/include/svx/sdtaitm.hxx
@@ -37,6 +37,7 @@ class SVX_DLLPUBLIC SdrTextVertAdjustItem: public SfxEnumItem {
public:
TYPEINFO();
SdrTextVertAdjustItem(SdrTextVertAdjust eAdj=SDRTEXTVERTADJUST_TOP): SfxEnumItem(SDRATTR_TEXT_VERTADJUST,(sal_uInt16)eAdj) {}
+ SdrTextVertAdjustItem(SdrTextVertAdjust eAdj, sal_uInt16 nWhich): SfxEnumItem(nWhich,(sal_uInt16)eAdj) {}
SdrTextVertAdjustItem(SvStream& rIn) : SfxEnumItem(SDRATTR_TEXT_VERTADJUST,rIn) {}
virtual SfxPoolItem* Clone(SfxItemPool* pPool=NULL) const;
virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const;
diff --git a/offapi/com/sun/star/text/BaseFrameProperties.idl b/offapi/com/sun/star/text/BaseFrameProperties.idl
index 9038d48487ca..2a1f25cc6556 100644
--- a/offapi/com/sun/star/text/BaseFrameProperties.idl
+++ b/offapi/com/sun/star/text/BaseFrameProperties.idl
@@ -29,6 +29,7 @@
#include <com/sun/star/xml/UserDefinedAttributesSupplier.idl>
#include <com/sun/star/drawing/FillStyle.idl>
#include <com/sun/star/awt/Gradient.idl>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
module com { module sun { module star { module text {
@@ -351,6 +352,13 @@ published service BaseFrameProperties
@since LibreOffice 4.3
*/
[optional, property] short RelativeWidthRelation;
+
+ /** adjusts the vertical position of the text inside of the frame.
+
+ @see com::sun::star::drawing::TextVerticalAdjust
+ @since LibreOffice 4.3
+ */
+ [optional, property] com::sun::star::drawing::TextVerticalAdjust TextVerticalAdjust;
};
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index e92f8e3f1f56..cb79ce418869 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -258,6 +258,7 @@ public:
inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const;
// #i28701#
inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const;
+ inline const SdrTextVertAdjustItem& GetTextVertAdjust(sal_Bool = sal_True) const;
/// Graphics-attributes - implemented in grfatr.hxx
inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const;
diff --git a/sw/inc/frmatr.hxx b/sw/inc/frmatr.hxx
index 977680c03082..772eb0c3bcf6 100644
--- a/sw/inc/frmatr.hxx
+++ b/sw/inc/frmatr.hxx
@@ -56,6 +56,8 @@ inline const SvxMacroItem &SwAttrSet::GetMacro(sal_Bool bInP) const
{ return (const SvxMacroItem&)Get( RES_FRMMACRO,bInP); }
inline const SvxFrameDirectionItem &SwAttrSet::GetFrmDir(sal_Bool bInP) const
{ return (const SvxFrameDirectionItem&)Get( RES_FRAMEDIR,bInP); }
+inline const SdrTextVertAdjustItem &SwAttrSet::GetTextVertAdjust(sal_Bool bInP) const
+ { return (const SdrTextVertAdjustItem&)Get( RES_TEXT_VERT_ADJUST,bInP); }
// Implementation of FrameAttribute methods of SwFmt.
@@ -85,6 +87,8 @@ inline const SvxMacroItem &SwFmt::GetMacro(sal_Bool bInP) const
{ return aSet.GetMacro(bInP); }
inline const SvxFrameDirectionItem &SwFmt::GetFrmDir(sal_Bool bInP) const
{ return aSet.GetFrmDir(bInP); }
+inline const SdrTextVertAdjustItem &SwFmt::GetTextVertAdjust(sal_Bool bInP) const
+ { return aSet.GetTextVertAdjust(bInP); }
#endif // INCLUDED_SW_INC_FRMATR_HXX
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index eef05579dbc5..cf911ab8bb0c 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -232,47 +232,48 @@ RES_FRMATR_BEGIN = RES_PARATR_LIST_END,
RES_FILL_STYLE, // 127
RES_FILL_GRADIENT, // 128
RES_FRMATR_GRABBAG, // 129
+ RES_TEXT_VERT_ADJUST, // 130
RES_FRMATR_END
};
enum RES_GRFATR
{
RES_GRFATR_BEGIN = RES_FRMATR_END,
- RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN, // 130
- RES_GRFATR_CROPGRF, // 131
-
- RES_GRFATR_ROTATION, // 132
- RES_GRFATR_LUMINANCE, // 133
- RES_GRFATR_CONTRAST, // 134
- RES_GRFATR_CHANNELR, // 135
- RES_GRFATR_CHANNELG, // 136
- RES_GRFATR_CHANNELB, // 137
- RES_GRFATR_GAMMA, // 138
- RES_GRFATR_INVERT, // 139
- RES_GRFATR_TRANSPARENCY, // 140
- RES_GRFATR_DRAWMODE, // 141
-
- RES_GRFATR_DUMMY1, // 142
- RES_GRFATR_DUMMY2, // 143
- RES_GRFATR_DUMMY3, // 144
- RES_GRFATR_DUMMY4, // 145
- RES_GRFATR_DUMMY5, // 146
+ RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN, // 131
+ RES_GRFATR_CROPGRF, // 132
+
+ RES_GRFATR_ROTATION, // 133
+ RES_GRFATR_LUMINANCE, // 134
+ RES_GRFATR_CONTRAST, // 135
+ RES_GRFATR_CHANNELR, // 136
+ RES_GRFATR_CHANNELG, // 137
+ RES_GRFATR_CHANNELB, // 138
+ RES_GRFATR_GAMMA, // 139
+ RES_GRFATR_INVERT, // 140
+ RES_GRFATR_TRANSPARENCY, // 141
+ RES_GRFATR_DRAWMODE, // 142
+
+ RES_GRFATR_DUMMY1, // 143
+ RES_GRFATR_DUMMY2, // 144
+ RES_GRFATR_DUMMY3, // 145
+ RES_GRFATR_DUMMY4, // 146
+ RES_GRFATR_DUMMY5, // 147
RES_GRFATR_END
};
enum RES_BOXATR
{
RES_BOXATR_BEGIN = RES_GRFATR_END,
- RES_BOXATR_FORMAT = RES_BOXATR_BEGIN, // 147
- RES_BOXATR_FORMULA, // 148
- RES_BOXATR_VALUE, // 149
+ RES_BOXATR_FORMAT = RES_BOXATR_BEGIN, // 148
+ RES_BOXATR_FORMULA, // 149
+ RES_BOXATR_VALUE, // 150
RES_BOXATR_END
};
enum RES_UNKNOWNATR
{
RES_UNKNOWNATR_BEGIN = RES_BOXATR_END,
- RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 150
+ RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 151
RES_UNKNOWNATR_END
};
diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx
index 72e77cfffbc5..edad75436b1f 100644
--- a/sw/inc/swatrset.hxx
+++ b/sw/inc/swatrset.hxx
@@ -96,6 +96,7 @@ class SwTextGridItem;
class SwHeaderAndFooterEatSpacingItem;
class SwFmtFollowTextFlow;
class SwFmtWrapInfluenceOnObjPos;
+class SdrTextVertAdjustItem;
// Graphic attributes
class SwMirrorGrf;
@@ -293,6 +294,7 @@ public:
inline const SwHeaderAndFooterEatSpacingItem &GetHeaderAndFooterEatSpacing( sal_Bool = sal_True ) const;
inline const SwFmtFollowTextFlow &GetFollowTextFlow(sal_Bool = sal_True) const;
inline const SwFmtWrapInfluenceOnObjPos& GetWrapInfluenceOnObjPos(sal_Bool = sal_True) const;
+ inline const SdrTextVertAdjustItem& GetTextVertAdjust(sal_Bool = sal_True) const;
// Graphic attributes - implementation in grfatr.hxx
inline const SwMirrorGrf &GetMirrorGrf( sal_Bool = sal_True ) const;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 369d3d303340..0be3cf70fa6e 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -813,6 +813,7 @@
#define UNO_NAME_CHAR_HIGHLIGHT "CharHighlight"
#define UNO_NAME_STYLE_INTEROP_GRAB_BAG "StyleInteropGrabBag"
#define UNO_NAME_CHAR_INTEROP_GRAB_BAG "CharInteropGrabBag"
+#define UNO_NAME_TEXT_VERT_ADJUST "TextVerticalAdjust"
#endif
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 42586121178b..1bfecbea0c6c 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -113,6 +113,7 @@
#include <svx/dialogs.hrc>
#include <svx/xfillit0.hxx>
#include <svx/xflgrit.hxx>
+#include <svx/sdtaitm.hxx>
#include <swcalwrp.hxx>
#include <SwStyleNameMapper.hxx>
#include <tblafmt.hxx>
@@ -390,6 +391,7 @@ SfxItemInfo aSlotTab[] =
{ SID_SW_ATTR_FILL_STYLE, SFX_ITEM_POOLABLE }, // RES_FILL_STYLE
{ SID_SW_ATTR_FILL_GRADIENT, SFX_ITEM_POOLABLE }, // RES_FILL_GRADIENT
{ 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_GRABBAG
+ { 0, SFX_ITEM_POOLABLE }, // RES_TEXT_VERT_ADJUST
{ 0, SFX_ITEM_POOLABLE }, // RES_GRFATR_MIRRORGRF
{ SID_ATTR_GRAF_CROP, SFX_ITEM_POOLABLE }, // RES_GRFATR_CROPGRF
@@ -607,6 +609,7 @@ void _InitCore()
aAttrTab[ RES_FILL_STYLE - POOLATTR_BEGIN ] = new XFillStyleItem(XFILL_SOLID, RES_FILL_STYLE);
aAttrTab[ RES_FILL_GRADIENT - POOLATTR_BEGIN ] = new XFillGradientItem(RES_FILL_GRADIENT);
aAttrTab[ RES_FRMATR_GRABBAG - POOLATTR_BEGIN ] = new SfxGrabBagItem(RES_FRMATR_GRABBAG);
+ aAttrTab[ RES_TEXT_VERT_ADJUST - POOLATTR_BEGIN ] = new SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP,RES_TEXT_VERT_ADJUST);
aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf;
aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index a295b8215cbe..9d204bf8020b 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -27,9 +27,11 @@
#include <com/sun/star/embed/EmbedStates.hpp>
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <svx/svxids.hrc>
#include <svx/xfillit0.hxx>
#include <svx/xflgrit.hxx>
+#include <svx/sdtaitm.hxx>
#include <editeng/memberids.hrc>
#include <swtypes.hxx>
@@ -587,6 +589,17 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SwDoc* pDoc, SfxItemSet& rToSe
rToSet.Put(aFmtWrapInfluenceOnObjPos);
}
+ {
+ const ::uno::Any* pTextVertAdjust = 0;
+ GetProperty(RES_TEXT_VERT_ADJUST, 0, pTextVertAdjust);
+ if ( pTextVertAdjust )
+ {
+ SdrTextVertAdjustItem aTextVertAdjust(static_cast <const :: SdrTextVertAdjustItem & > ( rFromSet.Get ( RES_TEXT_VERT_ADJUST ) ));
+ bRet &= ((SfxPoolItem&)aTextVertAdjust).PutValue(*pTextVertAdjust);
+ rToSet.Put(aTextVertAdjust);
+ }
+ }
+
return bRet;
}
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index a8b15f5a326f..eac4e79db2a3 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
@@ -409,7 +410,8 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
{ OUString(UNO_NAME_DESCRIPTION), FN_UNO_DESCRIPTION, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, \
{ OUString(UNO_NAME_LAYOUT_SIZE), WID_LAYOUT_SIZE, cppu::UnoType<css::awt::Size>::get(), PropertyAttribute::MAYBEVOID | PropertyAttribute::READONLY, 0 }, \
{ OUString(UNO_NAME_LINE_STYLE), RES_BOX, cppu::UnoType<css::drawing::LineStyle>::get(), 0, LINE_STYLE }, \
- { OUString(UNO_NAME_LINE_WIDTH), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, LINE_WIDTH |CONVERT_TWIPS },
+ { OUString(UNO_NAME_LINE_WIDTH), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, LINE_WIDTH |CONVERT_TWIPS }, \
+ { OUString(UNO_NAME_TEXT_VERT_ADJUST), RES_TEXT_VERT_ADJUST, cppu::UnoType<css::drawing::TextVerticalAdjust>::get(), PROPERTY_NONE ,0},
@@ -874,6 +876,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ OUString(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, cppu::UnoType<sal_Int8>::get(), PROPERTY_NONE, MID_WRAP_INFLUENCE},
{ OUString(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 },
{ OUString(UNO_NAME_HIDDEN), FN_UNO_HIDDEN, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0},
+ { OUString(UNO_NAME_TEXT_VERT_ADJUST), RES_TEXT_VERT_ADJUST, cppu::UnoType<css::drawing::TextVerticalAdjust>::get(), PROPERTY_NONE ,0},
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
aMapEntriesArr[nPropertyId] = aFrameStyleMap;
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index d251ef85c782..1919377447fd 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -3735,6 +3735,8 @@ SwAttrFnTab aCSS1AttrFnTab = {
/* RES_FRMATR_CONDITIONAL_STYLE_NAME */ 0,
/* RES_FILL_STYLE */ 0,
/* RES_FILL_GRADIENT */ 0,
+/* RES_FRMATR_GRABBAG */ 0,
+/* RES_TEXT_VERT_ADJUST */ 0,
/* RES_GRFATR_MIRRORGRF */ 0,
/* RES_GRFATR_CROPGRF */ 0,
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 351d4ff6cdee..f15a9ab4e3fc 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -3369,6 +3369,8 @@ SwAttrFnTab aHTMLAttrFnTab = {
/* RES_FRMATR_CONDITIONAL_STYLE_NAME */ 0,
/* RES_FILL_STYLE */ 0,
/* RES_FILL_GRADIENT */ 0,
+/* RES_FRMATR_GRABBAG */ 0,
+/* RES_TEXT_VERT_ADJUST */ 0,
/* RES_GRFATR_MIRRORGRF */ 0,
/* RES_GRFATR_CROPGRF */ 0,