tdf#41542 PaddingWithoutBorders: allow UI changes if...

If the compatibility option is set, allow the border dialog for frames
to be able to adjust the spacing values without enabling the border lines.
That means it is only true for .doc and .docx right now.

Change-Id: I4004a849f7369c993089d1c7b5d856cbea4f7780
Reviewed-on: https://gerrit.libreoffice.org/28602
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Justin Luth 2016-10-29 17:26:57 +03:00 committed by Miklos Vajna
parent 9937b8daa7
commit f013d4a1f4
4 changed files with 19 additions and 7 deletions

View File

@ -111,6 +111,7 @@ private:
bool mbTLBREnabled; ///< true = Top-left to bottom-right border enabled. bool mbTLBREnabled; ///< true = Top-left to bottom-right border enabled.
bool mbBLTREnabled; ///< true = Bottom-left to top-right border enabled. bool mbBLTREnabled; ///< true = Bottom-left to top-right border enabled.
bool mbUseMarginItem; bool mbUseMarginItem;
bool mbAllowPaddingWithoutBorders;
bool mbSync; bool mbSync;
bool mbRemoveAdjacentCellBorders; bool mbRemoveAdjacentCellBorders;
bool bIsCalcDoc; bool bIsCalcDoc;

View File

@ -102,6 +102,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore
mbTLBREnabled( false ), mbTLBREnabled( false ),
mbBLTREnabled( false ), mbBLTREnabled( false ),
mbUseMarginItem( false ), mbUseMarginItem( false ),
mbAllowPaddingWithoutBorders( false ),
mbSync(true), mbSync(true),
mbRemoveAdjacentCellBorders( false ), mbRemoveAdjacentCellBorders( false ),
bIsCalcDoc( false ) bIsCalcDoc( false )
@ -180,6 +181,11 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore
m_pLineWidthMF->SetValue(p->GetValue()); m_pLineWidthMF->SetValue(p->GetValue());
} }
if (rCoreAttrs.HasItem(SID_ALLOW_PADDING_WITHOUT_BORDERS, &pItem))
{
mbAllowPaddingWithoutBorders = static_cast<const SfxBoolItem*>(pItem)->GetValue();
}
// set metric // set metric
FieldUnit eFUnit = GetModuleFieldUnit( rCoreAttrs ); FieldUnit eFUnit = GetModuleFieldUnit( rCoreAttrs );
@ -698,10 +704,11 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs )
if( !m_pLeftMF->GetText().isEmpty() || !m_pRightMF->GetText().isEmpty() || if( !m_pLeftMF->GetText().isEmpty() || !m_pRightMF->GetText().isEmpty() ||
!m_pTopMF->GetText().isEmpty() || !m_pBottomMF->GetText().isEmpty() ) !m_pTopMF->GetText().isEmpty() || !m_pBottomMF->GetText().isEmpty() )
{ {
if ( ((mbHorEnabled || mbVerEnabled || (nSWMode & SwBorderModes::TABLE)) && if ( mbAllowPaddingWithoutBorders
(m_pLeftMF->IsModified()||m_pRightMF->IsModified()|| || ((mbHorEnabled || mbVerEnabled || (nSWMode & SwBorderModes::TABLE)) &&
m_pTopMF->IsModified()||m_pBottomMF->IsModified()) )|| (m_pLeftMF->IsModified()||m_pRightMF->IsModified()||
m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Top ) != svx::FrameBorderState::Hide m_pTopMF->IsModified()||m_pBottomMF->IsModified()) )
|| m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Top ) != svx::FrameBorderState::Hide
|| m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Bottom ) != svx::FrameBorderState::Hide || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Bottom ) != svx::FrameBorderState::Hide
|| m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Left ) != svx::FrameBorderState::Hide || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Left ) != svx::FrameBorderState::Hide
|| m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Right ) != svx::FrameBorderState::Hide ) || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Right ) != svx::FrameBorderState::Hide )
@ -1156,7 +1163,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, LinesChanged_Impl, LinkParamNone*, void)
m_pRightMF->SetFirst(0); m_pRightMF->SetFirst(0);
m_pTopMF->SetFirst(0); m_pTopMF->SetFirst(0);
m_pBottomMF->SetFirst(0); m_pBottomMF->SetFirst(0);
if(!bSpaceModified) if(!bSpaceModified && !mbAllowPaddingWithoutBorders)
{ {
m_pLeftMF->SetValue(0); m_pLeftMF->SetValue(0);
m_pRightMF->SetValue(0); m_pRightMF->SetValue(0);
@ -1168,7 +1175,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, LinesChanged_Impl, LinkParamNone*, void)
SvxBoxInfoItemValidFlags nValid = SvxBoxInfoItemValidFlags::TOP|SvxBoxInfoItemValidFlags::BOTTOM|SvxBoxInfoItemValidFlags::LEFT|SvxBoxInfoItemValidFlags::RIGHT; SvxBoxInfoItemValidFlags nValid = SvxBoxInfoItemValidFlags::TOP|SvxBoxInfoItemValidFlags::BOTTOM|SvxBoxInfoItemValidFlags::LEFT|SvxBoxInfoItemValidFlags::RIGHT;
// for other objects (paragraph, page, frame, character) the edit is disabled, if there's no border set // for other objects (paragraph, page, frame, character) the edit is disabled, if there's no border set
if(!(nSWMode & SwBorderModes::TABLE)) if(!(nSWMode & SwBorderModes::TABLE) && !mbAllowPaddingWithoutBorders)
{ {
if(bLineSet) if(bLineSet)
{ {

View File

@ -964,7 +964,7 @@
#define FN_SVX_SET_NUMBER ( SID_SVX_START + 1136 ) #define FN_SVX_SET_NUMBER ( SID_SVX_START + 1136 )
#define FN_SVX_SET_BULLET ( SID_SVX_START + 1137 ) #define FN_SVX_SET_BULLET ( SID_SVX_START + 1137 )
#define FN_SVX_SET_OUTLINE ( SID_SVX_START + 1138 ) #define FN_SVX_SET_OUTLINE ( SID_SVX_START + 1138 )
#define SID_ALLOW_PADDING_WITHOUT_BORDERS ( SID_SVX_START + 1139 )
#define SID_ATTR_BORDER_STYLES ( SID_SVX_START + 1140 ) #define SID_ATTR_BORDER_STYLES ( SID_SVX_START + 1140 )
#define SID_ATTR_BORDER_DEFAULT_WIDTH ( SID_SVX_START + 1141 ) #define SID_ATTR_BORDER_DEFAULT_WIDTH ( SID_SVX_START + 1141 )
// 1142 is used by editeng (SID_ATTR_CHAR_GRABBAG) // 1142 is used by editeng (SID_ATTR_CHAR_GRABBAG)

View File

@ -405,6 +405,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
SID_COLOR_TABLE, SID_PATTERN_LIST, // [10179 SID_COLOR_TABLE, SID_PATTERN_LIST, // [10179
SID_HTML_MODE, SID_HTML_MODE, // [10414 SID_HTML_MODE, SID_HTML_MODE, // [10414
SID_ALLOW_PADDING_WITHOUT_BORDERS, SID_ALLOW_PADDING_WITHOUT_BORDERS, // [11139
FN_GET_PRINT_AREA, FN_GET_PRINT_AREA, // [21032 FN_GET_PRINT_AREA, FN_GET_PRINT_AREA, // [21032
FN_SURROUND, FN_HORI_ORIENT, // [21303 FN_SURROUND, FN_HORI_ORIENT, // [21303
FN_SET_FRM_NAME, FN_KEEP_ASPECT_RATIO, // [21306 FN_SET_FRM_NAME, FN_KEEP_ASPECT_RATIO, // [21306
@ -456,6 +457,9 @@ void SwFrameShell::Execute(SfxRequest &rReq)
const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() ); const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) ); aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) );
aSet.Put( SfxBoolItem( SID_ALLOW_PADDING_WITHOUT_BORDERS,
rSh.GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::ALLOW_PADDING_WITHOUT_BORDERS) ) );
OString sDefPage; OString sDefPage;
if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, false, &pItem) == SfxItemState::SET) if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, false, &pItem) == SfxItemState::SET)
sDefPage = OUStringToOString(static_cast<const SfxStringItem *>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8); sDefPage = OUStringToOString(static_cast<const SfxStringItem *>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8);