summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-05-14 15:09:02 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2017-05-31 21:50:58 +0200
commitabf39e521178e3438dc507167e18a24d160b3fd5 (patch)
tree0a65eb59b77303e76f81f47fbc7e3db121bc0135 /sfx2
parent115577b1c3cf42f4831d79be41f512fa21383832 (diff)
Watermark: Insert watermark command
* added new command .uno:Watermark * if no arguments are provided the dialog is opened where user can enter the text * with provided Text argument the watermark is created * created SfxWatermarkItem to transfer watermark properties * dialog loads current setings * SetClassification use SetWatermark Change-Id: Ifc1319f5aa7c11bb141f8e4b5b9a5088613021c2 Reviewed-on: https://gerrit.libreoffice.org/37599 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/sdi/sfx.sdi17
-rw-r--r--sfx2/sdi/sfxitems.sdi1
-rw-r--r--sfx2/source/doc/watermarkitem.cxx67
4 files changed, 86 insertions, 0 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 647078f5f500..17fd09f772dc 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -236,6 +236,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/doc/syspath \
sfx2/source/doc/zoomitem \
sfx2/source/doc/templatedlg \
+ sfx2/source/doc/watermarkitem \
sfx2/source/doc/saveastemplatedlg \
sfx2/source/explorer/nochaos \
sfx2/source/inet/inettbc \
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 0347532228af..88735bbf9088 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -4457,6 +4457,23 @@ SfxVoidItem ClassificationApply SID_CLASSIFICATION_APPLY
GroupId = GID_DOCUMENT;
]
+SfxWatermarkItem Watermark SID_WATERMARK
+(SfxStringItem Text SID_WATERMARK)
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
SfxUInt16Item SwitchViewShell SID_VIEWSHELL
[
diff --git a/sfx2/sdi/sfxitems.sdi b/sfx2/sdi/sfxitems.sdi
index ab1b3fd067e0..3a45c573ab1e 100644
--- a/sfx2/sdi/sfxitems.sdi
+++ b/sfx2/sdi/sfxitems.sdi
@@ -34,6 +34,7 @@
item String SfxObjectShellItem //! Dummy
item String SfxUsrAnyItem //! Dummy
item String SfxUnoFrameItem //! Dummy
+ item String SfxWatermarkItem //! Dummy
struct Point
{
diff --git a/sfx2/source/doc/watermarkitem.cxx b/sfx2/source/doc/watermarkitem.cxx
new file mode 100644
index 000000000000..00c31f25d823
--- /dev/null
+++ b/sfx2/source/doc/watermarkitem.cxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sfx2/watermarkitem.hxx>
+#include <sfx2/sfxsids.hrc>
+
+SfxWatermarkItem::SfxWatermarkItem()
+: SfxPoolItem( SID_WATERMARK )
+, m_aText( "" )
+{
+}
+
+SfxPoolItem* SfxWatermarkItem::CreateDefault()
+{
+ return new SfxWatermarkItem();
+}
+
+SfxWatermarkItem::SfxWatermarkItem( sal_uInt16 nWhichId, const OUString& rText )
+: SfxPoolItem( nWhichId )
+, m_aText( rText )
+{
+}
+
+SfxWatermarkItem::SfxWatermarkItem( const SfxWatermarkItem& rCopy )
+: SfxPoolItem( rCopy )
+, m_aText( rCopy.m_aText )
+{
+}
+
+bool SfxWatermarkItem::operator==( const SfxPoolItem& rCmp ) const
+{
+ return ( SfxPoolItem::operator==( rCmp ) &&
+ m_aText == static_cast<const SfxWatermarkItem&>(rCmp).m_aText );
+}
+
+SfxPoolItem* SfxWatermarkItem::Clone( SfxItemPool *) const
+{
+ return new SfxWatermarkItem(*this);
+}
+
+bool SfxWatermarkItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ rVal <<= m_aText;
+
+ return true;
+}
+
+bool SfxWatermarkItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ OUString aText;
+
+ if ( rVal >>= aText )
+ {
+ m_aText = aText;
+ return true;
+ }
+
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */