summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/ruler.hxx3
-rw-r--r--svx/source/dialog/rlrcitem.cxx2
-rw-r--r--svx/source/dialog/svxruler.cxx13
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx22
4 files changed, 26 insertions, 14 deletions
diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx
index 374209a73f69..010af4b17936 100644
--- a/include/svx/ruler.hxx
+++ b/include/svx/ruler.hxx
@@ -91,6 +91,7 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
std::unique_ptr<SvxLongULSpaceItem> mxULSpaceItem; // upper and lower edge
std::unique_ptr<SvxTabStopItem> mxTabStopItem; // tab stops
std::unique_ptr<SvxLRSpaceItem> mxParaItem; // paragraphs
+ std::unique_ptr<SvxLRSpaceItem> mxBorderItem; // border distance
std::unique_ptr<SvxPagePosSizeItem> mxPagePosItem; // page distance to the rule
std::unique_ptr<SvxColumnItem> mxColumnItem; // columns
std::unique_ptr<SvxObjectItem> mxObjectItem; // object
@@ -140,7 +141,7 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
// paragraph indentations
void UpdatePara(const SvxLRSpaceItem* pItem);
// Border distance
- void UpdateParaBorder();
+ void UpdateBorder(const SvxLRSpaceItem* pItem);
// Tabs
void Update(const SvxTabStopItem* pItem);
// page position and width
diff --git a/svx/source/dialog/rlrcitem.cxx b/svx/source/dialog/rlrcitem.cxx
index 873663b27e30..a73cd00bdac5 100644
--- a/svx/source/dialog/rlrcitem.cxx
+++ b/svx/source/dialog/rlrcitem.cxx
@@ -131,7 +131,7 @@ void SvxRulerItem::StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState e
{
const SvxLRSpaceItem *pItem = dynamic_cast<const SvxLRSpaceItem*>( pState );
SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", "SvxLRSpaceItem expected");
- rRuler.UpdateParaBorder();
+ rRuler.UpdateBorder(pItem);
}
break;
case SID_RULER_TEXT_RIGHT_TO_LEFT :
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 6e960a18433d..d676c3c1208f 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -881,11 +881,16 @@ void SvxRuler::UpdatePara(const SvxLRSpaceItem *pItem) // new value of paragraph
}
}
-void SvxRuler::UpdateParaBorder()
+void SvxRuler::UpdateBorder(const SvxLRSpaceItem * pItem)
{
/* Border distance */
if(bActive)
{
+ if (pItem)
+ mxBorderItem.reset(new SvxLRSpaceItem(*pItem));
+ else
+ mxBorderItem.reset();
+
StartListening_Impl();
}
}
@@ -1206,6 +1211,9 @@ tools::Long SvxRuler::GetLeftFrameMargin() const
nLeft = mxColumnItem->GetActiveColumnDescription().nStart;
}
+ if (mxBorderItem && (!mxColumnItem || mxColumnItem->IsTable()))
+ nLeft += mxBorderItem->GetLeft();
+
return nLeft;
}
@@ -1257,6 +1265,9 @@ tools::Long SvxRuler::GetRightFrameMargin() const
else if(!bHorz && mxULSpaceItem)
lResult += mxULSpaceItem->GetLower();
+ if (bHorz && mxBorderItem && (!mxColumnItem || mxColumnItem->IsTable()))
+ lResult += mxBorderItem->GetRight();
+
if(bHorz)
lResult = mxPagePosItem->GetWidth() - lResult;
else
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 6bf269219d9a..c911971fd314 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1699,6 +1699,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
{
m_nLeftBorderDistance = 0;
m_nRightBorderDistance = 0;
+ SfxItemSetFixed<RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet2(GetPool());
if ( nSelType & SelectionType::Graphic ||
nSelType & SelectionType::Frame ||
nSelType & SelectionType::Ole ||
@@ -1714,15 +1716,17 @@ void SwView::StateTabWin(SfxItemSet& rSet)
const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( CurRectType::FlyEmbeddedPrt, pPt );
aDistLR.SetLeft(rFlyPrtRect.Left());
aDistLR.SetRight(rFlyPrtRect.Left());
+ rSet.Put(aDistLR);
}
else
{
SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
- aCoreSet.Put( aBoxInfo );
- rSh.GetFlyFrameAttr( aCoreSet );
- const SvxBoxItem& rBox = aCoreSet.Get(RES_BOX);
+ aCoreSet2.Put(aBoxInfo);
+ rSh.GetFlyFrameAttr(aCoreSet2);
+ const SvxBoxItem& rBox = aCoreSet2.Get(RES_BOX);
aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
+ rSet.Put(aDistLR);
//add the paragraph border distance
SfxItemSetFixed<RES_BOX, RES_BOX> aCoreSet1( GetPool() );
@@ -1731,7 +1735,6 @@ void SwView::StateTabWin(SfxItemSet& rSet)
aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
}
- rSet.Put(aDistLR);
m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
}
@@ -1739,8 +1742,6 @@ void SwView::StateTabWin(SfxItemSet& rSet)
( rSh.GetTableFormat() && !bFrameSelection &&
!(nFrameType & FrameTypeFlags::COLSECT ) ) )
{
- SfxItemSetFixed<RES_BOX, RES_BOX,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet2( GetPool() );
SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
aBoxInfo.SetTable(false);
aBoxInfo.SetDist(true);
@@ -1749,6 +1750,7 @@ void SwView::StateTabWin(SfxItemSet& rSet)
const SvxBoxItem& rBox = aCoreSet2.Get(RES_BOX);
aDistLR.SetLeft(rBox.GetDistance(SvxBoxItemLine::LEFT));
aDistLR.SetRight(rBox.GetDistance(SvxBoxItemLine::RIGHT));
+ rSet.Put(aDistLR);
//add the border distance of the paragraph
SfxItemSetFixed<RES_BOX, RES_BOX> aCoreSet1( GetPool() );
@@ -1756,7 +1758,6 @@ void SwView::StateTabWin(SfxItemSet& rSet)
const SvxBoxItem& rParaBox = aCoreSet1.Get(RES_BOX);
aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
- rSet.Put(aDistLR);
m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
}
@@ -1789,14 +1790,13 @@ void SwView::StateTabWin(SfxItemSet& rSet)
aDistLR.SetLeft(pBox->GetDistance(SvxBoxItemLine::LEFT));
aDistLR.SetRight(pBox->GetDistance(SvxBoxItemLine::RIGHT));
}
+ rSet.Put(aDistLR);
//add the border distance of the paragraph
- SfxItemSetFixed<RES_BOX, RES_BOX> aCoreSetTmp( GetPool() );
- rSh.GetCurAttr( aCoreSetTmp );
- const SvxBoxItem& rParaBox = aCoreSetTmp.Get(RES_BOX);
+ rSh.GetCurAttr(aCoreSet2);
+ const SvxBoxItem& rParaBox = aCoreSet2.Get(RES_BOX);
aDistLR.SetLeft(aDistLR.GetLeft() + rParaBox.GetDistance(SvxBoxItemLine::LEFT));
aDistLR.SetRight(aDistLR.GetRight() + rParaBox.GetDistance(SvxBoxItemLine::RIGHT));
- rSet.Put(aDistLR);
m_nLeftBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetLeft());
m_nRightBorderDistance = static_cast< sal_uInt16 >(aDistLR.GetRight());
}