summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorKevin Suo <suokunlong@126.com>2021-11-22 00:01:34 +0800
committerMiklos Vajna <vmiklos@collabora.com>2022-01-03 08:35:21 +0100
commit86cffd61c1f01a18f4016bb09c8d63a581f5cded (patch)
treeeb168f7460119f5d9110e6d047ff1b28d73a3ca4 /sw/source/uibase
parent3aaf8506b3ee0d4a1bb86be7c6ca4d9402467d49 (diff)
tdf#129448: Auto first-line indent should not be effected by line space
Previously, if you set the first line indent to auto, then if you change the line height, the first line indent will also change. I do not see a reason to change the first line indent value in case of change in line spacing, even for English language. Some languages (e.g. Chinese) may have set the auto first line indent to be 2 characters of the current font, but if the first line indent changes when line height changes, then this 2-character rule is not possible. For compatibility with old documents, a compatability flag 'AutoFirstLineIndentDisregardLineSpace' is added in this patch, thus this patch only has effect to new ODF documents. DOC/DOCX documents will also benefit from this patch, no matter old or new, because, as Miklos Vajna has pointed out, Word does not have the auto first line height feature. Change-Id: I1e2ddc33cce4ff9b3b2b4122445894f724d5bcd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125627 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index bc6051bd576c..4cfda7bbf3e4 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -151,6 +151,7 @@ enum SwDocumentSettingsPropertyHandles
HANDLE_GUTTER_AT_TOP,
HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND,
HANDLE_IMAGE_PREFERRED_DPI,
+ HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE,
};
}
@@ -248,6 +249,7 @@ static rtl::Reference<MasterPropertySetInfo> lcl_createSettingsInfo()
{ OUString("GutterAtTop"), HANDLE_GUTTER_AT_TOP, cppu::UnoType<bool>::get(), 0 },
{ OUString("FootnoteInColumnToPageEnd"), HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND, cppu::UnoType<bool>::get(), 0 },
{ OUString("ImagePreferredDPI"), HANDLE_IMAGE_PREFERRED_DPI, cppu::UnoType<sal_Int32>::get(), 0 },
+ { OUString("AutoFirstLineIndentDisregardLineSpace"), HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, cppu::UnoType<bool>::get(), 0 },
/*
* As OS said, we don't have a view when we need to set this, so I have to
@@ -1039,6 +1041,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
}
}
break;
+ case HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
+ {
+ bool bTmp;
+ if (rValue >>= bTmp)
+ {
+ mpDoc->getIDocumentSettingAccess().set(
+ DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, bTmp);
+ }
+ }
+ break;
default:
throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
}
@@ -1556,6 +1568,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
rValue <<= mpDoc->getIDocumentSettingAccess().getImagePreferredDPI();
}
break;
+ case HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE:
+ {
+ rValue <<= mpDoc->getIDocumentSettingAccess().get(
+ DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE);
+ }
+ break;
default:
throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
}