summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svx/inc/svx/svxids.hrc5
-rw-r--r--xmloff/inc/xmloff/styleexp.hxx19
-rw-r--r--xmloff/inc/xmloff/txtimp.hxx1
-rw-r--r--xmloff/inc/xmloff/txtstyli.hxx2
-rw-r--r--xmloff/source/style/styleexp.cxx73
-rw-r--r--xmloff/source/text/XMLTextNumRuleInfo.cxx10
-rw-r--r--xmloff/source/text/txtimp.cxx201
-rw-r--r--xmloff/source/text/txtparae.cxx70
-rw-r--r--xmloff/source/text/txtstyle.cxx20
-rw-r--r--xmloff/source/text/txtstyli.cxx21
10 files changed, 308 insertions, 114 deletions
diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc
index 3c5d321487f9..d7c018bedaac 100644
--- a/svx/inc/svx/svxids.hrc
+++ b/svx/inc/svx/svxids.hrc
@@ -1346,7 +1346,10 @@
#define SID_TABLE_STYLE_SETTINGS (SID_SVX_START+1089)
#define SID_CHAR_DLG_PREVIEW_STRING (SID_SVX_START+1090)
#define SID_RECHECK_DOCUMENT (SID_SVX_START+1091)
-#define SID_SVX_FIRSTFREE SID_RECHECK_DOCUMENT + 1
+#define SID_ATTR_PARA_OUTLINE_LEVEL (SID_SVX_START+1092)
+
+// IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
+#define SID_SVX_FIRSTFREE SID_ATTR_PARA_OUTLINE_LEVEL + 1
// --------------------------------------------------------------------------
// Overflow check for slot IDs
diff --git a/xmloff/inc/xmloff/styleexp.hxx b/xmloff/inc/xmloff/styleexp.hxx
index aef948760715..e18547c62688 100644
--- a/xmloff/inc/xmloff/styleexp.hxx
+++ b/xmloff/inc/xmloff/styleexp.hxx
@@ -50,6 +50,11 @@ namespace com { namespace sun { namespace star
{
class XPropertySet;
}
+ namespace container //#outline level,add by zhaojianwei
+ {
+ class XNameAccess;
+ } //<-end,zhaojianwei
+
} } }
class XMLPropertySetMapper;
@@ -65,6 +70,7 @@ protected:
const ::rtl::OUString sIsAutoUpdate;
const ::rtl::OUString sFollowStyle;
const ::rtl::OUString sNumberingStyleName;
+ const ::rtl::OUString sOutlineLevel; //#outline level,add by zhaojianwei
SvXMLExport& GetExport() { return rExport; }
const SvXMLExport& GetExport() const { return rExport; }
@@ -77,12 +83,19 @@ private:
protected:
- virtual sal_Bool exportStyle(
+ //virtual sal_Bool exportStyle( //#outline level,zhaojianwei
+ // const ::com::sun::star::uno::Reference<
+ // ::com::sun::star::style::XStyle > & rStyle,
+ // const ::rtl::OUString& rXMLFamily,
+ // const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ // const ::rtl::OUString* pPrefix = 0L );
+ virtual sal_Bool exportStyle( //add by zhaojianwei
const ::com::sun::star::uno::Reference<
- ::com::sun::star::style::XStyle > & rStyle,
+ ::com::sun::star::style::XStyle > & rStyle,
const ::rtl::OUString& rXMLFamily,
const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
- const ::rtl::OUString* pPrefix = 0L );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xStyles,
+ const ::rtl::OUString* pPrefix = 0L ); //<-end,zhaojianwei
virtual void exportStyleAttributes(
const ::com::sun::star::uno::Reference<
diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
index 536c6608ba57..fa81e97defeb 100644
--- a/xmloff/inc/xmloff/txtimp.hxx
+++ b/xmloff/inc/xmloff/txtimp.hxx
@@ -542,6 +542,7 @@ public:
// --> OD 2008-04-23 #refactorlists#
const ::rtl::OUString sPropNameDefaultListId;
const ::rtl::OUString sPropNameListId;
+ const ::rtl::OUString sOutlineLevel; //#outline level,add by zhaojianwei
// <--
::rtl::OUString sCellParaStyleDefault;
diff --git a/xmloff/inc/xmloff/txtstyli.hxx b/xmloff/inc/xmloff/txtstyli.hxx
index 14caa787669f..a81e677577a4 100644
--- a/xmloff/inc/xmloff/txtstyli.hxx
+++ b/xmloff/inc/xmloff/txtstyli.hxx
@@ -47,6 +47,8 @@ class XMLOFF_DLLPUBLIC XMLTextStyleContext : public XMLPropStyleContext
const ::rtl::OUString sIsAutoUpdate;
const ::rtl::OUString sCategory;
const ::rtl::OUString sNumberingStyleName;
+ const ::rtl::OUString sOutlineLevel; //#outline level,add by zhaojianwei
+
public:
const ::rtl::OUString sDropCapCharStyleName;
private:
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 6f5d0bc82468..f822239d3106 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 ) )
{
@@ -249,8 +275,49 @@ 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 802c721bc77c..30895a5edce6 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 bfb155353c22..5e2c6db87b45 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 );
@@ -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 6729ed0ccaac..3411a3e7f7c2 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 )
diff --git a/xmloff/source/text/txtstyle.cxx b/xmloff/source/text/txtstyle.cxx
index e82e514d1fe8..2321305deeda 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 4d940cc363ed..50185ed464bd 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() )