[Libreoffice-commits] core.git: offapi/com sw/inc sw/source writerfilter/source

2023-10-30 Thread Skyler Grey (via logerrit)
 offapi/com/sun/star/text/textfield/GetReference.idl |4 
 sw/inc/unoprnms.hxx |1 +
 sw/source/core/fields/reffld.cxx|   10 ++
 sw/source/core/inc/unofldmid.h  |2 ++
 sw/source/core/unocore/unofield.cxx |   12 +++-
 sw/source/core/unocore/unomap.cxx   |1 +
 sw/source/filter/ww8/ww8atr.cxx |   11 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |   18 ++
 writerfilter/source/dmapper/PropertyIds.cxx |1 +
 writerfilter/source/dmapper/PropertyIds.hxx |1 +
 10 files changed, 60 insertions(+), 1 deletion(-)

New commits:
commit e195c22533de44cd4f6afab7836c7eb6a613d202
Author: Skyler Grey 
AuthorDate: Fri Oct 20 13:07:12 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Oct 30 20:04:01 2023 +0100

Enable STYLEREF flag export/import with OOXML

This commit enables exporting the following STYLEREF flags with OOXML
- Search from bottom to top
- Hide non numerical

After this commit, the following steps have been implemented
- The document model (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The layout (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- The UI (I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19)
- UNO
- DOCX filter

Change-Id: Ib664fec059aa1f7f130acc76c253d5d298fa59f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158350
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/offapi/com/sun/star/text/textfield/GetReference.idl 
b/offapi/com/sun/star/text/textfield/GetReference.idl
index 11bfc92b7705..c686b00b23cf 100644
--- a/offapi/com/sun/star/text/textfield/GetReference.idl
+++ b/offapi/com/sun/star/text/textfield/GetReference.idl
@@ -62,6 +62,10 @@ published service GetReference
 
  */
 [optional, property] string ReferenceFieldLanguage;
+/** contains extra flags which can modify the behaviour of the field
+@since LibreOffice 24.2
+ */
+[optional, property] short ReferenceFieldFlags;
 };
 
 
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 1ab2395fa67d..e83b1b601ef4 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -307,6 +307,7 @@ inline constexpr OUString UNO_NAME_PAGE_NUMBER_OFFSET = 
u"PageNumberOffset"_ustr
 inline constexpr OUString UNO_NAME_PLACEHOLDER = u"PlaceHolder"_ustr;
 inline constexpr OUString UNO_NAME_PLACEHOLDER_TYPE = u"PlaceHolderType"_ustr;
 inline constexpr OUString UNO_NAME_PRINT = u"Print"_ustr;
+inline constexpr OUString UNO_NAME_REFERENCE_FIELD_FLAGS = 
u"ReferenceFieldFlags"_ustr;
 inline constexpr OUString UNO_NAME_REFERENCE_FIELD_PART = 
u"ReferenceFieldPart"_ustr;
 inline constexpr OUString UNO_NAME_REFERENCE_FIELD_SOURCE = 
u"ReferenceFieldSource"_ustr;
 inline constexpr OUString UNO_NAME_REFERENCE_FIELD_LANGUAGE = 
u"ReferenceFieldLanguage"_ustr;
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 96b9716f7eac..638baf0a5474 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -974,6 +974,9 @@ bool SwGetRefField::QueryValue( uno::Any& rAny, sal_uInt16 
nWhichId ) const
 rAny <<= nSource;
 }
 break;
+case FIELD_PROP_USHORT3:
+rAny <<= m_nFlags;
+break;
 case FIELD_PROP_PAR1:
 {
 OUString sTmp(GetPar1());
@@ -1076,6 +1079,13 @@ bool SwGetRefField::PutValue( const uno::Any& rAny, 
sal_uInt16 nWhichId )
 case FIELD_PROP_PAR4:
 rAny >>= m_sSetReferenceLanguage;
 break;
+case FIELD_PROP_USHORT3:
+{
+sal_uInt16 nSetFlags = 0;
+rAny >>= nSetFlags;
+m_nFlags = nSetFlags;
+}
+break;
 case FIELD_PROP_SHORT1:
 {
 sal_Int16 nSetSeq = 0;
diff --git a/sw/source/core/inc/unofldmid.h b/sw/source/core/inc/unofldmid.h
index 59f4583f3d6f..8c1838f45636 100644
--- a/sw/source/core/inc/unofldmid.h
+++ b/sw/source/core/inc/unofldmid.h
@@ -51,6 +51,8 @@
 #define FIELD_PROP_PAR6 36
 #define FIELD_PROP_PAR7 37
 
+#define FIELD_PROP_USHORT3  38
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index b5d423e8fd42..74b530ed5a28 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1043,6 +1043,7 @@ struct SwFieldProperties_Impl
 sal_Int32   nFormat;
 sal_uInt16  nUSHORT1;
 sal_uInt16  nUSHORT2;
+sal_uInt16  nUSHORT3;
 sal_Int16   nSHORT1;
 sal_Int8nByte1;
 boolbFormatIsDefault;
@@ -1058,6 +1059,7 @@ struct SwFieldProperties_Impl
 nFormat(0),
 nUSHORT1(0),
 nUSHORT2(0),
+nUSHORT3(0),
 nSHORT1(0),
 nByte1(0),
 bFormatIsDefa

[Libreoffice-commits] core.git: offapi/com sw/inc sw/source writerfilter/qa writerfilter/source

2022-10-26 Thread Miklos Vajna (via logerrit)
 offapi/com/sun/star/text/ContentControl.idl
  |   10 +++-
 sw/inc/unoprnms.hxx
  |1 
 sw/source/core/txtnode/attrcontentcontrol.cxx  
  |   11 +++-
 sw/source/core/unocore/unocontentcontrol.cxx   
  |7 +++
 sw/source/core/unocore/unomap1.cxx 
  |1 
 writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx 
  |   23 ++
 
writerfilter/qa/cppunittests/dmapper/data/content-control-date-data-binding.docx
 |binary
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  
  |   18 ++-
 8 files changed, 64 insertions(+), 7 deletions(-)

New commits:
commit 58002ab85d992c7ac44d8bb4d135246b67aa5cc7
Author: Miklos Vajna 
AuthorDate: Wed Oct 26 10:03:04 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 26 10:47:59 2022 +0200

sw content controls: enable data binding for date

The document had a 2022 date in document.xml, but had a 2012 date in
data binding. Writer used to show 2022, while Word picks 2012.

Data binding for dates were disabled in commit
de90c192cb8f1f03a4028493d8bfe9a127a76b2a (sw content controls, plain
text: enable DOCX filter with data binding, 2022-09-19), because the
formatting of those date timestamps were missing, so it was better to
just not update them from data binding, temporarily.

Fix the problem by adding a new read-only DateString property on
SwXContentControl, this way the import filter can set not only the
timestamp but the formatted date as well.

This shares the SwContentControl::GetDateString() code with the UI,
which already had the need in the past to turn a timestamp into a
date string, based on a provided language and date format.

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

diff --git a/offapi/com/sun/star/text/ContentControl.idl 
b/offapi/com/sun/star/text/ContentControl.idl
index 8f390665c2b3..ae8a0e1a9396 100644
--- a/offapi/com/sun/star/text/ContentControl.idl
+++ b/offapi/com/sun/star/text/ContentControl.idl
@@ -100,17 +100,23 @@ service ContentControl
 */
 [optional, property] boolean ComboBox;
 
-/** The alias: just remembered.
+/** The alias: kind of a human-readable title / description, show up on 
the UI.
 
 @since LibreOffice 7.5
 */
 [optional, property] string Alias;
 
-/** The tag: just remembered.
+/** The tag: similar to Alias, but is meant to be machine-readable.
 
 @since LibreOffice 7.5
 */
 [optional, property] string Tag;
+
+/** The formatted date string, based on DateFormat, DateLanguage and 
CurrentDate.
+
+@since LibreOffice 7.5
+*/
+[optional, property, readonly] string DateString;
 };
 
 
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 0a21fd182690..61cdcbb05938 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -892,6 +892,7 @@
 #define UNO_NAME_COLOR "Color"
 #define UNO_NAME_ALIAS "Alias"
 #define UNO_NAME_TAG "Tag"
+#define UNO_NAME_DATE_STRING "DateString"
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/attrcontentcontrol.cxx 
b/sw/source/core/txtnode/attrcontentcontrol.cxx
index 587d2f53ed74..fe530f8b9128 100644
--- a/sw/source/core/txtnode/attrcontentcontrol.cxx
+++ b/sw/source/core/txtnode/attrcontentcontrol.cxx
@@ -240,9 +240,14 @@ OUString SwContentControl::GetDateString() const
 
 const Color* pColor = nullptr;
 OUString aFormatted;
-if (!m_oSelectedDate)
+double fSelectedDate = 0;
+if (m_oSelectedDate)
 {
-return OUString();
+fSelectedDate = *m_oSelectedDate;
+}
+else
+{
+fSelectedDate = GetCurrentDateValue();
 }
 
 if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
@@ -250,7 +255,7 @@ OUString SwContentControl::GetDateString() const
 return OUString();
 }
 
-pNumberFormatter->GetOutputString(*m_oSelectedDate, nFormat, aFormatted, 
&pColor, false);
+pNumberFormatter->GetOutputString(fSelectedDate, nFormat, aFormatted, 
&pColor, false);
 return aFormatted;
 }
 
diff --git a/sw/source/core/unocore/unocontentcontrol.cxx 
b/sw/source/core/unocore/unocontentcontrol.cxx
index a0d7d96099cc..189cdb9ba316 100644
--- a/sw/source/core/unocore/unocontentcontrol.cxx
+++ b/sw/source/core/unocore/unocontentcontrol.cxx
@@ -1168,6 +1168,13 @@ uno::Any SAL_CALL 
SwXContentControl::getPropertyValue(const OUString& rPropertyN
 aRet <<= m_pImpl->m_pContentControl->GetTag();
 }
 }
+else if (rPropertyName == UNO_NAME_DATE_STRING)
+{
+if (!m_pImpl->m_bIsDescriptor)
+{
+aRet <<= m_pImpl->m_

[Libreoffice-commits] core.git: offapi/com sw/inc sw/source

2014-02-12 Thread Jan-Marek Glogowski
 offapi/com/sun/star/text/MailMerge.idl |7 +++
 sw/inc/dbmgr.hxx   |4 ++--
 sw/source/ui/dbui/dbmgr.cxx|7 ++-
 sw/source/ui/inc/unomailmerge.hxx  |   15 +--
 sw/source/ui/uno/unomailmerge.cxx  |   33 -
 5 files changed, 60 insertions(+), 6 deletions(-)

New commits:
commit 1a12777f46954045afbe8fffa6dd199b4b338762
Author: Jan-Marek Glogowski 
Date:   Sun Dec 22 17:42:20 2013 +0100

Export MailMerge cancel functionality via UNO.

If you start a mail merge jobs via UNO, there is no way to cancel
it. But the functionality is already implemented and used by the
LO internal mail merge dialogs.

This patch adds an optional XCancellable interface to the MailMerge
service and implements it in the SwXMailMerge class.

As the XJob::execute function already uses the SolarMutex to
prevent parallel runs, XCancellable::cancel can be implemented by
storing the SwNewDBMgr in the private variable m_pMgr, protected by
a mutex.

The bCancel member has to be converted from a bitfield value to a
real boolean, because otherwise all bitfield values would have to
be protected by a mutex. Bitfield assignments aren't atomic as you
always have to replace at least a byte.

Change-Id: I007cc23fdf04ccfca7d3cd6180b0e17e99f53061
Reviewed-on: https://gerrit.libreoffice.org/7190
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/offapi/com/sun/star/text/MailMerge.idl 
b/offapi/com/sun/star/text/MailMerge.idl
index f669d71..9741182 100644
--- a/offapi/com/sun/star/text/MailMerge.idl
+++ b/offapi/com/sun/star/text/MailMerge.idl
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
  module com {  module sun {  module star {  module text {
@@ -51,6 +52,12 @@ published service MailMerge
  */
 interface com::sun::star::task::XJob;
 
+/** interface to cancel the current mail merge job.
+
+@since LibreOffice 4.3
+ */
+[optional] interface com::sun::star::util::XCancellable;
+
 /** interface to access the services properties.
  */
 interface com::sun::star::beans::XPropertySet;
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index 009584f..e5ab96e 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -190,10 +190,9 @@ friend class SwConnectionDisposedListener_Impl;
 OUStringsEMailAddrFld;  ///< Mailing: Column name of email 
address.
 OUStringsSubject;   ///< Mailing: Subject
 OUStringsAttached;  ///< Mailing: Attached Files.
+sal_BoolbCancel;///< Mail merge canceled.
 sal_BoolbInitDBFields : 1;
 sal_BoolbSingleJobs : 1;///< Printing job when called from 
Basic.
-sal_BoolbCancel : 1;///< Mail merge save canceled.
-
 sal_BoolbInMerge: 1;///< merge process active
 sal_BoolbMergeSilent : 1;   ///< suppress display of 
dialogs/boxes (used when called over API)
 sal_BoolbMergeLock : 1; /**< prevent update of database 
fields while document is
@@ -233,6 +232,7 @@ public:
 /// Merging of data records into fields.
 sal_BoolMergeNew( const SwMergeDescriptor& rMergeDesc );
 sal_BoolMerge(SwWrtShell* pSh);
+voidMergeCancel();
 
 /// Initialize data fields that lack name of database.
 inline sal_Bool IsInitDBFields() const  { return bInitDBFields; }
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 63d70d1..192d29e 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -1355,10 +1355,15 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* 
pSourceShell,
 return bNoError;
 }
 
+void SwNewDBMgr::MergeCancel()
+{
+bCancel = sal_True;
+}
+
 IMPL_LINK_INLINE_START( SwNewDBMgr, PrtCancelHdl, Button *, pButton )
 {
 pButton->GetParent()->Hide();
-bCancel = sal_True;
+MergeCancel();
 return 0;
 }
 IMPL_LINK_INLINE_END( SwNewDBMgr, PrtCancelHdl, Button *, pButton )
diff --git a/sw/source/ui/inc/unomailmerge.hxx 
b/sw/source/ui/inc/unomailmerge.hxx
index 2be74c6..09d4beb 100644
--- a/sw/source/ui/inc/unomailmerge.hxx
+++ b/sw/source/ui/inc/unomailmerge.hxx
@@ -20,7 +20,7 @@
 #ifndef INCLUDED_SW_SOURCE_UI_INC_UNOMAILMERGE_HXX
 #define INCLUDED_SW_SOURCE_UI_INC_UNOMAILMERGE_HXX
 
-#include 
+#include 
 #include 
 #include 
 
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -76,16 +77,22 @@ typedef cppu::OMultiTypeInterfaceContainerHelperVar
 
 
 
+class SwNewDBMgr;
+class MailMergeExecuteFinalizer;
+
 class SwXMailMerge :
-public cppu::WeakImplHelper5
+public cppu::WeakImplHelper6
 <
 com::sun::star::task::XJob,
+com::sun::star::util: