summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/inc/format.hxx1
-rw-r--r--sw/inc/formatflysplit.hxx52
-rw-r--r--sw/inc/hintids.hxx53
-rw-r--r--sw/inc/swatrset.hxx2
-rw-r--r--sw/qa/core/attr/attr.cxx23
-rw-r--r--sw/source/core/attr/formatflysplit.cxx39
-rw-r--r--sw/source/core/bastyp/init.cxx5
8 files changed, 148 insertions, 28 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index fa2ca1663512..05dd36258649 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -138,6 +138,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/core/attr/fmtfollowtextflow \
sw/source/core/attr/fmtwrapinfluenceonobjpos \
sw/source/core/attr/format \
+ sw/source/core/attr/formatflysplit \
sw/source/core/attr/hints \
sw/source/core/attr/swatrset \
sw/source/core/bastyp/SwSmartTagMgr \
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index f9dcb30b2874..c5b599d36d31 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -233,6 +233,7 @@ public:
inline const SwFormatEditInReadonly &GetEditInReadonly( bool = true ) const;
inline const SwFormatLayoutSplit &GetLayoutSplit( bool = true ) const;
inline const SwFormatRowSplit &GetRowSplit( bool = true ) const;
+ inline const SwFormatFlySplit &GetFlySplit( bool = true ) const;
inline const SwFormatChain &GetChain( bool = true ) const;
inline const SwFormatFootnoteAtTextEnd &GetFootnoteAtTextEnd( bool = true ) const;
inline const SwFormatEndAtTextEnd &GetEndAtTextEnd( bool = true ) const;
diff --git a/sw/inc/formatflysplit.hxx b/sw/inc/formatflysplit.hxx
new file mode 100644
index 000000000000..a7cbb82847bb
--- /dev/null
+++ b/sw/inc/formatflysplit.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <svl/eitem.hxx>
+
+#include "swdllapi.h"
+#include "hintids.hxx"
+#include "format.hxx"
+
+/// Determines if a fly frame can be split across multiple pages.
+class SW_DLLPUBLIC SwFormatFlySplit final : public SfxBoolItem
+{
+public:
+ SwFormatFlySplit(bool bSplit = false)
+ : SfxBoolItem(RES_FLY_SPLIT, bSplit)
+ {
+ }
+
+ SwFormatFlySplit* Clone(SfxItemPool* pPool = nullptr) const override;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+};
+
+inline const SwFormatFlySplit& SwAttrSet::GetFlySplit(bool bInP) const
+{
+ return Get(RES_FLY_SPLIT, bInP);
+}
+
+inline const SwFormatFlySplit& SwFormat::GetFlySplit(bool bInP) const
+{
+ return m_aSet.GetFlySplit(bInP);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index e2392cf0007e..8d0c14f23572 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -116,6 +116,7 @@ class SwFormatLineNumber;
class SwFormatNoBalancedColumns;
class SwFormatPageDesc;
class SwFormatRowSplit;
+class SwFormatFlySplit;
class SwFormatSurround;
class SwFormatURL;
class SwFormatVertOrient;
@@ -358,35 +359,35 @@ constexpr TypedWhichId<SwFormatNoBalancedColumns> RES_COLUMNBALANCE(119);
constexpr TypedWhichId<SvxFrameDirectionItem> RES_FRAMEDIR(120);
constexpr TypedWhichId<SwHeaderAndFooterEatSpacingItem> RES_HEADER_FOOTER_EAT_SPACING(121);
constexpr TypedWhichId<SwFormatRowSplit> RES_ROW_SPLIT(122);
-constexpr TypedWhichId<SwFormatFollowTextFlow> RES_FOLLOW_TEXT_FLOW(123);
-constexpr TypedWhichId<SfxBoolItem> RES_COLLAPSING_BORDERS(124);
-constexpr TypedWhichId<SwFormatWrapInfluenceOnObjPos> RES_WRAP_INFLUENCE_ON_OBJPOS(125);
-constexpr TypedWhichId<SwFormatAutoFormat> RES_AUTO_STYLE(126);
-constexpr TypedWhichId<SfxStringItem> RES_FRMATR_STYLE_NAME(127);
-constexpr TypedWhichId<SfxStringItem> RES_FRMATR_CONDITIONAL_STYLE_NAME(128);
-constexpr TypedWhichId<SfxGrabBagItem> RES_FRMATR_GRABBAG(129);
-constexpr TypedWhichId<SdrTextVertAdjustItem> RES_TEXT_VERT_ADJUST(130);
-constexpr TypedWhichId<SfxBoolItem> RES_BACKGROUND_FULL_SIZE(131);
-constexpr TypedWhichId<SfxBoolItem> RES_RTL_GUTTER(132);
-constexpr TypedWhichId<SfxBoolItem> RES_DECORATIVE(133);
-constexpr sal_uInt16 RES_FRMATR_END(134);
+constexpr TypedWhichId<SwFormatFlySplit> RES_FLY_SPLIT(123);
+constexpr TypedWhichId<SwFormatFollowTextFlow> RES_FOLLOW_TEXT_FLOW(124);
+constexpr TypedWhichId<SfxBoolItem> RES_COLLAPSING_BORDERS(125);
+constexpr TypedWhichId<SwFormatWrapInfluenceOnObjPos> RES_WRAP_INFLUENCE_ON_OBJPOS(126);
+constexpr TypedWhichId<SwFormatAutoFormat> RES_AUTO_STYLE(127);
+constexpr TypedWhichId<SfxStringItem> RES_FRMATR_STYLE_NAME(128);
+constexpr TypedWhichId<SfxStringItem> RES_FRMATR_CONDITIONAL_STYLE_NAME(129);
+constexpr TypedWhichId<SfxGrabBagItem> RES_FRMATR_GRABBAG(130);
+constexpr TypedWhichId<SdrTextVertAdjustItem> RES_TEXT_VERT_ADJUST(131);
+constexpr TypedWhichId<SfxBoolItem> RES_BACKGROUND_FULL_SIZE(132);
+constexpr TypedWhichId<SfxBoolItem> RES_RTL_GUTTER(133);
+constexpr TypedWhichId<SfxBoolItem> RES_DECORATIVE(134);
+constexpr sal_uInt16 RES_FRMATR_END(135);
constexpr sal_uInt16 RES_GRFATR_BEGIN(RES_FRMATR_END);
constexpr TypedWhichId<SwMirrorGrf> RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN);
-constexpr TypedWhichId<SwCropGrf> RES_GRFATR_CROPGRF(135);
-
-constexpr TypedWhichId<SwRotationGrf> RES_GRFATR_ROTATION(136);
-constexpr TypedWhichId<SwLuminanceGrf> RES_GRFATR_LUMINANCE(137);
-constexpr TypedWhichId<SwContrastGrf> RES_GRFATR_CONTRAST(138);
-constexpr TypedWhichId<SwChannelRGrf> RES_GRFATR_CHANNELR(139);
-constexpr TypedWhichId<SwChannelGGrf> RES_GRFATR_CHANNELG(140);
-constexpr TypedWhichId<SwChannelBGrf> RES_GRFATR_CHANNELB(141);
-constexpr TypedWhichId<SwGammaGrf> RES_GRFATR_GAMMA(142);
-constexpr TypedWhichId<SwInvertGrf> RES_GRFATR_INVERT(143);
-constexpr TypedWhichId<SwTransparencyGrf> RES_GRFATR_TRANSPARENCY(144);
-constexpr TypedWhichId<SwDrawModeGrf> RES_GRFATR_DRAWMODE(145);
-
-constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY2(146);
+constexpr TypedWhichId<SwCropGrf> RES_GRFATR_CROPGRF(136);
+
+constexpr TypedWhichId<SwRotationGrf> RES_GRFATR_ROTATION(137);
+constexpr TypedWhichId<SwLuminanceGrf> RES_GRFATR_LUMINANCE(138);
+constexpr TypedWhichId<SwContrastGrf> RES_GRFATR_CONTRAST(139);
+constexpr TypedWhichId<SwChannelRGrf> RES_GRFATR_CHANNELR(140);
+constexpr TypedWhichId<SwChannelGGrf> RES_GRFATR_CHANNELG(141);
+constexpr TypedWhichId<SwChannelBGrf> RES_GRFATR_CHANNELB(142);
+constexpr TypedWhichId<SwGammaGrf> RES_GRFATR_GAMMA(143);
+constexpr TypedWhichId<SwInvertGrf> RES_GRFATR_INVERT(144);
+constexpr TypedWhichId<SwTransparencyGrf> RES_GRFATR_TRANSPARENCY(145);
+constexpr TypedWhichId<SwDrawModeGrf> RES_GRFATR_DRAWMODE(146);
+
constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY3(147);
constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY4(148);
constexpr TypedWhichId<SfxBoolItem> RES_GRFATR_DUMMY5(149);
diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx
index 1129914b378b..6fd2662186d8 100644
--- a/sw/inc/swatrset.hxx
+++ b/sw/inc/swatrset.hxx
@@ -81,6 +81,7 @@ class SwFormatLineNumber;
class SwFormatEditInReadonly;
class SwFormatLayoutSplit;
class SwFormatRowSplit;
+class SwFormatFlySplit;
class SwFormatChain;
class SwFormatFootnoteAtTextEnd;
class SwFormatEndAtTextEnd;
@@ -262,6 +263,7 @@ public:
inline const SwFormatEditInReadonly &GetEditInReadonly( bool = true ) const;
inline const SwFormatLayoutSplit &GetLayoutSplit( bool = true ) const;
inline const SwFormatRowSplit &GetRowSplit( bool = true ) const;
+ inline const SwFormatFlySplit &GetFlySplit( bool = true ) const;
inline const SwFormatChain &GetChain( bool = true ) const;
inline const SwFormatLineNumber &GetLineNumber( bool = true ) const;
inline const SwFormatFootnoteAtTextEnd &GetFootnoteAtTextEnd( bool = true ) const;
diff --git a/sw/qa/core/attr/attr.cxx b/sw/qa/core/attr/attr.cxx
index 3ba2a3b9a1eb..25d2a8025020 100644
--- a/sw/qa/core/attr/attr.cxx
+++ b/sw/qa/core/attr/attr.cxx
@@ -12,6 +12,9 @@
#include <docsh.hxx>
#include <swdtflvr.hxx>
#include <swmodule.hxx>
+#include <frmmgr.hxx>
+#include <frameformats.hxx>
+#include <formatflysplit.hxx>
namespace
{
@@ -50,6 +53,26 @@ CPPUNIT_TEST_FIXTURE(Test, testSwAttrSet)
CPPUNIT_ASSERT(aData.hasValue());
pMod->m_pXSelection = pOldTransferable;
}
+
+CPPUNIT_TEST_FIXTURE(Test, testFormatFlySplit)
+{
+ createSwDoc();
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT, nullptr);
+ RndStdIds eAnchor = RndStdIds::FLY_AT_PARA;
+ aMgr.InsertFlyFrame(eAnchor, aMgr.GetPos(), aMgr.GetSize());
+ SwDoc* pDoc = getSwDoc();
+ SwFrameFormats& rFlys = *pDoc->GetSpzFrameFormats();
+ SwFrameFormat* pFly = rFlys[0];
+ CPPUNIT_ASSERT(!pFly->GetAttrSet().GetFlySplit().GetValue());
+
+ SfxItemSet aSet(pFly->GetAttrSet());
+ SwFormatFlySplit aItem(true);
+ aSet.Put(aItem);
+ pDoc->SetFlyFrameAttr(*pFly, aSet);
+
+ CPPUNIT_ASSERT(pFly->GetAttrSet().GetFlySplit().GetValue());
+}
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/attr/formatflysplit.cxx b/sw/source/core/attr/formatflysplit.cxx
new file mode 100644
index 000000000000..72816b2ead4e
--- /dev/null
+++ b/sw/source/core/attr/formatflysplit.cxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <formatflysplit.hxx>
+
+#include <libxml/xmlwriter.h>
+
+SwFormatFlySplit* SwFormatFlySplit::Clone(SfxItemPool*) const
+{
+ return new SwFormatFlySplit(*this);
+}
+
+void SwFormatFlySplit::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatFlySplit"));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"),
+ BAD_CAST(OString::number(Which()).getStr()));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+ BAD_CAST(OString::boolean(GetValue()).getStr()));
+ (void)xmlTextWriterEndElement(pWriter);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index a7e1a41db639..4f7ee52b7ab6 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -105,6 +105,7 @@
#include <fmtpdsc.hxx>
#include <fmtrfmrk.hxx>
#include <fmtrowsplt.hxx>
+#include <formatflysplit.hxx>
#include <fmtruby.hxx>
#include <fmtsrnd.hxx>
#include <fmturl.hxx>
@@ -391,6 +392,7 @@ SfxItemInfo aSlotTab[] =
{ SID_ATTR_HDFT_DYNAMIC_SPACING, true },// RES_HEADER_FOOTER_EAT_SPACING
{ FN_TABLE_ROW_SPLIT, true }, // RES_ROW_SPLIT
+ { 0, true } , // RES_FLY_SPLIT
// #i18732# - use slot-id define in svx
{ SID_SW_FOLLOW_TEXT_FLOW, true }, // RES_FOLLOW_TEXT_FLOW
// #i29550#
@@ -417,7 +419,6 @@ SfxItemInfo aSlotTab[] =
{ 0, true }, // RES_GRFATR_GAMMA,
{ 0, true }, // RES_GRFATR_INVERT,
{ 0, true }, // RES_GRFATR_TRANSPARENCY,
- { 0, true }, // RES_GRFATR_DUMMY2,
{ 0, true }, // RES_GRFATR_DUMMY3,
{ 0, true }, // RES_GRFATR_DUMMY4,
{ 0, true }, // RES_GRFATR_DUMMY5,
@@ -593,6 +594,7 @@ void InitCore()
aAttrTab[ RES_COLUMNBALANCE - POOLATTR_BEGIN ] = new SwFormatNoBalancedColumns;
aAttrTab[ RES_FRAMEDIR - POOLATTR_BEGIN ] = new SvxFrameDirectionItem( SvxFrameDirection::Environment, RES_FRAMEDIR );
aAttrTab[ RES_ROW_SPLIT - POOLATTR_BEGIN ] = new SwFormatRowSplit;
+ aAttrTab[ RES_FLY_SPLIT - POOLATTR_BEGIN ] = new SwFormatFlySplit;
// #i18732#
aAttrTab[ RES_FOLLOW_TEXT_FLOW - POOLATTR_BEGIN ] = new SwFormatFollowTextFlow(false);
@@ -625,7 +627,6 @@ void InitCore()
aAttrTab[ RES_GRFATR_DRAWMODE - POOLATTR_BEGIN ] = new SwDrawModeGrf;
// GraphicAttr - Dummies
- aAttrTab[ RES_GRFATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY2 );
aAttrTab[ RES_GRFATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY3 );
aAttrTab[ RES_GRFATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY4 );
aAttrTab[ RES_GRFATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY5 );