Bugzilla – Attachment 133859 Details for
Bug 103091
An applied conditional paragraph style looses feature on opening
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for master branch
lo-conditional-styles.diff (text/plain), 7.75 KB, created by
Troy Rollo
on 2017-06-05 09:31:17 UTC
(
hide
)
Description:
Patch for master branch
Filename:
MIME Type:
Creator:
Troy Rollo
Created:
2017-06-05 09:31:17 UTC
Size:
7.75 KB
patch
obsolete
>diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx >index f9d3a06acbf2..2cce53ca24b6 100644 >--- a/sw/source/core/unocore/unostyle.cxx >+++ b/sw/source/core/unocore/unostyle.cxx >@@ -1997,7 +1997,8 @@ void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNa > { > if(!m_pDoc) > throw uno::RuntimeException(); >- const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(m_rEntry.m_nPropMapType); >+ sal_Int8 nPropSetId = m_bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : m_rEntry.m_nPropMapType; >+ const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); > const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); > if(rPropertyNames.getLength() != rValues.getLength()) > throw lang::IllegalArgumentException(); >diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx >index 685e7bc1dd75..5df8d0b5dc24 100644 >--- a/sw/source/filter/xml/xmlfmt.cxx >+++ b/sw/source/filter/xml/xmlfmt.cxx >@@ -31,6 +31,7 @@ > #include "docary.hxx" > #include <IDocumentStylePoolAccess.hxx> > #include "unostyle.hxx" >+#include "unoprnms.hxx" > #include "fmtpdsc.hxx" > #include "pagedesc.hxx" > #include <xmloff/xmlnmspe.hxx> >@@ -44,6 +45,7 @@ > #include <xmloff/XMLTextMasterStylesContext.hxx> > #include <xmloff/XMLTextShapeStyleContext.hxx> > #include <xmloff/XMLGraphicsDefaultStyle.hxx> >+#include <com/sun/star/beans/XPropertySet.hpp> > #include "xmlimp.hxx" > #include "xmltbli.hxx" > #include "cellatr.hxx" >@@ -51,10 +53,13 @@ > #include <xmloff/attrlist.hxx> > #include <unotxdoc.hxx> > #include <docsh.hxx> >+#include <ccoll.hxx> > > #include <memory> > > using namespace ::com::sun::star; >+using namespace ::com::sun::star::beans; >+using namespace ::com::sun::star::uno; > using namespace ::xmloff::token; > > class SwXMLConditionParser_Impl >@@ -205,6 +210,10 @@ public: > const uno::Reference< xml::sax::XAttributeList > & xAttrList ); > > bool IsValid() const { return Master_CollCondition::NONE != nCondition; } >+ >+ Master_CollCondition getCondition() const { return nCondition; } >+ sal_uInt32 getSubCondition() const { return nSubCondition; } >+ OUString const &getApplyStyle() const { return sApplyStyle; } > }; > > SwXMLConditionContext_Impl::SwXMLConditionContext_Impl( >@@ -250,10 +259,12 @@ typedef std::vector<rtl::Reference<SwXMLConditionContext_Impl>> SwXMLConditions_ > class SwXMLTextStyleContext_Impl : public XMLTextStyleContext > { > std::unique_ptr<SwXMLConditions_Impl> pConditions; >+ uno::Reference < style::XStyle > xNewStyle; > > protected: > > virtual uno::Reference < style::XStyle > Create() override; >+ virtual void Finish( bool bOverwrite ); > > public: > >@@ -273,7 +284,6 @@ public: > > uno::Reference < style::XStyle > SwXMLTextStyleContext_Impl::Create() > { >- uno::Reference < style::XStyle > xNewStyle; > > if( pConditions && XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() ) > { >@@ -295,6 +305,46 @@ uno::Reference < style::XStyle > SwXMLTextStyleContext_Impl::Create() > return xNewStyle; > } > >+void >+SwXMLTextStyleContext_Impl::Finish( bool bOverwrite ) >+{ >+ >+ if( pConditions && XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily() && xNewStyle.is() ) >+ { >+ CommandStruct const *aCommands = SwCondCollItem::GetCmds(); >+ >+ Reference< XPropertySet > xPropSet( xNewStyle, UNO_QUERY ); >+ >+ uno::Sequence< beans::NamedValue > aSeq( pConditions->size() ); >+ >+ unsigned i; >+ unsigned j; >+ >+ for( i = 0; i < pConditions->size(); ++i ) >+ { >+ if( (*pConditions)[i]->IsValid() ) >+ { >+ Master_CollCondition nCond = (*pConditions)[i]->getCondition(); >+ sal_uInt32 nSubCond = (*pConditions)[i]->getSubCondition(); >+ >+ for( j = 0; j < COND_COMMAND_COUNT; ++j ) >+ { >+ if( aCommands[j].nCnd == nCond && >+ aCommands[j].nSubCond == nSubCond ) >+ { >+ aSeq[i].Name = GetCommandContextByIndex( j ); >+ aSeq[i].Value = uno::makeAny( GetImport().GetStyleDisplayName( GetFamily(), (*pConditions)[i]->getApplyStyle() ) ); >+ break; >+ } >+ } >+ } >+ } >+ >+ xPropSet->setPropertyValue( UNO_NAME_PARA_STYLE_CONDITIONS, uno::makeAny( aSeq ) ); >+ } >+ XMLTextStyleContext::Finish( bOverwrite ); >+} >+ > SwXMLTextStyleContext_Impl::SwXMLTextStyleContext_Impl( SwXMLImport& rImport, > sal_uInt16 nPrfx, const OUString& rLName, > const uno::Reference< xml::sax::XAttributeList > & xAttrList, >diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk >index 1978f396c8a6..0f2156ce2364 100644 >--- a/xmloff/Library_xo.mk >+++ b/xmloff/Library_xo.mk >@@ -252,6 +252,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\ > xmloff/source/style/postuhdl \ > xmloff/source/style/prhdlfac \ > xmloff/source/style/prstylei \ >+ xmloff/source/style/prstylecond \ > xmloff/source/style/shadwhdl \ > xmloff/source/style/shdwdhdl \ > xmloff/source/style/styleexp \ >diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx >index 8cb43a1decef..a0f51dbf8812 100644 >--- a/xmloff/source/style/styleexp.cxx >+++ b/xmloff/source/style/styleexp.cxx >@@ -33,6 +33,7 @@ > #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> > #include <com/sun/star/style/XStyle.hpp> > #include <com/sun/star/container/XNameContainer.hpp> >+#include <com/sun/star/beans/NamedValue.hpp> > #include <com/sun/star/beans/XPropertySet.hpp> > #include <com/sun/star/beans/XPropertyState.hpp> > #include <com/sun/star/document/XEventsSupplier.hpp> >@@ -44,6 +45,7 @@ > #include <xmloff/maptype.hxx> > #include <memory> > #include <set> >+#include "prstylecond.hxx" > > using namespace ::com::sun::star; > using namespace ::com::sun::star::uno; >@@ -76,8 +78,54 @@ void XMLStyleExport::exportStyleAttributes( const Reference< XStyle >& ) > { > } > >-void XMLStyleExport::exportStyleContent( const Reference< XStyle >& ) >+void XMLStyleExport::exportStyleContent( const Reference< XStyle >& rStyle ) > { >+ Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY ); >+ >+ try >+ { >+ uno::Any aProperty = xPropSet->getPropertyValue( "ParaStyleConditions" ); >+ uno::Sequence< beans::NamedValue > aSeq; >+ int i; >+ >+ aProperty >>= aSeq; >+ >+ for(i = 0; i < aSeq.getLength(); ++i) >+ { >+ beans::NamedValue const& aNamedCond = aSeq[i]; >+ OUString aStyleName; >+ >+ if ( aNamedCond.Value >>= aStyleName ) >+ { >+ if ( aStyleName.getLength() > 0 ) >+ { >+ OUString aExternal = GetParaStyleCondExternal( aNamedCond.Name ); >+ >+ if (aExternal.getLength() > 0) >+ { >+ bool bEncoded; >+ >+ >+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, >+ XML_CONDITION, >+ aExternal); >+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, >+ XML_APPLY_STYLE_NAME, >+ GetExport().EncodeStyleName( aStyleName, >+ &bEncoded ) ); >+ SvXMLElementExport aElem( GetExport(), >+ XML_NAMESPACE_STYLE, >+ XML_MAP, >+ true, >+ true ); >+ } >+ } >+ } >+ } >+ } >+ catch( const beans::UnknownPropertyException& ) >+ { >+ } > } > > bool XMLStyleExport::exportStyle(
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 103091
:
127924
| 133859