summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-07-20 14:42:55 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-07-26 16:50:32 +0200
commitff09dd0bdcd64503c15f4b9ee4cdf6238426437c (patch)
tree205834165e220cea03fdaf22c5320a19b9540daa /sw/inc
parentcd38c23ed291e52fbb3cf0ce6070081e6aecff22 (diff)
sw content controls, plain text: add doc model & UNO API
OOXML's <w:sdt> with <w:text> describes a plain text content control. We are currently mapping this to fields, and then on export it's possible to map this to FORMTEXT fields. The trouble is that our doc model could not differentiate between content controls and fields for non-formatted form text, so the exporter can't do the opposite of import. This has the benefit that input fields do a reasonable job of providing the feature set of plain text content controls, but it has the downside that we map two OOXML features to a single Writer concept, loosing formatting. Fix this by introducing a dedicated "plain text" content control type, which can be used for OOXML's <w:sdt> with <w:text>, and keep using the input field only for OOXML fields. This commit just adds the document model & UNO API, follow-up commits will add the remaining functionality. (cherry picked from commit da8e95ebe0dce032cfbe37602ebb013869dc1e6d) Conflicts: sw/qa/core/unocore/unocore.cxx Change-Id: I0a0317adbd5f58c6ab880dccf6170292462d2671 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137470 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/formatcontentcontrol.hxx8
-rw-r--r--sw/inc/unoprnms.hxx1
2 files changed, 9 insertions, 0 deletions
diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx
index b40c9cdba0d7..6c1dffd240ae 100644
--- a/sw/inc/formatcontentcontrol.hxx
+++ b/sw/inc/formatcontentcontrol.hxx
@@ -44,6 +44,7 @@ enum class SwContentControlType
DROP_DOWN_LIST,
PICTURE,
DATE,
+ PLAIN_TEXT,
};
/// SfxPoolItem subclass that wraps an SwContentControl.
@@ -142,6 +143,9 @@ class SW_DLLPUBLIC SwContentControl : public sw::BroadcastingModify
/// Date in YYYY-MM-DDT00:00:00Z format.
OUString m_aCurrentDate;
+ /// Plain text, i.e. not rich text.
+ bool m_bPlainText = false;
+
/// The placeholder's doc part: just remembered.
OUString m_aPlaceholderDocPart;
@@ -257,6 +261,10 @@ public:
/// Formats m_oSelectedDate, taking m_aDateFormat and m_aDateLanguage into account.
OUString GetDateString() const;
+ void SetPlainText(bool bPlainText) { m_bPlainText = bPlainText; }
+
+ bool GetPlainText() const { return m_bPlainText; }
+
void SetPlaceholderDocPart(const OUString& rPlaceholderDocPart)
{
m_aPlaceholderDocPart = rPlaceholderDocPart;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 1ac7b671c695..f31523e73d3e 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -880,6 +880,7 @@
#define UNO_NAME_DATE_FORMAT "DateFormat"
#define UNO_NAME_DATE_LANGUAGE "DateLanguage"
#define UNO_NAME_CURRENT_DATE "CurrentDate"
+#define UNO_NAME_PLAIN_TEXT "PlainText"
#define UNO_NAME_PLACEHOLDER_DOC_PART "PlaceholderDocPart"
#define UNO_NAME_DATA_BINDING_PREFIX_MAPPINGS "DataBindingPrefixMappings"
#define UNO_NAME_DATA_BINDING_XPATH "DataBindingXpath"