Kaydet (Commit) efd316b6 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Justin Luth

tdf#94009 ww8export: always export section margins

Since the internal SW defaults (0) don't match the import
defaults, always write the top/bottom, left/right margins
into the document definition.

It is very rare indeed to have a zero margin anyway, since
the page margin being zero is highly discouraged because
of printing. The bug report is for DOCX, but it also
affects DOC.

I don't have an example where LRSpace is skipped, but it
only makes sense to treat these two the same just in case.

Change-Id: Ie9a08ad0dd4f73bc976756fe244fc33e2dc804f3
Reviewed-on: https://gerrit.libreoffice.org/59967
Tested-by: Jenkins
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst aa978430
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,sw_ww8export3))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_ww8export3, \
sw/qa/extras/ww8export/ww8export3 \
))
$(eval $(call gb_CppunitTest_use_libraries,sw_ww8export3, \
comphelper \
cppu \
cppuhelper \
editeng \
$(if $(filter WNT-TRUE,$(OS)-$(DISABLE_ATL)),,emboleobj) \
sal \
sfx \
test \
unotest \
utl \
sw \
tl \
))
$(eval $(call gb_CppunitTest_use_externals,sw_ww8export3,\
boost_headers \
libxml2 \
))
$(eval $(call gb_CppunitTest_set_include,sw_ww8export3,\
-I$(SRCDIR)/sw/inc \
-I$(SRCDIR)/sw/source/core/inc \
-I$(SRCDIR)/sw/qa/extras/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sw_ww8export3,\
udkapi \
offapi \
oovbaapi \
))
$(eval $(call gb_CppunitTest_use_ure,sw_ww8export3))
$(eval $(call gb_CppunitTest_use_vcl,sw_ww8export3))
$(eval $(call gb_CppunitTest_use_rdb,sw_ww8export3,services))
$(eval $(call gb_CppunitTest_use_configuration,sw_ww8export3))
# vim: set noet sw=4 ts=4:
......@@ -81,6 +81,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_ooxmlimport2 \
CppunitTest_sw_ww8export \
CppunitTest_sw_ww8export2 \
CppunitTest_sw_ww8export3 \
CppunitTest_sw_ww8import \
CppunitTest_sw_rtfexport \
CppunitTest_sw_rtfexport2 \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <swmodeltestbase.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
#include <drawdoc.hxx>
class Test : public SwModelTestBase
{
public:
Test()
: SwModelTestBase("/sw/qa/extras/ww8export/data/", "MS Word 97")
{
}
bool mustTestImportOf(const char* filename) const override
{
// If the testcase is stored in some other format, it's pointless to test.
return OString(filename).endsWith(".doc");
}
};
DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, "tdf94009_zeroPgMargin.odt")
{
uno::Reference<beans::XPropertySet> defaultStyle(getStyles("PageStyles")->getByName("Standard"),
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(defaultStyle, "TopMargin"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -5412,6 +5412,8 @@ void AttributeOutputBase::OutputStyleItemSet( const SfxItemSet& rSet, bool bTest
{
if ( SfxItemState::SET == pSet->GetItemState( nWhich, true/*bDeep*/, &pItem ) &&
( !bTestForDefault ||
nWhich == RES_UL_SPACE ||
nWhich == RES_LR_SPACE ||
*pItem != rPool.GetDefaultItem( nWhich ) ||
( pSet->GetParent() && *pItem != pSet->GetParent()->Get( nWhich ) ) ) )
{
......
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