[Libreoffice-commits] core.git: 6 commits - offapi/com sw/inc sw/source
Zolnai Tamás
zolnaitamas2000 at gmail.com
Mon Aug 12 01:30:33 PDT 2013
offapi/com/sun/star/style/CharacterProperties.idl | 38 +++++++++-
sw/inc/unoprnms.hxx | 12 ++-
sw/source/core/inc/swfont.hxx | 83 ++++++++++++++++++++++
sw/source/core/layout/paintfrm.cxx | 54 ++++----------
sw/source/core/text/atrstck.cxx | 15 ++-
sw/source/core/text/guess.cxx | 4 -
sw/source/core/text/inftxt.cxx | 23 +++---
sw/source/core/text/itratr.cxx | 8 +-
sw/source/core/text/itratr.hxx | 11 +-
sw/source/core/text/itrcrsr.cxx | 10 +-
sw/source/core/text/txtdrop.cxx | 6 -
sw/source/core/txtnode/swfont.cxx | 50 +++++++++++--
sw/source/core/unocore/unomap.cxx | 36 +++++++++
sw/source/core/unocore/unoprnms.cxx | 10 ++
sw/source/core/unocore/unosrch.cxx | 8 +-
sw/source/ui/app/docst.cxx | 65 -----------------
sw/source/ui/envelp/envfmt.cxx | 25 ------
sw/source/ui/inc/uitool.hxx | 11 ++
sw/source/ui/shells/textsh1.cxx | 39 ----------
sw/source/ui/utlui/uitool.cxx | 60 +++++++++++++++
20 files changed, 366 insertions(+), 202 deletions(-)
New commits:
commit e40f07f731080b1e71d1df507f92108fa5ef7b75
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Wed Aug 7 12:01:24 2013 +0200
Extract code of character attribute convertion
To avoid duplication
Change-Id: Ica59c7819596055c9d521957c663398f9f53272d
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 18095f9..8f0dece 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -568,24 +568,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl)
SfxItemSet aTmpSet( *m_pDlg->GetOutputItemSet() );
if( SFX_STYLE_FAMILY_CHAR == m_nFamily )
{
- const SfxPoolItem *pTmpBrush;
- if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
- sal_False, &pTmpBrush ) )
- {
- SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
- aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
- aTmpSet.Put( aTmpBrush );
- }
- aTmpSet.ClearItem( RES_BACKGROUND );
-
- const SfxPoolItem *pTmpBox;
- if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BOX, sal_False, &pTmpBox ) )
- {
- SvxBoxItem aTmpBox( *((SvxBoxItem*)pTmpBox) );
- aTmpBox.SetWhich( RES_CHRATR_BOX );
- aTmpSet.Put( aTmpBox );
- }
- aTmpSet.ClearItem( RES_BOX );
+ ::ConvertAttrGenToChar(aTmpSet, CONV_ATTR_STD);
}
m_xTmp->SetItemSet( aTmpSet );
@@ -743,27 +726,7 @@ sal_uInt16 SwDocShell::Edit(
}
else if( SFX_STYLE_FAMILY_CHAR == nFamily )
{
- SfxItemSet& rSet = xTmp->GetItemSet();
- const SfxPoolItem *pTmpBrush;
- if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_BACKGROUND,
- sal_True, &pTmpBrush ) )
- {
- SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
- aTmpBrush.SetWhich( RES_BACKGROUND );
- rSet.Put( aTmpBrush );
- }
- else
- rSet.ClearItem(RES_BACKGROUND);
-
- const SfxPoolItem *pTmpBox;
- if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_BOX, sal_True, &pTmpBox ) )
- {
- SvxBoxItem aTmpBox( *((SvxBoxItem*)pTmpBox) );
- aTmpBox.SetWhich( RES_BOX );
- rSet.Put( aTmpBox );
- }
- else
- rSet.ClearItem(RES_BOX);
+ ::ConvertAttrCharToGen(xTmp->GetItemSet(), CONV_ATTR_STD);
}
if (!bBasic)
{
@@ -831,29 +794,7 @@ sal_uInt16 SwDocShell::Edit(
::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() );
else
{
- SfxItemSet aTmpSet( xTmp->GetItemSet() );
- if( SFX_STYLE_FAMILY_CHAR == nFamily )
- {
- const SfxPoolItem *pTmpBrush;
- if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
- sal_False, &pTmpBrush ) )
- {
- SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
- aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
- aTmpSet.Put( aTmpBrush );
- }
- aTmpSet.ClearItem( RES_BACKGROUND );
-
- const SfxPoolItem *pTmpBox;
- if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BOX, sal_False, &pTmpBox ) )
- {
- SvxBoxItem aTmpBox( *((SvxBoxItem*)pTmpBox) );
- aTmpBox.SetWhich( RES_CHRATR_BOX );
- aTmpSet.Put( aTmpBox );
- }
- aTmpSet.ClearItem( RES_BOX );
- }
- xTmp->SetItemSet( aTmpSet );
+ ::ConvertAttrGenToChar(xTmp->GetItemSet(), CONV_ATTR_STD);
}
if(SFX_STYLE_FAMILY_PAGE == nFamily)
pView->InvalidateRulerPos();
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 5c5a3cf..397af1a 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -287,20 +287,7 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
// In order for the background color not to get ironed over:
SfxAllItemSet aTmpSet(*pCollSet);
-
- // The CHRATR_BACKGROUND attribute gets transformed into a
- // RES_BACKGROUND for the dialog and back again ...
- const SfxPoolItem *pTmpBrush;
-
- if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_CHRATR_BACKGROUND,
- sal_True, &pTmpBrush ) )
- {
- SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
- aTmpBrush.SetWhich( RES_BACKGROUND );
- aTmpSet.Put( aTmpBrush );
- }
- else
- aTmpSet.ClearItem( RES_BACKGROUND );
+ ::ConvertAttrCharToGen(aTmpSet, CONV_ATTR_ENV);
SwAbstractDialogFactory* pFact = swui::GetFactory();
OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
@@ -310,15 +297,7 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
if (pDlg->Execute() == RET_OK)
{
SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() );
- if( SFX_ITEM_SET == aOutputSet.GetItemState( RES_BACKGROUND,
- sal_False, &pTmpBrush ) )
- {
- SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
- aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
- pCollSet->Put( aTmpBrush );
- }
- aOutputSet.ClearItem( RES_BACKGROUND );
- //pColl->SetAttr( aTmpSet );
+ ::ConvertAttrGenToChar(aOutputSet, CONV_ATTR_ENV);
pCollSet->Put(aOutputSet);
}
delete pDlg;
diff --git a/sw/source/ui/inc/uitool.hxx b/sw/source/ui/inc/uitool.hxx
index 6373801..85387a2 100644
--- a/sw/source/ui/inc/uitool.hxx
+++ b/sw/source/ui/inc/uitool.hxx
@@ -42,6 +42,17 @@ SW_DLLPUBLIC void SetMetric(MetricFormatter& rCtrl, FieldUnit eUnit);
// fill BoxInfoAttribut
SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh);
+// Modes for attribute conversion
+#define CONV_ATTR_STD 1 // Standard character dialog
+#define CONV_ATTR_ENV 2 // Character dialog opened from envelope dialog
+
+// Convert character specific attributes to general ones used by tab pages
+SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet& rSet, sal_uInt8 nMode);
+
+// Convert general attributes to the corresponding character attributes
+// This method is used after executed a character dialog
+SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet& rSet, sal_uInt8 nMode);
+
// SfxItemSets <-> PageDesc
void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc );
void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet);
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index 4d02631..f700e96 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -168,29 +168,8 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const
}
aCoreSet.Put( SfxUInt16Item( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
rWrtSh.GetScalingOfSelectedText() ) );
- // The CHRATR_BACKGROUND attribute will be converted for the
- // dialogue in a RES_BACKGROUND and back again ...
- const SfxPoolItem *pTmpBrush;
- if( SFX_ITEM_SET == aCoreSet.GetItemState( RES_CHRATR_BACKGROUND, sal_True, &pTmpBrush ) )
- {
- SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
- aTmpBrush.SetWhich( RES_BACKGROUND );
- aCoreSet.Put( aTmpBrush );
- }
- else
- aCoreSet.ClearItem(RES_BACKGROUND);
- // The CHRATR_BOX attribute will be converted for the
- // dialogue in a RES_BOX and back again ...
- const SfxPoolItem *pTmpBox;
- if( SFX_ITEM_SET == aCoreSet.GetItemState( RES_CHRATR_BOX, sal_True, &pTmpBox ) )
- {
- SvxBoxItem aTmpBox( *((SvxBoxItem*)pTmpBox) );
- aTmpBox.SetWhich( RES_BOX );
- aCoreSet.Put( aTmpBox );
- }
- else
- aCoreSet.ClearItem(RES_BOX);
+ ::ConvertAttrCharToGen(aCoreSet, CONV_ATTR_STD);
// Setting the BoxInfo
::PrepareBoxInfo( aCoreSet, rWrtSh );
@@ -223,21 +202,7 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const
if ( pSet)
{
SfxItemSet aTmpSet( *pSet );
- if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND, sal_False, &pTmpBrush ) )
- {
- SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
- aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
- aTmpSet.Put( aTmpBrush );
- }
- aTmpSet.ClearItem( RES_BACKGROUND );
-
- if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BOX, sal_False, &pTmpBox ) )
- {
- SvxBoxItem aTmpBox( *((SvxBoxItem*)pTmpBox) );
- aTmpBox.SetWhich( RES_CHRATR_BOX );
- aTmpSet.Put( aTmpBox );
- }
- aTmpSet.ClearItem( RES_BOX );
+ ::ConvertAttrGenToChar(aTmpSet, CONV_ATTR_STD);
const SfxPoolItem* pSelectionItem;
sal_Bool bInsert = sal_False;
diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx
index 1337544..862a954 100644
--- a/sw/source/ui/utlui/uitool.cxx
+++ b/sw/source/ui/utlui/uitool.cxx
@@ -33,6 +33,7 @@
#include <editeng/tstpitem.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/sizeitem.hxx>
+#include <editeng/brushitem.hxx>
#include <svx/pageitem.hxx>
#include <editeng/lrspitem.hxx>
#include <svl/style.hxx>
@@ -117,6 +118,65 @@ void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh)
rSet.Put(aBoxInfo);
}
+void ConvertAttrCharToGen(SfxItemSet& rSet, sal_uInt8 nMode)
+{
+ // Background
+ {
+ const SfxPoolItem *pTmpBrush;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_BACKGROUND, sal_True, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_BACKGROUND );
+ rSet.Put( aTmpBrush );
+ }
+ else
+ rSet.ClearItem(RES_BACKGROUND);
+ }
+
+ // Border
+ if( nMode == CONV_ATTR_STD )
+ {
+ const SfxPoolItem *pTmpBox;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_BOX, sal_True, &pTmpBox ) )
+ {
+ SvxBoxItem aTmpBox( *((SvxBoxItem*)pTmpBox) );
+ aTmpBox.SetWhich( RES_BOX );
+ rSet.Put( aTmpBox );
+ }
+ else
+ rSet.ClearItem(RES_BOX);
+ }
+}
+
+void ConvertAttrGenToChar(SfxItemSet& rSet, sal_uInt8 nMode)
+{
+ // Background
+ {
+ const SfxPoolItem *pTmpBrush;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, sal_False, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
+ rSet.Put( aTmpBrush );
+ }
+ rSet.ClearItem( RES_BACKGROUND );
+ }
+
+ // Border
+ if( nMode == CONV_ATTR_STD )
+ {
+ const SfxPoolItem *pTmpBox;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOX, sal_False, &pTmpBox ) )
+ {
+ SvxBoxItem aTmpBox( *((SvxBoxItem*)pTmpBox) );
+ aTmpBox.SetWhich( RES_CHRATR_BOX );
+ rSet.Put( aTmpBox );
+ }
+ rSet.ClearItem( RES_BOX );
+ }
+}
+
+
// Fill header footer
void FillHdFt(SwFrmFmt* pFmt, const SfxItemSet& rSet)
commit 9ece71a185c93845e38c25eae91bc1955d60bfed
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Wed Aug 7 10:16:05 2013 +0200
It seems lcl_ExtendLeftAndRight is just a workaround
Which screens the calculation error
Change-Id: I51a37b2eba54d8d0a50dedc666487a83fc8d7f8c
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index a2869bc..751ff7d 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1432,25 +1432,6 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrm *pFrm,
::SwAlignRect( rRect, pGlobalShell );
}
-static void lcl_ExtendLeftAndRight( SwRect& _rRect,
- const SwFrm& _rFrm,
- const SwBorderAttrs& _rAttrs,
- const SwRectFn& _rRectFn )
-{
- // Extend left/right border/shadow rectangle to bottom of previous frame/to
- // top of next frame, if border/shadow is joined with previous/next frame.
- if ( _rAttrs.JoinedWithPrev( _rFrm ) )
- {
- const SwFrm* pPrevFrm = _rFrm.GetPrev();
- (_rRect.*_rRectFn->fnSetTop)( (pPrevFrm->*_rRectFn->fnGetPrtBottom)() );
- }
- if ( _rAttrs.JoinedWithNext( _rFrm ) )
- {
- const SwFrm* pNextFrm = _rFrm.GetNext();
- (_rRect.*_rRectFn->fnSetBottom)( (pNextFrm->*_rRectFn->fnGetPrtTop)() );
- }
-}
-
static void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage,
const SwRect &rRect, SwRegionRects &rRegion )
{
@@ -4190,7 +4171,6 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
SvxShadowLocation eLoc = rShadow.GetLocation();
- SWRECTFN( this )
if( IsVertical() )
{
switch( eLoc )
@@ -4234,13 +4214,14 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
aOut.Top ( rOutRect.Top() + nHeight );
if ( bBottom )
aOut.Bottom( aOut.Bottom() - nHeight );
- if ( bCnt && (!bTop || !bBottom) )
- ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
+ else
+ aOut.Bottom( aOut.Bottom() + nHeight );
aRegion.push_back( aOut );
}
rOutRect.Right ( rOutRect.Right() - nWidth );
- rOutRect.Bottom( rOutRect.Bottom()- nHeight );
+ if( bBottom )
+ rOutRect.Bottom( rOutRect.Bottom()- nHeight );
}
break;
case SVX_SHADOW_TOPLEFT:
@@ -4262,13 +4243,14 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
aOut.Bottom( rOutRect.Bottom() - nHeight );
if ( bTop )
aOut.Top( aOut.Top() + nHeight );
- if ( bCnt && (!bBottom || !bTop) )
- ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
+ else
+ aOut.Top( aOut.Top() - nHeight );
aRegion.push_back( aOut );
}
rOutRect.Left( rOutRect.Left() + nWidth );
- rOutRect.Top( rOutRect.Top() + nHeight );
+ if( bTop )
+ rOutRect.Top( rOutRect.Top() + nHeight );
}
break;
case SVX_SHADOW_TOPRIGHT:
@@ -4290,13 +4272,14 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
aOut.Bottom( rOutRect.Bottom() - nHeight );
if ( bTop )
aOut.Top( aOut.Top() + nHeight );
- if ( bCnt && (!bBottom || bTop) )
- ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
+ else
+ aOut.Top( aOut.Top() - nHeight );
aRegion.push_back( aOut );
}
rOutRect.Right( rOutRect.Right() - nWidth );
- rOutRect.Top( rOutRect.Top() + nHeight );
+ if( bTop )
+ rOutRect.Top( rOutRect.Top() + nHeight );
}
break;
case SVX_SHADOW_BOTTOMLEFT:
@@ -4318,13 +4301,14 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
aOut.Top( rOutRect.Top() + nHeight );
if ( bBottom )
aOut.Bottom( aOut.Bottom() - nHeight );
- if ( bCnt && (!bTop || !bBottom) )
- ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
+ else
+ aOut.Bottom( aOut.Bottom() + nHeight );
aRegion.push_back( aOut );
}
rOutRect.Left( rOutRect.Left() + nWidth );
- rOutRect.Bottom( rOutRect.Bottom() - nHeight );
+ if( bBottom )
+ rOutRect.Bottom( rOutRect.Bottom() - nHeight );
}
break;
default:
@@ -4691,8 +4675,6 @@ static void lcl_PaintLeftRightLine( const bool _bLeft,
if ( _rFrm.IsCntntFrm() )
{
- ::lcl_ExtendLeftAndRight( aRect, _rFrm, _rAttrs, _rRectFn );
-
// No Top / bottom borders for joint borders
if ( _rAttrs.JoinedWithPrev( _rFrm ) ) pTopBorder = NULL;
if ( _rAttrs.JoinedWithNext( _rFrm ) ) pBottomBorder = NULL;
commit 3dfd5d794b36a1af49c59f7ab4c5d563ba32ebb0
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Tue Aug 6 11:14:54 2013 +0200
CharBrd 6: UNO API
Change-Id: I7f93c3ca060ccd91ed52c0a1e8f477ed8e2c1534
diff --git a/offapi/com/sun/star/style/CharacterProperties.idl b/offapi/com/sun/star/style/CharacterProperties.idl
index 8ba1a61..d03a302 100644
--- a/offapi/com/sun/star/style/CharacterProperties.idl
+++ b/offapi/com/sun/star/style/CharacterProperties.idl
@@ -23,7 +23,7 @@
#include <com/sun/star/util/Color.idl>
#include <com/sun/star/awt/FontSlant.idl>
#include <com/sun/star/container/XNameContainer.idl>
-
+#include <com/sun/star/table/BorderLine2.idl>
module com { module sun { module star { module style {
@@ -374,6 +374,42 @@ published service CharacterProperties
*/
[optional, property] com::sun::star::container::XNameContainer TextUserDefinedAttributes;
+ /** This property contains the left border of the object.
+ */
+ [property, optional] com::sun::star::table::BorderLine2 CharLeftBorder;
+
+ /** This property contains the right border of the object.
+ */
+ [property, optional] com::sun::star::table::BorderLine2 CharRightBorder;
+
+ /** This property contains the top border of the object.
+ */
+ [property, optional] com::sun::star::table::BorderLine2 CharTopBorder;
+
+ /** This property contains the bottom border of the object.
+ */
+ [property, optional] com::sun::star::table::BorderLine2 CharBottomBorder;
+
+ /** This property contains the distance from the border to the object.
+ */
+ [property, optional] long CharBorderDistance;
+
+ /** This property contains the distance from the left border to the object.
+ */
+ [property, optional] long CharLeftBorderDistance;
+
+ /** This property contains the distance from the right border to the object.
+ */
+ [property, optional] long CharRightBorderDistance;
+
+ /** This property contains the distance from the top border to the object.
+ */
+ [property, optional] long CharTopBorderDistance;
+
+ /** This property contains the distance from the bottom border to the object.
+ */
+ [property, optional] long CharBottomBorderDistance;
+
};
}; }; }; };
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index d418a12..7466139 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -826,7 +826,17 @@ enum SwPropNameIds
/* 0762 */ UNO_NAME_PARA_INTEROP_GRAB_BAG,
-/* 0762 */ SW_PROPNAME_END
+/* 0763 */ UNO_NAME_CHAR_LEFT_BORDER,
+/* 0764 */ UNO_NAME_CHAR_RIGHT_BORDER,
+/* 0765 */ UNO_NAME_CHAR_TOP_BORDER,
+/* 0766 */ UNO_NAME_CHAR_BOTTOM_BORDER,
+/* 0767 */ UNO_NAME_CHAR_BORDER_DISTANCE,
+/* 0768 */ UNO_NAME_CHAR_LEFT_BORDER_DISTANCE,
+/* 0769 */ UNO_NAME_CHAR_RIGHT_BORDER_DISTANCE,
+/* 0770 */ UNO_NAME_CHAR_TOP_BORDER_DISTANCE,
+/* 0771 */ UNO_NAME_CHAR_BOTTOM_BORDER_DISTANCE,
+
+/* 0772 */ SW_PROPNAME_END
// new items in this array must match SwPropNameTab aPropNameTab
};
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 6b9cadd..f9d71a6 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -204,6 +204,15 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
{ SW_PROP_NMID(UNO_NAME_PARA_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT }, \
{ SW_PROP_NMID(UNO_NAME_NUMBERING_STYLE_NAME), RES_PARATR_NUMRULE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \
{ SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_LEFT_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, LEFT_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_RIGHT_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, RIGHT_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_TOP_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, TOP_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_BOTTOM_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, BOTTOM_BORDER|CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_LEFT_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_RIGHT_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_TOP_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, TOP_BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_BOTTOM_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },\
{ SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, LEFT_BORDER |CONVERT_TWIPS }, \
{ SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, RIGHT_BORDER |CONVERT_TWIPS }, \
{ SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, TOP_BORDER |CONVERT_TWIPS }, \
@@ -428,6 +437,15 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
{ SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN_RELATIVE), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_LO_REL_MARGIN},\
TABSTOPS_MAP_ENTRY\
{ SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_LEFT_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, LEFT_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_RIGHT_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, RIGHT_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_TOP_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, TOP_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_BOTTOM_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, BOTTOM_BORDER |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_LEFT_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_RIGHT_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_TOP_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, TOP_BORDER_DISTANCE |CONVERT_TWIPS },\
+ { SW_PROP_NMID(UNO_NAME_CHAR_BOTTOM_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },\
{ SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },\
{ SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },\
{ SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },\
@@ -574,6 +592,15 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FITTOLINE },
{ SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
{ SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_RELIEF },
+ { SW_PROP_NMID(UNO_NAME_CHAR_LEFT_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_RIGHT_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_TOP_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BOTTOM_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, BOTTOM_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_LEFT_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_RIGHT_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_TOP_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BOTTOM_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
{0,0,0,0,0,0}
};
aMapEntriesArr[nPropertyId] = aCharStyleMap;
@@ -622,6 +649,15 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
{ SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_RELIEF },
{ SW_PROP_NMID(UNO_NAME_CHAR_AUTO_STYLE_NAME), RES_TXTATR_AUTOFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_LEFT_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_RIGHT_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_TOP_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BOTTOM_BORDER), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PROPERTY_NONE, BOTTOM_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_LEFT_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_RIGHT_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_TOP_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BOTTOM_BORDER_DISTANCE), RES_CHRATR_BOX, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
{0,0,0,0,0,0}
};
aMapEntriesArr[nPropertyId] = aAutoCharStyleMap;
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index b721a3a..39e691f 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -792,6 +792,16 @@ const SwPropNameTab aPropNameTab = {
/* 0760 UNO_NAME_DEFAULT_PAGE_MODE */ {MAP_CHAR_LEN("DefaultPageMode")},
/* 0761 UNO_NAME_CHAR_SHADING_VALUE */ {MAP_CHAR_LEN("CharShadingValue")},
/* 0762 UNO_NAME_PARA_INTEROP_GRAB_BAG */ {MAP_CHAR_LEN("ParaInteropGrabBag")},
+/* 0763 UNO_NAME_CHAR_LEFT_BORDER */ {MAP_CHAR_LEN("CharLeftBorder")},
+/* 0764 UNO_NAME_CHAR_RIGHT_BORDER */ {MAP_CHAR_LEN("CharRightBorder")},
+/* 0765 UNO_NAME_CHAR_TOP_BORDER */ {MAP_CHAR_LEN("CharTopBorder")},
+/* 0766 UNO_NAME_CHAR_BOTTOM_BORDER*/ {MAP_CHAR_LEN("CharBottomBorder")},
+/* 0767 UNO_NAME_CHAR_BORDER_DISTANCE */ {MAP_CHAR_LEN("CharBorderDistance")},
+/* 0768 UNO_NAME_CHAR_LEFT_BORDER_DISTANCE */ {MAP_CHAR_LEN("CharLeftBorderDistance")},
+/* 0769 UNO_NAME_CHAR_RIGHT_BORDER_DISTANCE */ {MAP_CHAR_LEN("CharRightBorderDistance")},
+/* 0770 UNO_NAME_CHAR_TOP_BORDER_DISTANCE */ {MAP_CHAR_LEN("CharTopBorderDistance")},
+/* 0771 UNO_NAME_CHAR_BOTTOM_BORDER_DISTANCE */ {MAP_CHAR_LEN("CharBottomBorderDistance")},
+
// new items in this array must match enum SwPropNameIds
};
diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx
index a3b7ca5..bc728f4 100644
--- a/sw/source/core/unocore/unosrch.cxx
+++ b/sw/source/core/unocore/unosrch.cxx
@@ -123,9 +123,9 @@ const uno::Sequence< beans::PropertyValue > SwSearchProperties_Impl::GetProperti
void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSearch) const
{
- //
SfxPoolItem* pBoxItem = 0,
+ *pCharBoxItem = 0,
*pBreakItem = 0,
*pAutoKernItem = 0,
*pWLineItem = 0,
@@ -184,6 +184,11 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSea
pBoxItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
pTempItem = pBoxItem;
break;
+ case RES_CHRATR_BOX:
+ if(!pCharBoxItem)
+ pCharBoxItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
+ pTempItem = pCharBoxItem;
+ break;
case RES_BREAK:
if(!pBreakItem)
pBreakItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone();
@@ -418,6 +423,7 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSea
}
}
delete pBoxItem;
+ delete pCharBoxItem;
delete pBreakItem;
delete pAutoKernItem ;
delete pWLineItem;
commit 36651940d2164569030796db3521efc69abcb9b5
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Tue Aug 6 10:58:09 2013 +0200
CharBrd 5: border padding/spacing
Change-Id: I47529dce4cdb04b5b9d2b7aa6106be9bbd7d8428
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index 97c78d2..f57147e 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -136,6 +136,12 @@ class SwFont
boost::optional<editeng::SvxBorderLine> m_aRightBorder;
boost::optional<editeng::SvxBorderLine> m_aLeftBorder;
+ // border distance
+ sal_uInt16 m_nTopBorderDist;
+ sal_uInt16 m_nBottomBorderDist;
+ sal_uInt16 m_nRightBorderDist;
+ sal_uInt16 m_nLeftBorderDist;
+
sal_uInt8 nToxCnt; // Zaehlt die Schachtelungstiefe der Tox
sal_uInt8 nRefCnt; // Zaehlt die Schachtelungstiefe der Refs
sal_uInt8 m_nMetaCount; // count META/METAFIELD
@@ -380,6 +386,22 @@ public:
const boost::optional<editeng::SvxBorderLine>& GetAbsRightBorder( const bool bVertLayout ) const;
const boost::optional<editeng::SvxBorderLine>& GetAbsLeftBorder( const bool bVertLayout ) const;
+ void SetTopBorderDist( const sal_uInt16 nTopDist );
+ void SetBottomBorderDist( const sal_uInt16 nBottomDist );
+ void SetRightBorderDist( const sal_uInt16 nRightDist );
+ void SetLeftBorderDist( const sal_uInt16 nLeftDist );
+
+ sal_uInt16 GetTopBorderDist() const { return m_nTopBorderDist; }
+ sal_uInt16 GetBottomBorderDist() const { return m_nBottomBorderDist; }
+ sal_uInt16 GetRightBorderDist() const { return m_nRightBorderDist; }
+ sal_uInt16 GetLeftBorderDist() const { return m_nLeftBorderDist; }
+
+ // Return with the border width plus spacing
+ sal_uInt16 GetTopBorderSpace() const;
+ sal_uInt16 GetBottomBorderSpace() const;
+ sal_uInt16 GetRightBorderSpace() const;
+ sal_uInt16 GetLeftBorderSpace() const;
+
bool HasBorder() const;
void RemoveBorders();
};
@@ -831,6 +853,66 @@ inline void SwSubFont::SetVertical( const sal_uInt16 nDir, const sal_Bool bVertF
Font::SetOrientation( nDir );
}
+inline void SwFont::SetTopBorderDist( const sal_uInt16 nTopDist )
+{
+ m_nTopBorderDist = nTopDist;
+ bFntChg = sal_True;
+ aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
+}
+
+inline void SwFont::SetBottomBorderDist( const sal_uInt16 nBottomDist )
+{
+ m_nBottomBorderDist = nBottomDist;
+ bFntChg = sal_True;
+ aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
+}
+
+inline void SwFont::SetRightBorderDist( const sal_uInt16 nRightDist )
+{
+ m_nRightBorderDist = nRightDist;
+ bFntChg = sal_True;
+ aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
+}
+
+inline void SwFont::SetLeftBorderDist( const sal_uInt16 nLeftDist )
+{
+ m_nLeftBorderDist = nLeftDist;
+ bFntChg = sal_True;
+ aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
+}
+
+inline sal_uInt16 SwFont::GetTopBorderSpace() const
+{
+ if( m_aTopBorder )
+ return m_aTopBorder.get().GetScaledWidth() + m_nTopBorderDist;
+ else
+ return 0;
+}
+
+inline sal_uInt16 SwFont::GetBottomBorderSpace() const
+{
+ if( m_aBottomBorder )
+ return m_aBottomBorder.get().GetScaledWidth() + m_nBottomBorderDist;
+ else
+ return 0;
+}
+
+inline sal_uInt16 SwFont::GetRightBorderSpace() const
+{
+ if( m_aRightBorder )
+ return m_aRightBorder.get().GetScaledWidth() + m_nRightBorderDist;
+ else
+ return 0;
+}
+
+inline sal_uInt16 SwFont::GetLeftBorderSpace() const
+{
+ if( m_aLeftBorder )
+ return m_aLeftBorder.get().GetScaledWidth() + m_nLeftBorderDist;
+ else
+ return 0;
+}
+
inline bool SwFont::HasBorder() const
{
return m_aTopBorder || m_aBottomBorder || m_aLeftBorder || m_aRightBorder;
@@ -839,6 +921,7 @@ inline bool SwFont::HasBorder() const
inline void SwFont::RemoveBorders()
{
m_aTopBorder = m_aBottomBorder = m_aLeftBorder = m_aRightBorder = boost::none;
+ m_nTopBorderDist = m_nBottomBorderDist = m_nRightBorderDist = m_nLeftBorderDist = 0;
}
/*************************************************************************
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index 99fef3d..2897303 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -745,11 +745,18 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPu
break;
}
case RES_CHRATR_BOX:
- rFnt.SetTopBorder( ((SvxBoxItem&)rItem).GetTop() );
- rFnt.SetBottomBorder( ((SvxBoxItem&)rItem).GetBottom() );
- rFnt.SetRightBorder( ((SvxBoxItem&)rItem).GetRight() );
- rFnt.SetLeftBorder( ((SvxBoxItem&)rItem).GetLeft() );
+ {
+ const SvxBoxItem& aBoxItem = static_cast<const SvxBoxItem&>(rItem);
+ rFnt.SetTopBorder( aBoxItem.GetTop() );
+ rFnt.SetBottomBorder( aBoxItem.GetBottom() );
+ rFnt.SetRightBorder( aBoxItem.GetRight() );
+ rFnt.SetLeftBorder( aBoxItem.GetLeft() );
+ rFnt.SetTopBorderDist( aBoxItem.GetDistance(BOX_LINE_TOP) );
+ rFnt.SetBottomBorderDist( aBoxItem.GetDistance(BOX_LINE_BOTTOM) );
+ rFnt.SetRightBorderDist( aBoxItem.GetDistance(BOX_LINE_RIGHT) );
+ rFnt.SetLeftBorderDist( aBoxItem.GetDistance(BOX_LINE_LEFT) );
break;
+ }
case RES_CHRATR_OVERLINE :
rFnt.SetOverline( ((SvxOverlineItem&)rItem).GetLineStyle() );
rFnt.SetOverColor( ((SvxOverlineItem&)rItem).GetColor() );
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 37baa9e..9a3ea15 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -114,9 +114,9 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
// Decrease the line width with the right and left border width
if( rInf.GetFont()->GetRightBorder() )
- nLineWidth -= rInf.GetFont()->GetRightBorder().get().GetScaledWidth();
+ nLineWidth -= rInf.GetFont()->GetRightBorderSpace();
if( rInf.GetFont()->GetLeftBorder() )
- nLineWidth -= rInf.GetFont()->GetLeftBorder().get().GetScaledWidth();
+ nLineWidth -= rInf.GetFont()->GetLeftBorderSpace();
const bool bUnbreakableNumberings = rInf.GetTxtFrm()->GetTxtNode()->
getIDocumentSettingAccess()->get(IDocumentSettingAccess::UNBREAKABLE_NUMBERINGS);
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 4c87c9e..59bc524 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -375,7 +375,7 @@ KSHORT SwTxtSizeInfo::GetAscent() const
sal_uInt16 nAscent = ((SwFont*)GetFont())->GetAscent( m_pVsh, *GetOut() );
if( GetFont()->GetTopBorder() )
- nAscent += GetFont()->GetTopBorder().get().GetScaledWidth();
+ nAscent += GetFont()->GetTopBorderSpace();
return nAscent;
}
@@ -387,9 +387,9 @@ KSHORT SwTxtSizeInfo::GetTxtHeight() const
sal_uInt16 nHeight = ((SwFont*)GetFont())->GetHeight( m_pVsh, *GetOut() );
if( GetFont()->GetTopBorder() )
- nHeight += GetFont()->GetTopBorder().get().GetScaledWidth();
+ nHeight += GetFont()->GetTopBorderSpace();
if( GetFont()->GetBottomBorder() )
- nHeight += GetFont()->GetBottomBorder().get().GetScaledWidth();
+ nHeight += GetFont()->GetBottomBorderSpace();
return nHeight;
}
@@ -401,13 +401,13 @@ static void lcl_IncreaseSizeWithBorders(SwPosSize& rSize, const SwFont& rFont)
sal_uInt16 nHeight = rSize.Height();
if( rFont.GetTopBorder() )
- nHeight += rFont.GetTopBorder().get().GetScaledWidth();
+ nHeight += rFont.GetTopBorderSpace();
if( rFont.GetBottomBorder() )
- nHeight += rFont.GetBottomBorder().get().GetScaledWidth();
+ nHeight += rFont.GetBottomBorderSpace();
if( rFont.GetRightBorder() )
- nWidth += rFont.GetRightBorder().get().GetScaledWidth();
+ nWidth += rFont.GetRightBorderSpace();
if( rFont.GetLeftBorder() )
- nWidth += rFont.GetLeftBorder().get().GetScaledWidth();
+ nWidth += rFont.GetLeftBorderSpace();
rSize.Height(nHeight);
rSize.Width(nWidth);
@@ -698,19 +698,20 @@ void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPo
Point aFontPos(aPos);
if( m_pFnt->GetLeftBorder() )
{
+ const sal_uInt16 nLeftBorderSpace = m_pFnt->GetLeftBorderSpace();
switch( m_pFnt->GetOrientation(GetTxtFrm()->IsVertical()) )
{
case 0 :
- aFontPos.X() += m_pFnt->GetLeftBorder().get().GetScaledWidth();
+ aFontPos.X() += nLeftBorderSpace;
break;
case 900 :
- aFontPos.Y() -= m_pFnt->GetLeftBorder().get().GetScaledWidth();
+ aFontPos.Y() -= nLeftBorderSpace;
break;
case 1800 :
- aFontPos.X() -= m_pFnt->GetLeftBorder().get().GetScaledWidth();
+ aFontPos.X() -= nLeftBorderSpace;
break;
case 2700 :
- aFontPos.Y() += m_pFnt->GetLeftBorder().get().GetScaledWidth();
+ aFontPos.Y() += nLeftBorderSpace;
break;
}
}
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 3e97fa7..4410cc8 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -940,12 +940,12 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
}
if( pCurrPart && nSumLength != nOfst - aInf.GetIdx() && pCurrPart->GetFont().GetRightBorder() )
{
- nX -= pCurrPart->GetFont().GetRightBorder().get().GetScaledWidth();
+ nX -= pCurrPart->GetFont().GetRightBorderSpace();
}
}
else if(GetInfo().GetFont()->GetRightBorder())
{
- nX -= GetInfo().GetFont()->GetRightBorder().get().GetScaledWidth();
+ nX -= GetInfo().GetFont()->GetRightBorderSpace();
}
}
}
@@ -1650,11 +1650,11 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
nSumWidth += pCurrPart->GetWidth();
if( pCurrPart->GetFont().GetLeftBorder() )
{
- nSumBorderWidth += pCurrPart->GetFont().GetLeftBorder().get().GetScaledWidth();
+ nSumBorderWidth += pCurrPart->GetFont().GetLeftBorderSpace();
}
if( nSumWidth <= nX - nCurrStart && pCurrPart->GetFont().GetRightBorder() )
{
- nSumBorderWidth += pCurrPart->GetFont().GetRightBorder().get().GetScaledWidth();
+ nSumBorderWidth += pCurrPart->GetFont().GetRightBorderSpace();
}
pCurrPart = pCurrPart->GetFollow();
}
@@ -1662,7 +1662,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
}
// Shift the offset with the left border width
else if (GetInfo().GetFont()->GetLeftBorder() )
- nX = std::max(0, nX - GetInfo().GetFont()->GetLeftBorder().get().GetScaledWidth());
+ nX = std::max(0, nX - GetInfo().GetFont()->GetLeftBorderSpace());
aDrawInf.SetOfst( nX );
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 5d2d5a2..cb956b3 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -891,13 +891,13 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTxtFormatInfo &rInf )
// Modify the bounding rectangle with the borders
if( rFnt.GetTopBorder() )
{
- aRect.setHeight(aRect.GetHeight() + rFnt.GetTopBorder().get().GetScaledWidth());
- aRect.setY(aRect.getY() - rFnt.GetTopBorder().get().GetScaledWidth());
+ aRect.setHeight(aRect.GetHeight() + rFnt.GetTopBorderSpace());
+ aRect.setY(aRect.getY() - rFnt.GetTopBorderSpace());
}
if( rFnt.GetBottomBorder() )
{
- aRect.setHeight(aRect.GetHeight() + rFnt.GetBottomBorder().get().GetScaledWidth());
+ aRect.setHeight(aRect.GetHeight() + rFnt.GetBottomBorderSpace());
}
if ( bFirstGlyphRect )
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index f816636..c12c787 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -82,7 +82,10 @@ void SwFont::SetTopBorder( const editeng::SvxBorderLine* pTopBorder )
if( pTopBorder )
m_aTopBorder = *pTopBorder;
else
+ {
m_aTopBorder = boost::none;
+ m_nTopBorderDist = 0;
+ }
bFntChg = sal_True;
aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
}
@@ -92,7 +95,10 @@ void SwFont::SetBottomBorder( const editeng::SvxBorderLine* pBottomBorder )
if( pBottomBorder )
m_aBottomBorder = *pBottomBorder;
else
+ {
m_aBottomBorder = boost::none;
+ m_nBottomBorderDist = 0;
+ }
bFntChg = sal_True;
aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
}
@@ -102,7 +108,10 @@ void SwFont::SetRightBorder( const editeng::SvxBorderLine* pRightBorder )
if( pRightBorder )
m_aRightBorder = *pRightBorder;
else
+ {
m_aRightBorder = boost::none;
+ m_nRightBorderDist = 0;
+ }
bFntChg = sal_True;
aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
}
@@ -112,7 +121,10 @@ void SwFont::SetLeftBorder( const editeng::SvxBorderLine* pLeftBorder )
if( pLeftBorder )
m_aLeftBorder = *pLeftBorder;
else
+ {
m_aLeftBorder = boost::none;
+ m_nLeftBorderDist = 0;
+ }
bFntChg = sal_True;
aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
}
@@ -520,10 +532,15 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
sal_True, &pItem ))
{
- SetTopBorder(((SvxBoxItem*)pItem)->GetTop());
- SetBottomBorder(((SvxBoxItem*)pItem)->GetBottom());
- SetRightBorder(((SvxBoxItem*)pItem)->GetRight());
- SetLeftBorder(((SvxBoxItem*)pItem)->GetLeft());
+ const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem);
+ SetTopBorder(pBoxItem->GetTop());
+ SetBottomBorder(pBoxItem->GetBottom());
+ SetRightBorder(pBoxItem->GetRight());
+ SetLeftBorder(pBoxItem->GetLeft());
+ SetTopBorderDist(pBoxItem->GetDistance(BOX_LINE_TOP));
+ SetBottomBorderDist(pBoxItem->GetDistance(BOX_LINE_BOTTOM));
+ SetRightBorderDist(pBoxItem->GetDistance(BOX_LINE_RIGHT));
+ SetLeftBorderDist(pBoxItem->GetDistance(BOX_LINE_LEFT));
}
const SfxPoolItem* pTwoLinesItem = 0;
if( SFX_ITEM_SET ==
@@ -548,6 +565,10 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
SwFont::SwFont()
: pBackColor(0)
+ , m_nTopBorderDist(0)
+ , m_nBottomBorderDist(0)
+ , m_nRightBorderDist(0)
+ , m_nLeftBorderDist(0)
, nActual(SW_LATIN)
{
}
@@ -563,6 +584,10 @@ SwFont::SwFont( const SwFont &rFont )
m_aBottomBorder = rFont.m_aBottomBorder;
m_aRightBorder = rFont.m_aRightBorder;
m_aLeftBorder = rFont.m_aLeftBorder;
+ m_nTopBorderDist = rFont.m_nTopBorderDist;
+ m_nBottomBorderDist = rFont.m_nBottomBorderDist;
+ m_nRightBorderDist = rFont.m_nRightBorderDist;
+ m_nLeftBorderDist = rFont.m_nLeftBorderDist;
aUnderColor = rFont.GetUnderColor();
aOverColor = rFont.GetOverColor();
nToxCnt = 0;
@@ -687,10 +712,15 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BOX,
sal_True, &pItem ))
{
- SetTopBorder(((SvxBoxItem*)pItem)->GetTop());
- SetBottomBorder(((SvxBoxItem*)pItem)->GetBottom());
- SetRightBorder(((SvxBoxItem*)pItem)->GetRight());
- SetLeftBorder(((SvxBoxItem*)pItem)->GetLeft());
+ const SvxBoxItem* pBoxItem = static_cast<const SvxBoxItem*>(pItem);
+ SetTopBorder(pBoxItem->GetTop());
+ SetBottomBorder(pBoxItem->GetBottom());
+ SetRightBorder(pBoxItem->GetRight());
+ SetLeftBorder(pBoxItem->GetLeft());
+ SetTopBorderDist(pBoxItem->GetDistance(BOX_LINE_TOP));
+ SetBottomBorderDist(pBoxItem->GetDistance(BOX_LINE_BOTTOM));
+ SetRightBorderDist(pBoxItem->GetDistance(BOX_LINE_RIGHT));
+ SetLeftBorderDist(pBoxItem->GetDistance(BOX_LINE_LEFT));
}
else
RemoveBorders();
@@ -738,6 +768,10 @@ SwFont& SwFont::operator=( const SwFont &rFont )
m_aBottomBorder = rFont.m_aBottomBorder;
m_aRightBorder = rFont.m_aRightBorder;
m_aLeftBorder = rFont.m_aLeftBorder;
+ m_nTopBorderDist = rFont.m_nTopBorderDist;
+ m_nBottomBorderDist = rFont.m_nBottomBorderDist;
+ m_nRightBorderDist = rFont.m_nRightBorderDist;
+ m_nLeftBorderDist = rFont.m_nLeftBorderDist;
aUnderColor = rFont.GetUnderColor();
aOverColor = rFont.GetOverColor();
nToxCnt = 0;
commit 13c81d8741c57da9111f9f42061d5c62b94667c9
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Mon Aug 5 21:09:30 2013 +0200
fix vertical text border
Change-Id: Ifd75056e310a47960e587b0771b55fe08bfe6f42
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 3405c1d..a2869bc 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4818,7 +4818,7 @@ void PaintCharacterBorder(
aAlignedRect.Left(),
aAlignedRect.Top());
Point aRightBottom (
- aAlignedRect.Left() + rFont.GetLeftBorder().get().GetScaledWidth(),
+ aAlignedRect.Left() + aLeftBorder.get().GetScaledWidth(),
aAlignedRect.Bottom());
lcl_MakeBorderLine(
@@ -4832,7 +4832,7 @@ void PaintCharacterBorder(
if( aRightBorder )
{
Point aLeftTop (
- aAlignedRect.Right() - rFont.GetRightBorder().get().GetScaledWidth(),
+ aAlignedRect.Right() - aRightBorder.get().GetScaledWidth(),
aAlignedRect.Top());
Point aRightBottom (
aAlignedRect.Right(),
commit 66f3b17013c467b9e0a74497738c90173b7e7b4f
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date: Tue Aug 6 10:52:38 2013 +0200
Fix char border merge
Reset font when previous seek remove border from
the font during border merge.
Change-Id: I7456a5494e510395ebebddb09ce2a9d8355156f7
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index 7e0fefc..e674f60 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -277,7 +277,7 @@ sal_Bool SwAttrIter::Seek( const xub_StrLen nNewPos )
if( pHints )
{
- if( !nNewPos || nNewPos < nPos )
+ if( !nNewPos || nNewPos < nPos || m_bPrevSeekRemBorder )
{
if( pRedln )
pRedln->Clear( NULL );
@@ -385,7 +385,7 @@ bool SwAttrIter::MergeCharBorder( const bool bStart )
const sal_Int32 nTmpStart = nStartIndex;
// Check whether next neightbour has same border and height
- if( aTmpFont.GetRightBorder() && pHints && nTmpStart < pHints->GetStartCount() )
+ if( aTmpFont.GetRightBorder() && pHints && nEndIndex < pHints->GetEndCount() )
{
ImplSeekAndChgAttrIter(GetNextAttr(), pLastOut);
if( aTmpFont.GetHeight(pShell, *pLastOut) == pFnt->GetHeight(pShell, *pLastOut) &&
@@ -396,7 +396,7 @@ bool SwAttrIter::MergeCharBorder( const bool bStart )
}
// Check whether previous neightbour has same border and height
- if( aTmpFont.GetLeftBorder() && nTmpStart > 1)
+ if( aTmpFont.GetLeftBorder() && nTmpStart > 0)
{
ImplSeekAndChgAttrIter(nActPos-1, pLastOut);
if( aTmpFont.GetHeight(pShell, *pLastOut) == pFnt->GetHeight(pShell, *pLastOut) &&
@@ -420,7 +420,7 @@ bool SwAttrIter::MergeCharBorder( const bool bStart )
if( bRemoveLeft )
pFnt->SetLeftBorder(0);
- return bRemoveLeft || bRemoveRight;
+ return (m_bPrevSeekRemBorder = bRemoveLeft || bRemoveRight);
}
class SwMinMaxArgs
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index 317e59d..f315303 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -57,18 +57,21 @@ private:
SwRedlineItr *pRedln;
xub_StrLen nStartIndex, nEndIndex, nPos;
sal_uInt8 nPropFont;
- void SeekFwd( const xub_StrLen nPos );
- inline void SetFnt( SwFont* pNew ) { pFnt = pNew; }
const void* aMagicNo[ SW_SCRIPTS ];
MSHORT aFntIdx[ SW_SCRIPTS ];
const SwTxtNode* m_pTxtNode;
+ /// previous seek remove left/right border of the current font during merge character border
+ bool m_bPrevSeekRemBorder;
+
+ void SeekFwd( const xub_StrLen nPos );
+ inline void SetFnt( SwFont* pNew ) { pFnt = pNew; }
protected:
void Chg( SwTxtAttr *pHt );
void Rst( SwTxtAttr *pHt );
void CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, SwTxtFrm* pFrm = 0 );
inline SwAttrIter(SwTxtNode* pTxtNode)
- : pShell(0), pFnt(0), pHints(0), pAttrSet(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0), nPropFont(0), m_pTxtNode(pTxtNode) {
+ : pShell(0), pFnt(0), pHints(0), pAttrSet(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0), nPropFont(0), m_pTxtNode(pTxtNode), m_bPrevSeekRemBorder(false) {
aMagicNo[SW_LATIN] = aMagicNo[SW_CJK] = aMagicNo[SW_CTL] = NULL;
}
@@ -78,7 +81,7 @@ protected:
public:
// Constructor, destructor
inline SwAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf )
- : pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTxtNode(&rTxtNode)
+ : pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTxtNode(&rTxtNode),m_bPrevSeekRemBorder(false)
{ CtorInitAttrIter( rTxtNode, rScrInf ); }
virtual ~SwAttrIter();
More information about the Libreoffice-commits
mailing list