diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2017-05-14 15:09:02 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2017-05-18 00:44:34 +0200 |
commit | 08de2c31cb0da07ffc23f813379f810607e1cc7e (patch) | |
tree | 0e7152435d71df47c6a1adb17025d627862d801d /sfx2 | |
parent | 3884bb38f0712b6b1616b5d788cd00e90b14fcd3 (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.mk | 1 | ||||
-rw-r--r-- | sfx2/sdi/sfx.sdi | 17 | ||||
-rw-r--r-- | sfx2/sdi/sfxitems.sdi | 1 | ||||
-rw-r--r-- | sfx2/source/doc/watermarkitem.cxx | 67 |
4 files changed, 86 insertions, 0 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 5b0ca8cccd85..16f52bab5b57 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -233,6 +233,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 4622d3f838c9..6fce89a16635 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -4267,6 +4267,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: */ |