summaryrefslogtreecommitdiff
path: root/cui/source/tabpages/paragrph.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/tabpages/paragrph.cxx')
-rw-r--r--cui/source/tabpages/paragrph.cxx928
1 files changed, 666 insertions, 262 deletions
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index a7075bd862e7..11fefa11ed07 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -25,8 +25,8 @@
#include <vcl/settings.hxx>
#include <svx/flagsdef.hxx>
#include <svx/svxids.hrc>
+#include <svx/sdtaitm.hxx>
-#include <svl/languageoptions.hxx>
#include <svl/cjkoptions.hxx>
#include <editeng/pgrditem.hxx>
#include <svx/strings.hrc>
@@ -45,29 +45,47 @@
#include <editeng/lrspitem.hxx>
#include <editeng/formatbreakitem.hxx>
#include <editeng/keepitem.hxx>
+#include <editeng/scriptspaceitem.hxx>
+#include <editeng/hngpnctitem.hxx>
+#include <editeng/forbiddenruleitem.hxx>
+#include <i18nlangtag/languagetag.hxx>
+#include <i18nlangtag/mslangid.hxx>
#include <svx/dlgutil.hxx>
#include <sfx2/htmlmode.hxx>
#include <editeng/paravertalignitem.hxx>
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
+#include <unotools/syslocaleoptions.hxx>
+#include <com/sun/star/text/ParagraphHyphenationKeepType.hpp>
const WhichRangesContainer SvxStdParagraphTabPage::pStdRanges(
svl::Items<
SID_ATTR_PARA_LINESPACE, SID_ATTR_PARA_LINESPACE, // 10033
+ SID_ATTR_PARA_LEFTSPACE, SID_ATTR_PARA_FIRSTLINESPACE,
SID_ATTR_LRSPACE, SID_ATTR_ULSPACE, // 10048 - 10049
SID_ATTR_PARA_REGISTER, SID_ATTR_PARA_REGISTER // 10413
>);
const WhichRangesContainer SvxParaAlignTabPage::pAlignRanges(
- svl::Items<SID_ATTR_PARA_ADJUST, SID_ATTR_PARA_ADJUST>); // 10027
+ svl::Items<
+ SID_ATTR_PARA_ADJUST, SID_ATTR_PARA_ADJUST, // 10027
+ // tdf#154543 - reset snap to grid to parent
+ SID_ATTR_PARA_SNAPTOGRID, SID_ATTR_PARA_SNAPTOGRID // 10945
+ >);
+
+const WhichRangesContainer SvxParaAlignTabPage::pSdrAlignRanges(
+ svl::Items<
+ SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST, // 1076
+ SID_ATTR_PARA_ADJUST, SID_ATTR_PARA_ADJUST , // 10027
+ SID_ATTR_FRAMEDIRECTION, SID_ATTR_FRAMEDIRECTION // 10944
+ >);
const WhichRangesContainer SvxExtParagraphTabPage::pExtRanges(svl::Items<
SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_WIDOWS, // 10037 - 10041
SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP // 10065 - 10066
>);
-#define MAX_DURCH 5670 // 10 cm makes sense as maximum interline lead
- // according to BP
+#define MAX_DURCH 31680 // tdf#68335: 1584 pt for UX interoperability with Word
#define FIX_DIST_DEF 283 // standard fix distance 0,5 cm
namespace {
@@ -139,13 +157,15 @@ void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace,
static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet)
{
sal_uInt16 nHtmlMode = 0;
- const SfxPoolItem* pItem = nullptr;
- SfxObjectShell* pShell;
- if(SfxItemState::SET == rSet.GetItemState(SID_HTML_MODE, false, &pItem) ||
- ( nullptr != (pShell = SfxObjectShell::Current()) &&
- nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
+ const SfxUInt16Item* pItem = rSet.GetItemIfSet(SID_HTML_MODE, false);
+ if (!pItem)
+ {
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
+ pItem = pShell->GetItem(SID_HTML_MODE);
+ }
+ if(pItem)
{
- nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ nHtmlMode = pItem->GetValue();
}
return nHtmlMode;
@@ -158,34 +178,34 @@ void SvxStdParagraphTabPage::ELRLoseFocus()
FieldUnit eUnit =
MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
- sal_Int64 nL = m_xLeftIndent->denormalize(m_xLeftIndent->get_value(eUnit));
- sal_Int64 nR = m_xRightIndent->denormalize(m_xRightIndent->get_value(eUnit));
- OUString aTmp = m_xFLineIndent->get_text();
+ sal_Int64 nL = m_aLeftIndent.denormalize(m_aLeftIndent.get_value(eUnit));
+ sal_Int64 nR = m_aRightIndent.denormalize(m_aRightIndent.get_value(eUnit));
+ OUString aTmp = m_aFLineIndent.get_text();
- if (m_xLeftIndent->get_min(FieldUnit::NONE) < 0)
- m_xFLineIndent->set_min(-99999, FieldUnit::MM);
+ if (m_aLeftIndent.get_min(FieldUnit::NONE) < 0)
+ m_aFLineIndent.set_min(-99999, FieldUnit::MM);
else
- m_xFLineIndent->set_min(m_xFLineIndent->normalize(-nL), eUnit);
+ m_aFLineIndent.set_min(m_aFLineIndent.normalize(-nL), eUnit);
// Check only for concrete width (Shell)
sal_Int64 nTmp = nWidth - nL - nR - MM50;
- m_xFLineIndent->set_max(m_xFLineIndent->normalize(nTmp), eUnit);
+ m_aFLineIndent.set_max(m_aFLineIndent.normalize(nTmp), eUnit);
if (aTmp.isEmpty())
- m_xFLineIndent->set_text(OUString());
+ m_aFLineIndent.set_text(OUString());
// maximum left right
- aTmp = m_xLeftIndent->get_text();
+ aTmp = m_aLeftIndent.get_text();
nTmp = nWidth - nR - MM50;
- m_xLeftIndent->set_max(m_xLeftIndent->normalize(nTmp), eUnit);
+ m_aLeftIndent.set_max(m_aLeftIndent.normalize(nTmp), eUnit);
if ( aTmp.isEmpty() )
- m_xLeftIndent->set_text(OUString());
- aTmp = m_xRightIndent->get_text();
+ m_aLeftIndent.set_text(OUString());
+ aTmp = m_aRightIndent.get_text();
nTmp = nWidth - nL - MM50;
- m_xRightIndent->set_max(m_xRightIndent->normalize(nTmp), eUnit);
+ m_aRightIndent.set_max(m_aRightIndent.normalize(nTmp), eUnit);
if ( aTmp.isEmpty() )
- m_xRightIndent->set_text(OUString());
+ m_aRightIndent.set_text(OUString());
UpdateExample_Impl();
}
@@ -251,14 +271,14 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
if ( m_bLineDistToggled ||
!pOld || !( *static_cast<const SvxLineSpacingItem*>(pOld) == aSpacing ) ||
- SfxItemState::DONTCARE == GetItemSet().GetItemState( nWhich ) )
+ SfxItemState::INVALID == GetItemSet().GetItemState( nWhich ) )
{
rOutSet->Put( aSpacing );
bModified = true;
}
}
- if ( m_xTopDist->get_value_changed_from_saved() || m_xBottomDist->get_value_changed_from_saved()
+ if ( m_aTopDist.get_value_changed_from_saved() || m_aBottomDist.get_value_changed_from_saved()
|| m_xContextualCB->get_state_changed_from_saved())
{
nWhich = GetWhich( SID_ATTR_ULSPACE );
@@ -273,28 +293,28 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
const SvxULSpaceItem& rOldItem =
static_cast<const SvxULSpaceItem&>(GetItemSet().GetParent()->Get( nWhich ));
- if ( m_xTopDist->IsRelative() )
+ if ( m_aTopDist.IsRelative() )
aMargin.SetUpper( rOldItem.GetUpper(),
- static_cast<sal_uInt16>(m_xTopDist->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aTopDist.get_value(FieldUnit::NONE)) );
else
- aMargin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->GetCoreValue(eUnit)) );
+ aMargin.SetUpper( static_cast<sal_uInt16>(m_aTopDist.GetCoreValue(eUnit)) );
- if ( m_xBottomDist->IsRelative() )
+ if ( m_aBottomDist.IsRelative() )
aMargin.SetLower( rOldItem.GetLower(),
- static_cast<sal_uInt16>(m_xBottomDist->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aBottomDist.get_value(FieldUnit::NONE)) );
else
- aMargin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->GetCoreValue(eUnit)) );
+ aMargin.SetLower( static_cast<sal_uInt16>(m_aBottomDist.GetCoreValue(eUnit)) );
}
else
{
- aMargin.SetUpper(static_cast<sal_uInt16>(m_xTopDist->GetCoreValue(eUnit)));
- aMargin.SetLower(static_cast<sal_uInt16>(m_xBottomDist->GetCoreValue(eUnit)));
+ aMargin.SetUpper(static_cast<sal_uInt16>(m_aTopDist.GetCoreValue(eUnit)));
+ aMargin.SetLower(static_cast<sal_uInt16>(m_aBottomDist.GetCoreValue(eUnit)));
}
aMargin.SetContextValue(m_xContextualCB->get_active());
if ( !pOld || *static_cast<const SvxULSpaceItem*>(pOld) != aMargin ||
- SfxItemState::DONTCARE == GetItemSet().GetItemState( nWhich ) )
+ SfxItemState::INVALID == GetItemSet().GetItemState( nWhich ) )
{
rOutSet->Put( aMargin );
bModified = true;
@@ -302,10 +322,126 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
bool bNullTab = false;
- if ( m_xLeftIndent->get_value_changed_from_saved() ||
- m_xFLineIndent->get_value_changed_from_saved() ||
- m_xRightIndent->get_value_changed_from_saved() ||
- m_xAutoCB->get_state_changed_from_saved() )
+ if (m_bSplitLRSpace && m_aLeftIndent.get_value_changed_from_saved())
+ {
+ nWhich = GetWhich(SID_ATTR_PARA_LEFTSPACE);
+ MapUnit const eUnit = pPool->GetMetric(nWhich);
+ SvxTextLeftMarginItem item(nWhich);
+ pOld = GetOldItem(*rOutSet, SID_ATTR_PARA_LEFTSPACE);
+
+ if (bRelativeMode)
+ {
+ assert(GetItemSet().GetParent());
+
+ const SvxTextLeftMarginItem & rOldItem(
+ static_cast<const SvxTextLeftMarginItem&>(GetItemSet().GetParent()->Get(nWhich)));
+
+ if (m_aLeftIndent.IsRelative())
+ {
+ item.SetTextLeft(rOldItem.GetTextLeft(),
+ static_cast<sal_uInt16>(m_aLeftIndent.get_value(FieldUnit::NONE)));
+ }
+ else
+ {
+ item.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
+ }
+ }
+ else
+ {
+ item.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
+ }
+ if (!pOld || *static_cast<const SvxTextLeftMarginItem*>(pOld) != item
+ || SfxItemState::INVALID == GetItemSet().GetItemState(nWhich))
+ {
+ rOutSet->Put(item);
+ bModified = true;
+ }
+ }
+
+ if (m_bSplitLRSpace && m_aRightIndent.get_value_changed_from_saved())
+ {
+ nWhich = GetWhich(SID_ATTR_PARA_RIGHTSPACE);
+ MapUnit const eUnit = pPool->GetMetric(nWhich);
+ SvxRightMarginItem item(nWhich);
+ pOld = GetOldItem(*rOutSet, SID_ATTR_PARA_RIGHTSPACE);
+
+ if (bRelativeMode)
+ {
+ assert(GetItemSet().GetParent());
+
+ const SvxRightMarginItem & rOldItem(
+ static_cast<const SvxRightMarginItem&>(GetItemSet().GetParent()->Get(nWhich)));
+
+ if (m_aRightIndent.IsRelative())
+ {
+ item.SetRight(rOldItem.GetRight(),
+ static_cast<sal_uInt16>(m_aRightIndent.get_value(FieldUnit::NONE)));
+ }
+ else
+ {
+ item.SetRight(m_aRightIndent.GetCoreValue(eUnit));
+ }
+ }
+ else
+ {
+ item.SetRight(m_aRightIndent.GetCoreValue(eUnit));
+ }
+ if (!pOld || *static_cast<const SvxRightMarginItem*>(pOld) != item
+ || SfxItemState::INVALID == GetItemSet().GetItemState(nWhich))
+ {
+ rOutSet->Put(item);
+ bModified = true;
+ }
+ }
+
+ if (m_bSplitLRSpace && (m_aFLineIndent.get_value_changed_from_saved()
+ || m_xAutoCB->get_state_changed_from_saved()))
+ {
+ nWhich = GetWhich(SID_ATTR_PARA_FIRSTLINESPACE);
+ MapUnit const eUnit = pPool->GetMetric(nWhich);
+ SvxFirstLineIndentItem item(nWhich);
+ pOld = GetOldItem(*rOutSet, SID_ATTR_PARA_FIRSTLINESPACE);
+
+ if (bRelativeMode)
+ {
+ assert(GetItemSet().GetParent());
+
+ const SvxFirstLineIndentItem & rOldItem(
+ static_cast<const SvxFirstLineIndentItem&>(GetItemSet().GetParent()->Get(nWhich)));
+
+ if (m_aFLineIndent.IsRelative())
+ {
+ item.SetTextFirstLineOffset(rOldItem.GetTextFirstLineOffset(),
+ static_cast<sal_uInt16>(m_aFLineIndent.get_value(FieldUnit::NONE)));
+ }
+ else
+ {
+ item.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
+ }
+ }
+ else
+ {
+ item.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
+ }
+ item.SetAutoFirst(m_xAutoCB->get_active());
+ if (item.GetTextFirstLineOffset() < 0)
+ {
+ bNullTab = true;
+ }
+
+ if (!pOld || *static_cast<const SvxFirstLineIndentItem*>(pOld) != item
+ || SfxItemState::INVALID == GetItemSet().GetItemState(nWhich))
+ {
+ rOutSet->Put(item);
+ bModified = true;
+ }
+ }
+
+ if (!m_bSplitLRSpace &&
+ (m_aLeftIndent.get_value_changed_from_saved() ||
+ m_aFLineIndent.get_value_changed_from_saved() ||
+ m_aRightIndent.get_value_changed_from_saved() ||
+ m_xAutoCB->get_state_changed_from_saved()))
{
nWhich = GetWhich( SID_ATTR_LRSPACE );
MapUnit eUnit = pPool->GetMetric( nWhich );
@@ -319,36 +455,36 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
const SvxLRSpaceItem& rOldItem =
static_cast<const SvxLRSpaceItem&>(GetItemSet().GetParent()->Get( nWhich ));
- if (m_xLeftIndent->IsRelative())
+ if (m_aLeftIndent.IsRelative())
aMargin.SetTextLeft( rOldItem.GetTextLeft(),
- static_cast<sal_uInt16>(m_xLeftIndent->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aLeftIndent.get_value(FieldUnit::NONE)) );
else
- aMargin.SetTextLeft(m_xLeftIndent->GetCoreValue(eUnit));
+ aMargin.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
- if ( m_xRightIndent->IsRelative() )
+ if ( m_aRightIndent.IsRelative() )
aMargin.SetRight( rOldItem.GetRight(),
- static_cast<sal_uInt16>(m_xRightIndent->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aRightIndent.get_value(FieldUnit::NONE)) );
else
- aMargin.SetRight(m_xRightIndent->GetCoreValue(eUnit));
+ aMargin.SetRight(m_aRightIndent.GetCoreValue(eUnit));
- if ( m_xFLineIndent->IsRelative() )
+ if ( m_aFLineIndent.IsRelative() )
aMargin.SetTextFirstLineOffset( rOldItem.GetTextFirstLineOffset(),
- static_cast<sal_uInt16>(m_xFLineIndent->get_value(FieldUnit::NONE)) );
+ static_cast<sal_uInt16>(m_aFLineIndent.get_value(FieldUnit::NONE)) );
else
- aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_xFLineIndent->GetCoreValue(eUnit)));
+ aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
}
else
{
- aMargin.SetTextLeft(m_xLeftIndent->GetCoreValue(eUnit));
- aMargin.SetRight(m_xRightIndent->GetCoreValue(eUnit));
- aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_xFLineIndent->GetCoreValue(eUnit)));
+ aMargin.SetTextLeft(m_aLeftIndent.GetCoreValue(eUnit));
+ aMargin.SetRight(m_aRightIndent.GetCoreValue(eUnit));
+ aMargin.SetTextFirstLineOffset(static_cast<sal_uInt16>(m_aFLineIndent.GetCoreValue(eUnit)));
}
aMargin.SetAutoFirst(m_xAutoCB->get_active());
if ( aMargin.GetTextFirstLineOffset() < 0 )
bNullTab = true;
if ( !pOld || *static_cast<const SvxLRSpaceItem*>(pOld) != aMargin ||
- SfxItemState::DONTCARE == GetItemSet().GetItemState( nWhich ) )
+ SfxItemState::INVALID == GetItemSet().GetItemState( nWhich ) )
{
rOutSet->Put( aMargin );
bModified = true;
@@ -382,14 +518,14 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
*rOutSet, SID_ATTR_PARA_REGISTER));
if (!pBoolItem)
return bModified;
- std::unique_ptr<SfxBoolItem> pRegItem(pBoolItem->Clone());
sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
- bool bSet = pRegItem->GetValue();
+ bool bSet = pBoolItem->GetValue();
if (m_xRegisterCB->get_active() != bSet)
{
+ std::unique_ptr<SfxBoolItem> pRegItem(pBoolItem->Clone());
pRegItem->SetValue(!bSet);
- rOutSet->Put(*pRegItem);
+ rOutSet->Put(std::move(pRegItem));
bModified = true;
}
else if ( SfxItemState::DEFAULT == GetItemSet().GetItemState( _nWhich, false ) )
@@ -399,6 +535,19 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
return bModified;
}
+static bool UseCharUnitInUI(const SfxItemSet& rSet)
+{
+ const bool bApplyCharUnit = GetApplyCharUnit(rSet);
+ if (!bApplyCharUnit)
+ return false;
+ if (!SvtCJKOptions::IsAsianTypographyEnabled())
+ return false;
+ // tdf#101895 Given that we choose to show cm vs inch based on this Locale
+ // setting, also choose to use ch[ar] and line based on that locale when
+ // bApplyCharUnit is enabled.
+ return MsLangId::isCJK(SvtSysLocaleOptions().GetRealLanguageTag().getLanguageType());
+}
+
void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
{
SfxItemPool* pPool = rSet->GetPool();
@@ -406,32 +555,134 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
// adjust metric
FieldUnit eFUnit = GetModuleFieldUnit( *rSet );
-
- bool bApplyCharUnit = GetApplyCharUnit( *rSet );
-
- if(SvtCJKOptions::IsAsianTypographyEnabled() && bApplyCharUnit )
+ if (UseCharUnitInUI(*rSet))
eFUnit = FieldUnit::CHAR;
- m_xLeftIndent->SetFieldUnit(eFUnit);
- m_xRightIndent->SetFieldUnit(eFUnit);
- m_xFLineIndent->SetFieldUnit(eFUnit);
+ m_aLeftIndent.SetFieldUnit(eFUnit);
+ m_aRightIndent.SetFieldUnit(eFUnit);
+ m_aFLineIndent.SetFieldUnit(eFUnit);
if ( eFUnit == FieldUnit::CHAR )
{
- m_xTopDist->SetFieldUnit(FieldUnit::LINE);
- m_xBottomDist->SetFieldUnit(FieldUnit::LINE);
+ m_aTopDist.SetFieldUnit(FieldUnit::LINE);
+ m_aBottomDist.SetFieldUnit(FieldUnit::LINE);
SetFieldUnit(*m_xLineDistAtMetricBox, FieldUnit::POINT);
}
else
{
- m_xTopDist->SetFieldUnit(eFUnit);
- m_xBottomDist->SetFieldUnit(eFUnit);
+ m_aTopDist.SetFieldUnit(eFUnit);
+ m_aBottomDist.SetFieldUnit(eFUnit);
SetFieldUnit(*m_xLineDistAtMetricBox, eFUnit);
}
+ sal_uInt16 const nWhichFL(GetWhich(SID_ATTR_PARA_FIRSTLINESPACE));
+ m_bSplitLRSpace = (nWhichFL != SID_ATTR_PARA_FIRSTLINESPACE);
+ SfxItemState const eItemStateFL(rSet->GetItemState(nWhichFL));
+ sal_uInt16 const nWhichLM(GetWhich(SID_ATTR_PARA_LEFTSPACE));
+ SfxItemState const eItemStateLM(rSet->GetItemState(nWhichLM));
+ sal_uInt16 const nWhichRM(GetWhich(SID_ATTR_PARA_RIGHTSPACE));
+ SfxItemState const eItemStateRM(rSet->GetItemState(nWhichRM));
+
+ if (m_bSplitLRSpace && SfxItemState::DEFAULT <= eItemStateLM)
+ {
+ const SvxTextLeftMarginItem & rOldLeftMargin(
+ static_cast<const SvxTextLeftMarginItem &>(rSet->Get(nWhichLM)));
+
+ MapUnit const eUnit = pPool->GetMetric(nWhichLM);
+
+ if (bRelativeMode)
+ {
+ if (rOldLeftMargin.GetPropLeft() != 100)
+ {
+ m_aLeftIndent.SetRelative( true );
+ m_aLeftIndent.set_value(rOldLeftMargin.GetPropLeft(), FieldUnit::NONE);
+ }
+ else
+ {
+ m_aLeftIndent.SetRelative(false);
+ m_aLeftIndent.SetFieldUnit(eFUnit);
+ m_aLeftIndent.SetMetricValue(rOldLeftMargin.GetTextLeft(), eUnit);
+ }
+ }
+ else
+ {
+ m_aLeftIndent.SetMetricValue(rOldLeftMargin.GetTextLeft(), eUnit);
+ }
+ }
+ else if (m_bSplitLRSpace)
+ {
+ m_aLeftIndent.set_text(OUString());
+ }
+
+ if (m_bSplitLRSpace && SfxItemState::DEFAULT <= eItemStateRM)
+ {
+ const SvxRightMarginItem & rOldRightMargin(
+ static_cast<const SvxRightMarginItem &>(rSet->Get(nWhichRM)));
+
+ MapUnit const eUnit = pPool->GetMetric(nWhichRM);
+
+ if (bRelativeMode)
+ {
+ if (rOldRightMargin.GetPropRight() != 100)
+ {
+ m_aRightIndent.SetRelative( true );
+ m_aRightIndent.set_value(rOldRightMargin.GetPropRight(), FieldUnit::NONE);
+ }
+ else
+ {
+ m_aRightIndent.SetRelative(false);
+ m_aRightIndent.SetFieldUnit(eFUnit);
+ m_aRightIndent.SetMetricValue(rOldRightMargin.GetRight(), eUnit);
+ }
+ }
+ else
+ {
+ m_aRightIndent.SetMetricValue(rOldRightMargin.GetRight(), eUnit);
+ }
+ }
+ else if (m_bSplitLRSpace)
+ {
+ m_aRightIndent.set_text(OUString());
+ }
+
+ if (m_bSplitLRSpace && SfxItemState::DEFAULT <= eItemStateFL)
+ {
+ const SvxFirstLineIndentItem & rOldFirstLine(
+ static_cast<const SvxFirstLineIndentItem &>(rSet->Get(nWhichFL)));
+
+ MapUnit const eUnit = pPool->GetMetric(nWhichFL);
+
+ if (bRelativeMode)
+ {
+ if (rOldFirstLine.GetPropTextFirstLineOffset() != 100)
+ {
+ m_aFLineIndent.SetRelative(true);
+ m_aFLineIndent.set_value(rOldFirstLine.GetPropTextFirstLineOffset(), FieldUnit::NONE);
+ }
+ else
+ {
+ m_aFLineIndent.SetRelative(false);
+ m_aFLineIndent.set_min(-9999, FieldUnit::NONE);
+ m_aFLineIndent.SetFieldUnit(eFUnit);
+ m_aFLineIndent.SetMetricValue(rOldFirstLine.GetTextFirstLineOffset(), eUnit);
+ }
+ m_xAutoCB->set_active(rOldFirstLine.IsAutoFirst());
+ }
+ else
+ {
+ m_aFLineIndent.SetMetricValue(rOldFirstLine.GetTextFirstLineOffset(), eUnit);
+ m_xAutoCB->set_active(rOldFirstLine.IsAutoFirst());
+ }
+ AutoHdl_Impl(*m_xAutoCB);
+ }
+ else if (m_bSplitLRSpace)
+ {
+ m_aFLineIndent.set_text(OUString());
+ }
+
sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE );
SfxItemState eItemState = rSet->GetItemState( _nWhich );
- if ( eItemState >= SfxItemState::DEFAULT )
+ if (!m_bSplitLRSpace && SfxItemState::DEFAULT <= eItemState)
{
MapUnit eUnit = pPool->GetMetric( _nWhich );
@@ -442,39 +693,39 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
if ( rOldItem.GetPropLeft() != 100 )
{
- m_xLeftIndent->SetRelative( true );
- m_xLeftIndent->set_value(rOldItem.GetPropLeft(), FieldUnit::NONE);
+ m_aLeftIndent.SetRelative( true );
+ m_aLeftIndent.set_value(rOldItem.GetPropLeft(), FieldUnit::NONE);
}
else
{
- m_xLeftIndent->SetRelative(false);
- m_xLeftIndent->SetFieldUnit(eFUnit);
- m_xLeftIndent->SetMetricValue(rOldItem.GetTextLeft(), eUnit);
+ m_aLeftIndent.SetRelative(false);
+ m_aLeftIndent.SetFieldUnit(eFUnit);
+ m_aLeftIndent.SetMetricValue(rOldItem.GetTextLeft(), eUnit);
}
if ( rOldItem.GetPropRight() != 100 )
{
- m_xRightIndent->SetRelative( true );
- m_xRightIndent->set_value(rOldItem.GetPropRight(), FieldUnit::NONE);
+ m_aRightIndent.SetRelative( true );
+ m_aRightIndent.set_value(rOldItem.GetPropRight(), FieldUnit::NONE);
}
else
{
- m_xRightIndent->SetRelative(false);
- m_xRightIndent->SetFieldUnit(eFUnit);
- m_xRightIndent->SetMetricValue(rOldItem.GetRight(), eUnit);
+ m_aRightIndent.SetRelative(false);
+ m_aRightIndent.SetFieldUnit(eFUnit);
+ m_aRightIndent.SetMetricValue(rOldItem.GetRight(), eUnit);
}
if ( rOldItem.GetPropTextFirstLineOffset() != 100 )
{
- m_xFLineIndent->SetRelative(true);
- m_xFLineIndent->set_value(rOldItem.GetPropTextFirstLineOffset(), FieldUnit::NONE);
+ m_aFLineIndent.SetRelative(true);
+ m_aFLineIndent.set_value(rOldItem.GetPropTextFirstLineOffset(), FieldUnit::NONE);
}
else
{
- m_xFLineIndent->SetRelative(false);
- m_xFLineIndent->set_min(-9999, FieldUnit::NONE);
- m_xFLineIndent->SetFieldUnit(eFUnit);
- m_xFLineIndent->SetMetricValue(rOldItem.GetTextFirstLineOffset(), eUnit);
+ m_aFLineIndent.SetRelative(false);
+ m_aFLineIndent.set_min(-9999, FieldUnit::NONE);
+ m_aFLineIndent.SetFieldUnit(eFUnit);
+ m_aFLineIndent.SetMetricValue(rOldItem.GetTextFirstLineOffset(), eUnit);
}
m_xAutoCB->set_active(rOldItem.IsAutoFirst());
}
@@ -483,18 +734,18 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
const SvxLRSpaceItem& rSpace =
static_cast<const SvxLRSpaceItem&>(rSet->Get( _nWhich ));
- m_xLeftIndent->SetMetricValue(rSpace.GetTextLeft(), eUnit);
- m_xRightIndent->SetMetricValue(rSpace.GetRight(), eUnit);
- m_xFLineIndent->SetMetricValue(rSpace.GetTextFirstLineOffset(), eUnit);
+ m_aLeftIndent.SetMetricValue(rSpace.GetTextLeft(), eUnit);
+ m_aRightIndent.SetMetricValue(rSpace.GetRight(), eUnit);
+ m_aFLineIndent.SetMetricValue(rSpace.GetTextFirstLineOffset(), eUnit);
m_xAutoCB->set_active(rSpace.IsAutoFirst());
}
AutoHdl_Impl(*m_xAutoCB);
}
- else
+ else if (!m_bSplitLRSpace)
{
- m_xLeftIndent->set_text(OUString());
- m_xRightIndent->set_text(OUString());
- m_xFLineIndent->set_text(OUString());
+ m_aLeftIndent.set_text(OUString());
+ m_aRightIndent.set_text(OUString());
+ m_aFLineIndent.set_text(OUString());
}
_nWhich = GetWhich( SID_ATTR_ULSPACE );
@@ -511,45 +762,45 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
if ( rOldItem.GetPropUpper() != 100 )
{
- m_xTopDist->SetRelative( true );
- m_xTopDist->set_value(rOldItem.GetPropUpper(), FieldUnit::NONE);
+ m_aTopDist.SetRelative( true );
+ m_aTopDist.set_value(rOldItem.GetPropUpper(), FieldUnit::NONE);
}
else
{
- m_xTopDist->SetRelative(false);
+ m_aTopDist.SetRelative(false);
if (eFUnit == FieldUnit::CHAR)
- m_xTopDist->SetFieldUnit(FieldUnit::LINE);
+ m_aTopDist.SetFieldUnit(FieldUnit::LINE);
else
- m_xTopDist->SetFieldUnit(eFUnit);
- m_xTopDist->SetMetricValue(rOldItem.GetUpper(), eUnit);
+ m_aTopDist.SetFieldUnit(eFUnit);
+ m_aTopDist.SetMetricValue(rOldItem.GetUpper(), eUnit);
}
if ( rOldItem.GetPropLower() != 100 )
{
- m_xBottomDist->SetRelative( true );
- m_xBottomDist->set_value(rOldItem.GetPropLower(), FieldUnit::NONE);
+ m_aBottomDist.SetRelative( true );
+ m_aBottomDist.set_value(rOldItem.GetPropLower(), FieldUnit::NONE);
}
else
{
- m_xBottomDist->SetRelative(false);
+ m_aBottomDist.SetRelative(false);
if (eFUnit == FieldUnit::CHAR)
- m_xBottomDist->SetFieldUnit(FieldUnit::LINE);
+ m_aBottomDist.SetFieldUnit(FieldUnit::LINE);
else
- m_xBottomDist->SetFieldUnit(eFUnit);
- m_xBottomDist->SetMetricValue(rOldItem.GetLower(), eUnit);
+ m_aBottomDist.SetFieldUnit(eFUnit);
+ m_aBottomDist.SetMetricValue(rOldItem.GetLower(), eUnit);
}
}
else
{
- m_xTopDist->SetMetricValue(rOldItem.GetUpper(), eUnit);
- m_xBottomDist->SetMetricValue(rOldItem.GetLower(), eUnit);
+ m_aTopDist.SetMetricValue(rOldItem.GetUpper(), eUnit);
+ m_aBottomDist.SetMetricValue(rOldItem.GetLower(), eUnit);
}
m_xContextualCB->set_active(rOldItem.GetContext());
}
else
{
- m_xTopDist->set_text(OUString());
- m_xBottomDist->set_text(OUString());
+ m_aTopDist.set_text(OUString());
+ m_aBottomDist.set_text(OUString());
}
_nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
@@ -582,15 +833,15 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet )
void SvxStdParagraphTabPage::ChangesApplied()
{
- m_xLeftIndent->save_value();
- m_xRightIndent->save_value();
- m_xFLineIndent->save_value();
+ m_aLeftIndent.save_value();
+ m_aRightIndent.save_value();
+ m_aFLineIndent.save_value();
m_xLineDist->save_value();
m_xLineDistAtPercentBox->save_value();
m_xLineDistAtMetricBox->save_value();
m_xRegisterCB->save_state();
- m_xTopDist->save_value();
- m_xBottomDist->save_value();
+ m_aTopDist.save_value();
+ m_aBottomDist.save_value();
m_xContextualCB->save_state();
m_xAutoCB->save_state();
}
@@ -599,11 +850,11 @@ void SvxStdParagraphTabPage::EnableRelativeMode()
{
DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
- m_xLeftIndent->EnableRelativeMode( 0, 999 );
- m_xFLineIndent->EnableRelativeMode( 0, 999 );
- m_xRightIndent->EnableRelativeMode( 0, 999 );
- m_xTopDist->EnableRelativeMode( 0, 999 );
- m_xBottomDist->EnableRelativeMode( 0, 999 );
+ m_aLeftIndent.EnableRelativeMode( 0, 999 );
+ m_aFLineIndent.EnableRelativeMode( 0, 999 );
+ m_aRightIndent.EnableRelativeMode( 0, 999 );
+ m_aTopDist.EnableRelativeMode( 0, 999 );
+ m_aBottomDist.EnableRelativeMode( 0, 999 );
bRelativeMode = true;
}
@@ -658,32 +909,32 @@ SvxStdParagraphTabPage::SvxStdParagraphTabPage(weld::Container* pPage, weld::Dia
, nWidth(11905 /*567 * 50*/)
, nMinFixDist(0)
, bRelativeMode(false)
- , m_xLeftIndent(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_LEFTINDENT", FieldUnit::CM)))
- , m_xRightLabel(m_xBuilder->weld_label("labelFT_RIGHTINDENT"))
- , m_xRightIndent(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_RIGHTINDENT", FieldUnit::CM)))
+ , m_aLeftIndent(m_xBuilder->weld_metric_spin_button("spinED_LEFTINDENT", FieldUnit::CM))
+ , m_aRightIndent(m_xBuilder->weld_metric_spin_button("spinED_RIGHTINDENT", FieldUnit::CM))
, m_xFLineLabel(m_xBuilder->weld_label("labelFT_FLINEINDENT"))
- , m_xFLineIndent(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_FLINEINDENT", FieldUnit::CM)))
+ , m_aFLineIndent(m_xBuilder->weld_metric_spin_button("spinED_FLINEINDENT", FieldUnit::CM))
, m_xAutoCB(m_xBuilder->weld_check_button("checkCB_AUTO"))
- , m_xTopDist(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_TOPDIST", FieldUnit::CM)))
- , m_xBottomDist(new SvxRelativeField(m_xBuilder->weld_metric_spin_button("spinED_BOTTOMDIST", FieldUnit::CM)))
+ , m_aTopDist(m_xBuilder->weld_metric_spin_button("spinED_TOPDIST", FieldUnit::CM))
+ , m_aBottomDist(m_xBuilder->weld_metric_spin_button("spinED_BOTTOMDIST", FieldUnit::CM))
, m_xContextualCB(m_xBuilder->weld_check_button("checkCB_CONTEXTUALSPACING"))
, m_xLineDist(m_xBuilder->weld_combo_box("comboLB_LINEDIST"))
, m_xLineDistAtPercentBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTPERCENT", FieldUnit::PERCENT))
, m_xLineDistAtMetricBox(m_xBuilder->weld_metric_spin_button("spinED_LINEDISTMETRIC", FieldUnit::CM))
+ , m_xLineDistAtPlaceHolderBox(m_xBuilder->weld_metric_spin_button("spinED_BLANK", FieldUnit::CM))
, m_xLineDistAtLabel(m_xBuilder->weld_label("labelFT_LINEDIST"))
, m_xAbsDist(m_xBuilder->weld_label("labelST_LINEDIST_ABS"))
, m_xRegisterCB(m_xBuilder->weld_check_button("checkCB_REGISTER"))
, m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin))
{
- sAbsDist = m_xAbsDist->get_label();
-
// this page needs ExchangeSupport
SetExchangeSupport();
m_xLineDistAtMetricBox->hide();
+ m_xLineDistAtPlaceHolderBox->hide();
+ m_xLineDistAtPlaceHolderBox->set_text(OUString());
Init_Impl();
- m_xFLineIndent->set_min(-9999, FieldUnit::NONE); // is set to 0 on default
+ m_aFLineIndent.set_min(-9999, FieldUnit::NONE); // is set to 0 on default
}
SvxStdParagraphTabPage::~SvxStdParagraphTabPage()
@@ -692,10 +943,10 @@ SvxStdParagraphTabPage::~SvxStdParagraphTabPage()
void SvxStdParagraphTabPage::EnableNegativeMode()
{
- m_xLeftIndent->set_min(-9999, FieldUnit::NONE);
- m_xRightIndent->set_min(-9999, FieldUnit::NONE);
- m_xRightIndent->EnableNegativeMode();
- m_xLeftIndent->EnableNegativeMode();
+ m_aLeftIndent.set_min(-9999, FieldUnit::NONE);
+ m_aRightIndent.set_min(-9999, FieldUnit::NONE);
+ m_aRightIndent.EnableNegativeMode();
+ m_aLeftIndent.EnableNegativeMode();
}
void SvxStdParagraphTabPage::SetLineSpacing_Impl
@@ -784,10 +1035,9 @@ IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void)
case LLINESPACE_15:
case LLINESPACE_2:
m_xLineDistAtLabel->set_sensitive(false);
- m_xLineDistAtPercentBox->set_sensitive(false);
- m_xLineDistAtPercentBox->set_text(OUString());
- m_xLineDistAtMetricBox->set_sensitive(false);
- m_xLineDistAtMetricBox->set_text(OUString());
+ m_xLineDistAtPercentBox->hide();
+ m_xLineDistAtMetricBox->hide();
+ m_xLineDistAtPlaceHolderBox->show();
break;
case LLINESPACE_DURCH:
@@ -795,32 +1045,32 @@ IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void)
// limit MS min(10, aPageSize)
m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
- if (m_xLineDistAtMetricBox->get_text().isEmpty())
+ if (m_xLineDistAtPlaceHolderBox->get_visible())
m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(1), FieldUnit::NONE);
+ m_xLineDistAtPlaceHolderBox->hide();
m_xLineDistAtPercentBox->hide();
m_xLineDistAtMetricBox->show();
- m_xLineDistAtMetricBox->set_sensitive(true);
m_xLineDistAtLabel->set_sensitive(true);
break;
case LLINESPACE_MIN:
m_xLineDistAtMetricBox->set_min(0, FieldUnit::NONE);
- if (m_xLineDistAtMetricBox->get_text().isEmpty())
+ if (m_xLineDistAtPlaceHolderBox->get_visible())
m_xLineDistAtMetricBox->set_value(m_xLineDistAtMetricBox->normalize(10), FieldUnit::TWIP);
+ m_xLineDistAtPlaceHolderBox->hide();
m_xLineDistAtPercentBox->hide();
m_xLineDistAtMetricBox->show();
- m_xLineDistAtMetricBox->set_sensitive(true);
m_xLineDistAtLabel->set_sensitive(true);
break;
case LLINESPACE_PROP:
- if (m_xLineDistAtPercentBox->get_text().isEmpty())
+ if (m_xLineDistAtPlaceHolderBox->get_visible())
m_xLineDistAtPercentBox->set_value(m_xLineDistAtPercentBox->normalize(100), FieldUnit::TWIP);
+ m_xLineDistAtPlaceHolderBox->hide();
m_xLineDistAtMetricBox->hide();
m_xLineDistAtPercentBox->show();
- m_xLineDistAtPercentBox->set_sensitive(true);
m_xLineDistAtLabel->set_sensitive(true);
break;
case LLINESPACE_FIX:
@@ -832,9 +1082,9 @@ IMPL_LINK(SvxStdParagraphTabPage, LineDistHdl_Impl, weld::ComboBox&, rBox, void)
// it is time for the default
if (m_xLineDistAtMetricBox->get_value(FieldUnit::NONE) != nTemp)
SetMetricValue( *m_xLineDistAtMetricBox, FIX_DIST_DEF, MapUnit::MapTwip ); // fix is only in Writer
+ m_xLineDistAtPlaceHolderBox->hide();
m_xLineDistAtPercentBox->hide();
m_xLineDistAtMetricBox->show();
- m_xLineDistAtMetricBox->set_sensitive(true);
m_xLineDistAtLabel->set_sensitive(true);
}
break;
@@ -853,31 +1103,31 @@ void SvxStdParagraphTabPage::Init_Impl()
m_xLineDist->connect_changed(LINK(this, SvxStdParagraphTabPage, LineDistHdl_Impl));
Link<weld::MetricSpinButton&,void> aLink2 = LINK(this, SvxStdParagraphTabPage, ELRLoseFocusHdl);
- m_xFLineIndent->connect_value_changed(aLink2);
- m_xLeftIndent->connect_value_changed(aLink2);
- m_xRightIndent->connect_value_changed(aLink2);
+ m_aFLineIndent.connect_value_changed(aLink2);
+ m_aLeftIndent.connect_value_changed(aLink2);
+ m_aRightIndent.connect_value_changed(aLink2);
Link<weld::MetricSpinButton&,void> aLink = LINK(this, SvxStdParagraphTabPage, ModifyHdl_Impl);
- m_xTopDist->connect_value_changed(aLink);
- m_xBottomDist->connect_value_changed(aLink);
+ m_aTopDist.connect_value_changed(aLink);
+ m_aBottomDist.connect_value_changed(aLink);
m_xAutoCB->connect_toggled(LINK(this, SvxStdParagraphTabPage, AutoHdl_Impl));
SfxItemPool* pPool = GetItemSet().GetPool();
DBG_ASSERT( pPool, "Where is the pool?" );
FieldUnit eUnit = MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
- m_xTopDist->set_max( m_xTopDist->normalize( MAX_DURCH ), eUnit );
- m_xBottomDist->set_max( m_xBottomDist->normalize( MAX_DURCH ), eUnit );
+ m_aTopDist.set_max( m_aTopDist.normalize( MAX_DURCH ), eUnit );
+ m_aBottomDist.set_max( m_aBottomDist.normalize( MAX_DURCH ), eUnit );
m_xLineDistAtMetricBox->set_max( m_xLineDistAtMetricBox->normalize( MAX_DURCH ), eUnit );
}
void SvxStdParagraphTabPage::UpdateExample_Impl()
{
- m_aExampleWin.SetFirstLineOffset( static_cast<short>(m_xFLineIndent->denormalize( m_xFLineIndent->get_value( FieldUnit::TWIP ) )) );
- m_aExampleWin.SetLeftMargin( static_cast<tools::Long>(m_xLeftIndent->denormalize( m_xLeftIndent->get_value( FieldUnit::TWIP ) ) ) );
- m_aExampleWin.SetRightMargin( static_cast<tools::Long>(m_xRightIndent->denormalize( m_xRightIndent->get_value( FieldUnit::TWIP ) ) ) );
- m_aExampleWin.SetUpper( static_cast<sal_uInt16>(m_xTopDist->denormalize( m_xTopDist->get_value( FieldUnit::TWIP ) )) );
- m_aExampleWin.SetLower( static_cast<sal_uInt16>(m_xBottomDist->denormalize( m_xBottomDist->get_value( FieldUnit::TWIP ) )) );
+ m_aExampleWin.SetFirstLineOffset( static_cast<short>(m_aFLineIndent.denormalize( m_aFLineIndent.get_value( FieldUnit::TWIP ) )) );
+ m_aExampleWin.SetLeftMargin( static_cast<tools::Long>(m_aLeftIndent.denormalize( m_aLeftIndent.get_value( FieldUnit::TWIP ) ) ) );
+ m_aExampleWin.SetRightMargin( static_cast<tools::Long>(m_aRightIndent.denormalize( m_aRightIndent.get_value( FieldUnit::TWIP ) ) ) );
+ m_aExampleWin.SetUpper( static_cast<sal_uInt16>(m_aTopDist.denormalize( m_aTopDist.get_value( FieldUnit::TWIP ) )) );
+ m_aExampleWin.SetLower( static_cast<sal_uInt16>(m_aBottomDist.denormalize( m_aBottomDist.get_value( FieldUnit::TWIP ) )) );
int nPos = m_xLineDist->get_active();
@@ -911,7 +1161,7 @@ IMPL_LINK(SvxStdParagraphTabPage, AutoHdl_Impl, weld::Toggleable&, rBox, void)
{
bool bEnable = !rBox.get_active();
m_xFLineLabel->set_sensitive(bEnable);
- m_xFLineIndent->set_sensitive(bEnable);
+ m_aFLineIndent.set_sensitive(bEnable);
}
void SvxStdParagraphTabPage::EnableAutoFirstLine()
@@ -919,12 +1169,6 @@ void SvxStdParagraphTabPage::EnableAutoFirstLine()
m_xAutoCB->show();
}
-void SvxStdParagraphTabPage::EnableAbsLineDist(tools::Long nMinTwip)
-{
- m_xLineDist->append_text(sAbsDist);
- nMinFixDist = nMinTwip;
-}
-
void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
{
@@ -937,7 +1181,6 @@ void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
*/
const SfxUInt16Item* pPageWidthItem = aSet.GetItem<SfxUInt16Item>(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH, false);
const SfxUInt32Item* pFlagSetItem = aSet.GetItem<SfxUInt32Item>(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET, false);
- const SfxUInt32Item* pLineDistItem = aSet.GetItem<SfxUInt32Item>(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, false);
if (pPageWidthItem)
nWidth = pPageWidthItem->GetValue();
@@ -954,9 +1197,6 @@ void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
EnableAutoFirstLine();
}
- if(pLineDistItem)
- EnableAbsLineDist(pLineDistItem->GetValue());
-
if (pFlagSetItem)
{
if (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
@@ -975,6 +1215,7 @@ void SvxStdParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/paragalignpage.ui", "ParaAlignPage", &rSet)
+ , m_bSdrVertAlign(false)
, m_xLeft(m_xBuilder->weld_radio_button("radioBTN_LEFTALIGN"))
, m_xRight(m_xBuilder->weld_radio_button("radioBTN_RIGHTALIGN"))
, m_xCenter(m_xBuilder->weld_radio_button("radioBTN_CENTERALIGN"))
@@ -988,7 +1229,8 @@ SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container* pPage, weld::DialogCon
, m_xExampleWin(new weld::CustomWeld(*m_xBuilder, "drawingareaWN_EXAMPLE", m_aExampleWin))
, m_xVertAlignFL(m_xBuilder->weld_widget("frameFL_VERTALIGN"))
, m_xVertAlignLB(m_xBuilder->weld_combo_box("comboLB_VERTALIGN"))
- , m_xPropertiesFL(m_xBuilder->weld_widget("framePROPERTIES"))
+ , m_xVertAlign(m_xBuilder->weld_label("labelFL_VERTALIGN"))
+ , m_xVertAlignSdr(m_xBuilder->weld_label("labelST_VERTALIGN_SDR"))
, m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("comboLB_TEXTDIRECTION")))
{
SetExchangeSupport();
@@ -1104,7 +1346,10 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet )
if (m_xVertAlignLB->get_value_changed_from_saved())
{
- rOutSet->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align>(m_xVertAlignLB->get_active()), GetWhich( SID_PARA_VERTALIGN )));
+ if (m_bSdrVertAlign)
+ rOutSet->Put(SdrTextVertAdjustItem(static_cast<SdrTextVertAdjust>(m_xVertAlignLB->get_active())));
+ else
+ rOutSet->Put(SvxParaVertAlignItem(static_cast<SvxParaVertAlignItem::Align>(m_xVertAlignLB->get_active()), GetWhich( SID_PARA_VERTALIGN )));
bModified = true;
}
@@ -1190,16 +1435,23 @@ void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet )
m_xSnapToGridCB->set_active(rSnap.GetValue());
}
- _nWhich = GetWhich( SID_PARA_VERTALIGN );
+ _nWhich = m_bSdrVertAlign ? SDRATTR_TEXT_VERTADJUST : GetWhich( SID_PARA_VERTALIGN );
eItemState = rSet->GetItemState( _nWhich );
if ( eItemState >= SfxItemState::DEFAULT )
{
m_xVertAlignFL->show();
- const SvxParaVertAlignItem& rAlign = static_cast<const SvxParaVertAlignItem&>(rSet->Get( _nWhich ));
-
- m_xVertAlignLB->set_active(static_cast<sal_Int32>(rAlign.GetValue()));
+ if (m_bSdrVertAlign)
+ {
+ const SdrTextVertAdjustItem& rAlign = static_cast<const SdrTextVertAdjustItem&>(rSet->Get( _nWhich ));
+ m_xVertAlignLB->set_active(rAlign.GetValue());
+ }
+ else
+ {
+ const SvxParaVertAlignItem& rAlign = static_cast<const SvxParaVertAlignItem&>(rSet->Get( _nWhich ));
+ m_xVertAlignLB->set_active(static_cast<sal_Int32>(rAlign.GetValue()));
+ }
}
_nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
@@ -1329,6 +1581,15 @@ void SvxParaAlignTabPage::EnableJustifyExt()
}
+void SvxParaAlignTabPage::EnableSdrVertAlign()
+{
+ m_bSdrVertAlign = true;
+
+ m_xVertAlignLB->remove_id("0");
+ m_xVertAlignLB->remove_id("1");
+ m_xVertAlign->set_label(m_xVertAlignSdr->get_label());
+}
+
void SvxParaAlignTabPage::PageCreated (const SfxAllItemSet& aSet)
{
const SfxBoolItem* pBoolItem = aSet.GetItem<SfxBoolItem>(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT, false);
@@ -1350,22 +1611,68 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
if ( m_xHyphenBox->get_state_changed_from_saved() ||
m_xHyphenNoCapsBox->get_state_changed_from_saved() ||
+ m_xHyphenNoLastWordBox->get_state_changed_from_saved() ||
m_xExtHyphenBeforeBox->get_value_changed_from_saved() ||
m_xExtHyphenAfterBox->get_value_changed_from_saved() ||
- m_xMaxHyphenEdit->get_value_changed_from_saved() )
+ m_xExtCompoundHyphenBeforeBox->get_value_changed_from_saved() ||
+ m_xMaxHyphenEdit->get_value_changed_from_saved() ||
+ m_xMinWordLength->get_value_changed_from_saved() ||
+ m_aHyphenZone.get_value_changed_from_saved() ||
+ m_xAcrossColumnBox->get_state_changed_from_saved() ||
+ m_xAcrossPageBox->get_state_changed_from_saved() ||
+ m_xAcrossSpreadBox->get_state_changed_from_saved() )
{
SvxHyphenZoneItem aHyphen(
static_cast<const SvxHyphenZoneItem&>(GetItemSet().Get( _nWhich )) );
aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE );
- aHyphen.SetNoCapsHyphenation(m_xHyphenNoCapsBox->get_state() == TRISTATE_TRUE);
+ aHyphen.SetNoCapsHyphenation(m_xHyphenNoCapsBox->get_state() != TRISTATE_TRUE);
+ aHyphen.SetNoLastWordHyphenation(m_xHyphenNoLastWordBox->get_state() != TRISTATE_TRUE);
if ( eHyphenState == TRISTATE_TRUE )
{
aHyphen.GetMinLead() = static_cast<sal_uInt8>(m_xExtHyphenBeforeBox->get_value());
aHyphen.GetMinTrail() = static_cast<sal_uInt8>(m_xExtHyphenAfterBox->get_value());
+ aHyphen.GetCompoundMinLead() = static_cast<sal_uInt8>(m_xExtCompoundHyphenBeforeBox->get_value());
+ aHyphen.GetMinWordLength() = static_cast<sal_uInt8>(m_xMinWordLength->get_value());
}
aHyphen.GetMaxHyphens() = static_cast<sal_uInt8>(m_xMaxHyphenEdit->get_value());
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Where is the pool?" );
+ MapUnit eUnit = pPool->GetMetric( _nWhich );
+ aHyphen.GetTextHyphenZone() = static_cast<sal_uInt16>(m_aHyphenZone.GetCoreValue(eUnit));
+ aHyphen.SetHyphen( eHyphenState == TRISTATE_TRUE );
+ aHyphen.SetNoLastWordHyphenation(m_xHyphenNoLastWordBox->get_state() != TRISTATE_TRUE);
+ const TriState eAcrossColumnState = m_xAcrossColumnBox->get_state();
+ const TriState eAcrossPageState = m_xAcrossPageBox->get_state();
+ const TriState eAcrossSpreadState = m_xAcrossSpreadBox->get_state();
+ aHyphen.SetKeep( eAcrossSpreadState != TRISTATE_TRUE );
+ if ( eAcrossSpreadState == TRISTATE_TRUE )
+ {
+ // hyphenate across column, page and spread -> ParaHyphenationKeep = false and
+ // set default value 3 (COLUMN)
+ aHyphen.GetKeepType() =
+ static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::COLUMN);
+ }
+ else if ( eAcrossPageState == TRISTATE_TRUE )
+ {
+ // hyphenate across column and page, but not spread -> 1 (SPREAD)
+ aHyphen.GetKeepType() =
+ static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::SPREAD);
+ }
+ else if ( eAcrossColumnState == TRISTATE_TRUE )
+ {
+ // hyphenate across column, but not page and spread -> 2 (PAGE)
+ aHyphen.GetKeepType() =
+ static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::PAGE);
+ }
+ else
+ {
+ // don't hyphenate across column, page and spread -> 3 (COLUMN)
+ aHyphen.GetKeepType() =
+ static_cast<sal_uInt8>(css::text::ParagraphHyphenationKeepType::COLUMN);
+ }
+
if ( !pOld ||
*static_cast<const SvxHyphenZoneItem*>(pOld) != aHyphen ||
m_xHyphenBox->get_state_changed_from_saved())
@@ -1403,7 +1710,6 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
TriState eState = m_xApplyCollBtn->get_state();
bool bIsPageModel = false;
- _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
OUString sPage;
if ( m_xApplyCollBtn->get_state_changed_from_saved() ||
( TRISTATE_TRUE == eState &&
@@ -1418,7 +1724,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
if ( !pOld || static_cast<const SvxPageModelItem*>(pOld)->GetValue() != sPage )
{
- rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
+ rOutSet->Put( SvxPageModelItem( sPage, false, SID_ATTR_PARA_MODEL ) );
bModified = true;
}
else
@@ -1427,7 +1733,7 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
else if(TRISTATE_TRUE == eState && m_xApplyCollBtn->get_sensitive())
bIsPageModel = true;
else
- rOutSet->Put( SvxPageModelItem( sPage, false, _nWhich ) );
+ rOutSet->Put( SvxPageModelItem( sPage, false, SID_ATTR_PARA_MODEL ) );
_nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
@@ -1489,9 +1795,9 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
// paragraph split
_nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
- eState = m_xKeepTogetherBox->get_state();
+ eState = m_xAllowSplitBox->get_state();
- if (m_xKeepTogetherBox->get_state_changed_from_saved())
+ if (m_xAllowSplitBox->get_state_changed_from_saved())
{
pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_SPLIT );
@@ -1515,14 +1821,14 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
// widows and orphans
- _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
+ TypedWhichId<SvxWidowsItem> nWidowsWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
eState = m_xWidowBox->get_state();
if ( m_xWidowBox->get_state_changed_from_saved() ||
m_xWidowRowNo->get_value_changed_from_saved() )
{
SvxWidowsItem rItem( eState == TRISTATE_TRUE ?
- static_cast<sal_uInt8>(m_xWidowRowNo->get_value()) : 0, _nWhich );
+ static_cast<sal_uInt8>(m_xWidowRowNo->get_value()) : 0, nWidowsWhich );
pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_WIDOWS );
if ( m_xWidowBox->get_state_changed_from_saved() || !pOld || !( *static_cast<const SvxWidowsItem*>(pOld) == rItem ) )
@@ -1532,14 +1838,14 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
}
- _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
+ TypedWhichId<SvxOrphansItem> nOrphansWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
eState = m_xOrphanBox->get_state();
if ( m_xOrphanBox->get_state_changed_from_saved() ||
m_xOrphanRowNo->get_value_changed_from_saved() )
{
SvxOrphansItem rItem( eState == TRISTATE_TRUE ?
- static_cast<sal_uInt8>(m_xOrphanRowNo->get_value()) : 0, _nWhich );
+ static_cast<sal_uInt8>(m_xOrphanRowNo->get_value()) : 0, nOrphansWhich );
pOld = GetOldItem( *rOutSet, SID_ATTR_PARA_ORPHANS );
if ( m_xOrphanBox->get_state_changed_from_saved() ||
@@ -1555,6 +1861,14 @@ bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
{
+ SfxItemPool* pPool = rSet->GetPool();
+ DBG_ASSERT( pPool, "Where is the pool?" );
+
+ // adjust metric
+ FieldUnit eFUnit = GetModuleFieldUnit( *rSet );
+ if (UseCharUnitInUI(*rSet))
+ eFUnit = FieldUnit::CHAR;
+
sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
SfxItemState eItemState = rSet->GetItemState( _nWhich );
@@ -1568,40 +1882,61 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
bIsHyphen = rHyphen.IsHyphen();
m_xHyphenBox->set_state(bIsHyphen ? TRISTATE_TRUE : TRISTATE_FALSE);
- m_xHyphenNoCapsBox->set_state(rHyphen.IsNoCapsHyphenation() ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xHyphenNoCapsBox->set_state(rHyphen.IsNoCapsHyphenation() ? TRISTATE_FALSE : TRISTATE_TRUE);
+ m_xHyphenNoLastWordBox->set_state(rHyphen.IsNoLastWordHyphenation() ? TRISTATE_FALSE : TRISTATE_TRUE);
m_xExtHyphenBeforeBox->set_value(rHyphen.GetMinLead());
m_xExtHyphenAfterBox->set_value(rHyphen.GetMinTrail());
+ m_xExtCompoundHyphenBeforeBox->set_value(rHyphen.GetCompoundMinLead());
m_xMaxHyphenEdit->set_value(rHyphen.GetMaxHyphens());
+ m_xMinWordLength->set_value(rHyphen.GetMinWordLength());
+ m_aHyphenZone.SetFieldUnit(eFUnit);
+ m_aHyphenZone.SetMetricValue(rHyphen.GetTextHyphenZone(), MapUnit::MapTwip);
+ m_xAcrossColumnBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() < 3 ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xAcrossPageBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() < 2 ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xAcrossSpreadBox->set_state(!rHyphen.IsKeep() || rHyphen.GetKeepType() == 0 ? TRISTATE_TRUE : TRISTATE_FALSE);
+ aAcrossColumnState.bTriStateEnabled = false;
+ aAcrossPageState.bTriStateEnabled = false;
+ aAcrossSpreadState.bTriStateEnabled = false;
}
else
{
m_xHyphenBox->set_state(TRISTATE_INDET);
m_xHyphenNoCapsBox->set_state(TRISTATE_INDET);
+ m_xHyphenNoLastWordBox->set_state(TRISTATE_INDET);
}
bool bEnable = bItemAvailable && bIsHyphen;
m_xHyphenNoCapsBox->set_sensitive(bEnable);
+ m_xHyphenNoLastWordBox->set_sensitive(bEnable);
m_xExtHyphenBeforeBox->set_sensitive(bEnable);
m_xExtHyphenAfterBox->set_sensitive(bEnable);
+ m_xExtCompoundHyphenBeforeBox->set_sensitive(bEnable);
m_xBeforeText->set_sensitive(bEnable);
m_xAfterText->set_sensitive(bEnable);
+ m_xCompoundBeforeText->set_sensitive(bEnable);
m_xMaxHyphenLabel->set_sensitive(bEnable);
m_xMaxHyphenEdit->set_sensitive(bEnable);
+ m_xMinWordLabel->set_sensitive(bEnable);
+ m_xMinWordLength->set_sensitive(bEnable);
+ m_xHyphenZoneLabel->set_sensitive(bEnable);
+ m_aHyphenZone.set_sensitive(bEnable);
+ m_xAcrossText->set_sensitive(bEnable);
+ m_xAcrossColumnBox->set_sensitive(bEnable);
+ m_xAcrossPageBox->set_sensitive(bEnable);
+ m_xAcrossSpreadBox->set_sensitive(bEnable);
- _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM );
-
- switch (rSet->GetItemState(_nWhich))
+ switch (rSet->GetItemState(SID_ATTR_PARA_PAGENUM))
{
case SfxItemState::SET:
{
aPageNumState.bTriStateEnabled = false;
m_xPageNumBox->set_state(TRISTATE_TRUE);
- SfxUInt16Item const*const pItem(rSet->GetItem<SfxUInt16Item>(_nWhich));
+ SfxUInt16Item const*const pItem(rSet->GetItem<SfxUInt16Item>(SID_ATTR_PARA_PAGENUM));
const sal_uInt16 nPageNum(pItem->GetValue());
m_xPagenumEdit->set_value(nPageNum);
break;
}
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
{
aPageNumState.bTriStateEnabled = true;
m_xPageNumBox->set_state(TRISTATE_INDET);
@@ -1623,16 +1958,14 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
if ( bPageBreak )
{
// first handle PageModel
- _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
bool bIsPageModel = false;
- eItemState = rSet->GetItemState( _nWhich );
+ eItemState = rSet->GetItemState( SID_ATTR_PARA_MODEL );
if ( eItemState >= SfxItemState::SET )
{
aApplyCollState.bTriStateEnabled = false;
- const SvxPageModelItem& rModel =
- static_cast<const SvxPageModelItem&>(rSet->Get( _nWhich ));
+ const SvxPageModelItem& rModel = rSet->Get( SID_ATTR_PARA_MODEL );
const OUString& aStr( rModel.GetValue() );
if (!aStr.isEmpty() && m_xApplyCollBox->find_text(aStr) != -1)
@@ -1661,7 +1994,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
m_xApplyCollBtn->set_state(TRISTATE_FALSE);
}
}
- else if ( SfxItemState::DONTCARE == eItemState )
+ else if ( SfxItemState::INVALID == eItemState )
{
aApplyCollState.bTriStateEnabled = true;
m_xApplyCollBtn->set_state(TRISTATE_INDET);
@@ -1733,7 +2066,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
m_xBreakTypeLB->set_active(nType);
m_xBreakPositionLB->set_active(nPosition);
}
- else if ( SfxItemState::DONTCARE == eItemState )
+ else if ( SfxItemState::INVALID == eItemState )
m_xPageBreakBox->set_state(TRISTATE_INDET);
else
{
@@ -1763,7 +2096,7 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
else
m_xKeepParaBox->set_state(TRISTATE_FALSE);
}
- else if ( SfxItemState::DONTCARE == eItemState )
+ else if ( SfxItemState::INVALID == eItemState )
m_xKeepParaBox->set_state(TRISTATE_INDET);
else
m_xKeepParaBox->set_sensitive(false);
@@ -1775,70 +2108,69 @@ void SvxExtParagraphTabPage::Reset( const SfxItemSet* rSet )
{
const SvxFormatSplitItem& rSplit =
static_cast<const SvxFormatSplitItem&>(rSet->Get( _nWhich ));
- aKeepTogetherState.bTriStateEnabled = false;
+ aAllowSplitState.bTriStateEnabled = false;
if ( !rSplit.GetValue() )
- m_xKeepTogetherBox->set_state(TRISTATE_TRUE);
+ m_xAllowSplitBox->set_state(TRISTATE_FALSE);
else
{
- m_xKeepTogetherBox->set_state(TRISTATE_FALSE);
-
- // widows and orphans
+ m_xAllowSplitBox->set_state(TRISTATE_TRUE);
+ // default widows and orphans to enabled
m_xWidowBox->set_sensitive(true);
- _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
- SfxItemState eTmpState = rSet->GetItemState( _nWhich );
-
- if ( eTmpState >= SfxItemState::DEFAULT )
- {
- const SvxWidowsItem& rWidow =
- static_cast<const SvxWidowsItem&>(rSet->Get( _nWhich ));
- aWidowState.bTriStateEnabled = false;
- const sal_uInt16 nLines = rWidow.GetValue();
+ m_xOrphanBox->set_sensitive(true);
+ }
- bool _bEnable = nLines > 0;
- m_xWidowRowNo->set_value(m_xWidowRowNo->normalize(nLines));
- m_xWidowBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
- m_xWidowRowNo->set_sensitive(_bEnable);
- //m_xWidowRowLabel->set_sensitive(_bEnable);
+ // widows and orphans
+ _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
+ SfxItemState eTmpState = rSet->GetItemState( _nWhich );
- }
- else if ( SfxItemState::DONTCARE == eTmpState )
- m_xWidowBox->set_state( TRISTATE_INDET );
- else
- m_xWidowBox->set_sensitive(false);
+ if ( eTmpState >= SfxItemState::DEFAULT )
+ {
+ const SvxWidowsItem& rWidow =
+ static_cast<const SvxWidowsItem&>(rSet->Get( _nWhich ));
+ aWidowState.bTriStateEnabled = false;
+ const sal_uInt16 nLines = rWidow.GetValue();
+
+ bool _bEnable = nLines > 0;
+ m_xWidowRowNo->set_value(m_xWidowRowNo->normalize(nLines));
+ m_xWidowBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xWidowRowNo->set_sensitive(_bEnable);
+ }
+ else if ( SfxItemState::INVALID == eTmpState )
+ m_xWidowBox->set_state( TRISTATE_INDET );
+ else
+ m_xWidowBox->set_sensitive(false);
- m_xOrphanBox->set_sensitive(true);
- _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
- eTmpState = rSet->GetItemState( _nWhich );
+ _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
+ eTmpState = rSet->GetItemState( _nWhich );
- if ( eTmpState >= SfxItemState::DEFAULT )
- {
- const SvxOrphansItem& rOrphan =
- static_cast<const SvxOrphansItem&>(rSet->Get( _nWhich ));
- const sal_uInt16 nLines = rOrphan.GetValue();
- aOrphanState.bTriStateEnabled = false;
+ if ( eTmpState >= SfxItemState::DEFAULT )
+ {
+ const SvxOrphansItem& rOrphan =
+ static_cast<const SvxOrphansItem&>(rSet->Get( _nWhich ));
+ const sal_uInt16 nLines = rOrphan.GetValue();
+ aOrphanState.bTriStateEnabled = false;
- bool _bEnable = nLines > 0;
- m_xOrphanBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
- m_xOrphanRowNo->set_value(m_xOrphanRowNo->normalize(nLines));
- m_xOrphanRowNo->set_sensitive(_bEnable);
- m_xOrphanRowLabel->set_sensitive(_bEnable);
+ bool _bEnable = nLines > 0;
+ m_xOrphanBox->set_state(_bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
+ m_xOrphanRowNo->set_value(m_xOrphanRowNo->normalize(nLines));
+ m_xOrphanRowNo->set_sensitive(_bEnable);
+ m_xOrphanRowLabel->set_sensitive(_bEnable);
- }
- else if ( SfxItemState::DONTCARE == eTmpState )
- m_xOrphanBox->set_state(TRISTATE_INDET);
- else
- m_xOrphanBox->set_sensitive(false);
- aOrphanState.eState = m_xOrphanBox->get_state();
}
+ else if ( SfxItemState::INVALID == eTmpState )
+ m_xOrphanBox->set_state(TRISTATE_INDET);
+ else
+ m_xOrphanBox->set_sensitive(false);
+ aOrphanState.eState = m_xOrphanBox->get_state();
}
- else if ( SfxItemState::DONTCARE == eItemState )
- m_xKeepTogetherBox->set_state(TRISTATE_INDET);
+ else if ( SfxItemState::INVALID == eItemState )
+ m_xAllowSplitBox->set_state(TRISTATE_INDET);
else
- m_xKeepTogetherBox->set_sensitive(false);
+ m_xAllowSplitBox->set_sensitive(false);
// so that everything is enabled correctly
- KeepTogetherHdl();
+ AllowSplitHdl();
WidowHdl();
OrphanHdl();
ChangesApplied();
@@ -1847,9 +2179,16 @@ void SvxExtParagraphTabPage::ChangesApplied()
{
m_xHyphenBox->save_state();
m_xHyphenNoCapsBox->save_state();
- m_xExtHyphenBeforeBox->set_value(m_xExtHyphenBeforeBox->get_value());
- m_xExtHyphenAfterBox->set_value(m_xExtHyphenAfterBox->get_value());
- m_xMaxHyphenEdit->set_value(m_xMaxHyphenEdit->get_value());
+ m_xHyphenNoLastWordBox->save_state();
+ m_xExtHyphenBeforeBox->save_value();
+ m_xExtHyphenAfterBox->save_value();
+ m_xExtCompoundHyphenBeforeBox->save_value();
+ m_xMaxHyphenEdit->save_value();
+ m_xMinWordLength->save_value();
+ m_aHyphenZone.save_value();
+ m_xAcrossColumnBox->save_state();
+ m_xAcrossPageBox->save_state();
+ m_xAcrossSpreadBox->save_state();
m_xPageBreakBox->save_state();
m_xBreakPositionLB->save_value();
m_xBreakTypeLB->save_value();
@@ -1857,7 +2196,7 @@ void SvxExtParagraphTabPage::ChangesApplied()
m_xApplyCollBox->save_value();
m_xPageNumBox->save_state();
m_xPagenumEdit->save_value();
- m_xKeepTogetherBox->save_state();
+ m_xAllowSplitBox->save_state();
m_xKeepParaBox->save_state();
m_xWidowBox->save_state();
m_xOrphanBox->save_state();
@@ -1893,12 +2232,19 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
// Hyphenation
, m_xHyphenBox(m_xBuilder->weld_check_button("checkAuto"))
, m_xHyphenNoCapsBox(m_xBuilder->weld_check_button("checkNoCaps"))
+ , m_xHyphenNoLastWordBox(m_xBuilder->weld_check_button("checkNoLastWord"))
, m_xBeforeText(m_xBuilder->weld_label("labelLineBegin"))
, m_xExtHyphenBeforeBox(m_xBuilder->weld_spin_button("spinLineEnd"))
, m_xAfterText(m_xBuilder->weld_label("labelLineEnd"))
, m_xExtHyphenAfterBox(m_xBuilder->weld_spin_button("spinLineBegin"))
+ , m_xCompoundBeforeText(m_xBuilder->weld_label("labelCompoundLineEnd"))
+ , m_xExtCompoundHyphenBeforeBox(m_xBuilder->weld_spin_button("spinCompoundLineEnd"))
, m_xMaxHyphenLabel(m_xBuilder->weld_label("labelMaxNum"))
, m_xMaxHyphenEdit(m_xBuilder->weld_spin_button("spinMaxNum"))
+ , m_xMinWordLabel(m_xBuilder->weld_label("labelMinLen"))
+ , m_xMinWordLength(m_xBuilder->weld_spin_button("spinMinLen"))
+ , m_xHyphenZoneLabel(m_xBuilder->weld_label("labelHyphenZone"))
+ , m_aHyphenZone(m_xBuilder->weld_metric_spin_button("spinHyphenZone", FieldUnit::CM))
//Page break
, m_xPageBreakBox(m_xBuilder->weld_check_button("checkInsert"))
, m_xBreakTypeFT(m_xBuilder->weld_label("labelType"))
@@ -1910,7 +2256,7 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
, m_xPageNumBox(m_xBuilder->weld_check_button("labelPageNum"))
, m_xPagenumEdit(m_xBuilder->weld_spin_button("spinPageNumber"))
// Options
- , m_xKeepTogetherBox(m_xBuilder->weld_check_button("checkSplitPara"))
+ , m_xAllowSplitBox(m_xBuilder->weld_check_button("checkSplitPara"))
, m_xKeepParaBox(m_xBuilder->weld_check_button("checkKeepPara"))
, m_xOrphanBox(m_xBuilder->weld_check_button("checkOrphan"))
, m_xOrphanRowNo(m_xBuilder->weld_spin_button("spinOrphan"))
@@ -1918,13 +2264,18 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
, m_xWidowBox(m_xBuilder->weld_check_button("checkWidow"))
, m_xWidowRowNo(m_xBuilder->weld_spin_button("spinWidow"))
, m_xWidowRowLabel(m_xBuilder->weld_label("labelWidow"))
+ // Avoid hyphenation across
+ , m_xAcrossText(m_xBuilder->weld_label("labelHyphenAcross"))
+ , m_xAcrossColumnBox(m_xBuilder->weld_check_button("checkAcrossColumn"))
+ , m_xAcrossPageBox(m_xBuilder->weld_check_button("checkAcrossPage"))
+ , m_xAcrossSpreadBox(m_xBuilder->weld_check_button("checkAcrossSpread"))
{
// this page needs ExchangeSupport
SetExchangeSupport();
m_xHyphenBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, HyphenClickHdl_Impl));
m_xPageBreakBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageBreakHdl_Impl));
- m_xKeepTogetherBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl));
+ m_xAllowSplitBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AllowSplitHdl_Impl));
m_xWidowBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, WidowHdl_Impl));
m_xOrphanBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, OrphanHdl_Impl));
m_xApplyCollBtn->connect_toggled(LINK(this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl));
@@ -1932,9 +2283,11 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
m_xBreakPositionLB->connect_changed(LINK(this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl));
m_xPageNumBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, PageNumBoxClickHdl_Impl));
m_xKeepParaBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, KeepParaBoxClickHdl_Impl));
+ m_xAcrossColumnBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossColumnHdl_Impl));
+ m_xAcrossPageBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossPageHdl_Impl));
+ m_xAcrossSpreadBox->connect_toggled(LINK(this, SvxExtParagraphTabPage, AcrossSpreadHdl_Impl));
- SfxObjectShell* pSh = SfxObjectShell::Current();
- if ( pSh )
+ if (SfxObjectShell* pSh = SfxObjectShell::Current())
{
SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
SfxStyleSheetBase* pStyle = pPool->First(SfxStyleFamily::Page);
@@ -1960,14 +2313,25 @@ SvxExtParagraphTabPage::SvxExtParagraphTabPage(weld::Container* pPage, weld::Dia
bHtmlMode = true;
m_xHyphenBox->set_sensitive(false);
m_xHyphenNoCapsBox->set_sensitive(false);
+ m_xHyphenNoLastWordBox->set_sensitive(false);
m_xBeforeText->set_sensitive(false);
m_xExtHyphenBeforeBox->set_sensitive(false);
m_xAfterText->set_sensitive(false);
m_xExtHyphenAfterBox->set_sensitive(false);
+ m_xCompoundBeforeText->set_sensitive(false);
+ m_xExtCompoundHyphenBeforeBox->set_sensitive(false);
m_xMaxHyphenLabel->set_sensitive(false);
m_xMaxHyphenEdit->set_sensitive(false);
+ m_xMinWordLabel->set_sensitive(false);
+ m_xMinWordLength->set_sensitive(false);
+ m_xHyphenZoneLabel->set_sensitive(false);
+ m_aHyphenZone.set_sensitive(false);
m_xPageNumBox->set_sensitive(false);
m_xPagenumEdit->set_sensitive(false);
+ m_xAcrossText->set_sensitive(false);
+ m_xAcrossColumnBox->set_sensitive(false);
+ m_xAcrossPageBox->set_sensitive(false);
+ m_xAcrossSpreadBox->set_sensitive(false);
// no column break in HTML
m_xBreakTypeLB->remove(1);
}
@@ -2022,17 +2386,17 @@ IMPL_LINK(SvxExtParagraphTabPage, PageBreakHdl_Impl, weld::Toggleable&, rToggle,
PageBreakHdl();
}
-void SvxExtParagraphTabPage::KeepTogetherHdl()
+void SvxExtParagraphTabPage::AllowSplitHdl()
{
- bool bEnable = m_xKeepTogetherBox->get_state() == TRISTATE_FALSE;
+ bool bEnable = m_xAllowSplitBox->get_state() == TRISTATE_TRUE;
m_xWidowBox->set_sensitive(bEnable);
m_xOrphanBox->set_sensitive(bEnable);
}
-IMPL_LINK(SvxExtParagraphTabPage, KeepTogetherHdl_Impl, weld::Toggleable&, rToggle, void)
+IMPL_LINK(SvxExtParagraphTabPage, AllowSplitHdl_Impl, weld::Toggleable&, rToggle, void)
{
- aKeepTogetherState.ButtonToggled(rToggle);
- KeepTogetherHdl();
+ aAllowSplitState.ButtonToggled(rToggle);
+ AllowSplitHdl();
}
void SvxExtParagraphTabPage::WidowHdl()
@@ -2042,11 +2406,11 @@ void SvxExtParagraphTabPage::WidowHdl()
case TRISTATE_TRUE:
m_xWidowRowNo->set_sensitive(true);
m_xWidowRowLabel->set_sensitive(true);
- m_xKeepTogetherBox->set_sensitive(false);
+ m_xAllowSplitBox->set_sensitive(true);
break;
case TRISTATE_FALSE:
if (m_xOrphanBox->get_state() == TRISTATE_FALSE)
- m_xKeepTogetherBox->set_sensitive(true);
+ m_xAllowSplitBox->set_sensitive(false);
[[fallthrough]];
case TRISTATE_INDET:
m_xWidowRowNo->set_sensitive(false);
@@ -2074,12 +2438,12 @@ void SvxExtParagraphTabPage::OrphanHdl()
case TRISTATE_TRUE:
m_xOrphanRowNo->set_sensitive(true);
m_xOrphanRowLabel->set_sensitive(true);
- m_xKeepTogetherBox->set_sensitive(false);
+ m_xAllowSplitBox->set_sensitive(true);
break;
case TRISTATE_FALSE:
if (m_xWidowBox->get_state() == TRISTATE_FALSE)
- m_xKeepTogetherBox->set_sensitive(true);
+ m_xAllowSplitBox->set_sensitive(true);
[[fallthrough]];
case TRISTATE_INDET:
m_xOrphanRowNo->set_sensitive(false);
@@ -2092,12 +2456,23 @@ void SvxExtParagraphTabPage::HyphenClickHdl()
{
bool bEnable = m_xHyphenBox->get_state() == TRISTATE_TRUE;
m_xHyphenNoCapsBox->set_sensitive(bEnable);
+ m_xHyphenNoLastWordBox->set_sensitive(bEnable);
m_xBeforeText->set_sensitive(bEnable);
m_xExtHyphenBeforeBox->set_sensitive(bEnable);
m_xAfterText->set_sensitive(bEnable);
m_xExtHyphenAfterBox->set_sensitive(bEnable);
+ m_xCompoundBeforeText->set_sensitive(bEnable);
+ m_xExtCompoundHyphenBeforeBox->set_sensitive(bEnable);
m_xMaxHyphenLabel->set_sensitive(bEnable);
m_xMaxHyphenEdit->set_sensitive(bEnable);
+ m_xMinWordLabel->set_sensitive(bEnable);
+ m_xMinWordLength->set_sensitive(bEnable);
+ m_xHyphenZoneLabel->set_sensitive(bEnable);
+ m_aHyphenZone.set_sensitive(bEnable);
+ m_xAcrossText->set_sensitive(bEnable);
+ m_xAcrossColumnBox->set_sensitive(bEnable);
+ m_xAcrossPageBox->set_sensitive(bEnable);
+ m_xAcrossSpreadBox->set_sensitive(bEnable);
m_xHyphenBox->set_state(bEnable ? TRISTATE_TRUE : TRISTATE_FALSE);
}
@@ -2199,6 +2574,35 @@ void SvxExtParagraphTabPage::PageCreated(const SfxAllItemSet& aSet)
DisablePageBreak();
}
+IMPL_LINK(SvxExtParagraphTabPage, AcrossColumnHdl_Impl, weld::Toggleable&, rToggle, void)
+{
+ aAcrossColumnState.ButtonToggled(rToggle);
+ if (m_xAcrossColumnBox->get_state() != TRISTATE_TRUE )
+ {
+ m_xAcrossPageBox->set_state( TRISTATE_FALSE );
+ m_xAcrossSpreadBox->set_state( TRISTATE_FALSE );
+ }
+}
+
+IMPL_LINK(SvxExtParagraphTabPage, AcrossPageHdl_Impl, weld::Toggleable&, rToggle, void)
+{
+ aAcrossPageState.ButtonToggled(rToggle);
+ if (m_xAcrossPageBox->get_state() == TRISTATE_TRUE )
+ m_xAcrossColumnBox->set_state( TRISTATE_TRUE );
+ else
+ m_xAcrossSpreadBox->set_state( TRISTATE_FALSE );
+}
+
+IMPL_LINK(SvxExtParagraphTabPage, AcrossSpreadHdl_Impl, weld::Toggleable&, rToggle, void)
+{
+ aAcrossSpreadState.ButtonToggled(rToggle);
+ if (m_xAcrossSpreadBox->get_state() == TRISTATE_TRUE )
+ {
+ m_xAcrossColumnBox->set_state( TRISTATE_TRUE );
+ m_xAcrossPageBox->set_state( TRISTATE_TRUE );
+ }
+}
+
SvxAsianTabPage::SvxAsianTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/asiantypography.ui", "AsianTypography", &rSet)
, m_xForbiddenRulesCB(m_xBuilder->weld_check_button("checkForbidList"))
@@ -2228,7 +2632,7 @@ bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
if (m_xScriptSpaceCB->get_sensitive() && m_xScriptSpaceCB->get_state_changed_from_saved())
{
std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
- pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone()));
+ pPool->GetWhichIDFromSlotID(SID_ATTR_PARA_SCRIPTSPACE)).Clone()));
pNewItem->SetValue(m_xScriptSpaceCB->get_active());
rSet->Put(std::move(pNewItem));
bRet = true;
@@ -2236,7 +2640,7 @@ bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
if (m_xHangingPunctCB->get_sensitive() && m_xHangingPunctCB->get_state_changed_from_saved())
{
std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
- pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone()));
+ pPool->GetWhichIDFromSlotID(SID_ATTR_PARA_HANGPUNCTUATION)).Clone()));
pNewItem->SetValue(m_xHangingPunctCB->get_active());
rSet->Put(std::move(pNewItem));
bRet = true;
@@ -2244,7 +2648,7 @@ bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
if (m_xForbiddenRulesCB->get_sensitive() && m_xForbiddenRulesCB->get_state_changed_from_saved())
{
std::unique_ptr<SfxBoolItem> pNewItem(static_cast<SfxBoolItem*>(rSet->Get(
- pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone()));
+ pPool->GetWhichIDFromSlotID(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone()));
pNewItem->SetValue(m_xForbiddenRulesCB->get_active());
rSet->Put(std::move(pNewItem));
bRet = true;
@@ -2254,7 +2658,7 @@ bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
static void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, weld::CheckButton& rBox)
{
- sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId);
+ sal_uInt16 _nWhich = rSet.GetPool()->GetWhichIDFromSlotID(nSlotId);
SfxItemState eState = rSet.GetItemState(_nWhich);
if( eState == SfxItemState::UNKNOWN || eState == SfxItemState::DISABLED )
rBox.set_sensitive(false);