summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-07-27 21:34:57 -0800
committerMike Kaganski <mike.kaganski@collabora.com>2020-07-30 12:05:20 +0200
commit1c080b887c1ef28cb2e98173d0121bcae3167075 (patch)
treec352bea7101e38691df140ff707e88e484ab776c /xmloff
parentdce97e84f2bb748e4403841593bb7b0b92ea44c4 (diff)
tdf#38093 Writer outline folding - persistence
Patch 6/6 that breaks down https://gerrit.libreoffice.org/c/core/+/96672 Adds persistence attribute loext:outline-content-visible Change-Id: Ide3eeee0f127a05def4d4f493bb4b469e0877b00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99657 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmltoken.cxx1
-rw-r--r--xmloff/source/text/txtimp.cxx15
-rw-r--r--xmloff/source/text/txtparae.cxx31
-rw-r--r--xmloff/source/text/txtparai.cxx11
-rw-r--r--xmloff/source/text/txtparai.hxx1
-rw-r--r--xmloff/source/token/tokens.txt1
6 files changed, 56 insertions, 4 deletions
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 7773ac8ebcc6..5f02d4a94b07 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1392,6 +1392,7 @@ namespace xmloff::token {
TOKEN( "orientation-portrait", XML_ORIENTATION_PORTRAIT ),
TOKEN( "origin", XML_ORIGIN ),
TOKEN( "orphans", XML_ORPHANS ),
+ TOKEN( "outline-content-visible", XML_OUTLINE_CONTENT_VISIBLE ),
TOKEN( "outline-level", XML_OUTLINE_LEVEL ),
TOKEN( "outline-level-style", XML_OUTLINE_LEVEL_STYLE ),
TOKEN( "outline-style", XML_OUTLINE_STYLE ),
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index b1b6dedaf9d5..d047942752e3 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -314,6 +314,7 @@ const SvXMLTokenMapEntry aTextPAttrTokenMap[] =
{ XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_P_STYLE_NAME },
{ XML_NAMESPACE_TEXT, XML_COND_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME },
+ { XML_NAMESPACE_LO_EXT, XML_OUTLINE_CONTENT_VISIBLE, XML_TOK_TEXT_P_OUTLINE_CONTENT_VISIBLE },
{ XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL,XML_TOK_TEXT_P_LEVEL },
{ XML_NAMESPACE_TEXT, XML_IS_LIST_HEADER,XML_TOK_TEXT_P_IS_LIST_HEADER },
{ XML_NAMESPACE_TEXT, XML_RESTART_NUMBERING,XML_TOK_TEXT_P_RESTART_NUMBERING },
@@ -1510,7 +1511,8 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
bool bOutlineLevelAttrFound,
sal_Int8 nOutlineLevel,
// Numberings/Bullets in table not visible after save/reload (#i80724#)
- bool bSetListAttrs )
+ bool bSetListAttrs,
+ bool bOutlineContentVisible)
{
static const char s_NumberingRules[] = "NumberingRules";
static const char s_NumberingIsNumber[] = "NumberingIsNumber";
@@ -1865,7 +1867,16 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
makeAny( static_cast<sal_Int16>(nOutlineLevel) ) );
}
}
-
+ if (!bOutlineContentVisible)
+ {
+ uno::Sequence<beans::PropertyValue> aGrabBag;
+ xPropSet->getPropertyValue("ParaInteropGrabBag") >>= aGrabBag;
+ sal_Int32 length = aGrabBag.getLength();
+ aGrabBag.realloc(length + 1);
+ aGrabBag[length].Name = "OutlineContentVisibleAttr";
+ aGrabBag[length].Value <<= bool(bOutlineContentVisible);
+ xPropSet->setPropertyValue("ParaInteropGrabBag", uno::makeAny(aGrabBag));
+ }
// RFE: inserting headings into text documents (#i70748#)
if ( bApplyOutlineLevelAsListLevel )
{
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 75082493dfd8..4e85452b174d 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -374,6 +374,7 @@ static const char* aParagraphPropertyNames[] =
"ParaConditionalStyleName",
"ParaStyleName",
"TextSection",
+ "OutlineContentVisible",
nullptr
};
@@ -386,7 +387,8 @@ enum eParagraphPropertyNamesEnum
PARA_OUTLINE_LEVEL=2,
PARA_CONDITIONAL_STYLE_NAME = 3,
PARA_STYLE_NAME = 4,
- TEXT_SECTION = 5
+ TEXT_SECTION = 5,
+ PARA_OUTLINE_CONTENT_VISIBLE = 6
};
}
@@ -1987,6 +1989,33 @@ void XMLTextParagraphExport::exportParagraph(
XML_OUTLINE_LEVEL,
OUString::number( sal_Int32( nOutlineLevel) ) );
+ if ( rPropSetHelper.hasProperty( PARA_OUTLINE_CONTENT_VISIBLE ) )
+ {
+ uno::Sequence<beans::PropertyValue> propList;
+ bool bIsOutlineContentVisible = true;
+ if( xMultiPropSet.is() )
+ rPropSetHelper.getValue(
+ PARA_OUTLINE_CONTENT_VISIBLE, xMultiPropSet ) >>= propList;
+ else
+ rPropSetHelper.getValue(
+ PARA_OUTLINE_CONTENT_VISIBLE, xPropSet ) >>= propList;
+ for (const auto& rProp : std::as_const(propList))
+ {
+ OUString propName = rProp.Name;
+ if (propName == "OutlineContentVisibleAttr")
+ {
+ rProp.Value >>= bIsOutlineContentVisible;
+ break;
+ }
+ }
+ if (!bIsOutlineContentVisible)
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_LO_EXT,
+ XML_OUTLINE_CONTENT_VISIBLE,
+ XML_FALSE);
+ }
+ }
+
if( rPropSetHelper.hasProperty( NUMBERING_IS_NUMBER ) )
{
bool bIsNumber = false;
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 618cd85bf5bf..4f351d1b0787 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1870,6 +1870,7 @@ XMLParaContext::XMLParaContext(
nOutlineLevel( IsXMLToken( rLName, XML_H ) ? 1 : -1 ),
// Lost outline numbering in master document (#i73509#)
mbOutlineLevelAttrFound( false ),
+ mbOutlineContentVisible(true),
bIgnoreLeadingSpace( true ),
bHeading( bHead ),
bIsListHeader( false ),
@@ -1934,6 +1935,12 @@ XMLParaContext::XMLParaContext(
mbOutlineLevelAttrFound = true;
}
break;
+ case XML_TOK_TEXT_P_OUTLINE_CONTENT_VISIBLE:
+ {
+ mbOutlineContentVisible = true;
+ ::sax::Converter::convertBool(mbOutlineContentVisible, rValue);
+ }
+ break;
case XML_TOK_TEXT_P_IS_LIST_HEADER:
{
bool bBool(false);
@@ -2056,7 +2063,9 @@ void XMLParaContext::EndElement()
sStyleName,
true,
mbOutlineLevelAttrFound,
- bHeading ? nOutlineLevel : -1 );
+ bHeading ? nOutlineLevel : -1,
+ true,
+ mbOutlineContentVisible);
// handle list style header
if (bHeading && (bIsListHeader || bIsRestart))
diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
index 3b4a61a1c89d..e047a63e82d0 100644
--- a/xmloff/source/text/txtparai.hxx
+++ b/xmloff/source/text/txtparai.hxx
@@ -48,6 +48,7 @@ class XMLParaContext : public SvXMLImportContext
std::unique_ptr<XMLHints_Impl> m_xHints;
// Lost outline numbering in master document (#i73509#)
bool mbOutlineLevelAttrFound;
+ bool mbOutlineContentVisible;
bool bIgnoreLeadingSpace;
bool bHeading;
bool bIsListHeader;
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 0c67e23c3b50..d51a77608dc4 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -1302,6 +1302,7 @@ orientation-landscape
orientation-portrait
origin
orphans
+outline-content-visible
outline-level
outline-level-style
outline-style