summaryrefslogtreecommitdiff
path: root/xmloff/source/text/XMLSectionImportContext.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 09:16:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 10:15:29 +0200
commit04336ca32ea08f0c0c78125ea3b07689ee51acf2 (patch)
treedd63f28866185f0b04372cac41fa305d950ce8a3 /xmloff/source/text/XMLSectionImportContext.cxx
parentc525288fee6db8fde5a4ae3ffc22634fb6ea7805 (diff)
loplugin:flatten in xmloff/text
Change-Id: Iffadbe50a3b1e8263725b8f22395c5eaac11534d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100199 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/text/XMLSectionImportContext.cxx')
-rw-r--r--xmloff/source/text/XMLSectionImportContext.cxx166
1 files changed, 83 insertions, 83 deletions
diff --git a/xmloff/source/text/XMLSectionImportContext.cxx b/xmloff/source/text/XMLSectionImportContext.cxx
index a5c75a40e814..ee7d94426b16 100644
--- a/xmloff/source/text/XMLSectionImportContext.cxx
+++ b/xmloff/source/text/XMLSectionImportContext.cxx
@@ -121,108 +121,108 @@ void XMLSectionImportContext::StartElement(
rtl::Reference<XMLTextImportHelper> rHelper = GetImport().GetTextImport();
// valid?
- if (bValid)
- {
- // create text section (as XPropertySet)
- Reference<XMultiServiceFactory> xFactory(
- GetImport().GetModel(),UNO_QUERY);
- if (xFactory.is())
- {
- Reference<XInterface> xIfc =
- xFactory->createInstance( bIsIndexHeader ? OUString("com.sun.star.text.IndexHeaderSection")
- : OUString("com.sun.star.text.TextSection") );
- if (xIfc.is())
- {
- Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
+ if (!bValid)
+ return;
- // save PropertySet (for CreateChildContext)
- xSectionPropertySet = xPropSet;
+ // create text section (as XPropertySet)
+ Reference<XMultiServiceFactory> xFactory(
+ GetImport().GetModel(),UNO_QUERY);
+ if (!xFactory.is())
+ return;
- // name
- Reference<XNamed> xNamed(xPropSet, UNO_QUERY);
- xNamed->setName(sName);
+ Reference<XInterface> xIfc =
+ xFactory->createInstance( bIsIndexHeader ? OUString("com.sun.star.text.IndexHeaderSection")
+ : OUString("com.sun.star.text.TextSection") );
+ if (!xIfc.is())
+ return;
- // stylename?
- if (!sStyleName.isEmpty())
- {
- XMLPropStyleContext* pStyle = rHelper->
- FindSectionStyle(sStyleName);
+ Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY);
- if (pStyle != nullptr)
- {
- pStyle->FillPropertySet( xPropSet );
- }
- }
+ // save PropertySet (for CreateChildContext)
+ xSectionPropertySet = xPropSet;
- // IsVisible and condition (not for index headers)
- if (! bIsIndexHeader)
- {
- xPropSet->setPropertyValue( "IsVisible", Any(bIsVisible) );
+ // name
+ Reference<XNamed> xNamed(xPropSet, UNO_QUERY);
+ xNamed->setName(sName);
- // #97450# hidden sections must be hidden on reload
- // For backwards compatibility, set flag only if it is
- // present
- if( bIsCurrentlyVisibleOK )
- {
- xPropSet->setPropertyValue( "IsCurrentlyVisible", Any(bIsCurrentlyVisible));
- }
+ // stylename?
+ if (!sStyleName.isEmpty())
+ {
+ XMLPropStyleContext* pStyle = rHelper->
+ FindSectionStyle(sStyleName);
- if (bCondOK)
- {
- xPropSet->setPropertyValue( "Condition", Any(sCond) );
- }
- }
+ if (pStyle != nullptr)
+ {
+ pStyle->FillPropertySet( xPropSet );
+ }
+ }
- // password (only for regular sections)
- if ( bSequenceOK &&
- IsXMLToken(GetLocalName(), XML_SECTION) )
- {
- xPropSet->setPropertyValue("ProtectionKey", Any(aSequence));
- }
+ // IsVisible and condition (not for index headers)
+ if (! bIsIndexHeader)
+ {
+ xPropSet->setPropertyValue( "IsVisible", Any(bIsVisible) );
- // protection
- xPropSet->setPropertyValue( "IsProtected", Any(bProtect) );
+ // #97450# hidden sections must be hidden on reload
+ // For backwards compatibility, set flag only if it is
+ // present
+ if( bIsCurrentlyVisibleOK )
+ {
+ xPropSet->setPropertyValue( "IsCurrentlyVisible", Any(bIsCurrentlyVisible));
+ }
+
+ if (bCondOK)
+ {
+ xPropSet->setPropertyValue( "Condition", Any(sCond) );
+ }
+ }
- // insert marker, <paragraph>, marker; then insert
- // section over the first marker character, and delete the
- // last paragraph (and marker) when closing a section.
- Reference<XTextRange> xStart =
- rHelper->GetCursor()->getStart();
+ // password (only for regular sections)
+ if ( bSequenceOK &&
+ IsXMLToken(GetLocalName(), XML_SECTION) )
+ {
+ xPropSet->setPropertyValue("ProtectionKey", Any(aSequence));
+ }
+
+ // protection
+ xPropSet->setPropertyValue( "IsProtected", Any(bProtect) );
+
+ // insert marker, <paragraph>, marker; then insert
+ // section over the first marker character, and delete the
+ // last paragraph (and marker) when closing a section.
+ Reference<XTextRange> xStart =
+ rHelper->GetCursor()->getStart();
#ifndef DBG_UTIL
- OUString sMarkerString(" ");
+ OUString sMarkerString(" ");
#else
- OUString sMarkerString("X");
+ OUString sMarkerString("X");
#endif
- rHelper->InsertString(sMarkerString);
- rHelper->InsertControlCharacter(
- ControlCharacter::APPEND_PARAGRAPH );
- rHelper->InsertString(sMarkerString);
+ rHelper->InsertString(sMarkerString);
+ rHelper->InsertControlCharacter(
+ ControlCharacter::APPEND_PARAGRAPH );
+ rHelper->InsertString(sMarkerString);
- // select first marker
- rHelper->GetCursor()->gotoRange(xStart, false);
- rHelper->GetCursor()->goRight(1, true);
+ // select first marker
+ rHelper->GetCursor()->gotoRange(xStart, false);
+ rHelper->GetCursor()->goRight(1, true);
- // convert section to XTextContent
- Reference<XTextContent> xTextContent(xSectionPropertySet,
- UNO_QUERY);
+ // convert section to XTextContent
+ Reference<XTextContent> xTextContent(xSectionPropertySet,
+ UNO_QUERY);
- // and insert (over marker)
- rHelper->GetText()->insertTextContent(
- rHelper->GetCursorAsRange(), xTextContent, true );
+ // and insert (over marker)
+ rHelper->GetText()->insertTextContent(
+ rHelper->GetCursorAsRange(), xTextContent, true );
- // and delete first marker (in section)
- rHelper->GetText()->insertString(
- rHelper->GetCursorAsRange(), "", true);
+ // and delete first marker (in section)
+ rHelper->GetText()->insertString(
+ rHelper->GetCursorAsRange(), "", true);
- // finally, check for redlines that should start at
- // the section start node
- rHelper->RedlineAdjustStartNodeCursor(); // start ???
+ // finally, check for redlines that should start at
+ // the section start node
+ rHelper->RedlineAdjustStartNodeCursor(); // start ???
- // xml:id for RDF metadata
- GetImport().SetXmlId(xIfc, sXmlId);
- }
- }
- }
+ // xml:id for RDF metadata
+ GetImport().SetXmlId(xIfc, sXmlId);
}
void XMLSectionImportContext::ProcessAttributes(