Kaydet (Commit) f208e711 authored tarafından Daniel Vogelheim's avatar Daniel Vogelheim

fixed: export section style only for first paragraph in section

üst b019d473
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: txtsecte.cxx,v $ * $RCSfile: txtsecte.cxx,v $
* *
* $Revision: 1.9 $ * $Revision: 1.10 $
* *
* last change: $Author: dvo $ $Date: 2001-02-13 16:55:00 $ * last change: $Author: dvo $ $Date: 2001-05-14 13:03:17 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -223,113 +223,104 @@ void XMLTextParagraphExport::exportListAndSectionChange( ...@@ -223,113 +223,104 @@ void XMLTextParagraphExport::exportListAndSectionChange(
const XMLTextNumRuleInfo& rNextRule, const XMLTextNumRuleInfo& rNextRule,
sal_Bool bAutoStyles) sal_Bool bAutoStyles)
{ {
if ( bAutoStyles ) // old != new? -> maybe we have to start or end a new section
if (rPrevSection != rNextSection)
{ {
if ( rNextSection.is() ) // a new section started, or an old one gets closed!
{
pSectionExport->ExportSectionStart( rNextSection, bAutoStyles );
}
}
else
{
// old != new? -> start/equal?
if (rPrevSection != rNextSection)
{
// a new section started, or an old one gets closed!
// close old list // close old list
XMLTextNumRuleInfo aEmptyNumRule; XMLTextNumRuleInfo aEmptyNumRule;
if ( !bAutoStyles )
exportListChange(rPrevRule, aEmptyNumRule); exportListChange(rPrevRule, aEmptyNumRule);
// Build stacks of old and new sections // Build stacks of old and new sections
// Sections on top of mute sections should not be on the stack // Sections on top of mute sections should not be on the stack
vector<Reference<XTextSection> > aOldStack; vector<Reference<XTextSection> > aOldStack;
Reference<XTextSection> aCurrent = rPrevSection; Reference<XTextSection> aCurrent = rPrevSection;
while(aCurrent.is()) while(aCurrent.is())
{ {
// if we have a mute section, ignore all its children // if we have a mute section, ignore all its children
// (all previous ones) // (all previous ones)
if (pSectionExport->IsMuteSection(aCurrent)) if (pSectionExport->IsMuteSection(aCurrent))
aOldStack.clear(); aOldStack.clear();
aOldStack.push_back(aCurrent); aOldStack.push_back(aCurrent);
aCurrent = aCurrent->getParentSection(); aCurrent = aCurrent->getParentSection();
} }
vector<Reference<XTextSection> > aNewStack; vector<Reference<XTextSection> > aNewStack;
aCurrent = rNextSection; aCurrent = rNextSection;
while(aCurrent.is()) while(aCurrent.is())
{ {
// if we have a mute section, ignore all its children // if we have a mute section, ignore all its children
// (all previous ones) // (all previous ones)
if (pSectionExport->IsMuteSection(aCurrent)) if (pSectionExport->IsMuteSection(aCurrent))
aNewStack.clear(); aNewStack.clear();
aNewStack.push_back(aCurrent); aNewStack.push_back(aCurrent);
aCurrent = aCurrent->getParentSection(); aCurrent = aCurrent->getParentSection();
} }
// compare the two stacks // compare the two stacks
vector<Reference<XTextSection> > ::reverse_iterator aOld = vector<Reference<XTextSection> > ::reverse_iterator aOld =
aOldStack.rbegin(); aOldStack.rbegin();
vector<Reference<XTextSection> > ::reverse_iterator aNew = vector<Reference<XTextSection> > ::reverse_iterator aNew =
aNewStack.rbegin(); aNewStack.rbegin();
// compare bottom sections and skip equal section // compare bottom sections and skip equal section
while ( (aOld != aOldStack.rend()) && while ( (aOld != aOldStack.rend()) &&
(aNew != aNewStack.rend()) && (aNew != aNewStack.rend()) &&
(*aOld) == (*aNew) ) (*aOld) == (*aNew) )
{ {
aOld++; aOld++;
aNew++; aNew++;
} }
// close all elements of aOld ... // close all elements of aOld ...
// (order: newest to oldest) // (order: newest to oldest)
if (aOld != aOldStack.rend()) if (aOld != aOldStack.rend())
{
vector<Reference<XTextSection> > ::iterator aOldForward =
aOldStack.begin();
while ((aOldForward != aOldStack.end()) &&
(*aOldForward != *aOld))
{ {
vector<Reference<XTextSection> > ::iterator aOldForward = if (NULL != pRedlineExport)
aOldStack.begin(); pRedlineExport->ExportStartOrEndRedline(*aOldForward,
while ((aOldForward != aOldStack.end()) &&
(*aOldForward != *aOld))
{
if (NULL != pRedlineExport)
pRedlineExport->ExportStartOrEndRedline(*aOldForward,
sal_False);
pSectionExport->ExportSectionEnd(*aOldForward,
bAutoStyles);
aOldForward++;
}
if (aOldForward != aOldStack.end())
{
if (NULL != pRedlineExport)
pRedlineExport->ExportStartOrEndRedline(*aOldForward,
sal_False); sal_False);
pSectionExport->ExportSectionEnd(*aOldForward, pSectionExport->ExportSectionEnd(*aOldForward, bAutoStyles);
bAutoStyles); aOldForward++;
}
} }
if (aOldForward != aOldStack.end())
// ...then open all of aNew
// (order: oldest to newest)
while (aNew != aNewStack.rend())
{ {
if (NULL != pRedlineExport) if (NULL != pRedlineExport)
pRedlineExport->ExportStartOrEndRedline(*aNew, sal_True); pRedlineExport->ExportStartOrEndRedline(*aOldForward,
pSectionExport->ExportSectionStart(*aNew, bAutoStyles); sal_False);
aNew++; pSectionExport->ExportSectionEnd(*aOldForward, bAutoStyles);
} }
// start new list
exportListChange(aEmptyNumRule, rNextRule);
} }
else
// ...then open all of aNew
// (order: oldest to newest)
while (aNew != aNewStack.rend())
{ {
// list change, if sections have not changed if (NULL != pRedlineExport)
exportListChange(rPrevRule, rNextRule); pRedlineExport->ExportStartOrEndRedline(*aNew, sal_True);
pSectionExport->ExportSectionStart(*aNew, bAutoStyles);
aNew++;
} }
// start new list
if ( !bAutoStyles )
exportListChange(aEmptyNumRule, rNextRule);
}
else
{
// list change, if sections have not changed
if ( !bAutoStyles )
exportListChange(rPrevRule, rNextRule);
} }
// save old section (old numRule gets saved in calling method // save old section (old numRule gets saved in calling method)
rPrevSection = rNextSection; rPrevSection = rNextSection;
} }
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