[Libreoffice-commits] core.git: 15 commits - chart2/source filter/source framework/source include/o3tl include/svx jvmfwk/plugins sc/inc sc/source sd/source sfx2/source svtools/source svx/source sw/source unusedcode.easy writerfilter/source xmloff/source
Caolán McNamara
caolanm at redhat.com
Wed Oct 29 03:40:42 PDT 2014
chart2/source/controller/drawinglayer/DrawViewWrapper.cxx | 2
filter/source/graphicfilter/epict/epict.cxx | 13
filter/source/pdf/pdfexport.cxx | 2
framework/source/accelerators/acceleratorconfiguration.cxx | 2
include/o3tl/numeric.hxx | 28
include/svx/svdetc.hxx | 4
jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 29
sc/inc/numformat.hxx | 8
sc/source/core/data/drwlayer.cxx | 8
sc/source/core/tool/numformat.cxx | 16
sc/source/filter/excel/xlroot.cxx | 10
sc/source/filter/excel/xltoolbar.cxx | 2
sc/source/filter/inc/xlroot.hxx | 3
sc/source/ui/drawfunc/futext2.cxx | 2
sd/source/ui/func/fuexpand.cxx | 4
sd/source/ui/func/futext.cxx | 2
sd/source/ui/view/sdview.cxx | 6
sfx2/source/sidebar/SidebarController.cxx | 16
svtools/source/misc/imap.cxx | 5
svx/source/sdr/properties/textproperties.cxx | 2
svx/source/svdraw/svdedxv.cxx | 2
svx/source/svdraw/svdetc.cxx | 32
svx/source/svdraw/svdmodel.cxx | 4
svx/source/svdraw/svdoutlinercache.cxx | 2
svx/source/svdraw/svdtext.cxx | 2
svx/source/table/tablecontroller.cxx | 6
svx/source/table/tablertfimporter.cxx | 2
sw/source/core/doc/htmltbl.cxx | 18
sw/source/core/doc/tblrwcl.cxx | 3
sw/source/core/docnode/ndtbl.cxx | 22
sw/source/core/layout/findfrm.cxx | 11
sw/source/filter/basflt/fltshell.cxx | 543 -------------
sw/source/filter/inc/fltshell.hxx | 117 --
sw/source/uibase/uiview/viewdraw.cxx | 2
unusedcode.easy | 3
writerfilter/source/dmapper/DomainMapperTableManager.cxx | 3
xmloff/source/draw/sdxmlexp.cxx | 3
37 files changed, 138 insertions(+), 801 deletions(-)
New commits:
commit c090ecc4aa43004ef6da8dce3ba1e00cc778be4d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 09:53:44 2014 +0000
coverity#735663 Division or modulo by zero
Change-Id: I69410ebe3dcded9951bfa9e83844644147f4416a
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 6079135..8840494 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -1085,6 +1085,9 @@ void SdXMLExport::ImpWriteAutoLayoutInfos()
nRowCnt = nZwi;
}
+ if (nColCnt == 0 || nRowCnt == 0)
+ break;
+
aPartSize.Width() = (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt;
aPartSize.Height() = (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt;
commit 6fa813da677e303ca61074a2cda2c0e103fe5469
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 09:51:01 2014 +0000
coverity#1078538 Division or modulo by zero
Change-Id: I4f8f66689b46f594664c44da4e892983f38ad32e
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index ba18c27..b788405 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -1329,9 +1329,14 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
// Only use the relative widths' fraction, that is used for the
// absolute width.
sal_uLong nAbsTabWidthL = nAbsTabWidth;
- nRelTabWidth =
- ( nRelAvail ? (sal_uInt16)((nAbsTabWidthL * nRelAvail) / nAbsAvail)
- : nAbsTabWidth );
+ if (nRelAvail)
+ {
+ if (nAbsAvail == 0)
+ throw o3tl::divide_by_zero();
+ nRelTabWidth = (sal_uInt16)((nAbsTabWidthL * nRelAvail) / nAbsAvail);
+ }
+ else
+ nRelTabWidth = nAbsTabWidth;
// Are there columns width a percentage setting and some without one?
sal_uLong nFixMax = nMax;
commit c4e53fadbd9d4d5444547a18269eea5c54fd7a89
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 09:48:58 2014 +0000
coverity#1078537 Division or modulo by zero
Change-Id: I63e8168efe169e506b3be65ca150a779404f0885
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index 8ad6497..ba18c27 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -40,6 +40,7 @@
#include "htmltbl.hxx"
#include "ndindex.hxx"
#include "switerator.hxx"
+#include <o3tl/numeric.hxx>
#include <boost/foreach.hpp>
#ifdef DBG_UTIL
#include "tblrwcl.hxx"
@@ -1417,10 +1418,12 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
}
OSL_ENSURE( nCols==nFixedCols, "Missed a column!" );
}
- else
+ else if (nCols > 0)
{
+ if (nMax == 0)
+ throw o3tl::divide_by_zero();
// No. So distribute the space regularly among all columns.
- for( sal_uInt16 i=0; i<nCols; i++ )
+ for (sal_uInt16 i=0; i < nCols; ++i)
{
sal_uLong nColMax = GetColumn( i )->GetMax();
GetColumn( i )->SetAbsColWidth(
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 1ce8a37..2565bf0 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -55,6 +55,7 @@
#include <poolfmt.hxx>
#include <tblrwcl.hxx>
#include <unochart.hxx>
+#include <o3tl/numeric.hxx>
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/foreach.hpp>
@@ -1904,6 +1905,8 @@ static void lcl_CopyBoxToDoc(_FndBox const& rFndBox, _CpyPara *const pCpyPara)
{
nRealSize = pCpyPara->nNewSize;
nRealSize *= rFndBox.GetBox()->GetFrmFmt()->GetFrmSize().GetWidth();
+ if (pCpyPara->nOldSize == 0)
+ throw o3tl::divide_by_zero();
nRealSize /= pCpyPara->nOldSize;
}
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 25747f3..568493b 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2968,14 +2968,14 @@ bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )
aPosArr.erase( aPosArr.begin(), aPosArr.begin() + n );
m_Boxes.erase(m_Boxes.begin(), m_Boxes.begin() + n);
- size_t nSize = aPosArr.size();
- if (nSize)
+ size_t nArrSize = aPosArr.size();
+ if (nArrSize)
{
if (nOldWidth == 0)
throw o3tl::divide_by_zero();
// Adapt the positions to the new Size
- for( n = 0; n < nSize; ++n )
+ for( n = 0; n < nArrSize; ++n )
{
sal_uLong nSize = nWidth;
nSize *= ( aPosArr[ n ] - nOffset );
commit 54ba9587c0f1d3b5206742339af4907047fb4748
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 09:44:32 2014 +0000
coverity#1202781 Division or modulo by zero
Change-Id: I2908c57badd079c8f19c679f40ed815ce2cba374
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index 3fe0455..69407f6 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -34,7 +34,7 @@
#include <vcl/msgbox.hxx>
#include <vcl/gdimtf.hxx>
#include <tools/bigint.hxx>
-
+#include <o3tl/numeric.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <boost/scoped_array.hpp>
@@ -1758,7 +1758,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
if (nLength > 0)
{
if (nNormSize == 0)
- throw std::runtime_error("divide by zero");
+ throw o3tl::divide_by_zero();
for (sal_Int32 i = 0; i < nLength; ++i)
pDXAry[ i ] = pDXAry[ i ] * ( (long)pA->GetWidth() ) / nNormSize;
}
diff --git a/include/o3tl/numeric.hxx b/include/o3tl/numeric.hxx
new file mode 100644
index 0000000..09f67f5
--- /dev/null
+++ b/include/o3tl/numeric.hxx
@@ -0,0 +1,28 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_O3TL_NUMERIC_HXX
+#define INCLUDED_O3TL_NUMERIC_HXX
+
+#include <stdexcept>
+
+namespace o3tl
+{
+ struct divide_by_zero : public std::runtime_error
+ {
+ explicit divide_by_zero()
+ : std::runtime_error("divide by zero")
+ {
+ }
+ };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index 647f3e8..4eebd55 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -22,7 +22,7 @@
#include <vcl/svapp.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/window.hxx>
-
+#include <o3tl/numeric.hxx>
#include <svl/urihelper.hxx>
#include <svtools/imap.hxx>
#include <svtools/imapobj.hxx>
@@ -384,7 +384,7 @@ void IMapCircleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
}
if (!aAverage.GetDenominator())
- throw std::runtime_error("divide by zero");
+ throw o3tl::divide_by_zero();
nRadius = ( nRadius * aAverage.GetNumerator() ) / aAverage.GetDenominator();
}
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index d5956b7..25747f3 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -92,6 +92,7 @@
#include <rootfrm.hxx>
#include <fldupde.hxx>
#include <switerator.hxx>
+#include <o3tl/numeric.hxx>
#include <boost/foreach.hpp>
#ifdef DBG_UTIL
@@ -2948,7 +2949,7 @@ const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox )
bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )
{
- sal_uInt16 n;
+ size_t n;
if( !aPosArr.empty() )
{
@@ -2967,13 +2968,20 @@ bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )
aPosArr.erase( aPosArr.begin(), aPosArr.begin() + n );
m_Boxes.erase(m_Boxes.begin(), m_Boxes.begin() + n);
- // Adapt the positions to the new Size
- for( n = 0; n < aPosArr.size(); ++n )
+ size_t nSize = aPosArr.size();
+ if (nSize)
{
- sal_uLong nSize = nWidth;
- nSize *= ( aPosArr[ n ] - nOffset );
- nSize /= nOldWidth;
- aPosArr[ n ] = sal_uInt16( nSize );
+ if (nOldWidth == 0)
+ throw o3tl::divide_by_zero();
+
+ // Adapt the positions to the new Size
+ for( n = 0; n < nSize; ++n )
+ {
+ sal_uLong nSize = nWidth;
+ nSize *= ( aPosArr[ n ] - nOffset );
+ nSize /= nOldWidth;
+ aPosArr[ n ] = sal_uInt16( nSize );
+ }
}
}
return !aPosArr.empty();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index cbb32a8..f4bc4dd 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/text/TableColumnSeparator.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
+#include <o3tl/numeric.hxx>
#include <ooxml/resourceids.hxx>
#include <dmapperLoggers.hxx>
#include <dmapper/DomainMapper.hxx>
@@ -791,7 +792,7 @@ void DomainMapperTableManager::endOfRowAction()
if (nWidthsBound)
{
if (nFullWidthRelative == 0)
- throw std::range_error("divide by zero");
+ throw o3tl::divide_by_zero();
for (sal_uInt32 i = 0; i < nWidthsBound; ++i)
{
commit b7e999e2e9df272e8542c6a32486b2cc1a058f15
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 09:16:36 2014 +0000
coverity#1202880 annotate Dereference before null check as false positive
and
coverity#1202881 Dereference before null check as false positive
Change-Id: Id2c1ff2a5913755e9160807eace3219be3b35fd1
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 5a83c35..2284d16 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -1205,6 +1205,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(bool bPreferred, const css::
// take over all changes into the original container
SolarMutexGuard g;
+ // coverity[reverse_inull]
if (m_pPrimaryWriteCache)
{
m_aPrimaryReadCache.takeOver(*m_pPrimaryWriteCache);
@@ -1243,6 +1244,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(bool bPreferred, const css::
// take over all changes into the original container
SolarMutexGuard g;
+ // coverity[reverse_inull]
if (m_pSecondaryWriteCache)
{
m_aSecondaryReadCache.takeOver(*m_pSecondaryWriteCache);
commit 3d4c086b5098523a6f87abf6222798849d257204
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 09:16:10 2014 +0000
coverity#705921 Dereference before null check
Change-Id: Ied523c0ea680fa7d1fe147e7f2e7a78758bc1f14
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 629512e..d11c826 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1435,14 +1435,17 @@ SwCellFrm* SwCellFrm::GetFollowCell() const
// find most upper row frame
const SwFrm* pRow = GetUpper();
- while( !pRow->IsRowFrm() || !pRow->GetUpper()->IsTabFrm() )
+ if (!pRow)
+ return NULL;
+
+ while (!pRow->IsRowFrm() || !pRow->GetUpper()->IsTabFrm())
pRow = pRow->GetUpper();
- if ( !pRow )
+ if (!pRow)
return NULL;
- const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>( pRow->GetUpper() );
- if ( !pRow || !pTabFrm->GetFollow() || !pTabFrm->HasFollowFlowLine() )
+ const SwTabFrm* pTabFrm = static_cast<const SwTabFrm*>(pRow->GetUpper());
+ if (!pTabFrm || !pTabFrm->GetFollow() || !pTabFrm->HasFollowFlowLine())
return NULL;
const SwCellFrm* pThisCell = this;
commit a15298812622bd29f10c4ff04994ca162089c4ae
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 09:14:02 2014 +0000
coverity#1028106 Dereference before null check
Change-Id: I77a910542cf1b7889f69a1d3b7989779d9ecc7e8
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 2da9d48..d866818 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -92,7 +92,6 @@ namespace {
static const char gsDefaultDeckId[] = "PropertyDeck";
}
-
SidebarController::SidebarController (
SidebarDockingWindow* pParentWindow,
const css::uno::Reference<css::frame::XFrame>& rxFrame)
@@ -124,12 +123,6 @@ SidebarController::SidebarController (
mnWidthOnSplitterButtonDown(0),
mpCloseIndicator()
{
- if (pParentWindow == NULL)
- {
- OSL_ASSERT(pParentWindow!=NULL);
- return;
- }
-
// Listen for context change events.
css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
css::ui::ContextChangeEventMultiplexer::get(
@@ -163,16 +156,10 @@ SidebarController::SidebarController (
xWeakController));
}
-
-
-
SidebarController::~SidebarController (void)
{
}
-
-
-
SidebarController* SidebarController::GetSidebarControllerForFrame (
const css::uno::Reference<css::frame::XFrame>& rxFrame)
{
@@ -187,9 +174,6 @@ SidebarController* SidebarController::GetSidebarControllerForFrame (
return dynamic_cast<SidebarController*>(xController.get());
}
-
-
-
void SAL_CALL SidebarController::disposing (void)
{
SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame));
commit 836023dedc36cbfe946c42d629ece34174c6bd2b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 09:08:21 2014 +0000
coverity#1242433 SdrMakeOutliner alway derefs pMod
so change from a pointer to a reference
Change-Id: I81eb2c9e4df8353fbbdad7058c6ca7ea22286e62
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 1946051..63d093f 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -98,7 +98,7 @@ OutputDevice * lcl_GetParentRefDevice( const uno::Reference< frame::XModel > & x
DrawViewWrapper::DrawViewWrapper( SdrModel* pSdrModel, OutputDevice* pOut, bool bPaintPageForEditMode)
: E3dView(pSdrModel, pOut)
, m_pMarkHandleProvider(NULL)
- , m_apOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pSdrModel ) )
+ , m_apOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pSdrModel))
, m_bRestoreMapMode( false )
{
SetBufferedOutputAllowed(true);
diff --git a/include/svx/svdetc.hxx b/include/svx/svdetc.hxx
index e524364..c3e4510 100644
--- a/include/svx/svdetc.hxx
+++ b/include/svx/svdetc.hxx
@@ -49,7 +49,7 @@ namespace com { namespace sun { namespace star { namespace lang {
// Ist pMod<>NULL, dann wird der MapMode des uebergebenen
// Models verwendet. Die resultierende Default-Fonthoehe bleibt
// jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
-SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
+SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner(sal_uInt16 nOutlinerMode, SdrModel& rMod);
// Globale Defaulteinstellungen fuer die DrawingEngine.
// Diese Einstellungen sollte man direkt beim Applikationsstart
@@ -100,7 +100,7 @@ public:
// Ist pMod<>NULL, dann wird der MapMode des uebergebenen
// Models verwendet. Die resultierende Default-Fonthoehe bleibt
// jedoch dieselbe (die logische Fonthoehe wird umgerechnet).
- friend SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pMod );
+ friend SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner(sal_uInt16 nOutlinerMode, SdrModel& rMod);
};
class SfxItemSet;
diff --git a/sc/source/ui/drawfunc/futext2.cxx b/sc/source/ui/drawfunc/futext2.cxx
index 4e0e936..124c770 100644
--- a/sc/source/ui/drawfunc/futext2.cxx
+++ b/sc/source/ui/drawfunc/futext2.cxx
@@ -27,7 +27,7 @@
SdrOutliner* FuText::MakeOutliner()
{
ScViewData& rViewData = pViewShell->GetViewData();
- SdrOutliner* pOutl = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, pDrDoc);
+ SdrOutliner* pOutl = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *pDrDoc);
rViewData.UpdateOutlinerFlags(*pOutl);
diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx
index dc349d8..5d58d83 100644
--- a/sd/source/ui/func/fuexpand.cxx
+++ b/sd/source/ui/func/fuexpand.cxx
@@ -190,7 +190,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
if( pOutlinerParaObject->GetDepth(0) != -1 )
{
- SdrOutliner* pTempOutl = SdrMakeOutliner( OUTLINERMODE_TITLEOBJECT, mpDoc );
+ SdrOutliner* pTempOutl = SdrMakeOutliner(OUTLINERMODE_TITLEOBJECT, *mpDoc);
pTempOutl->SetText( *pOutlinerParaObject );
@@ -218,7 +218,7 @@ void FuExpandPage::DoExecute( SfxRequest& )
// create structuring text objects
OutlinerParaObject* pOPO = pOutl->CreateParaObject(++nParaPos, nChildCount);
- SdrOutliner* pTempOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc );
+ SdrOutliner* pTempOutl = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *mpDoc);
pTempOutl->SetText( *pOPO );
sal_Int32 nParaCount2 = pTempOutl->GetParagraphCount();
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index d4aa31a..be1ac08 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -1038,7 +1038,7 @@ void FuText::SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag)
nSdrObjKind == OBJ_OUTLINETEXT || !mxTextObj->IsEmptyPresObj() ) )
{
// create new outliner (owned by SdrObjEditView)
- SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc );
+ SdrOutliner* pOutl = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *mpDoc);
if (bEmptyOutliner)
mpView->SdrEndTextEdit(true);
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 8995064..9f6d25b 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -672,7 +672,7 @@ bool View::SdrBeginTextEdit(
sd::tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT, (void*)pObj );
if( pOutl==NULL && pObj )
- pOutl = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, pObj->GetModel() );
+ pOutl = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pObj->GetModel());
// make draw&impress specific initialisations
if( pOutl )
@@ -1258,7 +1258,7 @@ bool View::ShouldToggleOn(
return false;
bool bToggleOn = false;
- boost::scoped_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel));
+ boost::scoped_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pSdrModel));
const size_t nMarkCount = GetMarkedObjectCount();
for (size_t nIndex = 0; nIndex < nMarkCount && !bToggleOn; ++nIndex)
{
@@ -1330,7 +1330,7 @@ void View::ChangeMarkedObjectsBulletsNumbering(
? false
: ShouldToggleOn( bToggle, bHandleBullets );
- boost::scoped_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel));
+ boost::scoped_ptr<SdrOutliner> pOutliner(SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pSdrModel));
boost::scoped_ptr<OutlinerView> pOutlinerView(new OutlinerView(pOutliner.get(), pWindow));
const size_t nMarkCount = GetMarkedObjectCount();
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index d28b388..96552fd 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -405,7 +405,7 @@ namespace sdr
&& !rObj.IsTextEditActive()
&& !rObj.IsLinkedText())
{
- Outliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, rObj.GetModel());
+ Outliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *rObj.GetModel());
const svx::ITextProvider& rTextProvider(getTextProvider());
sal_Int32 nText = rTextProvider.getTextCount();
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 00e51b0..4568e16 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -602,7 +602,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
mxTextEditObj.reset( pObj );
pTextEditOutliner=pGivenOutliner;
if (pTextEditOutliner==NULL)
- pTextEditOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, mxTextEditObj->GetModel() );
+ pTextEditOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, *mxTextEditObj->GetModel() );
{
SvtAccessibilityOptions aOptions;
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index b9bdbf0..32eb75a 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -386,8 +386,6 @@ bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
return bRetval;
}
-
-
SdrEngineDefaults::SdrEngineDefaults():
aFontName( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, LANGUAGE_SYSTEM, DEFAULTFONT_FLAGS_ONLYONE ).GetName() ),
eFontFamily(FAMILY_ROMAN),
@@ -407,26 +405,20 @@ SdrEngineDefaults& SdrEngineDefaults::GetDefaults()
return *rGlobalData.pDefaults;
}
-
-
-SdrOutliner* SdrMakeOutliner( sal_uInt16 nOutlinerMode, SdrModel* pModel )
+SdrOutliner* SdrMakeOutliner(sal_uInt16 nOutlinerMode, SdrModel& rModel)
{
- SfxItemPool* pPool = &pModel->GetItemPool();
+ SfxItemPool* pPool = &rModel.GetItemPool();
SdrOutliner* pOutl = new SdrOutliner( pPool, nOutlinerMode );
pOutl->SetEditTextObjectPool( pPool );
- pOutl->SetStyleSheetPool( static_cast<SfxStyleSheetPool*>( pModel->GetStyleSheetPool() ) );
- pOutl->SetDefTab( pModel->GetDefaultTabulator() );
- pOutl->SetForbiddenCharsTable( pModel->GetForbiddenCharsTable() );
- pOutl->SetAsianCompressionMode( pModel->GetCharCompressType() );
- pOutl->SetKernAsianPunctuation( pModel->IsKernAsianPunctuation() );
- pOutl->SetAddExtLeading( pModel->IsAddExtLeading() );
-
+ pOutl->SetStyleSheetPool( static_cast<SfxStyleSheetPool*>(rModel.GetStyleSheetPool()));
+ pOutl->SetDefTab(rModel.GetDefaultTabulator());
+ pOutl->SetForbiddenCharsTable(rModel.GetForbiddenCharsTable());
+ pOutl->SetAsianCompressionMode(rModel.GetCharCompressType());
+ pOutl->SetKernAsianPunctuation(rModel.IsKernAsianPunctuation());
+ pOutl->SetAddExtLeading(rModel.IsAddExtLeading());
return pOutl;
}
-
-
-
SdrLinkList& ImpGetUserMakeObjHdl()
{
SdrGlobalData& rGlobalData=GetSdrGlobalData();
@@ -439,8 +431,6 @@ SdrLinkList& ImpGetUserMakeObjUserDataHdl()
return rGlobalData.aUserMakeObjUserDataHdl;
}
-
-
ResMgr* ImpGetResMgr()
{
SdrGlobalData& rGlobalData = GetSdrGlobalData();
@@ -454,15 +444,11 @@ ResMgr* ImpGetResMgr()
return rGlobalData.pResMgr;
}
-
-
OUString ImpGetResStr(sal_uInt16 nResID)
{
return ResId(nResID, *ImpGetResMgr()).toString();
}
-
-
namespace sdr
{
OUString GetResourceString(sal_uInt16 nResID)
@@ -471,8 +457,6 @@ namespace sdr
}
}
-
-
bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnlyEE)
{
bool bHas=false;
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index f06d667..a2974b1 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -208,10 +208,10 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
// can't create DrawOutliner OnDemand, because I can't get the Pool,
// then (only from 302 onwards!)
- pDrawOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
+ pDrawOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *this);
ImpSetOutlinerDefaults(pDrawOutliner, true);
- pHitTestOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
+ pHitTestOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *this);
ImpSetOutlinerDefaults(pHitTestOutliner, true);
ImpCreateTables();
diff --git a/svx/source/svdraw/svdoutlinercache.cxx b/svx/source/svdraw/svdoutlinercache.cxx
index c852668..3c733ef 100644
--- a/svx/source/svdraw/svdoutlinercache.cxx
+++ b/svx/source/svdraw/svdoutlinercache.cxx
@@ -45,7 +45,7 @@ SdrOutliner* SdrOutlinerCache::createOutliner( sal_uInt16 nOutlinerMode )
}
else
{
- pOutliner = SdrMakeOutliner( nOutlinerMode, mpModel );
+ pOutliner = SdrMakeOutliner(nOutlinerMode, *mpModel);
Outliner& aDrawOutliner = mpModel->GetDrawOutliner();
pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() );
maActiveOutliners.push_back(pOutliner);
diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx
index ed99ae3..5563bf3 100644
--- a/svx/source/svdraw/svdtext.cxx
+++ b/svx/source/svdraw/svdtext.cxx
@@ -173,7 +173,7 @@ void SdrText::ForceOutlinerParaObject( sal_uInt16 nOutlMode )
{
if( mpModel && !mpOutlinerParaObject )
{
- boost::scoped_ptr<Outliner> pOutliner(SdrMakeOutliner( nOutlMode, mpModel ));
+ boost::scoped_ptr<Outliner> pOutliner(SdrMakeOutliner(nOutlMode, *mpModel));
if( pOutliner )
{
Outliner& aDrawOutliner = mpModel->GetDrawOutliner();
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 13699d4..3ef0370 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -1825,11 +1825,11 @@ void SvxTableController::EditCell( const CellPos& rPos, vcl::Window* pWindow, co
pTableObj->setActiveCell( aPos );
// create new outliner, owner will be the SdrObjEditView
- SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpModel );
- if( pTableObj->IsVerticalWriting() )
+ SdrOutliner* pOutl = mpModel ? SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, *mpModel) : NULL;
+ if (pOutl && pTableObj->IsVerticalWriting())
pOutl->SetVertical( true );
- if(mpView->SdrBeginTextEdit(pTableObj, pPV, pWindow, true, pOutl))
+ if (mpView->SdrBeginTextEdit(pTableObj, pPV, pWindow, true, pOutl))
{
maCursorLastPos = maCursorFirstPos = rPos;
diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx
index fe7bf94..caf0570 100644
--- a/svx/source/table/tablertfimporter.cxx
+++ b/svx/source/table/tablertfimporter.cxx
@@ -127,7 +127,7 @@ private:
SdrTableRTFParser::SdrTableRTFParser( SdrTableObj& rTableObj )
: mrTableObj( rTableObj )
-, mpOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, rTableObj.GetModel() ) )
+, mpOutliner( SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, *rTableObj.GetModel() ) )
, mrItemPool( rTableObj.GetModel()->GetItemPool() )
, mnLastToken( 0 )
, mbNewDef( false )
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 52929b1..4e2bfe2 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -511,7 +511,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin,
{
SwWrtShell *pSh = &GetWrtShell();
SdrView *pSdrView = pSh->GetDrawView();
- SdrOutliner* pOutliner = ::SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrView->GetModel());
+ SdrOutliner* pOutliner = ::SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, *pSdrView->GetModel());
uno::Reference< linguistic2::XSpellChecker1 > xSpell( ::GetSpellChecker() );
if (pOutliner)
{
commit 9b8f91d348a51b0f0cd1bedb5168c2ca0888505a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 08:56:36 2014 +0000
coverity#1247624 oslModule -> osl::Module
should silence warning, still actually
avoid dlclose on the non-error path
Change-Id: Ibc522bf1067feb04def7d7284eee59878ddc6f47
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 2b72408..9954f8a 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -612,24 +612,23 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
// On linux we load jvm with RTLD_GLOBAL. This is necessary for debugging, because
// libjdwp.so need a symbol (fork1) from libjvm which it only gets if the jvm is loaded
// witd RTLD_GLOBAL. On Solaris libjdwp.so is correctly linked with libjvm.so
- oslModule moduleRt = 0;
+ osl::Module moduleRt;
#if defined(LINUX)
- if ((moduleRt = osl_loadModule(sRuntimeLib.pData,
- SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_NOW)) == 0 )
+ if (!moduleRt.load(sRuntimeLib, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_NOW))
#else
#if defined(WNT)
do_msvcr_magic(sRuntimeLib.pData);
#endif
- if ((moduleRt = osl_loadModule(sRuntimeLib.pData, SAL_LOADMODULE_DEFAULT)) == 0)
+ if (!moduleRt.load(sRuntimeLib, SAL_LOADMODULE_DEFAULT))
#endif
- {
- JFW_ENSURE(false,
- "[Java framework]sunjavaplugin" SAL_DLLEXTENSION
- " could not load Java runtime library: \n"
- + sRuntimeLib + "\n");
- JFW_TRACE0("Could not load Java runtime library: " << sRuntimeLib);
- return JFW_PLUGIN_E_VM_CREATION_FAILED;
- }
+ {
+ JFW_ENSURE(false,
+ "[Java framework]sunjavaplugin" SAL_DLLEXTENSION
+ " could not load Java runtime library: \n"
+ + sRuntimeLib + "\n");
+ JFW_TRACE0("Could not load Java runtime library: " << sRuntimeLib);
+ return JFW_PLUGIN_E_VM_CREATION_FAILED;
+ }
#if defined UNX && !defined MACOSX
//Setting the JAVA_HOME is needed for awt
@@ -641,8 +640,8 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
typedef jint JNICALL JNI_CreateVM_Type(JavaVM **, JNIEnv **, void *);
OUString sSymbolCreateJava("JNI_CreateJavaVM");
- JNI_CreateVM_Type * pCreateJavaVM = (JNI_CreateVM_Type *) osl_getFunctionSymbol(
- moduleRt, sSymbolCreateJava.pData);
+ JNI_CreateVM_Type * pCreateJavaVM =
+ (JNI_CreateVM_Type *)moduleRt.getFunctionSymbol(sSymbolCreateJava);
if (!pCreateJavaVM)
{
OSL_ASSERT(false);
@@ -653,9 +652,9 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
fprintf(stderr,"[Java framework]sunjavaplugin" SAL_DLLEXTENSION
"Java runtime library: %s does not export symbol %s !\n",
sLib.getStr(), sSymbol.getStr());
- osl_unloadModule(moduleRt);
return JFW_PLUGIN_E_VM_CREATION_FAILED;
}
+ moduleRt.release();
// Valgrind typically emits many false errors when executing JIT'ed JVM
// code, so force the JVM into interpreted mode:
commit 97bb460a68b3d9a3ac17afa37ce2623e952fd1a4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 29 08:40:25 2014 +0000
callcatcher: more ww1 removal fallout
quite pleasing
Change-Id: I3eaf711e8d5a42358922c16bfc82d0e32d0bc44b
diff --git a/sc/inc/numformat.hxx b/sc/inc/numformat.hxx
index 7293818..cd18d08 100644
--- a/sc/inc/numformat.hxx
+++ b/sc/inc/numformat.hxx
@@ -22,14 +22,6 @@ namespace sc {
class SC_DLLPUBLIC NumFmtUtil
{
public:
-
- /**
- * Return whether or not given number format is a 'General' number format.
- */
- static bool isGeneral( sal_uLong nFormat );
-
- static bool isGeneral( const ScPatternAttr& rPat );
-
/**
* Check if the attribute pattern has a number format that only produces
* latin script output.
diff --git a/sc/source/core/tool/numformat.cxx b/sc/source/core/tool/numformat.cxx
index a889ab8..8b1779b 100644
--- a/sc/source/core/tool/numformat.cxx
+++ b/sc/source/core/tool/numformat.cxx
@@ -29,22 +29,6 @@
namespace sc {
-bool NumFmtUtil::isGeneral( sal_uLong nFormat )
-{
- return (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0;
-}
-
-bool NumFmtUtil::isGeneral( const ScPatternAttr& rPat )
-{
- const SfxPoolItem* pItem = NULL;
- if (!rPat.GetItemSet().HasItem(ATTR_VALUE_FORMAT, &pItem))
- // Assume it's 'General' when the number format is not explicitly set.
- return true;
-
- sal_uInt32 nNumFmt = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
- return isGeneral(nNumFmt);
-}
-
bool NumFmtUtil::isLatinScript( const ScPatternAttr& rPat, ScDocument& rDoc )
{
SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index 5690316..d05ed8c 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -276,16 +276,6 @@ ScDocument* XclRoot::GetDocPtr() const
return &mrData.mrDoc;
}
-ScDocumentImport& XclRoot::GetDocImport()
-{
- return mrData.maDocImport;
-}
-
-const ScDocumentImport& XclRoot::GetDocImport() const
-{
- return mrData.maDocImport;
-}
-
SfxObjectShell* XclRoot::GetDocShell() const
{
return GetDoc().GetDocumentShell();
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index a132eda..a29e6e8 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -208,9 +208,6 @@ public:
/** Returns pointer to the destination document (import) or source document (export). */
ScDocument* GetDocPtr() const;
- ScDocumentImport& GetDocImport();
- const ScDocumentImport& GetDocImport() const;
-
/** Returns the object shell of the Calc document. May be 0 (i.e. import from clipboard). */
SfxObjectShell* GetDocShell() const;
/** Returns the object model of the Calc document. */
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index 482ffc7..f94b802 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -971,549 +971,6 @@ SfxPoolItem* SwFltTOX::Clone(SfxItemPool*) const
return new SwFltTOX(*this);
}
-/*virtual*/ SwFltOutBase& SwFltOutDoc::operator << (const SfxPoolItem& rItem)
-{
- rStack.NewAttr(*pPaM->GetPoint(), rItem);
- return *this;
-}
-
-const SfxPoolItem& SwFltOutDoc::GetAttr(sal_uInt16 nWhich)
-{
- return *rStack.GetFmtAttr(*pPaM->GetPoint(), nWhich);
-}
-
-// GetNodeOrStyAttr fetches attributes for toggle and modify attributes:
-// For format definitions, the current style with parents is
-// consulted, otherwise the node with parents.
-// The stack is never used.
-const SfxPoolItem& SwFltOutDoc::GetNodeOrStyAttr(sal_uInt16 nWhich)
-{
- SwCntntNode * pNd = pPaM->GetPoint()->nNode.GetNode().GetCntntNode();
- if (pNd) // ContentNode: Attribute with Parent
- return pNd->GetAttr(nWhich);
- else // no ContentNode, take the default attribute
- return GetDoc().GetAttrPool().GetDefaultItem(nWhich);
-}
-
-// Tables
-SwFltOutBase::~SwFltOutBase()
-{
-}
-
-SwFltOutBase::SwFltOutBase(SwDoc& rDocu)
- : rDoc(rDocu), eFlyAnchor(FLY_AT_PARA), bFlyAbsPos(false)
-{
-}
-
-const SfxPoolItem& SwFltOutBase::GetCellAttr(sal_uInt16 nWhich)
-{
- OSL_FAIL("GetCellAttr outside of normal text");
- return GetDoc().GetAttrPool().GetDefaultItem(nWhich);
-}
-
-bool SwFltOutBase::BeginTable()
-{
- OSL_FAIL("BeginTable outside of normal text");
- return false;
-}
-
-void SwFltOutBase::NextTableCell()
-{
- OSL_FAIL("NextTableCell outside of normal text");
-}
-
-void SwFltOutBase::NextTableRow()
-{
- OSL_FAIL("NextTableRow outside of normal text");
-}
-
-void SwFltOutBase::SetTableWidth(SwTwips /*nW*/)
-{
- OSL_FAIL("SetTableWidth outside of normal text");
-}
-
-void SwFltOutBase::SetTableOrient(sal_Int16 /*eOri*/)
-{
- OSL_FAIL("SetTableOrient outside of normal text");
-}
-
-void SwFltOutBase::SetCellWidth(SwTwips /*nWidth*/, sal_uInt16 /*nCell*/)
-{
- OSL_FAIL("SetCellWidth outside of normal text");
-}
-
-void SwFltOutBase::SetCellHeight(SwTwips /*nH*/)
-{
- OSL_FAIL("SetCellHeight outside of normal text");
-}
-
-void SwFltOutBase::SetCellBorder(const SvxBoxItem& /*rFmtBox*/, sal_uInt16 /*nCell*/)
-{
- OSL_FAIL("SetCellBorder outside of normal text");
-}
-
-void SwFltOutBase::SetCellSpace(sal_uInt16 /*nSp*/)
-{
- OSL_FAIL("SetCellSpace outside of normal text");
-}
-
-void SwFltOutBase::DeleteCell(sal_uInt16 /*nCell*/)
-{
- OSL_FAIL("DeleteCell outside of normal text");
-}
-
-void SwFltOutBase::EndTable()
-{
- OSL_FAIL("EndTable outside of normal text");
-}
-
-/*virtual*/ bool SwFltOutDoc::IsInTable()
-{
- return pTable != 0;
-};
-
-bool SwFltOutDoc::BeginTable()
-{
- if(bReadNoTbl)
- return false;
-
- if (pTable){
- OSL_FAIL("BeginTable in Table");
- return false;
- }
- // Close all attributes, because otherwise
- // attributes extending into Flys might be created
- rStack.SetAttr( *pPaM->GetPoint(), 0, false );
- rEndStack.SetAttr( *pPaM->GetPoint(), 0, false );
-
-// create table:
- OSL_ENSURE(pTabSavedPos == NULL, "SwFltOutDoc");
- pTabSavedPos = new SwPosition(*pPaM->GetPoint());
- pTable = GetDoc().InsertTable(
- SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ),
- *pTabSavedPos, 1, 1, text::HoriOrientation::LEFT, 0, 0, false, false ); // TODO MULTIHEADER
- nTableWidth = 0;
- ((SwTable*)pTable)->LockModify(); // Don't adjust anything automatically!
-// set pam in 1st table cell
- usTableX =
- usTableY = 0;
- SeekCell(usTableY, usTableX, true);
- return true;
-}
-
-SwTableBox* SwFltOutDoc::GetBox(sal_uInt16 ny, sal_uInt16 nx /*= USHRT_MAX */)
-{
- if(!pTable){
- OSL_ENSURE(pTable, "GetBox without table");
- return 0;
- }
- if( nx == USHRT_MAX ) // current cell
- nx = usTableX;
-
- // get structs to table cells
- const SwTableLines* pTableLines = &pTable->GetTabLines();
- if(!pTableLines){
- OSL_FAIL("SwFltOutDoc:GetBox:pTableLines");
- return 0;
- }
- if( ny >= pTableLines->size() ){ // emergency break
- OSL_FAIL( "SwFltOutDoc:GetBox:ny >= Count()");
- ny = pTableLines->size() - 1;
- }
- SwTableLine* pTableLine = (*pTableLines)[ny];
- if(!pTableLine){
- OSL_FAIL("SwFltOutDoc:GetBox:pTableLine");
- return 0;
- }
- SwTableBoxes* pTableBoxes = &pTableLine->GetTabBoxes();
- if(!pTableBoxes){
- OSL_FAIL("SwFltOutDoc:GetBox:pTableBoxes");
- return 0;
- }
- if( nx >= pTableBoxes->size() ){ // emergency break
- OSL_FAIL("SwFltOutDoc:GetBox:nx >= Count()");
- nx = pTableBoxes->size() - 1;
- }
- SwTableBox* pTableBox = (*pTableBoxes)[nx];
-
- OSL_ENSURE(pTableBox != 0, "SwFltOutDoc:GetBox:pTableBox");
- return pTableBox;
-}
-
-void SwFltOutDoc::NextTableCell()
-{
- if(!pTable){
- OSL_ENSURE(pTable, "NextTableCell without table");
- return;
- }
- const SwTableLines* pTableLines = &pTable->GetTabLines();
- SwTableLine* pTableLine = (*pTableLines)[usTableY];
- SwTableBoxes* pTableBoxes = &pTableLine->GetTabBoxes();
- SwTableBox* pTableBox = (*pTableBoxes)[usTableX];
- OSL_ENSURE(pTableBox != 0, "SwFltOutDoc:NextTableCell:pTableBox");
- if(!pTableBox)
- return;
- //#pragma message(__FILE__ "(?) : Sw's const problem")
- // insert cells:
- if (++usTableX >= pTableBoxes->size())
- GetDoc().GetNodes().InsBoxen(
- GetDoc().IsIdxInTbl(pPaM->GetPoint()->nNode),
- pTableLine,
- (SwTableBoxFmt*)pTableBox->GetFrmFmt(),
- GetDoc().getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ),
- 0,
- pTableBoxes->size());
- SeekCell(usTableY, usTableX, true);
- pTableBox = (*pTableBoxes)[usTableX];
- OSL_ENSURE(pTableBox != 0, "SwFltOutDoc:pTableBox");
- if(pTableBox)
- (*pTableBoxes)[usTableX]->ClaimFrmFmt();
-}
-
-void SwFltOutDoc::NextTableRow()
-{
- SwTableBox* pTableBox = GetBox(usTableY, 0);
- if (pTableBox)
- {
- // duplicate row:
- SwSelBoxes aSelBoxes;
- aSelBoxes.insert( pTableBox );
- GetDoc().InsertRow(aSelBoxes);
- usTableX = 0;
- SeekCell(++usTableY, usTableX, true);
- GetDoc().SetTxtFmtColl(*pPaM,
- GetDoc().getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ));
- }
-}
-
-void SwFltOutDoc::SetTableWidth(SwTwips nSwWidth)
-{
- if(!pTable){
- OSL_ENSURE(pTable, "SetTableWidth without table");
- return;
- }
- OSL_ENSURE( nSwWidth > MINLAY, "Table width <= MINLAY" );
- if( nSwWidth != nTableWidth ){
- if( nTableWidth ) // don't set the first time
- SplitTable();
- pTable->GetFrmFmt()->SetFmtAttr( SwFmtFrmSize(ATT_VAR_SIZE, nSwWidth));
- nTableWidth = nSwWidth;
- }
-}
-
-void SwFltOutDoc::SetTableOrient(sal_Int16 eOri)
-{
- if(!pTable){
- OSL_ENSURE(pTable, "SetTableOrient without table");
- return;
- }
- pTable->GetFrmFmt()->SetFmtAttr( SwFmtHoriOrient( 0, eOri ));
-}
-
-void SwFltOutDoc::SetCellWidth(SwTwips nWidth, sal_uInt16 nCell /* = USHRT_MAX */ )
-{
- if(!pTable){
- OSL_ENSURE(pTable, "SetCellWidth without table");
- return;
- }
- OSL_ENSURE( nWidth > MINLAY, "Table cell width <= MINLAY" );
- if (nWidth < MINLAY)
- nWidth = MINLAY;
-
- SwTableBox* pTableBox = GetBox(usTableY, nCell);
- if(pTableBox && pTableBox->GetFrmFmt() ){
- SwFmtFrmSize aFmtFrmSize(ATT_FIX_SIZE);
- aFmtFrmSize.SetWidth(nWidth);
- pTableBox->GetFrmFmt()->SetFmtAttr(aFmtFrmSize);
- }
-}
-
-void SwFltOutDoc::SetCellHeight(SwTwips nHeight)
-{
- if(!pTable){
- OSL_ENSURE(pTable, "SetCellHeight without table");
- return;
- }
-
- const SwTableLines* pTableLines = &pTable->GetTabLines();
- SwTableLine* pTableLine = (*pTableLines)[usTableY];
- SwFmtFrmSize aFmtFrmSize(ATT_MIN_SIZE, 0, 0);
- if (nHeight < MINLAY)
- nHeight = MINLAY;
- aFmtFrmSize.SetHeight(nHeight);
- pTableLine->GetFrmFmt()->SetFmtAttr(aFmtFrmSize);
-}
-
-const SfxPoolItem& SwFltOutDoc::GetCellAttr(sal_uInt16 nWhich)
-{
- if (!pTable){
- OSL_ENSURE(pTable, "GetCellAttr without table");
- return GetDoc().GetAttrPool().GetDefaultItem(nWhich);
- }
-
- SwTableBox* pTableBox = GetBox(usTableY, usTableX);
- if(!pTableBox)
- return GetDoc().GetAttrPool().GetDefaultItem(nWhich);
- return pTableBox->GetFrmFmt()->GetFmtAttr( nWhich );
-}
-
-void SwFltOutDoc::SetCellBorder(const SvxBoxItem& rFmtBox,
- sal_uInt16 nCell /* = USHRT_MAX */ )
-{
- SwTableBox* pTableBox = GetBox(usTableY, nCell);
- if(pTableBox)
- pTableBox->GetFrmFmt()->SetFmtAttr(rFmtBox);
-}
-
-// not activated!
-void SwFltOutDoc::SetCellSpace(sal_uInt16 nDist)
-{
- if(!pTable){
- OSL_ENSURE(pTable, "SetCellSpace without table");
- return;
- }
- SwTableBox* pTableBox = GetBox(usTableY, usTableX);
- if(!pTableBox)
- return;
-
- SvxBoxItem aFmtBox( *((SvxBoxItem*)
- &pTableBox->GetFrmFmt()->GetFmtAttr( RES_BOX )));
-
- // I don't get it, sven: if (!nDist) nDist = 18; // ca. 0.03 cm
- if (nDist > 42) // max. 0.7 mm
- nDist = 42;
- else
- if (nDist < MIN_BORDER_DIST)
- nDist = MIN_BORDER_DIST;
- aFmtBox.SetDistance(nDist);
- pTableBox->GetFrmFmt()->SetFmtAttr(aFmtBox);
-}
-
-void SwFltOutDoc::DeleteCell(sal_uInt16 nCell /* = USHRT_MAX */)
-{
- SwTableBox* pTableBox = GetBox(usTableY, nCell);
- if( pTableBox )
- {
- SwSelBoxes aSelBoxes;
- aSelBoxes.insert( pTableBox );
- GetDoc().DeleteRowCol(aSelBoxes);
- usTableX--;
- }
-}
-
-void SwFltOutDoc::SplitTable()
-{
- if(!pTable)
- {
- OSL_ENSURE(pTable, "SplitTable without table");
- return;
- }
- SwTableBox* pAktBox = GetBox(usTableY, usTableX);
- SwTableBox* pSplitBox = GetBox(usTableY - 1, 0);
- GetDoc().GetNodes().SplitTable(SwNodeIndex(*pSplitBox->GetSttNd()), false);
- pTable = &pAktBox->GetSttNd()->FindTableNode()->GetTable();
- usTableY = 0;
-}
-
-void SwFltOutDoc::EndTable()
-{
- if (!pTable){
- OSL_ENSURE(pTable, "EndTable without table");
- return;
- }
- // Close all attributes, because otherwise
- // attributes extending into Flys might be created
- rStack.SetAttr( *pPaM->GetPoint(), 0, false );
- rEndStack.SetAttr( *pPaM->GetPoint(), 0, false );
-
- if (GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell()){
- SwTableNode* pTableNode = GetDoc().IsIdxInTbl(
- pPaM->GetPoint()->nNode);
- pTableNode->DelFrms();
- pTableNode->MakeFrms(&pPaM->GetPoint()->nNode);
- }
-
- *pPaM->GetPoint() = *pTabSavedPos; // restore Cursor
- delete pTabSavedPos;
- pTabSavedPos = 0;
- ((SwTable*)pTable)->UnlockModify(); // Test, doesn't help against assert
- pTable = 0;
- nTableWidth = 0;
-}
-
-bool SwFltOutDoc::SeekCell(short nRow, short nCol, bool bPam)
-{
- // get structs to table cells
- const SwTableLines* pTableLines = &pTable->GetTabLines();
- SwTableLine* pTableLine = (*pTableLines)[usTableY];
- SwTableBoxes* pTableBoxes = &pTableLine->GetTabBoxes();
- SwTableBox* pTableBox = (*pTableBoxes)[usTableX];
-
- if ((sal_uInt16)nRow >= pTableLines->size())
- {
- OSL_ENSURE((sal_uInt16)nRow >= pTableLines->size(), "SwFltOutDoc");
- return false;
- }
- pTableLine = (*pTableLines)[nRow];
- pTableBoxes = &pTableLine->GetTabBoxes();
- if (nCol >= (short)pTableBoxes->size())
- return false;
- pTableBox = (*pTableBoxes)[nCol];
- if( !pTableBox->GetSttNd() )
- {
- OSL_ENSURE(pTableBox->GetSttNd(), "SwFltOutDoc");
- return false;
- }
- if(bPam)
- {
- pPaM->GetPoint()->nNode = pTableBox->GetSttIdx() + 1;
- pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0);
- GetDoc().SetTxtFmtColl(*pPaM,
- GetDoc().getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ));
- }
- return true;
-}
-
-// Flys in SwFltOutBase
-SfxItemSet* SwFltOutBase::NewFlyDefaults()
-{
- // Set required default values ( except when they will be explicitly set
- // later )
- SfxItemSet* p = new SfxItemSet( GetDoc().GetAttrPool(),
- RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
- SwFmtFrmSize aSz( ATT_VAR_SIZE, MINFLY, MINFLY );
- // Default: width 100% ( = PMW:Auto )
- aSz.SetWidthPercent( 100 ); // Height: Auto
- p->Put( aSz );
- p->Put( SwFmtHoriOrient( 0, text::HoriOrientation::NONE, text::RelOrientation::FRAME ));
- return p;
-}
-
-bool SwFltOutBase::BeginFly( RndStdIds eAnchor /*= FLY_AT_PARA*/,
- bool bAbsolutePos /*= sal_False*/,
- const SfxItemSet* pMoreAttrs /*= 0*/)
-{
- (void) pMoreAttrs; // unused in non-debug
- OSL_ENSURE(!pMoreAttrs, "SwFltOutBase:BeginFly with pMoreAttrs" );
- eFlyAnchor = eAnchor;
- bFlyAbsPos = bAbsolutePos; // nonsense, actually
- return true;
-}
-
-/*virtual*/ void SwFltOutBase::SetFlyAnchor( RndStdIds eAnchor )
-{
- if( !IsInFly() ){
- OSL_FAIL( "SetFlyAnchor() without Fly" );
- return;
- }
- if ( eAnchor == FLY_AS_CHAR ){
- OSL_FAIL( "SetFlyAnchor( FLY_AS_CHAR ) not implemented" );
- return;
- }
- SwFmtAnchor& rAnchor = (SwFmtAnchor&)GetFlyFrmAttr( RES_ANCHOR );
- rAnchor.SetType( eAnchor );
-}
-
-void SwFltOutBase::EndFly()
-{
- if( bFlyAbsPos ){
- // here, the absolute positions on the Fly need to be transformed to
- // writer coordinates
- }
-}
-
-// Flys in SwFltDoc
-/* virtual */ bool SwFltOutDoc::IsInFly()
-{
- return pFly != 0;
-};
-
-SwFrmFmt* SwFltOutDoc::MakeFly( RndStdIds eAnchor, SfxItemSet* pSet )
-{
- pFly = (SwFlyFrmFmt*)GetDoc().MakeFlySection( eAnchor, pPaM->GetPoint(),
- pSet );
- return pFly;
-}
-
-bool SwFltOutDoc::BeginFly( RndStdIds eAnchor,
- bool bAbsolutePos ,
- const SfxItemSet* pMoreAttrs)
-
-{
- SwFltOutBase::BeginFly( eAnchor, bAbsolutePos, 0 );
- SfxItemSet* pSet = NewFlyDefaults();
-
- // Close all attributes, because otherwise attributes extending into Flys might
- // be created
- rStack.SetAttr( *pPaM->GetPoint(), 0, false );
- rEndStack.SetAttr( *pPaM->GetPoint(), 0, false );
-
- // create Fly:
- OSL_ENSURE(pFlySavedPos == NULL, "BeginFly in Fly"); // recursive doesn't work yet
- pFlySavedPos = new SwPosition(*pPaM->GetPoint());
-
- SwFmtAnchor aAnchor( eAnchor, 1 );
-
- // If the style contained Fly attributes, use them as defaults now
- if (pMoreAttrs)
- pSet->Put(*pMoreAttrs);
-
- // this NOT for page-dependent Fly with page NUMBER !
- aAnchor.SetAnchor(pPaM->GetPoint()); // surprisingly, doesn't require
- // the stack
-
- pSet->Put( aAnchor );
- SwFrmFmt* pF = MakeFly( eAnchor, pSet );
- delete pSet;
-
- // set pam in Fly
- const SwFmtCntnt& rCntnt = pF->GetCntnt();
- OSL_ENSURE( rCntnt.GetCntntIdx(), "No prepared content." );
- pPaM->GetPoint()->nNode = rCntnt.GetCntntIdx()->GetIndex() + 1;
- SwCntntNode *pNode = pPaM->GetCntntNode();
- pPaM->GetPoint()->nContent.Assign( pNode, 0 );
-
- return true;
-}
-
-/*virtual*/ void SwFltOutDoc::SetFlyFrmAttr(const SfxPoolItem& rAttr)
-{
- if (pFly){
- pFly->SetFmtAttr( rAttr );
- }else{
- OSL_ENSURE(pFly, "SetFlyAttr without Doc-Fly");
- return;
- }
-}
-
-/*virtual*/ const SfxPoolItem& SwFltOutDoc::GetFlyFrmAttr(sal_uInt16 nWhich)
-{
- if (pFly){
- return pFly->GetFmtAttr( nWhich );
- }else{
- OSL_ENSURE(pFly, "GetFlyAttr without Fly");
- return GetDoc().GetAttrPool().GetDefaultItem(nWhich);
- }
-}
-
-void SwFltOutDoc::EndFly()
-{
- if( pTable ){
- OSL_FAIL( "SwFltOutDoc::EndFly() in Table" );
- return;
- }
- // Close all attributes, because otherwise
- // attributes extending into Flys might be created
- rStack.SetAttr( *pPaM->GetPoint(), 0, false );
- rEndStack.SetAttr( *pPaM->GetPoint(), 0, false );
-
- *pPaM->GetPoint() = *pFlySavedPos; // restore Cursor
- delete pFlySavedPos;
- pFlySavedPos = 0;
- SwFltOutBase::EndFly();
- pFly = 0;
-}
-
// UpdatePageDescs needs to be called at end of parsing to make Writer actually
// accept Pagedescs contents
void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset)
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index 8837961..5ea953c 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -327,123 +327,6 @@ public:
}
};
-// hier beginnen die fuer ww1-filter neu erstellten klassen. diese
-// sollen eine simple oberflaeche fuer die komplexen strukturen des
-// writers speziell fuer filter sein. soll etwas in den writer gegeben
-// werden, soll ein << reichen. hierfuer sind neue typen erzeugt
-// worden. ausserdem soll moeglich sein das objekt nach vielen
-// zustaenden der momentanen formatierung zu fragen, sodasz diese der
-// filter nicht selbst verwalten musz.
-
-// den anfang macht eine vorlagen-oberklasse, die einfachen umgang mit
-// formatvorlagen ermoeglicht:
-
-class SwFltOutBase
-{
- SwDoc& rDoc;
-protected:
- RndStdIds eFlyAnchor;
- bool bFlyAbsPos;
-
- SwDoc& GetDoc() { return rDoc; }
- SfxItemSet* NewFlyDefaults();
- SwFltOutBase(SwDoc& rDocu);
- virtual ~SwFltOutBase();
-public:
- virtual SwFltOutBase& operator << (const SfxPoolItem& rItem) = 0;
-
- virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich) = 0;
- virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich) = 0;
-
- virtual const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich);
- virtual bool BeginTable();
- virtual void NextTableCell();
- virtual void NextTableRow();
- virtual void SetTableWidth(SwTwips nW);
- virtual void SetTableOrient(sal_Int16 eOri);
- virtual void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell);
- virtual void SetCellHeight(SwTwips nH);
- virtual void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell);
- virtual void SetCellSpace(sal_uInt16 nSp);
- virtual void DeleteCell(sal_uInt16 nCell);
- virtual void EndTable();
-
- virtual bool IsInFly() = 0;
- virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr) = 0;
- virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich) = 0;
- virtual bool BeginFly( RndStdIds eAnchor, bool bAbsolutePos,
- const SfxItemSet* pMoreAttrs = 0 );
- virtual void SetFlyAnchor( RndStdIds eAnchor );
- virtual void EndFly();
-};
-
-class SwFltOutDoc : public SwFltOutBase
-{
- SwFltControlStack& rStack;
- SwFltEndStack& rEndStack;
- SwPaM* pPaM;
- SwFrmFmt* pFly;
-// table items:
- const SwTable* pTable;
- SwPosition* pTabSavedPos; // set when in table
- SwPosition* pFlySavedPos; // set when in fly
- SwTwips nTableWidth;
- sal_uInt16 usTableX;
- sal_uInt16 usTableY;
- bool bReadNoTbl; // Keine Tabellen
-
- SwTableBox* GetBox(sal_uInt16 ny, sal_uInt16 nx = USHRT_MAX);
- bool SeekCell( short nRow, short nCol, bool bPam );
- void SplitTable();
-public:
- SwFltOutDoc(SwDoc& rDocu, SwPaM* pP, SwFltControlStack& rStk,
- SwFltEndStack& rEStk)
- : SwFltOutBase(rDocu)
- , rStack(rStk)
- , rEndStack(rEStk)
- , pPaM(pP)
- , pFly(0)
- , pTable(0)
- , pTabSavedPos(0)
- , pFlySavedPos(0)
- , nTableWidth(0)
- , usTableX(0)
- , usTableY(0)
- , bReadNoTbl(false)
- {
- }
-
- void SetReadNoTable() { bReadNoTbl = true; }
- bool IsTableWidthSet() const { return 0 != nTableWidth; }
-
- virtual SwFltOutBase& operator << (const SfxPoolItem& rItem) SAL_OVERRIDE;
-
- virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich) SAL_OVERRIDE;
- virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich) SAL_OVERRIDE;
-
- bool IsInTable();
- virtual const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich) SAL_OVERRIDE;
- virtual bool BeginTable() SAL_OVERRIDE;
- virtual void NextTableCell() SAL_OVERRIDE;
- virtual void NextTableRow() SAL_OVERRIDE;
- virtual void SetTableWidth(SwTwips nW) SAL_OVERRIDE;
- virtual void SetTableOrient(sal_Int16 eOri) SAL_OVERRIDE;
- virtual void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell) SAL_OVERRIDE;
- virtual void SetCellHeight(SwTwips nH) SAL_OVERRIDE;
- virtual void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell) SAL_OVERRIDE;
- virtual void SetCellSpace(sal_uInt16 nSp) SAL_OVERRIDE;
- virtual void DeleteCell(sal_uInt16 nCell) SAL_OVERRIDE;
- virtual void EndTable() SAL_OVERRIDE;
-
- SwFrmFmt* MakeFly( RndStdIds eAnchor, SfxItemSet* pSet );
- virtual bool IsInFly() SAL_OVERRIDE;
- virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr) SAL_OVERRIDE;
- virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich) SAL_OVERRIDE;
- virtual bool BeginFly( RndStdIds eAnchor, bool bAbsolutePos,
- const SfxItemSet* pMoreAttrs = 0 ) SAL_OVERRIDE;
- virtual void EndFly() SAL_OVERRIDE;
-};
-
SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset);
#endif
diff --git a/unusedcode.easy b/unusedcode.easy
index d1fa4e6..d1271ea 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -26,8 +26,6 @@ ScFormulaCellGroup::scheduleCompilation()
ScRawToken::Clone() const
ScRawToken::Delete()
ScTabView::DrawMarkRect(Rectangle const&)
-ScTable::AttachFormulaCells(sc::StartListeningContext&, short, int, short, int)
-ScTable::DetachFormulaCells(sc::EndListeningContext&, short, int, short, int)
ScTable::MarkSubTotalCells(sc::ColumnSpanSet&, short, int, short, int, bool) const
ScVbaFormat<ooo::vba::excel::XStyle>::getAddIndent()
ScVbaFormat<ooo::vba::excel::XStyle>::setAddIndent(com::sun::star::uno::Any const&)
@@ -204,3 +202,4 @@ sfx2::SvBaseLink::SvBaseLink(rtl::OUString const&, unsigned short, sfx2::SvLinkS
std::_Rb_tree<rtl::OUString, std::pair<rtl::OUString const, (anonymous namespace)::TemplateId>, std::_Select1st<std::pair<rtl::OUString const, (anonymous namespace)::TemplateId> >, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, (anonymous namespace)::TemplateId> > >::_Rb_tree(std::_Rb_tree<rtl::OUString, std::pair<rtl::OUString const, (anonymous namespace)::TemplateId>, std::_Select1st<std::pair<rtl::OUString const, (anonymous namespace)::TemplateId> >, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, (anonymous namespace)::TemplateId> > >&&)
std::__cxx1998::vector<rtl::Reference<oox::xls::(anonymous namespace)::WorkerThread>, std::allocator<rtl::Reference<oox::xls::(anonymous namespace)::WorkerThread> > >::reserve(unsigned long)
vcl::MapChar(vcl::_TrueTypeFont*, unsigned short, bool)
+writerfilter::TagLogger::propertySet(boost::shared_ptr<writerfilter::Reference<writerfilter::Properties> >, boost::shared_ptr<writerfilter::IdToString>)
commit 6aea1876a88a9c9bbae6f16c43899747a1c75fa8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 20:42:48 2014 +0000
improve coverity#1242796 calculation
Change-Id: I0a462d043aaa67863d5f1906451e66d01b634a8f
diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx
index f85f455..6d307f4 100644
--- a/sc/source/filter/excel/xltoolbar.cxx
+++ b/sc/source/filter/excel/xltoolbar.cxx
@@ -361,7 +361,7 @@ ScCTBWrapper::Read( SvStream &rS)
//ScCTB is 1 TB which is min 15bytes, nViews TBVisualData which is min 20bytes
//and one 32bit number (4 bytes)
- const size_t nMinRecordSize = 39;
+ const size_t nMinRecordSize = 19 + ctbSet.ctbViews * 20;
const size_t nMaxPossibleRecords = rS.remainingSize()/nMinRecordSize;
if (ctbSet.ctb > nMaxPossibleRecords)
return false;
commit 52d98d8e716cf59eb4a8cbdec11d42d47608e6bb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 16:25:04 2014 +0000
coverity#735609 Division or modulo by zero
Change-Id: Iaa765c4ed0aa7bb11e74c1c2be48b336158249cc
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 9fdc626..635d64e 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -1066,6 +1066,8 @@ void PDFExport::ImplWriteWatermark( PDFWriter& rWriter, const Size& rPageSize )
int w = 0;
while( ( w = pDev->GetTextWidth( aText ) ) > nTextWidth )
{
+ if (w == 0)
+ break;
long nNewHeight = aFont.GetHeight() * nTextWidth / w;
if( nNewHeight == aFont.GetHeight() )
{
commit 27277d76bbfedc97942a0de3200d363fca851614
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 16:23:46 2014 +0000
coverity#1078542 Division or modulo by zero
Change-Id: I3325328c01b23d43c774db4af080df535f47787b
diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index 1aad8c1e22..3fe0455 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -1745,7 +1745,6 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
VirtualDevice aVirDev;
boost::scoped_array<long> pDXAry(new long[ aStr.getLength() ]);
sal_Int32 nNormSize( aVirDev.GetTextArray( aStr,pDXAry.get() ) );
- sal_uInt16 i;
if (aSrcFont.GetAlign()!=ALIGN_BASELINE)
{
@@ -1755,8 +1754,14 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
aPt.Y()-=(long)aVirDev.GetFontMetric(aSrcFont).GetDescent();
}
- for ( i = 0; i < aStr.getLength() - 1; i++ )
- pDXAry[ i ] = pDXAry[ i ] * ( (long)pA->GetWidth() ) / nNormSize;
+ sal_Int32 nLength = aStr.getLength() - 1;
+ if (nLength > 0)
+ {
+ if (nNormSize == 0)
+ throw std::runtime_error("divide by zero");
+ for (sal_Int32 i = 0; i < nLength; ++i)
+ pDXAry[ i ] = pDXAry[ i ] * ( (long)pA->GetWidth() ) / nNormSize;
+ }
SetAttrForText();
WriteTextArray( aPt, aStr, pDXAry.get() );
commit 1ed46f6cb71ddf274490f2f851ca5566fbfb7ae2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 16:19:50 2014 +0000
coverity#1078539 Division or modulo by zero
Change-Id: Ifbe3cbd8fa93ee828ed95c19893c52b8134d3fd1
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index 705021a..647f3e8 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -383,6 +383,9 @@ void IMapCircleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
SCALEPOINT( aCenter, rFracX, rFracY );
}
+ if (!aAverage.GetDenominator())
+ throw std::runtime_error("divide by zero");
+
nRadius = ( nRadius * aAverage.GetNumerator() ) / aAverage.GetDenominator();
}
commit 683ecd2816400ec5d28675417f394561f4de5a50
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 16:17:07 2014 +0000
coverity#735611 Division or modulo by float zero
and
coverity#735612 Division or modulo by float zero
Change-Id: I805d59a88a6a9fea11a4cb9890a50f0b649a7ad3
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index daf4f8a..ae224ce 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -816,14 +816,16 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
- if (pObj->IsPolyObj())
+ long nOldWidth = aOld.GetWidth();
+ long nOldHeight = aOld.GetHeight();
+ if (pObj->IsPolyObj() && nOldWidth && nOldHeight)
{
// Polyline objects need special treatment.
Size aSizeMove(aNew.Left()-aOld.Left(), aNew.Top()-aOld.Top());
pObj->NbcMove(aSizeMove);
- double fXFrac = static_cast<double>(aNew.GetWidth()) / static_cast<double>(aOld.GetWidth());
- double fYFrac = static_cast<double>(aNew.GetHeight()) / static_cast<double>(aOld.GetHeight());
+ double fXFrac = static_cast<double>(aNew.GetWidth()) / static_cast<double>(nOldWidth);
+ double fYFrac = static_cast<double>(aNew.GetHeight()) / static_cast<double>(nOldHeight);
pObj->NbcResize(aNew.TopLeft(), Fraction(fXFrac), Fraction(fYFrac));
}
// order of these lines is important, modify rData.maLastRect carefully it is used as both
More information about the Libreoffice-commits
mailing list