summaryrefslogtreecommitdiff
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
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>
-rw-r--r--include/xmloff/txtimp.hxx4
-rw-r--r--include/xmloff/xmltoken.hxx1
-rw-r--r--schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng9
-rw-r--r--sw/inc/unoprnms.hxx1
-rw-r--r--sw/source/core/unocore/unomap1.cxx1
-rw-r--r--sw/source/core/unocore/unomapproperties.hxx3
-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
12 files changed, 73 insertions, 6 deletions
diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index 603aa599ab1c..96edbbee0dba 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -245,6 +245,7 @@ enum XMLTextPAttrTokens
XML_TOK_TEXT_P_TEXTID,
XML_TOK_TEXT_P_STYLE_NAME,
XML_TOK_TEXT_P_COND_STYLE_NAME,
+ XML_TOK_TEXT_P_OUTLINE_CONTENT_VISIBLE,
XML_TOK_TEXT_P_LEVEL,
XML_TOK_TEXT_P_IS_LIST_HEADER,
XML_TOK_TEXT_P_RESTART_NUMBERING,
@@ -457,7 +458,8 @@ public:
bool bPara,
bool bOutlineLevelAttrFound = false,
sal_Int8 nOutlineLevel = -1,
- bool bSetListAttrs = true );
+ bool bSetListAttrs = true,
+ bool bOutlineContentVisible = true);
/** Find a suitable name for the given outline level.
* If rStyleName is empty, change it to a previously used or default style
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 83c0f8bf3193..3f3a4f62d8ed 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1386,6 +1386,7 @@ namespace xmloff::token {
XML_ORIENTATION_PORTRAIT,
XML_ORIGIN,
XML_ORPHANS,
+ XML_OUTLINE_CONTENT_VISIBLE,
XML_OUTLINE_LEVEL,
XML_OUTLINE_LEVEL_STYLE,
XML_OUTLINE_STYLE,
diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index bd66081734c1..51d905c88b13 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2359,4 +2359,13 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
</rng:optional>
</rng:define>
+ <!-- TODO no proposal -->
+ <rng:define name="text-index-entry-chapter-attrs" combine="interleave">
+ <rng:optional>
+ <rng:attribute name="loext:outline-content-visible">
+ <rng:ref name="boolean"/>
+ </rng:attribute>
+ </rng:optional>
+ </rng:define>
+
</rng:grammar>
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 1f79400bb28a..afea9bc0af50 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -803,6 +803,7 @@
#define UNO_NAME_CHAR_OVERLINE "CharOverline"
#define UNO_NAME_CHAR_OVERLINE_COLOR "CharOverlineColor"
#define UNO_NAME_CHAR_OVERLINE_HAS_COLOR "CharOverlineHasColor"
+#define UNO_NAME_OUTLINE_CONTENT_VISIBLE "OutlineContentVisible"
#define UNO_NAME_OUTLINE_LEVEL "OutlineLevel"
#define UNO_NAME_DESCRIPTION "Description"
#define UNO_NAME_META "InContentMetadata"
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 909f183bb288..3f8358898fad 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -163,6 +163,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetAutoParaStyleProper
{ OUString(UNO_NAME_PARA_IS_NUMBERING_RESTART), FN_NUMBER_NEWSTART, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, 0 },
// TODO add RES_PARATR_LIST_AUTOFMT?
{ OUString(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, 0},
+ { OUString(UNO_NAME_OUTLINE_CONTENT_VISIBLE), RES_PARATR_GRABBAG, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, 0 },
COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN
TABSTOPS_MAP_ENTRY
COMMON_TEXT_CONTENT_PROPERTIES
diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx
index 0b211f392b67..fe53cc5d4391 100644
--- a/sw/source/core/unocore/unomapproperties.hxx
+++ b/sw/source/core/unocore/unomapproperties.hxx
@@ -96,7 +96,8 @@
{ OUString(UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE), FN_UNO_PARA_CONT_PREV_SUBTREE, cppu::UnoType<bool>::get(), PropertyAttribute::READONLY, 0 }, \
{ OUString(UNO_NAME_PARA_LIST_LABEL_STRING), FN_UNO_PARA_NUM_STRING, cppu::UnoType<OUString>::get(), PropertyAttribute::READONLY, 0 }, \
{ OUString(UNO_NAME_PARA_LIST_AUTO_FORMAT), FN_UNO_PARA_NUM_AUTO_FORMAT, cppu::UnoType<cppu::UnoSequenceType<css::beans::NamedValue>>::get(), PropertyAttribute::MAYBEVOID, 0 }, \
- { OUString(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, 0},
+ { OUString(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL, cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, 0}, \
+ { OUString(UNO_NAME_OUTLINE_CONTENT_VISIBLE), RES_PARATR_GRABBAG, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, 0 },
#define COMMON_HYPERLINK_PROPERTIES \
{ OUString(UNO_NAME_HYPER_LINK_U_R_L), RES_TXTATR_INETFMT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID ,MID_URL_URL}, \
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