[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2020-09-07 Thread Miklos Vajna (via logerrit)
 sw/inc/doc.hxx|2 ++
 sw/source/core/doc/doc.cxx|5 +
 sw/source/core/doc/docnew.cxx |   22 ++
 3 files changed, 29 insertions(+)

New commits:
commit f3d2a591db8b14d5d83ec6f7e7d4273b44f0a354
Author: Miklos Vajna 
AuthorDate: Fri Sep 4 16:51:59 2020 +0200
Commit: Miklos Vajna 
CommitDate: Mon Sep 7 12:32:26 2020 +0200

sw: default to UI locale when language is missing

This means that when extras/source/shellnew/soffice.odt is opened, it'll
always match the user's language. The same was already working in Calc
and Impress.

Conflicts:
sw/source/core/doc/docnew.cxx

Change-Id: Ic1afc82d7b59f1bd32815586f756e7e8408e5c6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102150
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 83f89c88db79..e110052bed2b 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1647,6 +1647,8 @@ public:
 /// Returns true if no dictionary can be found for any content
 bool IsDictionaryMissing() { return meDictionaryMissing == 
MissingDictionary::True; }
 
+void SetLanguage(const LanguageType eLang, const sal_uInt16 nId);
+
 private:
 // Copies master header to left / first one, if necessary - used by 
ChgPageDesc().
 void CopyMasterHeader(const SwPageDesc , const SwFormatHeader 
, SwPageDesc , bool bLeft, bool bFirst);
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 59ea8ea19672..d1f4725250d8 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -127,6 +127,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* @@@MAINTAINABILITY-HORROR@@@
@@ -1839,5 +1840,9 @@ void SwDoc::SetMissingDictionaries( bool bIsMissing )
 meDictionaryMissing = MissingDictionary::False;
 };
 
+void SwDoc::SetLanguage(const LanguageType eLang, const sal_uInt16 nId)
+{
+mpAttrPool->SetPoolDefaultItem(SvxLanguageItem(eLang, nId));
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 4d36e33b50d4..dd8e87042ef2 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -120,6 +121,9 @@
 #include 
 
 #include 
+#include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::document;
@@ -376,6 +380,24 @@ SwDoc::SwDoc()
 }
 mnRsidRoot = mnRsid;
 
+if (!utl::ConfigManager::IsFuzzing())
+{
+// Make sure that in case the document language is not set, then we 
don't return
+// LANGUAGE_DONTKNOW, but the UI locale.
+const SvtLinguConfig aLinguConfig;
+SvtLinguOptions aOptions;
+aLinguConfig.GetOptions(aOptions);
+LanguageType eLang = 
MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage,
+ 
i18n::ScriptType::LATIN);
+SetLanguage(eLang, RES_CHRATR_LANGUAGE);
+eLang = 
MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK,
+
i18n::ScriptType::ASIAN);
+SetLanguage(eLang, RES_CHRATR_CJK_LANGUAGE);
+eLang = 
MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL,
+
i18n::ScriptType::COMPLEX);
+SetLanguage(eLang, RES_CHRATR_CTL_LANGUAGE);
+}
+
 getIDocumentState().ResetModified();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2020-06-11 Thread Julien Nabet (via logerrit)
 sw/inc/modcfg.hxx  |4 ++--
 sw/inc/swabstdlg.hxx   |2 +-
 sw/source/ui/dialog/swdlgfact.cxx  |4 ++--
 sw/source/ui/dialog/swdlgfact.hxx  |2 +-
 sw/source/ui/envelp/mailmrge.cxx   |2 +-
 sw/source/uibase/config/modcfg.cxx |8 
 sw/source/uibase/dbui/dbmgr.cxx|2 +-
 sw/source/uibase/inc/mailmrge.hxx  |2 +-
 8 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 231e6e0effb2056ba37cf1b160d9af1adcf097a7
Author: Julien Nabet 
AuthorDate: Thu May 28 14:14:41 2020 +0200
Commit: Andras Timar 
CommitDate: Thu Jun 11 09:20:07 2020 +0200

Fix 983db96a17630be906b868d2be811663f0d846f6


warn:unotools.config:172285:172285:unotools/source/config/configitem.cxx:409:
ignoring XHierarchicalNameAccess to

/org.openoffice.Office.Writer/FormLetter/PrintOutput/AskForMergeFormLetter/FileOutput/FilePassword/FromDatabaseField
com.sun.star.container.NoSuchElementException message:

FormLetter/PrintOutput/AskForMergeFormLetter/FileOutput/FilePassword/FromDatabaseField
/home/julien/lo/libreoffice/configmgr/source/access.cxx:436

missing comma + confusion in switch cases in SwMiscConfig::Load

+ typo Encyrpted->Encrypted

Author: Gülşah Köse 
Date:   Fri May 22 11:51:33 2020 +0300

Add an option to create encyrpted PDF files with mailmerge.

With that option user can create encyrpted pdf files with
a password column in database via mailmerge.

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95033
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit 90d3311b08cef7418376d183b7116223db3e627d)

Change-Id: I1ae9bbeb3f69ed9c0ba51709852f8edd5f2dc683
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96069
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index c27f3be749be..98615f8eb378 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -332,8 +332,8 @@ public:
 voidSetNameFromColumn( const OUString& rSet )   { 
m_aMiscConfig.m_sNameFromColumn = rSet;
   
m_aMiscConfig.SetModified();}
 
-boolIsFileEncyrptedFromColumn() const{ return 
m_aMiscConfig.m_bIsPasswordFromColumn;}
-voidSetIsFileEncyrptedFromColumn( bool bSet )
+boolIsFileEncryptedFromColumn() const{ return 
m_aMiscConfig.m_bIsPasswordFromColumn;}
+voidSetIsFileEncryptedFromColumn( bool bSet )
 {
 m_aMiscConfig.SetModified();
 m_aMiscConfig.m_bIsPasswordFromColumn = bSet;
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 3f261c47c344..587a142c2a61 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -152,7 +152,7 @@ public:
 virtual css::uno::Reference< css::sdbc::XResultSet> GetResultSet() const = 
0;
 virtual bool IsSaveSingleDoc() const = 0;
 virtual bool IsGenerateFromDataBase() const = 0;
-virtual bool IsFileEncyrptedFromDataBase() const = 0;
+virtual bool IsFileEncryptedFromDataBase() const = 0;
 virtual OUString GetColumnName() const = 0;
 virtual OUString GetPasswordColumnName() const = 0;
 virtual OUString GetTargetURL() const = 0;
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index a715f6280c44..99f23f595a3c 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -645,9 +645,9 @@ bool AbstractMailMergeDlg_Impl::IsGenerateFromDataBase() 
const
 return pDlg->IsGenerateFromDataBase();
 }
 
-bool AbstractMailMergeDlg_Impl::IsFileEncyrptedFromDataBase() const
+bool AbstractMailMergeDlg_Impl::IsFileEncryptedFromDataBase() const
 {
-return pDlg->IsFileEncyrptedFromDataBase();
+return pDlg->IsFileEncryptedFromDataBase();
 }
 
 OUString AbstractMailMergeDlg_Impl::GetColumnName() const
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index 3a7ecc581512..97bb2c0c0606 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -507,7 +507,7 @@ class AbstractMailMergeDlg_Impl : public 
AbstractMailMergeDlg
 virtual css::uno::Reference< css::sdbc::XResultSet> GetResultSet() const 
override;
 virtual bool IsSaveSingleDoc() const override;
 virtual bool IsGenerateFromDataBase() const override;
-virtual bool IsFileEncyrptedFromDataBase() const override;
+virtual bool IsFileEncryptedFromDataBase() const override;
 virtual OUString GetColumnName() const override;
 virtual OUString GetPasswordColumnName() const override;
 virtual OUString GetTargetURL() const override;
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index 0eca50378902..21f8591f4439 100644
--- 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2020-05-20 Thread Szymon Kłos (via logerrit)
 sw/inc/swabstdlg.hxx   |8 +
 sw/source/ui/dialog/swdlgfact.cxx  |   13 +--
 sw/source/ui/dialog/swdlgfact.hxx  |   10 +-
 sw/source/uibase/shells/basesh.cxx |  156 ++---
 4 files changed, 110 insertions(+), 77 deletions(-)

New commits:
commit ba8595407be6eb094448534e3ea93b6c22eac892
Author: Szymon Kłos 
AuthorDate: Tue May 19 16:55:39 2020 +0200
Commit: Szymon Kłos 
CommitDate: Wed May 20 13:17:29 2020 +0200

Make Insert Table dialog async

Change-Id: Id2458c16f259a58e2376f42104a9a6c9056cab11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94536
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 

diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 2347116e172c..8e7020d37e87 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -57,6 +57,7 @@ struct SfxChildWinInfo;
 class SwTOXMark;
 struct SwDocStat;
 struct SwInsertTableOptions;
+class SwInsTableDlg;
 enum class SwBorderModes;
 enum class SwCharDlgMode;
 enum class SfxStyleFamily;
@@ -117,14 +118,15 @@ public:
 virtual voidSetText( const OUString& rStr ) = 0;
 };
 
-class AbstractInsTableDlg : public VclAbstractDialog
+class AbstractInsTableDlg
 {
 protected:
-virtual ~AbstractInsTableDlg() override = default;
+virtual ~AbstractInsTableDlg() = default;
 public:
 virtual voidGetValues( OUString& rName, sal_uInt16& rRow, 
sal_uInt16& rCol,
 SwInsertTableOptions& rInsTableFlags, 
OUString& rTableAutoFormatName,
 SwTableAutoFormat *& prTAFormat ) = 0;
+virtual std::shared_ptr getDialogController() = 0;
 };
 
 class AbstractJavaEditDialog : public VclAbstractDialog
@@ -457,7 +459,7 @@ public:
 SwWrtShell , bool bEd = false) = 0;
 virtual VclPtr  
CreateTitlePageDlg(weld::Window* pParent) = 0;
 virtual VclPtr CreateVclSwViewDialog(SwView& 
rView) = 0;
-virtual VclPtrCreateInsTableDlg(SwView& 
rView) = 0;
+virtual std::shared_ptr CreateInsTableDlg(SwView& 
rView) = 0;
 virtual VclPtr 
CreateJavaEditDialog(weld::Window* pParent,
 SwWrtShell* pWrtSh) = 0;
 virtual VclPtr   CreateMailMergeDlg(
diff --git a/sw/source/ui/dialog/swdlgfact.cxx 
b/sw/source/ui/dialog/swdlgfact.cxx
index 970d83e40d38..20097ec6c385 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -218,11 +218,6 @@ short AbstractInsFootNoteDlg_Impl::Execute()
 return m_xDlg->run();
 }
 
-short AbstractInsTableDlg_Impl::Execute()
-{
-return m_xDlg->run();
-}
-
 short AbstractJavaEditDialog_Impl::Execute()
 {
 return m_xDlg->run();
@@ -590,7 +585,9 @@ void AbstractInsTableDlg_Impl::GetValues( OUString& rName, 
sal_uInt16& rRow, sal
 SwInsertTableOptions& rInsTableFlags, 
OUString& rTableAutoFormatName,
 SwTableAutoFormat *& prTAFormat )
 {
-m_xDlg->GetValues(rName, rRow, rCol, rInsTableFlags, rTableAutoFormatName, 
prTAFormat);
+SwInsTableDlg* pDlg = dynamic_cast(m_xDlg.get());
+if (pDlg)
+pDlg->GetValues(rName, rRow, rCol, rInsTableFlags, 
rTableAutoFormatName, prTAFormat);
 }
 
 OUString AbstractJavaEditDialog_Impl::GetScriptText() const
@@ -1048,9 +1045,9 @@ VclPtr 
SwAbstractDialogFactory_Impl::CreateVclSwViewDialog(Sw
 return 
VclPtr::Create(o3tl::make_unique(rView));
 }
 
-VclPtr 
SwAbstractDialogFactory_Impl::CreateInsTableDlg(SwView& rView)
+std::shared_ptr 
SwAbstractDialogFactory_Impl::CreateInsTableDlg(SwView& rView)
 {
-return 
VclPtr::Create(o3tl::make_unique(rView));
+return 
std::make_shared(std::make_shared(rView));
 }
 
 VclPtr 
SwAbstractDialogFactory_Impl::CreateJavaEditDialog(
diff --git a/sw/source/ui/dialog/swdlgfact.hxx 
b/sw/source/ui/dialog/swdlgfact.hxx
index 3a31db3546da..295b56f92348 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -467,16 +467,16 @@ class SwInsTableDlg;
 class AbstractInsTableDlg_Impl : public AbstractInsTableDlg
 {
 protected:
-std::unique_ptr m_xDlg;
+std::shared_ptr m_xDlg;
 public:
-explicit AbstractInsTableDlg_Impl(std::unique_ptr p)
-: m_xDlg(std::move(p))
+explicit AbstractInsTableDlg_Impl(std::shared_ptr 
p)
+: m_xDlg(p)
 {
 }
-virtual short Execute() override;
 virtual voidGetValues( OUString& rName, sal_uInt16& rRow, 
sal_uInt16& rCol,
 SwInsertTableOptions& rInsTableFlags, 
OUString& rTableAutoFormatName,
 SwTableAutoFormat *& prTAFormat ) override;
+virtual std::shared_ptr getDialogController() 
override { return m_xDlg; }
 };
 
 class SwJavaEditDialog;
@@ -702,7 +702,7 @@ public:
 weld::Window * pParent, SwWrtShell , bool bEd = false) override;
 virtual VclPtr CreateTitlePageDlg(weld::Window* 
pParent) override;
 virtual 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2020-03-29 Thread Gülşah Köse (via logerrit)
 sw/inc/ndgrf.hxx |3 ++-
 sw/source/core/graphic/ndgrf.cxx |9 +++--
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit bda5fcbbbe13d4fb78ae33722e254395850556ac
Author: Gülşah Köse 
AuthorDate: Fri Mar 6 16:12:59 2020 +0300
Commit: Andras Timar 
CommitDate: Sun Mar 29 23:49:24 2020 +0200

tdf#131185 Prevent unnecessary SwapIn calls.

When the http response is 404 or something like
that we shouldn't retry the download embeded image
constantly. This causes libreoffice to short freezes.

Change-Id: I7381d04f12e9fbea961dd0eea0d39aa93d14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90102
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 
(cherry picked from commit 30b23d77c894bdf6f7ae0d18d594ea267a80f662)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90271
Reviewed-by: Andras Timar 
(cherry picked from commit ddd7277b218204dca539b3f93d36098df0349b38)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91296
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 2faed3ec01e8..3621292cfa46 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -39,7 +39,8 @@ class SW_DLLPUBLIC SwGrfNode: public SwNoTextNode
 std::unique_ptr mpReplacementGraphic;
 tools::SvRef refLink;   ///< If graphics only as 
link then pointer is set.
 Size nGrfSize;
-bool bInSwapIn  :1;
+bool bInSwapIn   :1; // to avoid recursion in SwGrfNode::SwapIn
+bool bInBaseLinkSwapIn  :1; // to avoid recursion in SwBaseLink::SwapIn
 
 bool bChgTwipSize   :1;
 bool bFrameInPaint  :1; ///< To avoid Start-/EndActions in Paint 
via SwapIn.
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index e8c237f10fb0..6a87796169cd 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -68,6 +68,7 @@ SwGrfNode::SwGrfNode(
 SwAttrSet const * pAutoAttr ) :
 SwNoTextNode( rWhere, SwNodeType::Grf, pGrfColl, pAutoAttr ),
 maGrfObj(),
+bInBaseLinkSwapIn(true),
 // #i73788#
 mbLinkedInputStreamReady( false ),
 mbIsStreamReadOnly( false )
@@ -84,6 +85,7 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
   SwAttrSet const * pAutoAttr ) :
 SwNoTextNode( rWhere, SwNodeType::Grf, pGrfColl, pAutoAttr ),
 maGrfObj(rGrfObj),
+bInBaseLinkSwapIn(true),
 // #i73788#
 mbLinkedInputStreamReady( false ),
 mbIsStreamReadOnly( false )
@@ -105,6 +107,7 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
   SwAttrSet const * pAutoAttr ) :
 SwNoTextNode( rWhere, SwNodeType::Grf, pGrfColl, pAutoAttr ),
 maGrfObj(),
+bInBaseLinkSwapIn(true),
 // #i73788#
 mbLinkedInputStreamReady( false ),
 mbIsStreamReadOnly( false )
@@ -448,13 +451,15 @@ bool SwGrfNode::SwapIn(bool bWaitForData)
 
 if( pLink )
 {
-if( GraphicType::NONE == maGrfObj.GetType() ||
-GraphicType::Default == maGrfObj.GetType() )
+if( (GraphicType::NONE == maGrfObj.GetType() ||
+ GraphicType::Default == maGrfObj.GetType()) &&
+bInBaseLinkSwapIn)
 {
 // link was not loaded yet
 if( pLink->SwapIn( bWaitForData ) )
 {
 bRet = true;
+bInBaseLinkSwapIn = false;
 }
 else if( GraphicType::Default == maGrfObj.GetType() )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2020-03-03 Thread Caolán McNamara (via logerrit)
 sw/inc/crsrsh.hxx|6 +--
 sw/inc/view.hxx  |2 -
 sw/source/core/crsr/crsrsh.cxx   |4 +-
 sw/source/uibase/app/appenv.cxx  |2 -
 sw/source/uibase/app/applab.cxx  |2 -
 sw/source/uibase/dbui/dbmgr.cxx  |2 -
 sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx |   12 +++---
 sw/source/uibase/dochdl/swdtflvr.cxx |4 +-
 sw/source/uibase/docvw/edtwin.cxx|   36 +--
 sw/source/uibase/ribbar/drawbase.cxx |2 -
 sw/source/uibase/shells/basesh.cxx   |   10 ++---
 sw/source/uibase/shells/beziersh.cxx |6 +--
 sw/source/uibase/shells/drawsh.cxx   |4 +-
 sw/source/uibase/shells/drwtxtex.cxx |4 +-
 sw/source/uibase/shells/drwtxtsh.cxx |2 -
 sw/source/uibase/shells/mediash.cxx  |2 -
 sw/source/uibase/shells/textfld.cxx  |6 +--
 sw/source/uibase/uiview/view.cxx |   10 ++---
 sw/source/uibase/uiview/view1.cxx|4 +-
 sw/source/uibase/uiview/view2.cxx|8 ++--
 sw/source/uibase/uiview/viewdraw.cxx |6 +--
 sw/source/uibase/uno/unomailmerge.cxx|4 +-
 sw/source/uibase/uno/unotxvw.cxx |4 +-
 sw/source/uibase/wrtsh/select.cxx|2 -
 sw/source/uibase/wrtsh/wrtsh1.cxx|2 -
 sw/source/uibase/wrtsh/wrtsh3.cxx|2 -
 26 files changed, 74 insertions(+), 74 deletions(-)

New commits:
commit 147849c328e7fcef65b5e4ea17a473d2bab3bdb1
Author: Caolán McNamara 
AuthorDate: Thu Oct 10 16:11:14 2019 +0100
Commit: Andras Timar 
CommitDate: Tue Mar 3 14:31:48 2020 +0100

SwCursorShell argument of AttrChangedNotify is unused

Change-Id: I1fde665dcb77d29cad7f6a5c12e82c1822cff022
Reviewed-on: https://gerrit.libreoffice.org/80621
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89883
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 7add73be4c23..050648beb901 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -175,7 +175,7 @@ private:
 
 Link m_aFlyMacroLnk;/**< Link will 
be called, if the Cursor is set
into a fly. A macro can then be called */
-Link m_aChgLnk; /**< link will be called 
by every attribute/
+Link m_aChgLnk; /**< link will be called 
by every attribute/
format changes at cursor position.*/
 Link m_aGrfArrivedLnk;  ///< Link calls to UI if 
a graphic is arrived
 
@@ -486,8 +486,8 @@ public:
 const Link& GetFlyMacroLnk() const   
{ return m_aFlyMacroLnk; }
 
 // Methods returning/altering link for changes of attributes/formats.
-voidSetChgLnk( const Link  ) { m_aChgLnk 
= rLnk; }
-const Link& GetChgLnk() const   { return 
m_aChgLnk; }
+voidSetChgLnk( const Link  ) { m_aChgLnk 
= rLnk; }
+const Link& GetChgLnk() const   { return 
m_aChgLnk; }
 
 // Methods returning/altering ling for "graphic completely loaded".
 voidSetGrfArrivedLnk( const Link  ) { 
m_aGrfArrivedLnk = rLnk; }
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 94e2cc86e81e..f18ba61d0569 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -534,7 +534,7 @@ public:
 voidStateTabWin(SfxItemSet&);
 
 // attributes have changed
-DECL_LINK( AttrChangedNotify, SwCursorShell*, void );
+DECL_LINK( AttrChangedNotify, LinkParamNone*, void );
 
 // form control has been activated
 DECL_LINK( FormControlActivated, LinkParamNone*, void );
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 1edaf9a9f590..3e29c1b83f3b 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -286,7 +286,7 @@ void SwCursorShell::EndAction( const bool bIdleEnd, const 
bool DoSetPosX )
 // call ChgCall if there is still one
 if( m_bCallChgLnk && m_bChgCallFlag && m_aChgLnk.IsSet() )
 {
-m_aChgLnk.Call( this );
+m_aChgLnk.Call(nullptr);
 m_bChgCallFlag = false;   // reset flag
 }
 }
@@ -2486,7 +2486,7 @@ void SwCursorShell::CallChgLnk()
 else if( m_aChgLnk.IsSet() )
 {
 if( m_bCallChgLnk )
-m_aChgLnk.Call( this );
+m_aChgLnk.Call(nullptr);
 m_bChgCallFlag = false; // reset flag
 }
 }
diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx
index 8815f6a97ee2..6d90b30be544 100644
--- a/sw/source/uibase/app/appenv.cxx
+++ 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2020-02-20 Thread Michael Stahl (via logerrit)
 sw/inc/undobj.hxx   |   15 +
 sw/source/core/doc/DocumentContentOperationsManager.cxx |  217 ++--
 sw/source/core/doc/DocumentLayoutManager.cxx|2 
 sw/source/core/doc/doccomp.cxx  |2 
 sw/source/core/doc/docdesc.cxx  |4 
 sw/source/core/doc/docedt.cxx   |   99 +--
 sw/source/core/doc/docfmt.cxx   |2 
 sw/source/core/doc/docglbl.cxx  |2 
 sw/source/core/doc/docredln.cxx |2 
 sw/source/core/doc/tblcpy.cxx   |2 
 sw/source/core/doc/tblrwcl.cxx  |2 
 sw/source/core/docnode/section.cxx  |2 
 sw/source/core/inc/DocumentContentOperationsManager.hxx |3 
 sw/source/core/inc/frmtool.hxx  |6 
 sw/source/core/inc/mvsave.hxx   |   18 -
 sw/source/core/layout/frmtool.cxx   |  105 ++-
 sw/source/core/layout/wsfrm.cxx |   13 
 sw/source/core/txtnode/atrftn.cxx   |2 
 sw/source/core/undo/undobj.cxx  |   58 +++-
 sw/source/core/undo/untblk.cxx  |  139 +++---
 sw/source/filter/basflt/shellio.cxx |   24 -
 21 files changed, 510 insertions(+), 209 deletions(-)

New commits:
commit 5e79482c28db7d8e479c603eb3e9eb276ad4ad7d
Author: Michael Stahl 
AuthorDate: Thu Jul 11 18:37:28 2019 +0200
Commit: Miklos Vajna 
CommitDate: Thu Feb 20 18:51:02 2020 +0100

tdf#117185 tdf#110442 sw: bring harmony & peace to fly at-char selection

Use IsDestroyFrameAnchoredAtChar() to harmonize the at-char fly
selection across all relevant operations:

* CopyImpl: this is the most tricky one:
- the code in CopyWithFlyInFly() and CopyFlyInFlyImpl() is quite con-
  voluted as it needs to do some things ignoring a partially selected
  start node, while including it in other cases
- it had pre-existing bugs too that would lose a fly anchored to the
  2nd (1st fully selected) node of a redline
- now it needs to copy the flys in the selection if it is inside a
  single node
- another complication is that flys that already existed at the
  insert position need to have their anchors corrected
- SwUndoInsLayFormat need to be created for the appropriate flys
- SwUndoInserts Undo/Redo needs to run the nested SwUndoInsLayFormat
  at the appropriate time
- SwUndoInserts::UndoImpl() needs a special case to *never* delete
  flys at the start/end of the selection because those are handled by
  nested SwUndoInsLayFormat
- Insert File (shellio.cxx) needs adapting to the SwUndoInserts change

* DeleteRange: this just needs to delete the flys via DelFlyInRange()

* MoveRange:
- this is used by the old SwRangeRedline Show/Hide, i.e. on ODF export
- the SaveFlyInRange()/RestFlyInRange() was rather inadequate and
  didn't even restore content indexes at all...

* IsShown: the sw_redlinehide code needs to check visibility against
  the (inverted) extents

The selection behavior is changed so that at-char flys in the start and
end node of the selection are also selected, instead of having their
anchor moved to a different content index by the operation. This appears
more obvious and user-friendly, fixes tdf#110442, and is also more like
what Word does.

Selections exclude the start and end position except if it's a fully
selected node or at the start or end of a section (i.e. Ctrl+A should
also select every at-char fly).

A special hack is needed to keep writerfilter happy for now; it likes to
anchor flys at nodes which it then deletes in RemoveLastParagraph(),
which likely could be improved there (disposing the SwXParagraph runs
into the same problem...).

Crashes fixed by this:
tdf#117185
tdf#117215 except comment#12
tdf#124720
tdf#124721
tdf#124739

Previously fixed bugs tested:
i#97570 plus the 2 bugs that already have UITests

(cherry picked from commit 28b77c89dfcafae82cf2a6d85731b643ff9290e5)

Conflicts:
sw/qa/uitest/writer_tests6/tdf107975.py
sw/source/core/doc/docedt.cxx
sw/source/core/inc/frmtool.hxx
sw/source/core/layout/frmtool.cxx

Change-Id: I4fec2a3c15ca0e64e5c4e99acfb04f59bb2bcf64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89093
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 8610ab3d38a6..2d8b02ce6e12 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -35,6 +35,7 @@ struct SwPosition;
 class SwDoc;
 class SwTextFormatColl;
 class SwFrameFormat;
+class 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2019-12-25 Thread Ashod Nakashian (via logerrit)
 sw/inc/editsh.hxx   |7 +--
 sw/source/core/doc/DocumentTimerManager.cxx |4 
 sw/source/core/edit/edfcol.cxx  |7 ---
 sw/source/core/edit/edws.cxx|   11 ---
 4 files changed, 17 insertions(+), 12 deletions(-)

New commits:
commit deaf934e3c62b554704d1d3548ac699ea6d308ab
Author: Ashod Nakashian 
AuthorDate: Wed Oct 3 05:53:28 2018 -0400
Commit: Ashod Nakashian 
CommitDate: Thu Dec 26 04:36:10 2019 +0100

sw: paragraph-sign: process signatures in one pass on loading

This combines the metadata field restoration logic with
validation/update of said field in one pass upon loading docs.
This cuts down overheads and makes the code more readable.

In addition, now that paragraph signature validation is quite
cheap (separate commits), esp. when no signatures exist, we
validate and update signatures (where applicable) when fields
are updated.

Change-Id: I4adcea579c591f9be457ed742d2cf54fa308163d
Reviewed-on: https://gerrit.libreoffice.org/63008
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian 
(cherry picked from commit ad9902f34dd0b5837ab518445ea9f3a24352738b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85809
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 74323492d538..32c0b8014f2f 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -375,8 +375,11 @@ public:
 /// Validate all paragraph signatures.
 void ValidateAllParagraphSignatures(bool updateDontRemove);
 
-/// Restore the metadata fields, if missing, from the RDF metadata.
-void RestoreMetadataFields();
+/// Restore the metadata fields, if missing, from the RDF metadata
+/// and validate the signatures and update the signature metadata fields.
+/// Needed since deleting the metadata field doesn't remove the RDF
+/// and editing docs using software that don't support paragraph signing.
+void RestoreMetadataFieldsAndValidateParagraphSignatures();
 
 /// Ensure that the classification of the doc is never lower than
 /// the paragraph with the highest classification.
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx 
b/sw/source/core/doc/DocumentTimerManager.cxx
index d290e70942b8..86afcb9107fa 100644
--- a/sw/source/core/doc/DocumentTimerManager.cxx
+++ b/sw/source/core/doc/DocumentTimerManager.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace sw
 {
@@ -201,6 +202,9 @@ IMPL_LINK_NOARG( DocumentTimerManager, DoIdleJobs, Timer*, 
void )
 m_rDoc.getIDocumentFieldsAccess().UpdateTableFields(nullptr);  // 
Tables
 m_rDoc.getIDocumentFieldsAccess().UpdateRefFields();  // References
 
+// Validate and update the paragraph signatures.
+m_rDoc.GetEditShell()->ValidateAllParagraphSignatures(true);
+
 pTmpRoot->EndAllAction();
 
 pShell->LockView( bOldLockView );
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index b97ce353a840..e2014a101966 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1902,7 +1902,7 @@ static uno::Reference 
lcl_GetParagraphMetadataFieldAtIndex(con
 return xTextField;
 }
 
-void SwEditShell::RestoreMetadataFields()
+void SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures()
 {
 SwDocShell* pDocShell = GetDoc()->GetDocShell();
 if (!pDocShell || !IsParagraphSignatureValidationEnabled())
@@ -2028,6 +2028,7 @@ void SwEditShell::RestoreMetadataFields()
 }
 }
 
+lcl_ValidateParagraphSignatures(GetDoc(), xParagraph, true); // 
Validate and Update signatures.
 }
 catch (const std::exception&)
 {
@@ -2118,7 +2119,7 @@ static OUString 
lcl_GetHighestClassificationParagraphClass(SwPaM* pCursor)
 while (xParagraphs->hasMoreElements())
 {
 uno::Reference 
xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY);
-OUString sCurrentClass = lcl_GetParagraphClassification(aHelper, 
aKeyCreator, xModel, xParagraph);
+const OUString sCurrentClass = lcl_GetParagraphClassification(aHelper, 
aKeyCreator, xModel, xParagraph);
 sHighestClass = aHelper.GetHigherClass(sHighestClass, sCurrentClass);
 }
 
@@ -2131,7 +2132,7 @@ void SwEditShell::ClassifyDocPerHighestParagraphClass()
 if (!pDocShell)
 return;
 
-// bail out as early as possible if we don't have paragraph classification
+// Bail out as early as possible if we don't have paragraph classification.
 if (!SwRDFHelper::hasMetadataGraph(pDocShell->GetBaseModel(), MetaNS))
 return;
 
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 9ed3970fc164..dd5381cbb9eb 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -17,11 +17,12 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2019-12-25 Thread Ashod Nakashian (via logerrit)
 sw/inc/editsh.hxx|5 -
 sw/source/core/edit/edfcol.cxx   |   27 ---
 sw/source/core/txtnode/ndtxt.cxx |2 +-
 3 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit 412eaa9d66157e1da71580a245e1693143e6de34
Author: Ashod Nakashian 
AuthorDate: Tue Oct 2 05:20:38 2018 -0400
Commit: Ashod Nakashian 
CommitDate: Thu Dec 26 04:34:15 2019 +0100

sw: paragraph-sign: validate current SwTextNode directly

When invoking undo, it turns out that the cursor position
is updated after the text modification, which triggers the
paragraph signature validation. Relying on the cursor
position, then, results in the wrong (previous) paragraph
to be validated (if the undo is in a different paragraph).

Since we have the correct SwTextNode when it's modified
(due to undo or otherwise), there is no reason why
we shouldn't use it and try to deduce it from the cursor.

Change-Id: I4c3283d59738988dcc1c592a9f3ef2c818ce675d
Reviewed-on: https://gerrit.libreoffice.org/63004
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian 
(cherry picked from commit 25446d1c7d021ba99201f36b04d59c29c85b7733)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85805
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index a29313d6e181..74323492d538 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -366,7 +366,10 @@ public:
 /// Sign the paragraph at the cursor.
 void SignParagraph();
 
-/// Validate current paragraph signatures, if any, at the cursor start.
+/// Validate the paragraph signatures, if any, of the current text node.
+void ValidateParagraphSignatures(SwTextNode* pNode, bool updateDontRemove);
+
+/// Validate the current paragraph signatures, if any, at the cursor start.
 void ValidateCurrentParagraphSignatures(bool updateDontRemove);
 
 /// Validate all paragraph signatures.
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index bfbb4fa62f1c..ccc5028eb311 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1811,16 +1811,13 @@ void SwEditShell::SignParagraph()
 GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::PARA_SIGN_ADD, nullptr);
 }
 
-void SwEditShell::ValidateCurrentParagraphSignatures(bool updateDontRemove)
+void SwEditShell::ValidateParagraphSignatures(SwTextNode* pNode, bool 
updateDontRemove)
 {
-SwDocShell* pDocShell = GetDoc()->GetDocShell();
-if (!pDocShell || !GetCursor() || !GetCursor()->Start() || 
!IsParagraphSignatureValidationEnabled())
+if (!pNode || !IsParagraphSignatureValidationEnabled())
 return;
 
-SwPaM* pPaM = GetCursor();
-const SwPosition* pPosStart = pPaM->Start();
-SwTextNode* pNode = pPosStart->nNode.GetNode().GetTextNode();
-if (!pNode)
+// Table text signing is not supported.
+if (pNode->FindTableNode() != nullptr)
 return;
 
 // Prevent recursive validation since this is triggered on node updates, 
which we do below.
@@ -1829,12 +1826,20 @@ void 
SwEditShell::ValidateCurrentParagraphSignatures(bool updateDontRemove)
 SetParagraphSignatureValidation(bOldValidationFlag);
 });
 
-// Table text signing is not supported.
-if (pNode->FindTableNode() != nullptr)
+uno::Reference xParentText = 
SwXParagraph::CreateXParagraph(*GetDoc(), pNode);
+lcl_ValidateParagraphSignatures(GetDoc(), xParentText, updateDontRemove);
+}
+
+void SwEditShell::ValidateCurrentParagraphSignatures(bool updateDontRemove)
+{
+SwDocShell* pDocShell = GetDoc()->GetDocShell();
+if (!pDocShell || !GetCursor() || !GetCursor()->Start() || 
!IsParagraphSignatureValidationEnabled())
 return;
 
-uno::Reference xParentText = 
SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
-lcl_ValidateParagraphSignatures(GetDoc(), xParentText, updateDontRemove);
+SwPaM* pPaM = GetCursor();
+const SwPosition* pPosStart = pPaM->Start();
+SwTextNode* pNode = pPosStart->nNode.GetNode().GetTextNode();
+ValidateParagraphSignatures(pNode, updateDontRemove);
 }
 
 void SwEditShell::ValidateAllParagraphSignatures(bool updateDontRemove)
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 619e99efa1b5..c83c5f5dfc55 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1540,7 +1540,7 @@ void SwTextNode::Update(
 // Update the paragraph signatures.
 if (SwEditShell* pEditShell = GetDoc()->GetEditShell())
 {
-pEditShell->ValidateCurrentParagraphSignatures(true);
+pEditShell->ValidateParagraphSignatures(this, true);
 }
 
 // Inform LOK clients about change in position of redlines (if any)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2019-12-25 Thread Ashod Nakashian (via logerrit)
 sw/inc/rdfhelper.hxx |6 
 sw/source/core/doc/rdfhelper.cxx |   50 ---
 2 files changed, 43 insertions(+), 13 deletions(-)

New commits:
commit 7f004baf5ef503b5341e12bc7fc04c6fee3e2acb
Author: Ashod Nakashian 
AuthorDate: Sun Oct 28 14:44:34 2018 -0400
Commit: Ashod Nakashian 
CommitDate: Thu Dec 26 03:43:07 2019 +0100

paragraph-sign: exception-safe metadata graph enumeration

Metadata graph enumeration can throw from a number
functions and break things in horrible ways.
Here we sanitize against the most egregious offenders,
but not all possible sources.

Change-Id: I40e006ea433dd7274d4fa08f3e8f8507680ef2f4
Reviewed-on: https://gerrit.libreoffice.org/63009
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian 
(cherry picked from commit f29f873d8e638d566f53f9ac5712e49910ee4094)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85803
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/rdfhelper.hxx b/sw/inc/rdfhelper.hxx
index 9ccb39156cb3..b7934678d5f9 100644
--- a/sw/inc/rdfhelper.hxx
+++ b/sw/inc/rdfhelper.hxx
@@ -26,6 +26,7 @@ namespace com { namespace sun { namespace star {
 class XModel;
 }
 namespace rdf {
+class XDocumentMetadataAccess;
 class XResource;
 class XURI;
 }
@@ -35,6 +36,11 @@ namespace com { namespace sun { namespace star {
 class SW_DLLPUBLIC SwRDFHelper
 {
 public:
+/// Gets all graph-names in RDF of a given type.
+static css::uno::Sequence>
+getGraphNames(const 
css::uno::Reference& xDocumentMetadataAccess,
+  const css::uno::Reference& xType);
+
 /// Gets all graph-names in RDF of a given type.
 static css::uno::Sequence>
 getGraphNames(const css::uno::Reference& xModel, const 
OUString& rType);
diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx
index 29e9e8dcf230..d1fb7d4dbf4f 100644
--- a/sw/source/core/doc/rdfhelper.cxx
+++ b/sw/source/core/doc/rdfhelper.cxx
@@ -23,15 +23,40 @@
 
 using namespace com::sun::star;
 
+css::uno::Sequence> 
SwRDFHelper::getGraphNames(
+const css::uno::Reference& 
xDocumentMetadataAccess,
+const css::uno::Reference& xType)
+{
+try
+{
+return xDocumentMetadataAccess->getMetadataGraphsWithType(xType);
+}
+catch (const uno::RuntimeException&)
+{
+return uno::Sequence>();
+}
+}
+
 css::uno::Sequence>
 SwRDFHelper::getGraphNames(const css::uno::Reference& 
xModel,
const OUString& rType)
 {
-uno::Reference xComponentContext(
-comphelper::getProcessComponentContext());
-uno::Reference xType = rdf::URI::create(xComponentContext, 
rType);
-uno::Reference 
xDocumentMetadataAccess(xModel, uno::UNO_QUERY);
-return xDocumentMetadataAccess->getMetadataGraphsWithType(xType);
+try
+{
+uno::Reference xComponentContext(
+comphelper::getProcessComponentContext());
+// rdf::URI::create may fail with type: 
com.sun.star.uno.DeploymentException
+// message: component context fails to supply service 
com.sun.star.rdf.URI of type com.sun.star.rdf.XURI
+// context: cppu::ComponentContext
+uno::Reference xType = rdf::URI::create(xComponentContext, 
rType);
+uno::Reference 
xDocumentMetadataAccess(xModel,
+ 
uno::UNO_QUERY);
+return getGraphNames(xDocumentMetadataAccess, xType);
+}
+catch (const ::css::uno::Exception&)
+{
+return uno::Sequence>();
+}
 }
 
 std::map
@@ -76,7 +101,7 @@ void SwRDFHelper::addStatement(const 
css::uno::Reference& xM
 uno::Reference 
xComponentContext(comphelper::getProcessComponentContext());
 uno::Reference xType = rdf::URI::create(xComponentContext, 
rType);
 uno::Reference 
xDocumentMetadataAccess(xModel, uno::UNO_QUERY);
-uno::Sequence< uno::Reference > aGraphNames = 
xDocumentMetadataAccess->getMetadataGraphsWithType(xType);
+const uno::Sequence< uno::Reference > aGraphNames = 
getGraphNames(xDocumentMetadataAccess, xType);
 uno::Reference xGraphName;
 if (aGraphNames.hasElements())
 xGraphName = aGraphNames[0];
@@ -96,8 +121,7 @@ bool SwRDFHelper::hasMetadataGraph(const 
css::uno::Reference
 uno::Reference 
xComponentContext(comphelper::getProcessComponentContext());
 uno::Reference xType = rdf::URI::create(xComponentContext, 
rType);
 uno::Reference 
xDocumentMetadataAccess(xModel, uno::UNO_QUERY);
-uno::Sequence< uno::Reference > aGraphNames = 
xDocumentMetadataAccess->getMetadataGraphsWithType(xType);
-return aGraphNames.hasElements();
+return getGraphNames(xDocumentMetadataAccess, xType).hasElements();
 }
 
 void SwRDFHelper::removeStatement(const 
css::uno::Reference& xModel,
@@ -108,7 +132,7 @@ void SwRDFHelper::removeStatement(const 
css::uno::Reference&
 uno::Reference 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2019-12-25 Thread Ashod Nakashian (via logerrit)
 sw/inc/rdfhelper.hxx |   11 ++
 sw/source/core/doc/rdfhelper.cxx |   42 +++
 2 files changed, 41 insertions(+), 12 deletions(-)

New commits:
commit 391db9909b9456042492b3fdc73eff140d724adf
Author: Ashod Nakashian 
AuthorDate: Mon Oct 1 07:22:00 2018 -0400
Commit: Ashod Nakashian 
CommitDate: Thu Dec 26 03:42:46 2019 +0100

sw: rdf: Split graph-name lookup from getStatement

The graph-name lookup is significantly costly (compared
to the statement lookup, esp. when no statements exist).
Luckily, the graph-names do not change often and in the
course of enumerating all paragraphs (as happens for
paragraph-signature validation) it doesn't change at all.

This split allows for doing the graph-name lookup only
once and also allows for passing custom graph-names
directly, if we know them already.

Reviewed-on: https://gerrit.libreoffice.org/63002
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian 
(cherry picked from commit d5c9288e00cf39292d077d58be550af566b779ac)

Change-Id: I75425df201becb41105ba1fa6ba580af202d035c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85802
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Ashod Nakashian 

diff --git a/sw/inc/rdfhelper.hxx b/sw/inc/rdfhelper.hxx
index 18ddd87127d7..9ccb39156cb3 100644
--- a/sw/inc/rdfhelper.hxx
+++ b/sw/inc/rdfhelper.hxx
@@ -17,6 +17,7 @@
 #include "swdllapi.h"
 
 #include 
+#include 
 
 class SwTextNode;
 
@@ -26,6 +27,7 @@ namespace com { namespace sun { namespace star {
 }
 namespace rdf {
 class XResource;
+class XURI;
 }
 }}}
 
@@ -33,6 +35,15 @@ namespace com { namespace sun { namespace star {
 class SW_DLLPUBLIC SwRDFHelper
 {
 public:
+/// Gets all graph-names in RDF of a given type.
+static css::uno::Sequence>
+getGraphNames(const css::uno::Reference& xModel, const 
OUString& rType);
+
+/// Gets all (XResource, key, value) statements in RDF graphs given the 
graph-names.
+static std::map
+getStatements(const css::uno::Reference& xModel,
+  const 
css::uno::Sequence>& rGraphNames,
+  const css::uno::Reference& xSubject);
 
 /// Gets all (XResource, key, value) statements in RDF graphs of type 
rType.
 static std::map getStatements(const 
css::uno::Reference& xModel,
diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx
index 8e8c78d90313..29e9e8dcf230 100644
--- a/sw/source/core/doc/rdfhelper.cxx
+++ b/sw/source/core/doc/rdfhelper.cxx
@@ -23,26 +23,36 @@
 
 using namespace com::sun::star;
 
-std::map SwRDFHelper::getStatements(const 
css::uno::Reference& xModel,
-const OUString& rType,
-const 
css::uno::Reference& xSubject)
+css::uno::Sequence>
+SwRDFHelper::getGraphNames(const css::uno::Reference& 
xModel,
+   const OUString& rType)
 {
-std::map aRet;
-
-uno::Reference 
xComponentContext(comphelper::getProcessComponentContext());
+uno::Reference xComponentContext(
+comphelper::getProcessComponentContext());
 uno::Reference xType = rdf::URI::create(xComponentContext, 
rType);
 uno::Reference 
xDocumentMetadataAccess(xModel, uno::UNO_QUERY);
-uno::Sequence< uno::Reference > aGraphNames = 
xDocumentMetadataAccess->getMetadataGraphsWithType(xType);
-if (!aGraphNames.hasElements())
+return xDocumentMetadataAccess->getMetadataGraphsWithType(xType);
+}
+
+std::map
+SwRDFHelper::getStatements(const css::uno::Reference& 
xModel,
+   const 
uno::Sequence>& rGraphNames,
+   const css::uno::Reference& 
xSubject)
+{
+std::map aRet;
+if (!rGraphNames.hasElements())
 return aRet;
 
-for (const uno::Reference& xGraphName : aGraphNames)
+uno::Reference 
xDocumentMetadataAccess(xModel, uno::UNO_QUERY);
+const uno::Reference& xRepo = 
xDocumentMetadataAccess->getRDFRepository();
+for (const uno::Reference& xGraphName : rGraphNames)
 {
-uno::Reference xGraph = 
xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName);
-uno::Reference xStatements = 
xGraph->getStatements(xSubject, uno::Reference(), 
uno::Reference());
+uno::Reference xGraph = xRepo->getGraph(xGraphName);
+uno::Reference xStatements = 
xGraph->getStatements(
+xSubject, uno::Reference(), 
uno::Reference());
 while (xStatements->hasMoreElements())
 {
-rdf::Statement aStatement = 
xStatements->nextElement().get();
+const rdf::Statement aStatement = 
xStatements->nextElement().get();
 aRet[aStatement.Predicate->getStringValue()] = 
aStatement.Object->getStringValue();
 }
 }
@@ -50,6 +60,14 @@ std::map 
SwRDFHelper::getStatements(const css::uno::Referenc
 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2019-11-29 Thread Scott Clarke (via logerrit)
 sw/inc/strings.hrc  |1 +
 sw/source/core/doc/doc.cxx  |2 ++
 sw/source/core/text/EnhancedPDFExportHelper.cxx |6 +-
 sw/source/uibase/docvw/AnnotationWin2.cxx   |   12 
 4 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit cf7d723194d7a20e9c014dcf94dff7edfc6b7c04
Author: Scott Clarke 
AuthorDate: Fri Sep 6 14:26:52 2019 +0100
Commit: Michael Meeks 
CommitDate: Fri Nov 29 14:29:29 2019 +0100

Make resolved comments appear resolved when printed

Added an indication to resolved comments when printing them or
exporting them as a PDF.

Change-Id: I9a84b76d6f12cca3c4541d19a0890cbd1cf430a7
Reviewed-on: https://gerrit.libreoffice.org/78712
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
Reviewed-on: https://gerrit.libreoffice.org/83740
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index f094e5736947..324c49c88051 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -659,6 +659,7 @@
 #define STR_POSTIT_SHOW NC_("STR_POSTIT_SHOW", "Show 
All")
 #define STR_POSTIT_HIDE NC_("STR_POSTIT_HIDE", "Hide 
All")
 #define STR_POSTIT_DELETE   NC_("STR_POSTIT_DELETE", 
"Delete All")
+#define STR_RESOLVEDNC_("STR_RESOLVED", "RESOLVED")
 
 #define STR_MARGIN_TOOLTIP_LEFT NC_("STR_MARGIN_TOOLTIP_LEFT", 
"Left: ")
 #define STR_MARGIN_TOOLTIP_RIGHT
NC_("STR_MARGIN_TOOLTIP_RIGHT", ". Right: ")
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 2c69bb7fa1fe..59ea8ea19672 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -616,6 +616,8 @@ static void lcl_FormatPostIt(
 aStr += " ";
 SvtSysLocale aSysLocale;
 aStr += /*(LocaleDataWrapper&)*/aSysLocale.GetLocaleData().getDate( 
pField->GetDate() );
+if(pField->GetResolved())
+aStr += " " + SwResId(STR_RESOLVED);
 pIDCO->InsertString( aPam, aStr );
 
 pIDCO->SplitNode( *aPam.GetPoint(), false );
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 4ad8d67964a2..8ddead098a80 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -75,6 +75,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1598,7 +1599,10 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
 pNumFormatter->GetOutputString( 
aDateDiff.GetDate(), nFormat, sDate,  );
 
 // The title should consist of the author and the 
date:
-aNote.Title = pField->GetPar1() + ", " + sDate;
+if(pField->GetResolved())
+aNote.Title = pField->GetPar1() + ", " + sDate 
+ ", " + SwResId(STR_RESOLVED);
+else
+aNote.Title = pField->GetPar1() + ", " + sDate;
 // Guess what the contents contains...
 aNote.Contents = pField->GetText();
 
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 1016118aedec..48db11fdd37e 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -300,6 +300,18 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const 
Point& rPt, const Size& rSz
 mpMetadataDate->SetControlFont( aOrigFont );
 }
 
+if (mpMetadataResolved->IsVisible())
+{
+vcl::Font aOrigFont(mpMetadataResolved->GetControlFont());
+Size aSize(PixelToLogic(mpMetadataResolved->GetSizePixel()));
+Point aPos(PixelToLogic(mpMetadataResolved->GetPosPixel()));
+aPos += rPt;
+vcl::Font aFont( 
mpMetadataResolved->GetSettings().GetStyleSettings().GetFieldFont() );
+mpMetadataResolved->SetControlFont( aFont );
+mpMetadataResolved->Draw(pDev, aPos, aSize, nInFlags);
+mpMetadataResolved->SetControlFont( aOrigFont );
+}
+
 mpSidebarTextControl->Draw(pDev, rPt, rSz, nInFlags);
 
 const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2019-08-27 Thread Scott Clarke (via logerrit)
 sw/inc/AnnotationWin.hxx  |2 
 sw/inc/strings.hrc|1 
 sw/source/uibase/docvw/AnnotationWin.cxx  |   11 +
 sw/source/uibase/docvw/AnnotationWin2.cxx |   64 +++---
 4 files changed, 72 insertions(+), 6 deletions(-)

New commits:
commit 4bfc562d8f9745bc4805ea06c73d4d53efee8a33
Author: Scott Clarke 
AuthorDate: Wed Jun 19 16:30:35 2019 +0100
Commit: Miklos Vajna 
CommitDate: Tue Aug 27 17:50:15 2019 +0200

tdf#119228 Add UI elements to display the resolved state

Co-authored-by: Jim MacArthur 
(cherry picked from commit 7ade0c7d03594bfa5c067f32230a1e4ed93d7fbb)

Change-Id: I3ba1572771bc893d2c74993a161d00c2acc70960
Reviewed-on: https://gerrit.libreoffice.org/78183
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 5682a846d486..5c0fb100b9c3 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -157,6 +157,7 @@ class SwAnnotationWin : public vcl::Window
 sal_Int32   GetMinimumSizeWithoutMeta();
 sal_Int32   GetMetaButtonAreaWidth();
 sal_Int32   GetScrollbarWidth();
+sal_Int32   GetNumFields();
 
 voidSetSpellChecking();
 
@@ -230,6 +231,7 @@ class SwAnnotationWin : public vcl::Window
 VclPtr  mpVScrollbar;
 VclPtr   mpMetadataAuthor;
 VclPtr   mpMetadataDate;
+VclPtr   mpMetadataResolved;
 VclPtr mpMenuButton;
 
 std::unique_ptr mpAnchor;
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 1bb9b35a7c1a..3c968c3914fa 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -557,6 +557,7 @@
 #define STR_ACCESS_PAGE_DESCNC_("STR_ACCESS_PAGE_DESC", 
"Page: $(ARG1)")
 #define STR_ACCESS_ANNOTATION_AUTHOR_NAME   
NC_("STR_ACCESS_ANNOTATION_AUTHOR_NAME", "Author")
 #define STR_ACCESS_ANNOTATION_DATE_NAME 
NC_("STR_ACCESS_ANNOTATION_DATE_NAME", "Date")
+#define STR_ACCESS_ANNOTATION_RESOLVED_NAME 
NC_("STR_ACCESS_ANNOTATION_RESOLVED_NAME", "Resolved")
 #define STR_ACCESS_ANNOTATION_BUTTON_NAME   
NC_("STR_ACCESS_ANNOTATION_BUTTON_NAME", "Actions")
 #define STR_ACCESS_ANNOTATION_BUTTON_DESC   
NC_("STR_ACCESS_ANNOTATION_BUTTON_DESC", "Activate this button to open a list 
of actions which can be performed on this comment and other comments")
 #define STR_ACCESS_PREVIEW_DOC_NAME 
NC_("STR_ACCESS_PREVIEW_DOC_NAME", "Document preview")
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx 
b/sw/source/uibase/docvw/AnnotationWin.cxx
index 9516d011ea99..1bef5a9d8740 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -147,6 +147,12 @@ void SwAnnotationWin::dispose()
 }
 mpMetadataAuthor.disposeAndClear();
 
+if (mpMetadataResolved)
+{
+mpMetadataResolved->RemoveEventListener( LINK( this, SwAnnotationWin, 
WindowEventListener ) );
+}
+mpMetadataResolved.disposeAndClear();
+
 if (mpMetadataDate)
 {
 mpMetadataDate->RemoveEventListener( LINK( this, SwAnnotationWin, 
WindowEventListener ) );
@@ -216,6 +222,11 @@ void SwAnnotationWin::SetResolved(bool resolved)
 
static_cast(mpFormatField->GetField())->SetResolved(resolved);
 mrSidebarItem.bShow = !IsResolved();
 
+if(IsResolved())
+mpMetadataResolved->Show();
+else
+mpMetadataResolved->Hide();
+
 mbResolvedStateUpdated = true;
 UpdateData();
 Invalidate();
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 39bea61bfdf5..c504bef5c5e1 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -153,7 +153,7 @@ namespace sw { namespace annotation {
 #define METABUTTON_WIDTH16
 #define METABUTTON_HEIGHT   18
 #define METABUTTON_AREA_WIDTH   30
-#define POSTIT_META_HEIGHT  sal_Int32(30)
+#define POSTIT_META_FIELD_HEIGHT  sal_Int32(15)
 #define POSTIT_MINIMUMSIZE_WITHOUT_META 50
 
 
@@ -173,11 +173,13 @@ void SwAnnotationWin::Paint(vcl::RenderContext& 
rRenderContext, const tools::Rec
 rRenderContext.SetFillColor(mColorDark);
 }
 
+sal_uInt32 boxHeight = mpMetadataAuthor->GetSizePixel().Height() + 
mpMetadataDate->GetSizePixel().Height();
+boxHeight += IsThreadResolved() ? 
mpMetadataResolved->GetSizePixel().Height() : 0;
+
 rRenderContext.SetLineColor();
 tools::Rectangle aRectangle(Point(mpMetadataAuthor->GetPosPixel().X() 
+ mpMetadataAuthor->GetSizePixel().Width(),
mpMetadataAuthor->GetPosPixel().Y()),
- Size(GetMetaButtonAreaWidth(),
-  mpMetadataAuthor->GetSizePixel().Height() + 
mpMetadataDate->GetSizePixel().Height()));
+ 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/inc sw/source

2019-07-16 Thread Miklos Vajna (via logerrit)
 sw/inc/postithelper.hxx   |7 +++
 sw/source/core/fields/postithelper.cxx|1 +
 sw/source/uibase/docvw/AnnotationWin2.cxx |3 ++-
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit aeff40f65f421128ab6c07247ac106cded7323a2
Author: Miklos Vajna 
AuthorDate: Mon Jul 15 15:33:39 2019 +0200
Commit: Miklos Vajna 
CommitDate: Tue Jul 16 10:23:07 2019 +0200

sw comments on frames: avoid overlay that covers only an at-char image

The comment is already attached to the image via the anchor, and the
overlay would change the image, which is confusing.

(cherry picked from commit 5914fae974875366026bb3b1245ef8bffeadd7d2)

Change-Id: I7a1c2a25182f628effa224fb82b5bcd71fdf35d4
Reviewed-on: https://gerrit.libreoffice.org/75675
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
index 2a9fb448f7da..84d9674063c0 100644
--- a/sw/inc/postithelper.hxx
+++ b/sw/inc/postithelper.hxx
@@ -56,6 +56,12 @@ struct SwLayoutInfo
 
 std::size_t mRedlineAuthor;
 
+/**
+ * If true, the overlay arrow points to the comment anchor, otherwise it 
points to the commented
+ * frame.
+ */
+bool mPositionFromCommentAnchor;
+
 SwLayoutInfo()
 : mpAnchorFrame(nullptr)
 , mPosition()
@@ -66,6 +72,7 @@ struct SwLayoutInfo
 , mnPageNumber(1)
 , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE)
 , mRedlineAuthor(0)
+, mPositionFromCommentAnchor(true)
 {}
 };
 
diff --git a/sw/source/core/fields/postithelper.cxx 
b/sw/source/core/fields/postithelper.cxx
index d692e829a7c6..26cdd2bf8384 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -142,6 +142,7 @@ SwPostItHelper::SwLayoutStatus 
SwPostItHelper::getLayoutInfos(
 {
 pTextFrame->GetCharRect(o_rInfo.mPosition, rAnchorPos, 
nullptr, false);
 }
+o_rInfo.mPositionFromCommentAnchor = 
bPositionFromCommentAnchor;
 }
 if (pAnnotationMark != nullptr)
 {
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx 
b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 380831b966c8..d5309d0cc8d3 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -794,7 +794,8 @@ void SwAnnotationWin::SetPosAndSize()
 if (bDisableMapMode)
 EditWin().EnableMapMode(false);
 
-pTmpCursorForAnnotationTextRange->FillRects();
+if (mrSidebarItem.maLayoutInfo.mPositionFromCommentAnchor)
+pTmpCursorForAnnotationTextRange->FillRects();
 
 if (bDisableMapMode)
 EditWin().EnableMapMode();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits