diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-17 09:39:56 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-17 11:27:05 +0200 |
commit | 6255575c475a25698a4c7145923abbb46f58313d (patch) | |
tree | 25dd6feaaf9134574d9f9232094642893b54a8c8 /sw | |
parent | 2e8acde112e1c6754df26902e79a78346ba45a2d (diff) |
MSWord export: adapt interface to avoid const_cast
If the implementation uses const_cast anyway, then it's clearer to just
not pretend const at the interface level.
Change-Id: Ib819efe9204440fde6dc2af890e5ff2769f4b9d3
Reviewed-on: https://gerrit.libreoffice.org/41238
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/rdfhelper.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/rdfhelper.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 8 |
7 files changed, 14 insertions, 17 deletions
diff --git a/sw/inc/rdfhelper.hxx b/sw/inc/rdfhelper.hxx index 43abffd27ae2..c47ba0b5c9a6 100644 --- a/sw/inc/rdfhelper.hxx +++ b/sw/inc/rdfhelper.hxx @@ -23,7 +23,7 @@ class SW_DLLPUBLIC SwRDFHelper { public: /// Gets all (rTextNode, key, value) statements in RDF graphs of type rType. - static std::map<OUString, OUString> getTextNodeStatements(const OUString& rType, const SwTextNode& rTextNode); + static std::map<OUString, OUString> getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode); /// Add an (rTextNode, key, value) statement in the graph of type rType -- or if it does not exist, create a graph at rPath first. static void addTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue); diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx index 25f7d00f1f43..390e17ba7d79 100644 --- a/sw/source/core/doc/rdfhelper.cxx +++ b/sw/source/core/doc/rdfhelper.cxx @@ -23,13 +23,10 @@ using namespace com::sun::star; -std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& rType, const SwTextNode& rNode) +std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode) { std::map<OUString, OUString> aRet; - // We only read the node, but CreateXParagraph() needs a non-cost one. - auto& rTextNode = const_cast<SwTextNode&>(rNode); - uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext()); uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType); uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(rTextNode.GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 5c810787f224..2bc367de642a 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -937,7 +937,7 @@ void RtfExport::OutputLinkedOLE(const OUString&) { } -void RtfExport::OutputTextNode(const SwTextNode& rNode) +void RtfExport::OutputTextNode(SwTextNode& rNode) { m_nCurrentNodeIndex = rNode.GetIndex(); if (!m_bOutOutlineOnly || rNode.IsOutline()) diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx index 0cda386b7736..2a28280e0efc 100644 --- a/sw/source/filter/ww8/rtfexport.hxx +++ b/sw/source/filter/ww8/rtfexport.hxx @@ -140,7 +140,7 @@ protected: bool DisallowInheritingOutlineNumbering(const SwFormat& rFormat) override; /// Output SwTextNode is depending on outline export mode - void OutputTextNode(const SwTextNode&) override; + void OutputTextNode(SwTextNode&) override; /// Output SwEndNode void OutputEndNode(const SwEndNode&) override; diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 166ee9f1276b..bc536d49c876 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2022,7 +2022,7 @@ void MSWordExportBase::GetSortedBookmarks( const SwTextNode& rNode, sal_Int32 nA } } -void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) +void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) { SAL_INFO( "sw.ww8", "<OutWW8_SwTextNode>" ); @@ -2197,7 +2197,7 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); if ( ch == CH_TXT_ATR_FIELDSTART ) { - SwPosition aPosition( rNode, SwIndex( const_cast< SwTextNode* >( &rNode ), nAktPos ) ); + SwPosition aPosition( rNode, SwIndex( &rNode, nAktPos ) ); ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition ); OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" ); @@ -2246,7 +2246,7 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) } else if ( ch == CH_TXT_ATR_FIELDEND ) { - SwPosition aPosition( rNode, SwIndex( const_cast< SwTextNode* >( &rNode ), nAktPos ) ); + SwPosition aPosition( rNode, SwIndex( &rNode, nAktPos ) ); ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition ); OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDEND??" ); @@ -2270,7 +2270,7 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) } else if ( ch == CH_TXT_ATR_FORMELEMENT ) { - SwPosition aPosition( rNode, SwIndex( const_cast< SwTextNode* >( &rNode ), nAktPos ) ); + SwPosition aPosition( rNode, SwIndex( &rNode, nAktPos ) ); ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition ); OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" ); @@ -3079,7 +3079,7 @@ void WW8AttributeOutput::Redline( const SwRedlineData* pRedline ) } } -void MSWordExportBase::OutputContentNode( const SwContentNode& rNode ) +void MSWordExportBase::OutputContentNode( SwContentNode& rNode ) { switch ( rNode.GetNodeType() ) { diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 5d0a42530f51..942d6b047487 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1492,7 +1492,7 @@ void WW8Export::AppendAnnotationMarks(const SwTextNode& rNode, sal_Int32 nAktPos } } -void WW8Export::AppendSmartTags(const SwTextNode& rTextNode) +void WW8Export::AppendSmartTags(SwTextNode& rTextNode) { std::map<OUString, OUString> aStatements = SwRDFHelper::getTextNodeStatements("urn:bails", rTextNode); if (!aStatements.empty()) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 57aedebc5b07..ffa7221bdb90 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -680,7 +680,7 @@ public: virtual void AppendAnnotationMarks( const SwTextNode& rNd, sal_Int32 nAktPos, sal_Int32 nLen ) = 0; - virtual void AppendSmartTags(const SwTextNode& /*rTextNode*/) { } + virtual void AppendSmartTags(SwTextNode& /*rTextNode*/) { } //For i120928,add this interface to export graphic of bullet virtual void ExportGrfBullet(const SwTextNode& rNd) = 0; @@ -794,7 +794,7 @@ protected: void UpdatePosition( SwWW8AttrIter* pAttrIter, sal_Int32 nAktPos ); /// Output SwTextNode - virtual void OutputTextNode( const SwTextNode& ); + virtual void OutputTextNode( SwTextNode& ); /// Setup the chapter fields (maChapterFieldLocs). void GatherChapterFields(); @@ -838,7 +838,7 @@ protected: /// Call the right (virtual) function according to the type of the item. /// /// One of OutputTextNode(), OutputGrfNode(), or OutputOLENode() - void OutputContentNode( const SwContentNode& ); + void OutputContentNode( SwContentNode& ); /// Find the nearest bookmark from the current position. /// @@ -1041,7 +1041,7 @@ public: virtual void AppendAnnotationMarks( const SwTextNode& rNd, sal_Int32 nAktPos, sal_Int32 nLen ) override; - virtual void AppendSmartTags(const SwTextNode& rTextNode) override; + virtual void AppendSmartTags(SwTextNode& rTextNode) override; virtual void ExportGrfBullet(const SwTextNode& rNd) override; void OutGrfBullets(const ww8::Frame &rFrame); |