[Libreoffice-commits] core.git: 4 commits - sw/inc sw/qa sw/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Jul 31 00:19:38 PDT 2015
sw/inc/drawdoc.hxx | 2
sw/qa/extras/uiwriter/uiwriter.cxx | 20 +++++
sw/source/core/draw/drawdoc.cxx | 8 ++
sw/source/uibase/inc/textsh.hxx | 5 +
sw/source/uibase/shells/frmsh.cxx | 6 -
sw/source/uibase/shells/textsh.cxx | 78 ++++++++++++----------
writerfilter/source/dmapper/TblStylePrHandler.cxx | 1
writerfilter/source/dmapper/TblStylePrHandler.hxx | 2
8 files changed, 82 insertions(+), 40 deletions(-)
New commits:
commit 2c4e0aaa8d54877c55d3c4e397a7b869d8ff57cc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jul 31 09:17:55 2015 +0200
tdf#88986 testcase
Change-Id: I90d0c76c11e44ffe18be9fde4df06ccd0ac13da9
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index bf04bd0..69da76a 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -52,6 +52,8 @@
#include <editeng/wghtitem.hxx>
#include "UndoManager.hxx"
+#include <textsh.hxx>
+#include <frmmgr.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -145,6 +147,7 @@ public:
void testDde();
void testTdf89954();
void testTdf89720();
+ void testTdf88986();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -209,6 +212,7 @@ public:
CPPUNIT_TEST(testDde);
CPPUNIT_TEST(testTdf89954);
CPPUNIT_TEST(testTdf89720);
+ CPPUNIT_TEST(testTdf88986);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2146,6 +2150,22 @@ void SwUiWriterTest::testTdf89720()
}
}
+void SwUiWriterTest::testTdf88986()
+{
+ // Create a text shell.
+ SwDoc* pDoc = createDoc();
+ SwView* pView = pDoc->GetDocShell()->GetView();
+ SwTextShell aShell(*pView);
+
+ // Create the item set that is normally passed to the insert frame dialog.
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ SwFlyFrmAttrMgr aMgr(true, pWrtShell, FRMMGR_TYPE_TEXT);
+ SfxItemSet aSet = aShell.CreateInsertFrameItemSet(aMgr);
+
+ // This was missing along with the gradient and other tables.
+ CPPUNIT_ASSERT(aSet.HasItem(SID_COLOR_TABLE));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
commit ab9594038e1b3f6c4c260d0903376c2214ecc128
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jul 31 09:16:07 2015 +0200
Extract SwTextShell::CreateInsertFrameItemSet() from SwTextShell::ExecInsert()
Change-Id: I94ecd7c391c656e86918a227d344a24eef893577
diff --git a/sw/source/uibase/inc/textsh.hxx b/sw/source/uibase/inc/textsh.hxx
index baab15a..0e601da 100644
--- a/sw/source/uibase/inc/textsh.hxx
+++ b/sw/source/uibase/inc/textsh.hxx
@@ -25,9 +25,10 @@
class AbstractSvxPostItDialog;
class SwFieldMgr;
+class SwFlyFrmAttrMgr;
class SvxHyperlinkItem;
-class SwTextShell: public SwBaseShell
+class SW_DLLPUBLIC SwTextShell: public SwBaseShell
{
SwFieldMgr* pPostItFieldMgr;
RotateTransliteration m_aRotateCase;
@@ -80,6 +81,8 @@ public:
SwTextShell(SwView &rView);
virtual ~SwTextShell();
+ /// Create item set for the insert frame dialog.
+ SfxItemSet CreateInsertFrameItemSet(SwFlyFrmAttrMgr& rMgr);
};
void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq );
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index ccc4798..39d60ed 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -572,43 +572,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
}
else
{
- static const sal_uInt16 aFrmAttrRange[] =
- {
- RES_FRMATR_BEGIN, RES_FRMATR_END-1,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
- SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
- FN_SET_FRM_NAME, FN_SET_FRM_NAME,
- SID_HTML_MODE, SID_HTML_MODE,
- SID_COLOR_TABLE, SID_BITMAP_LIST,
- 0
- };
-
- SfxItemSet aSet(GetPool(), aFrmAttrRange );
- aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
-
- // For the Area tab page.
- GetShell().GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->PutAreaListItems(aSet);
-
- const SwRect &rPg = GetShell().GetAnyCurRect(RECT_PAGE);
- SwFormatFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
- aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
- aSet.Put(aFrmSize);
-
- const SwRect &rPr = GetShell().GetAnyCurRect(RECT_PAGE_PRT);
- SwFormatFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
- aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
- aSet.Put(aPrtSize);
-
- aSet.Put(aMgr.GetAttrSet());
- aSet.SetParent( aMgr.GetAttrSet().GetParent() );
-
- // Delete minimum size in columns.
- SvxBoxInfoItem aBoxInfo(static_cast<const SvxBoxInfoItem &>(aSet.Get(SID_ATTR_BORDER_INNER)));
- const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(aSet.Get(RES_BOX));
- aBoxInfo.SetMinDist(false);
- aBoxInfo.SetDefDist(rBox.GetDistance(SvxBoxItemLine::LEFT));
- aSet.Put(aBoxInfo);
+ SfxItemSet aSet = CreateInsertFrameItemSet(aMgr);
FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, GetView().GetDocShell()));
SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
@@ -969,6 +933,49 @@ SwTextShell::~SwTextShell()
{
}
+SfxItemSet SwTextShell::CreateInsertFrameItemSet(SwFlyFrmAttrMgr& rMgr)
+{
+ static const sal_uInt16 aFrmAttrRange[] =
+ {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ FN_SET_FRM_NAME, FN_SET_FRM_NAME,
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_COLOR_TABLE, SID_BITMAP_LIST,
+ 0
+ };
+
+ SfxItemSet aSet(GetPool(), aFrmAttrRange );
+ aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
+
+ // For the Area tab page.
+ GetShell().GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->PutAreaListItems(aSet);
+
+ const SwRect &rPg = GetShell().GetAnyCurRect(RECT_PAGE);
+ SwFormatFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
+ aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
+ aSet.Put(aFrmSize);
+
+ const SwRect &rPr = GetShell().GetAnyCurRect(RECT_PAGE_PRT);
+ SwFormatFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
+ aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
+ aSet.Put(aPrtSize);
+
+ aSet.Put(rMgr.GetAttrSet());
+ aSet.SetParent( rMgr.GetAttrSet().GetParent() );
+
+ // Delete minimum size in columns.
+ SvxBoxInfoItem aBoxInfo(static_cast<const SvxBoxInfoItem &>(aSet.Get(SID_ATTR_BORDER_INNER)));
+ const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>(aSet.Get(RES_BOX));
+ aBoxInfo.SetMinDist(false);
+ aBoxInfo.SetDefDist(rBox.GetDistance(SvxBoxItemLine::LEFT));
+ aSet.Put(aBoxInfo);
+
+ return aSet;
+}
+
void SwTextShell::InsertSymbol( SfxRequest& rReq )
{
const SfxItemSet *pArgs = rReq.GetArgs();
commit 6c3ca675509101732d3d878d6ceb6226026cd9ac
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jul 31 09:15:14 2015 +0200
tdf#88986 sw: add missing XPropertyList pool items on TextFrame insertion
Regression from commit 6e61ecd09679a66060f932835622821d39e92f01 (Merge
back branch alg_writerframes to trunk, 2014-03-19), the problem was
while SwFrameShell::Execute() was modified to put the various pool items
related to fill types (colors, gradients, etc) to the item set of the
dialog, the same was missing in SwTextShell::ExecInsert(), so colors
were missing on inserting a new frame, but not when editing an existing
one.
Change-Id: Id009f914c1c3b6509e31a4887e32a00624678cf4
diff --git a/sw/inc/drawdoc.hxx b/sw/inc/drawdoc.hxx
index 43c816d..386eb81 100644
--- a/sw/inc/drawdoc.hxx
+++ b/sw/inc/drawdoc.hxx
@@ -35,6 +35,8 @@ public:
const SwDoc& GetDoc() const { return *m_pDoc; }
SwDoc& GetDoc() { return *m_pDoc; }
+ /// Put needed items for XPropertyList entries from the DrawModel.
+ void PutAreaListItems(SfxItemSet& rSet) const;
virtual SdrPage* AllocPage(bool bMasterPage) SAL_OVERRIDE;
diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx
index e4fe12e..10130c2 100644
--- a/sw/source/core/draw/drawdoc.cxx
+++ b/sw/source/core/draw/drawdoc.cxx
@@ -145,4 +145,12 @@ uno::Reference< uno::XInterface > SwDrawModel::createUnoModel()
return xModel;
}
+void SwDrawModel::PutAreaListItems(SfxItemSet& rSet) const
+{
+ rSet.Put(SvxColorListItem(GetColorList(), SID_COLOR_TABLE));
+ rSet.Put(SvxGradientListItem(GetGradientList(), SID_GRADIENT_LIST));
+ rSet.Put(SvxHatchListItem(GetHatchList(), SID_HATCH_LIST));
+ rSet.Put(SvxBitmapListItem(GetBitmapList(), SID_BITMAP_LIST));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index f9ea90d..9442579 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -415,11 +415,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
//UUUU create needed items for XPropertyList entries from the DrawModel so that
// the Area TabPage can access them
const SwDrawModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel();
-
- aSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
- aSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
- aSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
- aSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
+ pDrawModel->PutAreaListItems(aSet);
const SwViewOption* pVOpt = rSh.GetViewOptions();
if(nSel & nsSelectionType::SEL_OLE)
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index cde79a0..ccc4798 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -114,6 +114,8 @@ using namespace ::com::sun::star;
#include <table.hrc>
#include <frmui.hrc>
#include <unomid.h>
+#include <IDocumentDrawModelAccess.hxx>
+#include <drawdoc.hxx>
#include <boost/scoped_ptr.hpp>
SFX_IMPL_INTERFACE(SwTextShell, SwBaseShell)
@@ -578,11 +580,16 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
FN_SET_FRM_NAME, FN_SET_FRM_NAME,
SID_HTML_MODE, SID_HTML_MODE,
+ SID_COLOR_TABLE, SID_BITMAP_LIST,
0
};
SfxItemSet aSet(GetPool(), aFrmAttrRange );
aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
+
+ // For the Area tab page.
+ GetShell().GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->PutAreaListItems(aSet);
+
const SwRect &rPg = GetShell().GetAnyCurRect(RECT_PAGE);
SwFormatFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
commit b697b1b68e7f335f9ab25d081764c75e515ae733
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Jul 31 09:01:17 2015 +0200
writerfilter: use std::unique_ptr<> in TblStylePrHandler
Change-Id: Ia98b351a3ef14826ab638382fa312734edeb751d
diff --git a/writerfilter/source/dmapper/TblStylePrHandler.cxx b/writerfilter/source/dmapper/TblStylePrHandler.cxx
index d1c28ba..6664a03 100644
--- a/writerfilter/source/dmapper/TblStylePrHandler.cxx
+++ b/writerfilter/source/dmapper/TblStylePrHandler.cxx
@@ -39,7 +39,6 @@ m_pProperties( new PropertyMap )
TblStylePrHandler::~TblStylePrHandler( )
{
- delete m_pTablePropsHandler, m_pTablePropsHandler = nullptr;
}
OUString TblStylePrHandler::getTypeString()
diff --git a/writerfilter/source/dmapper/TblStylePrHandler.hxx b/writerfilter/source/dmapper/TblStylePrHandler.hxx
index 13ab322..458badb 100644
--- a/writerfilter/source/dmapper/TblStylePrHandler.hxx
+++ b/writerfilter/source/dmapper/TblStylePrHandler.hxx
@@ -54,7 +54,7 @@ class TblStylePrHandler : public LoggedProperties
{
private:
DomainMapper & m_rDMapper;
- TablePropertiesHandler * m_pTablePropsHandler;
+ std::unique_ptr<TablePropertiesHandler> m_pTablePropsHandler;
TblStyleType m_nType;
PropertyMapPtr m_pProperties;
More information about the Libreoffice-commits
mailing list