sw/source/core/crsr/pam.cxx | 30 ++++++++++++++++++++++++++++++ sw/source/uibase/shells/textsh1.cxx | 1 - 2 files changed, 30 insertions(+), 1 deletion(-)
New commits: commit 4dbe82bcb83a9732519cee6ed7128dfe52c5b961 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Fri Sep 15 17:14:47 2017 -0400 sw: make paragraph signature fields read-only Change-Id: Ib0218e2a92cdde81030c517b0826bd6062a333f3 Reviewed-on: https://gerrit.libreoffice.org/42732 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits