diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2017-09-15 17:14:47 -0400 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2017-09-26 07:14:21 +0200 |
commit | 4dbe82bcb83a9732519cee6ed7128dfe52c5b961 (patch) | |
tree | f08d6eacb7ce421d9183b350f9f0142563035675 | |
parent | 4020945651b4f3c636980e2103db440b5c55459c (diff) |
sw: make paragraph signature fields read-only
Change-Id: Ib0218e2a92cdde81030c517b0826bd6062a333f3
Reviewed-on: https://gerrit.libreoffice.org/42732
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 30 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 1 |
2 files changed, 30 insertions, 1 deletions
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index cd1d7f200e7c..488572415a2b 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -43,6 +43,10 @@ #include <hints.hxx> #include <xmloff/odffields.hxx> +#include <rdfhelper.hxx> +#include <txtatr.hxx> +#include <docsh.hxx> + // for the dump "MSC-" compiler inline sal_Int32 GetSttOrEnd( bool bCondition, const SwContentNode& rNd ) { @@ -711,6 +715,32 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const bRet = !( pA == pB && pA != nullptr ); } + // Paragraph Signatures are read-only. + if (!bRet) + { + SwTextNode* pNode = Start()->nNode.GetNode().GetTextNode(); + if (pNode != nullptr) + { + SwTextAttr* pAttr = pNode->GetTextAttrAt(Start()->nContent.GetIndex(), RES_TXTATR_METAFIELD); + SwTextMeta* pTextMeta = static_txtattr_cast<SwTextMeta*>(pAttr); + if (pTextMeta) + { + SwFormatMeta& rFormatMeta(static_cast<SwFormatMeta&>(pTextMeta->GetAttr())); + if (::sw::Meta* pMeta = rFormatMeta.GetMeta()) + { + if (const SwDocShell* pDocSh = pDoc->GetDocShell()) + { + static const OUString metaNS("urn:bails"); + 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()); + } + } + } + } + } + return bRet; } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 331e5245b8ac..fb8be7dd5cae 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -113,7 +113,6 @@ #include <svx/drawitem.hxx> #include <numrule.hxx> #include <memory> -#include <IDocumentUndoRedo.hxx> using namespace ::com::sun::star; using namespace svx::sidebar; |