Resolves: #i119558# set default page mode value to false for docx

To avoid default page mode affect the calculation of table row height

Found by: xiao ting xiao, tingxiaox@gmail.com
Patch by: zhaoshzh, aoo.zhaoshzh@gmail.com
Review by: zhangjf

(cherry picked from commit 28e1cb1240e7c7a274a04756c7cab2f5797de400)

Conflicts:
	sw/inc/unomap.hxx
	sw/inc/unoprnms.hxx
	sw/source/core/unocore/unomap.cxx
	sw/source/core/unocore/unoprnms.cxx
	sw/source/ui/uno/unotxdoc.cxx
	writerfilter/source/dmapper/PropertyIds.cxx

Change-Id: I41745eb9d727a5ae87d34872f9dc3f4442c7bc8d
This commit is contained in:
Jian Fang Zhang
2012-09-12 11:19:10 +00:00
committed by Caolán McNamara
parent 0f33ad3847
commit 0181f258e5
8 changed files with 30 additions and 15 deletions

View File

@@ -237,7 +237,8 @@
#define WID_DOC_LOCK_UPDATES 1016
#define WID_DOC_HAS_VALID_SIGNATURES 1017
#define WID_DOC_BUILDID 1024
#define WID_DOC_ISTEMPLATEID 1025
#define WID_DOC_ISTEMPLATEID 1025
#define WID_DOC_DEFAULT_PAGE_MODE 1069
// MailMerge
#define WID_SELECTION 1071

View File

@@ -820,7 +820,9 @@ enum SwPropNameIds
/* 0758 */ UNO_NAME_FILL_GRADIENT,
/* 0759 */ UNO_NAME_FILL_GRADIENT_NAME,
/* 0760 */ SW_PROPNAME_END
/* 0760 */ UNO_NAME_DEFAULT_PAGE_MODE,
/* 0761 */ SW_PROPNAME_END
// new items in this array must match SwPropNameTab aPropNameTab
};

View File

@@ -1559,6 +1559,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_LOCK_UPDATES), WID_DOC_LOCK_UPDATES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
{ SW_PROP_NMID(UNO_NAME_HAS_VALID_SIGNATURES), WID_DOC_HAS_VALID_SIGNATURES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
{ SW_PROP_NMID(UNO_NAME_BUILDID), WID_DOC_BUILDID, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0},
{ SW_PROP_NMID(UNO_NAME_DEFAULT_PAGE_MODE), WID_DOC_DEFAULT_PAGE_MODE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
{0,0,0,0,0,0}
};
aMapEntriesArr[nPropertyId] = aDocMap_Impl;

View File

@@ -789,6 +789,7 @@ const SwPropNameTab aPropNameTab = {
/* 0757 UNO_NAME_FILL_STYLE */ {MAP_CHAR_LEN("FillStyle")},
/* 0758 UNO_NAME_FILL_GRADIENT */ {MAP_CHAR_LEN("FillGradient")},
/* 0759 UNO_NAME_FILL_GRADIENT_NAME */ {MAP_CHAR_LEN("FillGradientName")},
/* 0760 UNO_NAME_DEFAULT_PAGE_MODE */ {MAP_CHAR_LEN("DefaultPageMode")}
// new items in this array must match enum SwPropNameIds
};

View File

@@ -1991,6 +1991,14 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName,
aValue >>= maBuildId;
break;
case WID_DOC_DEFAULT_PAGE_MODE:
{
bool bDefaultPageMode( false );
aValue >>= bDefaultPageMode;
pDocShell->GetDoc()->SetDefaultPageMode( bDefaultPageMode );
}
break;
default:
{
const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pEntry->nWID);

View File

@@ -228,6 +228,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_GRID_LINES : sName = "GridLines"; break;
case PROP_GRID_BASE_HEIGHT : sName = "GridBaseHeight"; break;
case PROP_GRID_RUBY_HEIGHT : sName = "GridRubyHeight"; break;
case PROP_GRID_STANDARD_MODE : sName = "StandardPageMode"; break;
case PROP_IS_ON : sName = "IsOn"; break;
case PROP_RESTART_AT_EACH_PAGE : sName = "RestartAtEachPage"; break;
case PROP_COUNT_EMPTY_LINES : sName = "CountEmptyLines"; break;

View File

@@ -276,6 +276,7 @@ enum PropertyIds
,PROP_USER_DATA_TYPE
,PROP_VERTICAL_MERGE
,PROP_VERT_MIRRORED
/*254*/ ,PROP_GRID_STANDARD_MODE
,PROP_VERT_ORIENT
,PROP_VERT_ORIENT_POSITION
,PROP_VERT_ORIENT_RELATION

View File

@@ -990,21 +990,21 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
nRubyHeight = 0;
operator[]( PropertyDefinition( PROP_GRID_RUBY_HEIGHT, false )) = uno::makeAny( nRubyHeight );
sal_Int16 nGridMode = text::TextGridMode::NONE;
switch (m_nGridType)
// #i119558#, force to set document as standard page mode,
// refer to ww8 import process function "SwWW8ImplReader::SetDocumentGrid"
try
{
case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_lines:
nGridMode = text::TextGridMode::LINES;
break;
case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_linesAndChars:
nGridMode = text::TextGridMode::LINES_AND_CHARS;
break;
default:
break;
uno::Reference< beans::XPropertySet > xDocProperties;
xDocProperties = uno::Reference< beans::XPropertySet >( rDM_Impl.GetTextDocument(), uno::UNO_QUERY_THROW );
sal_Bool bSquaredPageMode = sal_False;
operator[]( PropertyDefinition( PROP_GRID_STANDARD_MODE, false )) = uno::makeAny( !bSquaredPageMode );
xDocProperties->setPropertyValue( OUString("DefaultPageMode"), uno::makeAny( bSquaredPageMode ));
}
catch (const uno::Exception& rEx)
{
OSL_ENSURE( false, "Exception in SectionPropertyMap::CloseSectionGroup");
(void)rEx;
}
operator[](PropertyDefinition(PROP_GRID_MODE, false)) = uno::makeAny(nGridMode);
if (rDM_Impl.IsNewDoc())
_ApplyProperties( xFollowPageStyle );