diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2017-09-24 21:05:34 -0400 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2017-09-26 13:58:21 +0200 |
commit | ebc378519cc66b2d55ae421fd362456e9b041766 (patch) | |
tree | f059783825fb14ad6dcbcdcc4215a0762a224154 /sw | |
parent | 2c5973410c034bdb8c36d118506b1d4230a83a9a (diff) |
TSCP: cleanup constant strings
Change-Id: I5c307db7ef1c5980c9ae7706ae95970b5705ab58
Reviewed-on: https://gerrit.libreoffice.org/42740
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 30 |
2 files changed, 14 insertions, 18 deletions
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 488572415a2b..dc7314e4896e 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -734,7 +734,7 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const const css::uno::Reference<css::rdf::XResource> xSubject(pMeta->MakeUnoObject(), uno::UNO_QUERY); uno::Reference<frame::XModel> xModel = pDocSh->GetBaseModel(); const std::map<OUString, OUString> aStatements = SwRDFHelper::getStatements(xModel, metaNS, xSubject); - bRet = (aStatements.find("loext:signature:signature") != aStatements.end()); + bRet = (aStatements.find("loext:paragraph:signature") != aStatements.end()); } } } diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 9b96fd2bd7c6..9ab83df7e36f 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -87,6 +87,10 @@ namespace { +static const OUString MetaFilename("bails.rdf"); +static const OUString MetaNS("urn:bails"); +static const OUString ParagraphSignatureRDFName = "loext:paragraph:signature"; +static const OUString MetadataFieldServiceName = "com.sun.star.text.textfield.MetadataField"; /// Find all page styles which are currently used in the document. std::vector<OUString> lcl_getUsedPageStyles(SwViewShell const * pShell) @@ -226,14 +230,12 @@ lcl_MakeParagraphSignatureFieldText(const uno::Reference<frame::XModel>& xModel, const uno::Reference<css::text::XTextField>& xField, const OString& utf8Text) { - static const OUString metaNS("urn:bails"); - OUString msg = SwResId(STR_INVALID_SIGNATURE); bool valid = false; const css::uno::Reference<css::rdf::XResource> xSubject(xField, uno::UNO_QUERY); - std::map<OUString, OUString> aStatements = SwRDFHelper::getStatements(xModel, metaNS, xSubject); - const auto it = aStatements.find("loext:signature:signature"); + std::map<OUString, OUString> aStatements = SwRDFHelper::getStatements(xModel, MetaNS, xSubject); + const auto it = aStatements.find(ParagraphSignatureRDFName); if (it != aStatements.end()) { const sal_Char* pData = utf8Text.getStr(); @@ -263,13 +265,8 @@ uno::Reference<text::XTextField> lcl_InsertParagraphSignature(const uno::Referen const uno::Reference<text::XTextContent>& xParent, const OUString& signature) { - static const OUString MetaFilename("bails.rdf"); - static const OUString MetaNS("urn:bails"); - static const OUString RDFName = "loext:signature:signature"; - static const OUString ServiceName = "com.sun.star.text.textfield.MetadataField"; - uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY); - auto xField = uno::Reference<text::XTextField>(xMultiServiceFactory->createInstance(ServiceName), uno::UNO_QUERY); + auto xField = uno::Reference<text::XTextField>(xMultiServiceFactory->createInstance(MetadataFieldServiceName), uno::UNO_QUERY); // Add the signature at the end. // uno::Reference<text::XTextContent> xContent(xField, uno::UNO_QUERY); @@ -277,7 +274,7 @@ uno::Reference<text::XTextField> lcl_InsertParagraphSignature(const uno::Referen xField->attach(xParent->getAnchor()->getEnd()); const css::uno::Reference<css::rdf::XResource> xSubject(xField, uno::UNO_QUERY); - SwRDFHelper::addStatement(xModel, MetaNS, MetaFilename, xSubject, RDFName, signature); + SwRDFHelper::addStatement(xModel, MetaNS, MetaFilename, xSubject, ParagraphSignatureRDFName, signature); return xField; } @@ -307,7 +304,7 @@ bool lcl_UpdateParagraphSignatureField(SwDoc* pDoc, return false; } -void lcl_RemoveParagraphSignatureField(const uno::Reference<css::text::XTextField>& xField) +void lcl_RemoveParagraphMetadataField(const uno::Reference<css::text::XTextField>& xField) { uno::Reference<css::text::XTextContent> xFieldTextContent(xField, uno::UNO_QUERY); uno::Reference<css::text::XTextRange> xParagraph(xFieldTextContent->getAnchor()); @@ -969,11 +966,10 @@ SwUndoParagraphSigning::SwUndoParagraphSigning(const SwPosition& rPos, m_bRemove(bRemove) { // Save the metadata and field content to undo/redo. - static const OUString metaNS("urn:bails"); uno::Reference<frame::XModel> xModel = m_pDoc->GetDocShell()->GetBaseModel(); const css::uno::Reference<css::rdf::XResource> xSubject(m_xField, uno::UNO_QUERY); - std::map<OUString, OUString> aStatements = SwRDFHelper::getStatements(xModel, metaNS, xSubject); - const auto it = aStatements.find("loext:signature:signature"); + std::map<OUString, OUString> aStatements = SwRDFHelper::getStatements(xModel, MetaNS, xSubject); + const auto it = aStatements.find(ParagraphSignatureRDFName); if (it != aStatements.end()) m_signature = it->second; @@ -1037,7 +1033,7 @@ void SwUndoParagraphSigning::Remove() m_pDoc->GetIDocumentUndoRedo().DoUndo(isUndoEnabled); }); - lcl_RemoveParagraphSignatureField(m_xField); + lcl_RemoveParagraphMetadataField(m_xField); } void SwEditShell::SignParagraph() @@ -1154,7 +1150,7 @@ void SwEditShell::ValidateParagraphSignatures(bool updateDontRemove) GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::PARA_SIGN_ADD, nullptr); SwUndoParagraphSigning* pUndo = new SwUndoParagraphSigning(SwPosition(*pNode), xContent, xParent, false); GetDoc()->GetIDocumentUndoRedo().AppendUndo(pUndo); - lcl_RemoveParagraphSignatureField(xContent); + lcl_RemoveParagraphMetadataField(xContent); GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::PARA_SIGN_ADD, nullptr); } } |