summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2009-03-14 16:18:16 +0000
committerVladimir Glazounov <vg@openoffice.org>2009-03-14 16:18:16 +0000
commit95eaad0223d5e2215f7c8320e1d395d33aa58cba (patch)
treed582527c3eadc9aa2e0f5d27e9c299e6468d5907 /sw
parent2a3f90ee458de956e3ab6b097e3b40390ac99ef9 (diff)
CWS-TOOLING: integrate CWS sw31bf05
2009-02-04 10:10:51 +0100 od r267352 : #i98791# for method <SwWW8ImplReader::SetOutLineStyles()> - adjust paragraph style sorting algorithm due to introduced outline level attribute
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx34
-rw-r--r--sw/source/filter/ww8/writerhelper.hxx15
-rw-r--r--sw/source/filter/ww8/ww8par.cxx6
3 files changed, 42 insertions, 13 deletions
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 2495bfbf59..b92aba9b21 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -98,17 +98,39 @@ namespace
return res;
}
- //Utility to sort SwTxtFmtColl's by their outline numbering level
+ // --> OD 2009-02-04 #i98791# - adjust sorting
+ //Utility to sort SwTxtFmtColl's by their assigned outline style list level
class outlinecmp : public
std::binary_function<const SwTxtFmtColl*, const SwTxtFmtColl*, bool>
{
public:
bool operator()(const SwTxtFmtColl *pA, const SwTxtFmtColl *pB) const
{
- //return pA->GetOutlineLevel() < pB->GetOutlineLevel(); //#outline level,zhaojianwei
- return pA->GetAttrOutlineLevel() < pB->GetAttrOutlineLevel(); //<-end,zhaojianwei
+ // --> OD 2009-02-04 #i98791#
+// return pA->GetAttrOutlineLevel() < pB->GetAttrOutlineLevel(); //<-end,zhaojianwei
+ bool bResult( false );
+ const bool bIsAAssignedToOutlineStyle( pA->IsAssignedToListLevelOfOutlineStyle() );
+ const bool bIsBAssignedToOutlineStyle( pB->IsAssignedToListLevelOfOutlineStyle() );
+ if ( bIsAAssignedToOutlineStyle != bIsBAssignedToOutlineStyle )
+ {
+ bResult = bIsBAssignedToOutlineStyle;
+ }
+ else if ( !bIsAAssignedToOutlineStyle )
+ {
+ // pA and pB are equal regarding the sorting criteria.
+ // Thus return value does not matter.
+ bResult = false;
+ }
+ else
+ {
+ bResult = pA->GetAssignedOutlineStyleLevel() < pB->GetAssignedOutlineStyleLevel();
+ }
+
+ return bResult;
+ // <--
}
};
+ // <--
bool IsValidSlotWhich(USHORT nSlotId, USHORT nWhichId)
{
@@ -554,10 +576,12 @@ namespace sw
return pFmt;
}
- void SortByOutline(ParaStyles &rStyles)
+ // --> OD 2009-02-04 #i98791# - adjust sorting algorithm
+ void SortByAssignedOutlineStyleListLevel(ParaStyles &rStyles)
{
std::sort(rStyles.begin(), rStyles.end(), outlinecmp());
}
+ // <--
Frames GetAllFrames(const SwDoc &rDoc, SwPaM *pPaM)
{
diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx
index cce7e4527e..5add6ccec7 100644
--- a/sw/source/filter/ww8/writerhelper.hxx
+++ b/sw/source/filter/ww8/writerhelper.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -560,11 +560,14 @@ namespace sw
*/
SwCharFmt* GetCharStyle(SwDoc &rDoc, const String& rName);
- /** Sort sequence of Paragraph Styles by outline numbering level
+ /** Sort sequence of Paragraph Styles by assigned outline style list level
+
+ Sort ParaStyles in ascending order of assigned outline style list level,
+ e.g. given Normal/Heading1/Heading2/.../Heading10 at their default
+ assigned outline style list levels of body level/level 1/level 2/.../level 10
- Sort ParaStyles in ascending order of outline level, e.g. given
- Normal/Heading2/Heading1 at their default outline levels of body
- level/level 2/level 1 sorts them to Heading1/Heading2/Normal
+ OD 2009-02-04 #i98791#
+ adjust the sorting algorithm due to introduced outline level attribute
@param rStyles
The ParaStyles to sort
@@ -572,7 +575,7 @@ namespace sw
@author
<a href="mailto:cmc@openoffice.org">Caol&aacute;n McNamara</a>
*/
- void SortByOutline(ParaStyles &rStyles);
+ void SortByAssignedOutlineStyleListLevel(ParaStyles &rStyles);
/** Get the SfxPoolItems of a SfxItemSet
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 95b9fea92c..9f3434faeb 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1886,7 +1886,7 @@ void SwWW8ImplReader::AppendTxtNode(SwPosition& rPos)
SwTxtNode* pTxt = pPaM->GetNode()->GetTxtNode();
const SwNumRule* pRule = NULL;
-
+
if (pTxt != NULL)
pRule = sw::util::GetNumRuleFromTxtNode(*pTxt);
@@ -4391,7 +4391,9 @@ void SwWW8ImplReader::SetOutLineStyles()
// <--
sw::ParaStyles aOutLined(sw::util::GetParaStyles(rDoc));
- sw::util::SortByOutline(aOutLined);
+ // --> OD 2009-02-04 #i98791# - sorting algorithm adjusted
+ sw::util::SortByAssignedOutlineStyleListLevel(aOutLined);
+ // <--
typedef sw::ParaStyleIter myParaStyleIter;
/*