summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-01-07 11:57:24 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-01-07 11:57:24 +0000
commit8a7283a051c2db9c6108c6f83f8d2415c18f7b88 (patch)
tree1dd46c3dfb39625b55b8ce79add2371932a88bda /xmloff/source
parent43a8dcc1dda2736869841d5b0a0510dc46ca5501 (diff)
CWS-TOOLING: integrate CWS outlinelevel
2008-12-19 10:32:51 +0100 od r265718 : #i70748# method <SwWW8Writer::StartTOX(..)> - correction for custom to outline style assigned paragraph styles 2008-12-19 09:24:41 +0100 od r265715 : #i70748# method <HandleModifyAtTxtNode(..)> - retrieve former applied list style before potential reset of empty list style due to set outline level 2008-12-17 15:33:57 +0100 hde r265608 : #i97013# 2008-12-17 14:43:42 +0100 od r265603 : #i70748# adjust fix i44177 - adjustment of to outline style assigned paragraph styles only for OOo-Templates. 2008-12-17 12:59:42 +0100 od r265598 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - special handling of OOo 2.x document regarding outline numbering of headings. 2008-12-17 12:45:53 +0100 od r265597 : #i70748# method <HandleModifyAtTxtNode(..)> - correct determination of new and former applied list style 2008-12-17 10:18:41 +0100 od r265581 : #i97312# method <XMLTextNumRuleInfo::Set(..)> - check, if numbering rules instance contains any numbering rule. 2008-12-16 14:34:22 +0100 hde r265542 : #i97013 2008-12-16 14:20:24 +0100 od r265541 : #i70748# adjust documentation of "Which"-ID numbers 2008-12-16 14:19:49 +0100 od r265539 : #i70748# Adjust Attribute-Function-Mapping table due to new attribute 2008-12-16 14:06:24 +0100 od r265538 : #i70748# - Correct handling of to outline style assigned paragraph styles on reset of all paragraph style attributes - WW8 import: Consider refactoring of paragraph style's outline level attribute - NO_NUMBERING define no longer exsits. 2008-12-16 10:37:19 +0100 od r265530 : #i70478# Correction on moving outline paragraph up respectively down in its outline level: - Check also outline paragraph, which are not an outline via a to outline style assigned paragraph style, if action is applicable. 2008-12-16 09:10:13 +0100 hde r265523 : #i97277 2008-12-16 09:09:30 +0100 hde r265522 : #i97277 2008-12-16 09:07:40 +0100 hde r265521 : Added control and purged obsolete id's 2008-12-10 13:09:36 +0100 od r265174 : #i70748# correction of previous fix due to warning-free code 2008-12-10 13:03:30 +0100 od r265172 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - Due to performance issues avoid retrieving outline level value from paragraph's paragraph style for each paragraph. Instead retrieve current outline level value from paragraph, which is the inherited value from its paragraph style, and only when it is needed. 2008-12-09 16:50:36 +0100 ufi r265117 : help 2008-12-09 16:49:50 +0100 ufi r265116 : help 2008-12-09 15:45:05 +0100 od r265107 : #i70748# method <XMLTextImportHelper::SetStyleAndAttrs(..)> - some minor rework and check access to paragraph styles 2008-12-09 15:42:04 +0100 od r265106 : #i70748# adjust name of local variable to avoid hiding of class variable 2008-12-09 15:40:51 +0100 od r265105 : #i70748# correct initialization order 2008-12-09 15:35:07 +0100 od r265101 : #i70748# remove duplicate entry in certain property map 2008-12-09 15:33:39 +0100 od r265100 : #i70748# add end of file token 2008-12-07 15:11:54 +0100 zhaojianwei r264952 : conflicts left not to be resolved when cws rebase 2008-12-04 14:52:21 +0100 zhaojianwei r264846 : CWS-TOOLING: rebase CWS outlinelevel to trunk@264325 (milestone: DEV300:m36) 2008-11-28 03:42:09 +0100 zhaojianwei r264525 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:39 +0100 zhaojianwei r264524 : #i70748#: migrate CWS outlinelevel to SVN 2008-11-28 03:41:11 +0100 zhaojianwei r264523 : #i70748#: migrate CWS outlinelevel to SVN
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/style/styleexp.cxx73
-rw-r--r--xmloff/source/text/XMLTextNumRuleInfo.cxx10
-rw-r--r--xmloff/source/text/txtimp.cxx205
-rw-r--r--xmloff/source/text/txtparae.cxx72
-rw-r--r--xmloff/source/text/txtstyle.cxx20
-rw-r--r--xmloff/source/text/txtstyli.cxx21
6 files changed, 288 insertions, 113 deletions
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index c697134e0e..fa1877b481 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -86,6 +86,7 @@ XMLStyleExport::XMLStyleExport(
sIsAutoUpdate( RTL_CONSTASCII_USTRINGPARAM( "IsAutoUpdate" ) ),
sFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) ),
sNumberingStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyleName" ) ),
+ sOutlineLevel( RTL_CONSTASCII_USTRINGPARAM( "OutlineLevel" ) ),//#outline level,add by zhaojianwei
sPoolStyleName( rPoolStyleName ),
pAutoStylePool( pAutoStyleP )
{
@@ -107,12 +108,12 @@ sal_Bool XMLStyleExport::exportStyle(
const Reference< XStyle >& rStyle,
const OUString& rXMLFamily,
const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ const Reference< XNameAccess >& xStyles, //#outline level,add by zhaojianwei
const OUString* pPrefix )
{
Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
Reference< XPropertySetInfo > xPropSetInfo =
xPropSet->getPropertySetInfo();
-
Any aAny;
// Don't export styles that aren't existing really. This may be the
@@ -185,6 +186,31 @@ sal_Bool XMLStyleExport::exportStyle(
XML_TRUE );
}
+ // style:default-outline-level"..." //#outline level, add by zhaojianwei.0802
+ sal_Int32 nOutlineLevel = 0;
+ if( xPropSetInfo->hasPropertyByName( sOutlineLevel ) )
+ {
+ Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
+ if( PropertyState_DIRECT_VALUE == xPropState->getPropertyState( sOutlineLevel ) )
+ {
+ aAny = xPropSet->getPropertyValue( sOutlineLevel );
+ aAny >>= nOutlineLevel;
+ if( nOutlineLevel > 0 )
+ {
+ OUStringBuffer sTmp;
+ sTmp.append( static_cast<sal_Int32>(nOutlineLevel));
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ XML_DEFAULT_OUTLINE_LEVEL,
+ sTmp.makeStringAndClear() );
+ }
+ else
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DEFAULT_OUTLINE_LEVEL,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "" )));
+ }
+ }
+ }//<-end,zhaojianwei
+
// style:list-style-name="..." (SW paragarph styles only)
if( xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
{
@@ -248,9 +274,50 @@ sal_Bool XMLStyleExport::exportStyle(
}
// <--
}
+ }
+ //#outline level, add by zhaojianwei.0802
+ else if( nOutlineLevel > 0 )
+ {
+
+ bool bNoInheritedListStyle( true );
+
+ /////////////////////////////////////////////////
+ Reference<XStyle> xStyle( xPropState, UNO_QUERY );
+ while ( xStyle.is() )
+ {
+ OUString aParentStyle( xStyle->getParentStyle() );
+ if ( aParentStyle.getLength() == 0 ||
+ !xStyles->hasByName( aParentStyle ) )
+ {
+ break;
+ }
+ else
+ {
+ xPropState = Reference< XPropertyState >( xStyles->getByName( aParentStyle ), UNO_QUERY );
+ if ( !xPropState.is() )
+ {
+ break;
+ }
+ if ( xPropState->getPropertyState( sNumberingStyleName ) == PropertyState_DIRECT_VALUE )
+ {
+ bNoInheritedListStyle = false;
+ break;
+ }
+ else
+ {
+ xStyle = Reference<XStyle>( xPropState, UNO_QUERY );
+ }
+ }
+ }
+ /////////////////////////////////////////////////
+ if ( bNoInheritedListStyle )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_LIST_STYLE_NAME,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "" )));
}
+ //<-end,zhaojianwei
}
+
// style:pool-id="..." is not required any longer since we use
// english style names only
exportStyleAttributes( rStyle );
@@ -405,7 +472,7 @@ void XMLStyleExport::exportStyleFamily(
if( !bUsed || xStyle->isInUse() )
{
BOOL bExported = exportStyle( xStyle, rXMLFamily, rPropMapper,
- pPrefix );
+ xStyles,pPrefix );
if( bUsed && bFirstStyle && bExported )
{
// If this is the first style, find out wether next styles
@@ -480,7 +547,7 @@ void XMLStyleExport::exportStyleFamily(
xStyleCont->getByName( sNextName ) >>= xStyle;
DBG_ASSERT( xStyle.is(), "Style not found for export!" );
- if( xStyle.is() && exportStyle( xStyle, rXMLFamily, rPropMapper, pPrefix ) )
+ if( xStyle.is() && exportStyle( xStyle, rXMLFamily, rPropMapper, xStyles,pPrefix ) )
pExportedStyles->Insert( new String( sTmp ) );
}
}
diff --git a/xmloff/source/text/XMLTextNumRuleInfo.cxx b/xmloff/source/text/XMLTextNumRuleInfo.cxx
index 802c721bc7..30895a5edc 100644
--- a/xmloff/source/text/XMLTextNumRuleInfo.cxx
+++ b/xmloff/source/text/XMLTextNumRuleInfo.cxx
@@ -113,6 +113,16 @@ void XMLTextNumRuleInfo::Set(
mnListLevel = 0;
}
+ // --> OD 2008-12-17 #i97312#
+ if ( mxNumRules.is() && mxNumRules->getCount() < 1 )
+ {
+ DBG_ASSERT( false,
+ "<XMLTextNumRuleInfo::Set(..)> - numbering rules instance does not contain any numbering rule" );
+ Reset();
+ return;
+ }
+ // <--
+
// --> OD 2006-09-27 #i69627#
bool bSuppressListStyle( false );
if ( mxNumRules.is() )
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 3997985bfa..52d0c0f1d2 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -520,6 +520,7 @@ XMLTextImportHelper::XMLTextImportHelper(
// --> OD 2008-04-23 #refactorlists#
, sPropNameDefaultListId(RTL_CONSTASCII_USTRINGPARAM("DefaultListId"))
, sPropNameListId(RTL_CONSTASCII_USTRINGPARAM("ListId"))
+, sOutlineLevel( RTL_CONSTASCII_USTRINGPARAM("OutlineLevel")) //#outline level,add by zhaojianwei
// <--
{
Reference< XChapterNumberingSupplier > xCNSupplier( rModel, UNO_QUERY );
@@ -632,8 +633,8 @@ XMLTextImportHelper::~XMLTextImportHelper()
delete [] mpOutlineStylesCandidates;
// <--
- aBookmarkVector.clear();
-
+ aBookmarkVector.clear();
+
_FinitBackpatcher();
}
@@ -971,10 +972,10 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
sStyleName = OUString();
}
- // --> OD 2008-05-13 #refactorlists#
- // keep track of setting numbering level
- bool bNumberingLevelSet( false );
- // <--
+ // --> OD 2008-09-10 #i70748#
+ // The outline level needs to be only applied as list level, if the heading
+ // is not inside a list and if it by default applies the outline style.
+ bool bApplyOutlineLevelAsListLevel( false );
// --> OD 2007-08-17 #i80724#
if ( bSetListAttrs && bPara && xPropSetInfo->hasPropertyByName( sNumberingRules ) )
// <--
@@ -1079,9 +1080,6 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
}
xPropSet->setPropertyValue( sNumberingLevel, Any(nLevel) );
- // --> OD 2008-05-13 #refactorlists#
- bNumberingLevelSet = true;
- // <--
if( pListBlock && pListBlock->IsRestartNumbering() )
{
@@ -1123,16 +1121,33 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
if( xNumRules.is() )
{
bool bRemove( true );
- if ( xChapterNumbering.is() )
+ // --> OD 2008-12-17 #i70748# - special handling for document from OOo 2.x
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
+ DBG_ASSERT( ( bBuildIdFound && nUPD == 680 ) ||
+ !pStyle ||
+ !pStyle->IsListStyleSet() ||
+ pStyle->GetListStyle().getLength() == 0,
+ "automatic paragraph style with list style name, but paragraph not in list???" );
+ if ( ( bBuildIdFound && nUPD == 680 ) ||
+ !pStyle || !pStyle->IsListStyleSet() )
{
- Reference< XNamed > xNumNamed( xNumRules, UNO_QUERY );
- Reference< XNamed > xChapterNumNamed( xChapterNumbering, UNO_QUERY );
- if ( xNumNamed.is() && xChapterNumNamed.is() &&
- xNumNamed->getName() == xChapterNumNamed->getName() )
+ if ( xChapterNumbering.is() )
{
- bRemove = false;
+ Reference< XNamed > xNumNamed( xNumRules, UNO_QUERY );
+ Reference< XNamed > xChapterNumNamed( xChapterNumbering, UNO_QUERY );
+ if ( xNumNamed.is() && xChapterNumNamed.is() &&
+ xNumNamed->getName() == xChapterNumNamed->getName() )
+ {
+ bRemove = false;
+ // --> OD 2008-09-10 #i70748#
+ bApplyOutlineLevelAsListLevel = true;
+ // <--
+ }
}
}
+ // <--
if ( bRemove )
{
xPropSet->setPropertyValue( sNumberingRules, Any() );
@@ -1217,90 +1232,112 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
// outline level.
// - DO NOT set type of numbering rule to outline.
// - DO NOT set numbering rule directly at the paragraph.
- if ( bPara && nOutlineLevel != -1 )
+
+ // --> OD 2008-12-09 #i70748#
+ // Some minor rework and adjust access to paragraph styles
+ if ( bPara )
{
- // --> OD 2008-05-28 #refactorlists# - no longer needed
-// // --> OD 2005-08-25 #i53198# - set the outline level at the paragraph.
-// {
-// const OUString sParaChapterNumberingLevel(
-// RTL_CONSTASCII_USTRINGPARAM("ParaChapterNumberingLevel") );
-// xPropSet->setPropertyValue( sParaChapterNumberingLevel,
-// makeAny( static_cast<sal_Int8>(nOutlineLevel - 1) ) );
-// }
-// // <--
- // --> OD 2005-09-01 #i53198# - set numbering level of the paragraph to
- // its outline level, if no numbering level is set.
+ //if ( bPara && nOutlineLevel != -1 ) //#outline level,removed by zhaojianwei
+ if ( nOutlineLevel > 0 ) //add by zhaojianwei
{
- // --> OD 2008-05-13 #refactorlists#
- sal_Int16 nNumLevel = -1;
- xPropSet->getPropertyValue( sNumberingLevel ) >>= nNumLevel;
- if ( nNumLevel == -1 ||
- ( !bNumberingLevelSet && nNumLevel != (nOutlineLevel - 1) ) )
+ //#outline level,removed by zhaojianwei
+ if ( xPropSetInfo->hasPropertyByName( sOutlineLevel ) )
{
- xPropSet->setPropertyValue( sNumberingLevel,
- makeAny( static_cast<sal_Int8>(nOutlineLevel - 1) ) );
- }
- // <--
- }
- // <--
- // --> OD 2006-10-13 #i69629# - correction:
- // - for text document from version OOo 2.0.4/SO 8 PU4 and earlier
- // the paragraph style of a heading should be assigned to the
- // corresponding list level of the outline style.
- // - for other text documents the paragraph style of a heading is only
- // a candidate for an assignment to the list level of the outline
- // style, if it has no direct list style property and (if exists) the
- // automatic paragraph style has also no direct list style set.
- if( xParaStyles->hasByName( sStyleName ) )
- {
- bool bOutlineStyleCandidate( false );
-
- sal_Int32 nUPD( 0 );
- sal_Int32 nBuild( 0 );
- // --> OD 2007-12-19 #152540#
- const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
- // --> OD 2007-07-25 #i73509#
- // --> OD 2008-03-19 #i86058# - check explicitly on certain versions
- if ( rImport.IsTextDocInOOoFileFormat() ||
- ( bBuildIdFound &&
- ( nUPD == 645 || nUPD == 641 ) ) )
- {
- bOutlineStyleCandidate = true;
- }
- else if ( nUPD == 680 && nBuild <= 9073 ) /* BuildId of OOo 2.0.4/SO8 PU4 */
+ sal_Int16 nCurrentOutlineLevelInheritedFromParagraphStyle = 0;
+ xPropSet->getPropertyValue( sOutlineLevel ) >>= nCurrentOutlineLevelInheritedFromParagraphStyle;
+ // In case that the value equals the value of its paragraph style
+ // attribute outline level, the paragraph attribute value is left unset
+ if ( nCurrentOutlineLevelInheritedFromParagraphStyle != nOutlineLevel )
+ {
+ xPropSet->setPropertyValue( sOutlineLevel,
+ makeAny( static_cast<sal_Int16>(nOutlineLevel) ) );
+ }
+ }//<-end,zhaojianwei
+
+ // --> OD 2008-09-10 #i70748#
+ if ( bApplyOutlineLevelAsListLevel )
{
- bOutlineStyleCandidate = bOutlineLevelAttrFound;
+ sal_Int16 nNumLevel = -1;
+ xPropSet->getPropertyValue( sNumberingLevel ) >>= nNumLevel;
+ if ( nNumLevel == -1 ||
+ nNumLevel != (nOutlineLevel - 1) )
+ {
+ xPropSet->setPropertyValue( sNumberingLevel,
+ makeAny( static_cast<sal_Int8>(nOutlineLevel - 1) ) );
+ }
}
// <--
- else
+ // --> OD 2006-10-13 #i69629# - correction:
+ // - for text document from version OOo 2.0.4/SO 8 PU4 and earlier
+ // the paragraph style of a heading should be assigned to the
+ // corresponding list level of the outline style.
+ // - for other text documents the paragraph style of a heading is only
+ // a candidate for an assignment to the list level of the outline
+ // style, if it has no direct list style property and (if exists) the
+ // automatic paragraph style has also no direct list style set.
+ if( xParaStyles->hasByName( sStyleName ) )
{
- Reference< XPropertyState > xStylePropState(
- xParaStyles->getByName( sStyleName ), UNO_QUERY );
- if ( xStylePropState.is() &&
- xStylePropState->getPropertyState( sNumberingStyleName ) == PropertyState_DIRECT_VALUE )
+ bool bOutlineStyleCandidate( false );
+
+ sal_Int32 nUPD( 0 );
+ sal_Int32 nBuild( 0 );
+ // --> OD 2007-12-19 #152540#
+ const bool bBuildIdFound = rImport.getBuildIds( nUPD, nBuild );
+ // --> OD 2007-07-25 #i73509#
+ // --> OD 2008-03-19 #i86058# - check explicitly on certain versions
+ if ( rImport.IsTextDocInOOoFileFormat() ||
+ ( bBuildIdFound &&
+ ( nUPD == 645 || nUPD == 641 ) ) )
{
- bOutlineStyleCandidate = false;
+ bOutlineStyleCandidate = true;
+ }
+ else if ( nUPD == 680 && nBuild <= 9073 ) /* BuildId of OOo 2.0.4/SO8 PU4 */
+ {
+ bOutlineStyleCandidate = bOutlineLevelAttrFound;
}
- // --> OD 2007-01-11 #i73361#
- // The automatic paragraph style doesn't have to be considered.
-// else if ( pStyle && /* automatic paragraph style */
-// pStyle->IsListStyleSet() )
-// {
-// bOutlineStyleCandidate = false;
-// }
// <--
- else
+// else
+// {
+// Reference< XPropertyState > xStylePropState(
+// xParaStyles->getByName( sStyleName ), UNO_QUERY );
+// if ( xStylePropState.is() &&
+// xStylePropState->getPropertyState( sNumberingStyleName ) == PropertyState_DIRECT_VALUE )
+// {
+// bOutlineStyleCandidate = false;
+// }
+// // --> OD 2007-01-11 #i73361#
+// // The automatic paragraph style doesn't have to be considered.
+// // else if ( pStyle && /* automatic paragraph style */
+// // pStyle->IsListStyleSet() )
+// // {
+// // bOutlineStyleCandidate = false;
+// // }
+// // <--
+// else
+// {
+// bOutlineStyleCandidate = true;
+// }
+// }
+
+ if ( bOutlineStyleCandidate )
{
- bOutlineStyleCandidate = true;
+ AddOutlineStyleCandidate( nOutlineLevel, sStyleName );
}
}
-
- if ( bOutlineStyleCandidate )
+ // <--
+ }
+ //-> #outlinelevel added by zhaojianwei
+ //handle for text:p,if the paragraphstyle outlinelevel is set to[1~10]
+ else if( xPropSetInfo->hasPropertyByName( sOutlineLevel ) )
+ {
+ sal_Int16 nCurrentOutlineLevelInheritedFromParagraphStyle = 0;
+ xPropSet->getPropertyValue( sOutlineLevel ) >>= nCurrentOutlineLevelInheritedFromParagraphStyle;
+ if ( nCurrentOutlineLevelInheritedFromParagraphStyle != 0 )
{
- AddOutlineStyleCandidate( nOutlineLevel, sStyleName );
+ sal_Int16 nZero = 0;
+ xPropSet->setPropertyValue( sOutlineLevel, makeAny( static_cast<sal_Int16>(nZero) ) );
}
- }
- // <--
+ }//<-end,zhaojianwei
}
// <--
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 2b41f617f2..ed001cb4da 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -53,6 +53,7 @@
#include <com/sun/star/text/XTextSectionsSupplier.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
#include <com/sun/star/text/XNumberingRulesSupplier.hpp>
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>//#outline level,add by zhaojianwei
#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/XTextContent.hpp>
@@ -199,7 +200,10 @@ enum eParagraphPropertyNamesEnumAuto
static const sal_Char* aParagraphPropertyNames[] =
{
"NumberingIsNumber",
- "ParaChapterNumberingLevel",
+ "NumberingStyleName", //#outline level,add by zhaojianwei
+
+ //"ParaChapterNumberingLevel", //#outline level,remove by zhaojianwei
+ "OutlineLevel", //<-end,add by zhaojianwei
"ParaConditionalStyleName",
"ParaStyleName",
"TextSection",
@@ -209,10 +213,12 @@ static const sal_Char* aParagraphPropertyNames[] =
enum eParagraphPropertyNamesEnum
{
NUMBERING_IS_NUMBER = 0,
- PARA_CHAPTER_NUMERBING_LEVEL = 1,
- PARA_CONDITIONAL_STYLE_NAME = 2,
- PARA_STYLE_NAME = 3,
- TEXT_SECTION = 4
+ PARA_NUMBERING_STYLENAME = 1, //#outline level,add by zhaojianwei
+ //PARA_CHAPTER_NUMERBING_LEVEL = 1, //#outline level,remove by zhaojianwei
+ PARA_OUTLINE_LEVEL=2, //<-end.add by zhaojianwei
+ PARA_CONDITIONAL_STYLE_NAME = 3,
+ PARA_STYLE_NAME = 4,
+ TEXT_SECTION = 5
};
void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
@@ -1964,7 +1970,7 @@ void XMLTextParagraphExport::exportParagraph(
sal_Bool bAutoStyles, sal_Bool bIsProgress, sal_Bool bExportParagraph,
MultiPropertySetHelper& rPropSetHelper)
{
- sal_Int8 nOutlineLevel = -1;
+ sal_Int16 nOutlineLevel = -1;
if( bIsProgress )
{
@@ -2041,19 +2047,24 @@ void XMLTextParagraphExport::exportParagraph(
}
}
- if( rPropSetHelper.hasProperty( PARA_CHAPTER_NUMERBING_LEVEL ) )
+ //if( rPropSetHelper.hasProperty( PARA_CHAPTER_NUMERBING_LEVEL ) ) //#outline level,zhaojianwei
+ if( rPropSetHelper.hasProperty( PARA_OUTLINE_LEVEL ) ) //<-end
{
if( xMultiPropSet.is() )
- rPropSetHelper.getValue( PARA_CHAPTER_NUMERBING_LEVEL,
+ //rPropSetHelper.getValue( PARA_CHAPTER_NUMERBING_LEVEL, //#outline level,zhaojianwei
+ rPropSetHelper.getValue( PARA_OUTLINE_LEVEL, //<-end
xMultiPropSet ) >>= nOutlineLevel;
else
- rPropSetHelper.getValue( PARA_CHAPTER_NUMERBING_LEVEL,
+ //rPropSetHelper.getValue( PARA_CHAPTER_NUMERBING_LEVEL, //#outline level,zhaojianwei
+ rPropSetHelper.getValue( PARA_OUTLINE_LEVEL, //<-end
xPropSet ) >>= nOutlineLevel;
- if( -1 != nOutlineLevel )
+ //if( -1 != nOutlineLevel ) //#outline level,zhaojianwei
+ if( 0 < nOutlineLevel ) //<-end,zhaojianwei
{
OUStringBuffer sTmp;
- sTmp.append( sal_Int32( nOutlineLevel + 1 ) );
+ //sTmp.append( sal_Int32( nOutlineLevel + 1 ) ); //#outline level,zhaojianwei
+ sTmp.append( sal_Int32( nOutlineLevel) ); //<-end,zhaojianwei
GetExport().AddAttribute( XML_NAMESPACE_TEXT,
XML_OUTLINE_LEVEL,
sTmp.makeStringAndClear() );
@@ -2068,7 +2079,39 @@ void XMLTextParagraphExport::exportParagraph(
rPropSetHelper.getValue(
NUMBERING_IS_NUMBER, xPropSet ) >>= bIsNumber;
- if( ! bIsNumber )
+ OUString sListStyleName;
+ if( xMultiPropSet.is() )
+ rPropSetHelper.getValue(
+ PARA_NUMBERING_STYLENAME, xMultiPropSet ) >>= sListStyleName;
+ else
+ rPropSetHelper.getValue(
+ PARA_NUMBERING_STYLENAME, xPropSet ) >>= sListStyleName;
+
+
+
+ bool bAssignedtoOutlineStyle = false;//#outline level,add by zhaojianwei
+ {
+ Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(), UNO_QUERY );
+
+ OUString sOutlineName;
+ if (xCNSupplier.is())
+ {
+ Reference< XIndexReplace > xNumRule ( xCNSupplier->getChapterNumberingRules() );
+ DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
+
+ if (xNumRule.is())
+ {
+ Reference< XPropertySet > xNumRulePropSet( xNumRule, UNO_QUERY );
+ xNumRulePropSet->getPropertyValue(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("Name")) ) >>= sOutlineName;
+ bAssignedtoOutlineStyle = ( sListStyleName == sOutlineName );
+ }
+ }
+
+ } //<end,zhaojianwei
+
+ //if( ! bIsNumber ) //#outline level,removed by zhaojianwei
+ if( ! bIsNumber && bAssignedtoOutlineStyle ) //#outline level,add by zhaojianwei
GetExport().AddAttribute( XML_NAMESPACE_TEXT,
XML_IS_LIST_HEADER,
XML_TRUE );
@@ -2177,7 +2220,8 @@ void XMLTextParagraphExport::exportParagraph(
{
sal_Bool bPrevCharIsSpace = sal_True;
enum XMLTokenEnum eElem =
- -1 == nOutlineLevel ? XML_P : XML_H;
+ //-1 == nOutlineLevel ? XML_P : XML_H; //#outline level,zhaojianwei
+ 0 < nOutlineLevel ? XML_H : XML_P; //<-end,zhaojianwei
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem,
sal_True, sal_False );
if( bHasContentEnum )
@@ -2269,7 +2313,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
{
exportRuby(xPropSet, bAutoStyles);
}
- else if (sType.equals(sTextFieldStart))
+ else if (sType.equals(sTextFieldStart))
{
Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
if (xBookmark.is()) {
diff --git a/xmloff/source/text/txtstyle.cxx b/xmloff/source/text/txtstyle.cxx
index 95b13a3451..d9e061be84 100644
--- a/xmloff/source/text/txtstyle.cxx
+++ b/xmloff/source/text/txtstyle.cxx
@@ -137,16 +137,16 @@ void XMLTextParagraphExport::exportStyleAttributes(
GetExport().EncodeStyleName( sName ) );
}
}
- sal_Int32 nOutlineLevel =
- GetExport().GetTextParagraphExport()->GetHeadingLevel( rStyle->getName() );
- if( nOutlineLevel != -1 )
- {
- OUStringBuffer sTmp;
- sTmp.append( static_cast<sal_Int32>(nOutlineLevel+1L) );
- GetExport().AddAttribute( XML_NAMESPACE_STYLE,
- XML_DEFAULT_OUTLINE_LEVEL,
- sTmp.makeStringAndClear() );
- }
+ //sal_Int32 nOutlineLevel = //#outline level, zhaojianwei, moved to styleexp.cxx - XMLStyleExport::exportStyle(¡­¡­)
+ // GetExport().GetTextParagraphExport()->GetHeadingLevel( rStyle->getName() );
+ //if( nOutlineLevel != -1 )
+ //{
+ // OUStringBuffer sTmp;
+ // sTmp.append( static_cast<sal_Int32>(nOutlineLevel+1L) );
+ // GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ // XML_DEFAULT_OUTLINE_LEVEL,
+ // sTmp.makeStringAndClear() );
+ //}
if( bProgress )
{
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index eba794254b..3a1c921d75 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -127,7 +127,8 @@ void XMLTextStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
{
sal_Int32 nTmp;
if( SvXMLUnitConverter::convertNumber( nTmp, rValue ) &&
- nTmp > 0 && nTmp < 256 )
+ // nTmp > 0 && nTmp < 256 ) //#outline level, removed by zhaojianwei
+ 0 <= nTmp && nTmp <= 10 ) //<-end,add by zhaojianwei
nOutlineLevel = static_cast< sal_Int8 >( nTmp );
}
else
@@ -152,9 +153,11 @@ XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport,
, sIsAutoUpdate( RTL_CONSTASCII_USTRINGPARAM( "IsAutoUpdate" ) )
, sCategory( RTL_CONSTASCII_USTRINGPARAM( "Category" ) )
, sNumberingStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyleName" ) )
+, sOutlineLevel(RTL_CONSTASCII_USTRINGPARAM( "OutlineLevel" ) )//#outline level,add by zhaojianwei
, sDropCapCharStyleName( RTL_CONSTASCII_USTRINGPARAM( "DropCapCharStyleName" ) )
, sPageDescName( RTL_CONSTASCII_USTRINGPARAM( "PageDescName" ) )
-, nOutlineLevel( 0 )
+//, nOutlineLevel( 0 ) // removed by zhaojianwei
+, nOutlineLevel( -1 ) //<-end, add by zhaojianwei
, bAutoUpdate( sal_False )
, bHasMasterPageName( sal_False )
, bHasCombinedCharactersLetter( sal_False )
@@ -294,6 +297,7 @@ void XMLTextStyleContext::Finish( sal_Bool bOverwrite )
// consider set empty list style
// if ( !( sListStyleName.getLength() ||
if ( !( mbListStyleSet ||
+ nOutlineLevel >= 0 || //#outline level,add by zhaojianwei
sDropCapTextStyleName.getLength() ||
bHasMasterPageName ) ||
!xStyle.is() ||
@@ -305,6 +309,19 @@ void XMLTextStyleContext::Finish( sal_Bool bOverwrite )
Reference< XPropertySetInfo > xPropSetInfo =
xPropSet->getPropertySetInfo();
+ //#outline level,add by zhaojianwei
+ if( xPropSetInfo->hasPropertyByName( sOutlineLevel ))
+ {
+ Any aAny;
+ if( nOutlineLevel >= 0 )
+ {
+ aAny <<= nOutlineLevel;
+ xPropSet->setPropertyValue( sOutlineLevel, aAny );
+ }
+ }
+ //<-end,zhaojianwei
+
+
// --> OD 2006-09-21 #i69523#
// consider set empty list style
// if( sListStyleName.getLength() )