Kaydet (Commit) 49f45375 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Oliver Specht

tdf#89714 - enable Widow/Orphan in default style

For new Writer documents only, turn on the widow/orphan settings.
This has been the default in MS Word since at least 2003.

Change-Id: I1e873e7e4f0eac5e558732444594ef84e9ffe6c7
Reviewed-on: https://gerrit.libreoffice.org/19794Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarOliver Specht <oliver.specht@cib.de>
üst 3ac9942c
...@@ -149,6 +149,7 @@ public: ...@@ -149,6 +149,7 @@ public:
void testTdf90808(); void testTdf90808();
void testTdf75137(); void testTdf75137();
void testTdf83798(); void testTdf83798();
void testTdf89714();
void testPropertyDefaults(); void testPropertyDefaults();
void testTableBackgroundColor(); void testTableBackgroundColor();
void testTdf88899(); void testTdf88899();
...@@ -226,6 +227,7 @@ public: ...@@ -226,6 +227,7 @@ public:
CPPUNIT_TEST(testTdf90808); CPPUNIT_TEST(testTdf90808);
CPPUNIT_TEST(testTdf75137); CPPUNIT_TEST(testTdf75137);
CPPUNIT_TEST(testTdf83798); CPPUNIT_TEST(testTdf83798);
CPPUNIT_TEST(testTdf89714);
CPPUNIT_TEST(testPropertyDefaults); CPPUNIT_TEST(testPropertyDefaults);
CPPUNIT_TEST(testTableBackgroundColor); CPPUNIT_TEST(testTableBackgroundColor);
CPPUNIT_TEST(testTdf88899); CPPUNIT_TEST(testTdf88899);
...@@ -2269,6 +2271,17 @@ void SwUiWriterTest::testTdf83798() ...@@ -2269,6 +2271,17 @@ void SwUiWriterTest::testTdf83798()
pCrsr->DeleteMark(); pCrsr->DeleteMark();
} }
void SwUiWriterTest::testTdf89714()
{
createDoc();
uno::Reference<lang::XMultiServiceFactory> xFact(mxComponent, uno::UNO_QUERY);
uno::Reference<uno::XInterface> xInterface(xFact->createInstance("com.sun.star.text.Defaults"), uno::UNO_QUERY);
uno::Reference<beans::XPropertyState> xPropState(xInterface, uno::UNO_QUERY);
//enabled Paragraph Orphan and Widows by default starting in LO5.1
CPPUNIT_ASSERT_EQUAL( uno::makeAny(sal_Int8(2)), xPropState->getPropertyDefault(OUString("ParaOrphans")) );
CPPUNIT_ASSERT_EQUAL( uno::makeAny(sal_Int8(2)), xPropState->getPropertyDefault(OUString("ParaWidows")) );
}
void SwUiWriterTest::testPropertyDefaults() void SwUiWriterTest::testPropertyDefaults()
{ {
createDoc(); createDoc();
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#include <editeng/tstpitem.hxx> #include <editeng/tstpitem.hxx>
#include <editeng/langitem.hxx> #include <editeng/langitem.hxx>
#include <editeng/colritem.hxx> #include <editeng/colritem.hxx>
#include <editeng/orphitem.hxx>
#include <editeng/widwitem.hxx>
#include <editeng/hyphenzoneitem.hxx> #include <editeng/hyphenzoneitem.hxx>
#include <editeng/svxacorr.hxx> #include <editeng/svxacorr.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
...@@ -688,6 +690,13 @@ void SwDocShell::SubInitNew() ...@@ -688,6 +690,13 @@ void SwDocShell::SubInitNew()
{ {
bool bSquaredPageMode = SW_MOD()->GetUsrPref(false)->IsSquaredPageMode(); bool bSquaredPageMode = SW_MOD()->GetUsrPref(false)->IsSquaredPageMode();
m_pDoc->SetDefaultPageMode( bSquaredPageMode ); m_pDoc->SetDefaultPageMode( bSquaredPageMode );
// only set Widow/Orphan defaults on a new, non-web document - not an opened one
if( GetMedium() && GetMedium()->GetOrigURL().isEmpty() )
{
m_pDoc->SetDefault( SvxWidowsItem( (sal_uInt8) 2, RES_PARATR_WIDOWS) );
m_pDoc->SetDefault( SvxOrphansItem( (sal_uInt8) 2, RES_PARATR_ORPHANS) );
}
} }
m_pDoc->getIDocumentState().ResetModified(); m_pDoc->getIDocumentState().ResetModified();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment