diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 41 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 10 |
3 files changed, 54 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index dd123d618267..5e98a98a45cc 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -780,6 +780,30 @@ SwXDocumentIndex::setPropertyValue( case WID_CREATE_FROM_PARAGRAPH_STYLES: lcl_AnyToBitMask(rValue, nCreate, SwTOXElement::Template); break; + case WID_CREATE_FROM_PARAGRAPH_STYLE: + { + OUString style; + if (rValue >>= style) + { + if (style.indexOf(TOX_STYLE_DELIMITER) != -1) + { + throw lang::IllegalArgumentException(); + } + lcl_AnyToBitMask(uno::Any(true), nCreate, SwTOXElement::Template); + OUString uiStyle; + SwStyleNameMapper::FillUIName(style, uiStyle, SwGetPoolIdFromName::TxtColl); + rTOXBase.SetStyleNames(uiStyle, 0); + } + else if (!rValue.hasValue()) + { + lcl_AnyToBitMask(uno::Any(false), nCreate, SwTOXElement::Template); + } + else + { + throw lang::IllegalArgumentException(); + } + } + break; case WID_PARA_LEV1: case WID_PARA_LEV2: @@ -1089,6 +1113,23 @@ SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName) case WID_CREATE_FROM_PARAGRAPH_STYLES: lcl_BitMaskToAny(aRet, nCreate, SwTOXElement::Template); break; + case WID_CREATE_FROM_PARAGRAPH_STYLE: + { + if (nCreate & SwTOXElement::Template) + { // there is only one style, at top level + OUString const& rStyle(pTOXBase->GetStyleNames(0)); + if (!rStyle.isEmpty()) + { + assert(rStyle.indexOf(TOX_STYLE_DELIMITER) == -1); + OUString ret; + SwStyleNameMapper::FillProgName(rStyle, ret, + SwGetPoolIdFromName::TxtColl); + aRet <<= ret; + } + } + } + break; + case WID_PARA_HEAD: { //Header is at position 0 diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 92f0d8aea861..f6765dadd4b9 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -443,6 +443,7 @@ o3tl::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetPropertyM BASE_INDEX_PROPERTIES_ { UNO_NAME_CREATE_FROM_CHAPTER, WID_CREATE_FROM_CHAPTER , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_CREATE_FROM_LABELS, WID_CREATE_FROM_LABELS , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CREATE_FROM_PARAGRAPH_STYLE, WID_CREATE_FROM_PARAGRAPH_STYLE, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, { UNO_NAME_IS_PROTECTED, WID_PROTECTED , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_LABEL_CATEGORY, WID_LABEL_CATEGORY , cppu::UnoType<OUString>::get() , PROPERTY_NONE, 0}, { UNO_NAME_LABEL_DISPLAY_TYPE, WID_LABEL_DISPLAY_TYPE , cppu::UnoType<sal_Int16>::get() , PROPERTY_NONE, 0}, @@ -475,6 +476,7 @@ o3tl::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetPropertyM { UNO_NAME_CREATE_FROM_STAR_CALC, WID_CREATE_FROM_STAR_CALC , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_CREATE_FROM_STAR_DRAW, WID_CREATE_FROM_STAR_DRAW , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS, WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CREATE_FROM_PARAGRAPH_STYLE, WID_CREATE_FROM_PARAGRAPH_STYLE, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, { UNO_NAME_TEXT_COLUMNS, RES_COL, cppu::UnoType<css::text::XTextColumns>::get(), PROPERTY_NONE, MID_COLUMNS}, { UNO_NAME_BACK_GRAPHIC_URL, RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, { UNO_NAME_BACK_GRAPHIC, RES_BACKGROUND, cppu::UnoType<graphic::XGraphic>::get(), PROPERTY_NONE, MID_GRAPHIC }, @@ -496,6 +498,7 @@ o3tl::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetPropertyM BASE_INDEX_PROPERTIES_ { UNO_NAME_CREATE_FROM_CHAPTER, WID_CREATE_FROM_CHAPTER , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_CREATE_FROM_LABELS, WID_CREATE_FROM_LABELS , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CREATE_FROM_PARAGRAPH_STYLE, WID_CREATE_FROM_PARAGRAPH_STYLE, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, { UNO_NAME_IS_PROTECTED, WID_PROTECTED , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_USE_ALPHABETICAL_SEPARATORS, WID_USE_ALPHABETICAL_SEPARATORS , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_LABEL_CATEGORY, WID_LABEL_CATEGORY , cppu::UnoType<OUString>::get() , PROPERTY_NONE, 0}, diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 49ffa1eb1a98..68fb57f4ce26 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2368,6 +2368,16 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) { sStr += "\\h "; } + if (pTOX->GetCreateType() & SwTOXElement::Template) + { + OUString const& rStyle(pTOX->GetStyleNames(0)); + assert(rStyle.indexOf(TOX_STYLE_DELIMITER) == -1); + SwTextFormatColl const*const pColl = GetExport().m_rDoc.FindTextFormatCollByName(rStyle); + if (pColl) + { + sStr += "\\t \"" + rStyle + sEntryEnd; + } + } break; case TOX_AUTHORITIES: |