[Libreoffice-commits] core.git: Branch 'feature/gsoc14-libcmis2' - 9 commits - cui/source editeng/source include/svx include/xmloff libreofficekit/qa reportdesign/source sc/source sd/source svx/source sw/inc sw/qa sw/source writerfilter/source xmerge/source xmloff/source
Takeshi Abe
tabe at fixedpoint.jp
Thu Jul 31 05:17:37 PDT 2014
cui/source/tabpages/page.cxx | 4
cui/source/tabpages/paragrph.cxx | 19 +-
cui/source/tabpages/swpossizetabpage.cxx | 4
cui/source/tabpages/tparea.cxx | 42 ++----
cui/source/tabpages/tpbitmap.cxx | 42 +++---
editeng/source/xml/xmltxtexp.cxx | 2
include/svx/unoapi.hxx | 7 -
include/xmloff/xmlexp.hxx | 3
include/xmloff/xmluconv.hxx | 12 +
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 4
reportdesign/source/filter/xml/xmlExport.cxx | 4
sc/source/filter/xml/xmlexprt.cxx | 4
sc/source/filter/xml/xmlexprt.hxx | 2
sd/source/ui/unoidl/UnoDocumentSettings.cxx | 6
sd/source/ui/unoidl/unomodel.cxx | 2
svx/source/unodraw/unoprov.cxx | 6
svx/source/xml/xmlxtexp.cxx | 2
sw/inc/swmodule.hxx | 2
sw/qa/extras/ooxmlexport/data/2-id.docx |binary
sw/qa/extras/ooxmlexport/data/sdt-2-para.docx |binary
sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 37 ++++-
sw/source/filter/ww8/docxattributeoutput.cxx | 57 ++++++++
sw/source/filter/ww8/docxattributeoutput.hxx | 8 +
sw/source/filter/ww8/docxexport.cxx | 7 +
sw/source/filter/ww8/docxexport.hxx | 3
sw/source/filter/ww8/docxsdrexport.cxx | 23 +++
sw/source/filter/ww8/docxsdrexport.hxx | 5
sw/source/uibase/app/swmodul1.cxx | 4
sw/source/uibase/inc/unomod.hxx | 4
sw/source/uibase/uno/unomod.cxx | 30 ++--
writerfilter/source/dmapper/StyleSheetTable.cxx | 25 +++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 4
xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java | 65 +++-------
xmloff/source/core/xmlexp.cxx | 2
xmloff/source/core/xmluconv.cxx | 16 +-
35 files changed, 289 insertions(+), 168 deletions(-)
New commits:
commit 8ec35ed13bf520c925917ae49f7b810fbdd61589
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Thu Jul 31 10:32:53 2014 +0900
Avoid possible memory leaks in case of exceptions
Change-Id: I8bdb8ca84b75efde4effba1ce76704d2c7c3f214
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 76d2894..6c02b90 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -60,6 +60,7 @@
#include <svx/unobrushitemhelper.hxx>
#include <numpages.hxx>
+#include <boost/scoped_ptr.hpp>
// static ----------------------------------------------------------------
@@ -874,7 +875,7 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
(m_pRegisterCB->IsChecked() || m_pRegisterCB->IsValueChangedFromSaved()))
{
const SfxBoolItem& rRegItem = (const SfxBoolItem&)rOldSet.Get(SID_SWREGISTER_MODE);
- SfxBoolItem* pRegItem = (SfxBoolItem*)rRegItem.Clone();
+ boost::scoped_ptr<SfxBoolItem> pRegItem((SfxBoolItem*)rRegItem.Clone());
bool bCheck = m_pRegisterCB->IsChecked();
pRegItem->SetValue(bCheck);
rSet->Put(*pRegItem);
@@ -885,7 +886,6 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
rSet->Put(SfxStringItem(SID_SWREGISTER_COLLECTION,
m_pRegisterLB->GetSelectEntry()));
}
- delete pRegItem;
}
SvxFrameDirection eDirection = m_pTextFlowBox->GetSelectEntryValue();
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index bbeb896..21dc407 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -51,6 +51,7 @@
#include <svl/eitem.hxx>
#include <sfx2/request.hxx>
#include <svl/intitem.hxx>
+#include <boost/scoped_ptr.hpp>
static const sal_uInt16 pStdRanges[] =
{
@@ -383,7 +384,7 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
*rOutSet, SID_ATTR_PARA_REGISTER);
if (!pBoolItem)
return bModified;
- SfxBoolItem* pRegItem = (SfxBoolItem*)pBoolItem->Clone();
+ boost::scoped_ptr<SfxBoolItem> pRegItem((SfxBoolItem*)pBoolItem->Clone());
sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
bool bSet = pRegItem->GetValue();
@@ -395,7 +396,6 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
}
else if ( SFX_ITEM_DEFAULT == GetItemSet().GetItemState( _nWhich, false ) )
rOutSet->ClearItem(_nWhich);
- delete pRegItem;
}
return bModified;
@@ -2155,29 +2155,26 @@ bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
SfxItemPool* pPool = rSet->GetPool();
if (m_pScriptSpaceCB->IsEnabled() && m_pScriptSpaceCB->IsValueChangedFromSaved())
{
- SfxBoolItem* pNewItem = (SfxBoolItem*)rSet->Get(
- pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone();
+ boost::scoped_ptr<SfxBoolItem> pNewItem((SfxBoolItem*)rSet->Get(
+ pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone());
pNewItem->SetValue(m_pScriptSpaceCB->IsChecked());
rSet->Put(*pNewItem);
- delete pNewItem;
bRet = true;
}
if (m_pHangingPunctCB->IsEnabled() && m_pHangingPunctCB->IsValueChangedFromSaved())
{
- SfxBoolItem* pNewItem = (SfxBoolItem*)rSet->Get(
- pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone();
+ boost::scoped_ptr<SfxBoolItem> pNewItem((SfxBoolItem*)rSet->Get(
+ pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone());
pNewItem->SetValue(m_pHangingPunctCB->IsChecked());
rSet->Put(*pNewItem);
- delete pNewItem;
bRet = true;
}
if (m_pForbiddenRulesCB->IsEnabled() && m_pForbiddenRulesCB->IsValueChangedFromSaved())
{
- SfxBoolItem* pNewItem = (SfxBoolItem*)rSet->Get(
- pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone();
+ boost::scoped_ptr<SfxBoolItem> pNewItem((SfxBoolItem*)rSet->Get(
+ pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone());
pNewItem->SetValue(m_pForbiddenRulesCB->IsChecked());
rSet->Put(*pNewItem);
- delete pNewItem;
bRet = true;
}
return bRet;
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 666bc03..b471078 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <svx/dialogs.hrc>
+#include <boost/scoped_ptr.hpp>
using namespace ::com::sun::star::text;
#define SwFPos SvxSwFramePosString
@@ -857,10 +858,9 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
const SfxPoolItem* pItem = GetItem( rOldSet, SID_SW_FOLLOW_TEXT_FLOW);
if(pItem)
{
- SfxBoolItem* pFollow = static_cast<SfxBoolItem*>(pItem->Clone());
+ boost::scoped_ptr<SfxBoolItem> pFollow(static_cast<SfxBoolItem*>(pItem->Clone()));
pFollow->SetValue(m_pFollowCB->IsChecked());
bModified |= 0 != rSet->Put(*pFollow);
- delete pFollow;
}
}
}
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index cc89a49..1b7a65e 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -44,6 +44,7 @@
//UUUU
#include "sfx2/opengrf.hxx"
#include <vcl/msgbox.hxx>
+#include <boost/scoped_ptr.hpp>
using namespace com::sun::star;
@@ -1245,11 +1246,11 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
m_pTsbOriginal->IsEnabled() &&
m_pTsbScale->GetSavedValue() != TRISTATE_TRUE ) )
{
- XFillBmpSizeLogItem* pItem = NULL;
+ boost::scoped_ptr<XFillBmpSizeLogItem> pItem;
if( m_pTsbScale->IsEnabled() )
- pItem = new XFillBmpSizeLogItem( eState == TRISTATE_FALSE );
+ pItem.reset(new XFillBmpSizeLogItem( eState == TRISTATE_FALSE ));
else if( m_pTsbOriginal->IsEnabled() && m_pTsbOriginal->GetState() == TRISTATE_TRUE )
- pItem = new XFillBmpSizeLogItem( true );
+ pItem.reset(new XFillBmpSizeLogItem( true ));
if( pItem )
{
@@ -1259,14 +1260,13 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
rAttrs->Put( *pItem );
bModified = true;
}
- delete pItem;
}
}
//aMtrFldXSize
OUString aStr = m_pMtrFldXSize->GetText();
{
- XFillBmpSizeXItem* pItem = NULL;
+ boost::scoped_ptr<XFillBmpSizeXItem> pItem;
TriState eScaleState = m_pTsbScale->GetState();
if( m_pMtrFldXSize->IsEnabled() &&
@@ -1274,18 +1274,18 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
aStr != m_pMtrFldXSize->GetSavedValue() )
{
if( eScaleState == TRISTATE_FALSE )
- pItem = new XFillBmpSizeXItem( GetCoreValue( *m_pMtrFldXSize, ePoolUnit ) );
+ pItem.reset(new XFillBmpSizeXItem( GetCoreValue( *m_pMtrFldXSize, ePoolUnit ) ));
else
{
// Percentage values are set negatively, so that
// they aren't scaled; this is considered in the item.
- pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(m_pMtrFldXSize->GetValue()) ) );
+ pItem.reset(new XFillBmpSizeXItem( -labs( static_cast<long>(m_pMtrFldXSize->GetValue()) ) ));
}
}
else if( m_pTsbOriginal->IsEnabled() &&
m_pTsbOriginal->GetState() == TRISTATE_TRUE &&
!m_pMtrFldXSize->GetSavedValue().isEmpty() )
- pItem = new XFillBmpSizeXItem( 0 );
+ pItem.reset(new XFillBmpSizeXItem( 0 ));
if( pItem )
{
@@ -1295,14 +1295,13 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
rAttrs->Put( *pItem );
bModified = true;
}
- delete pItem;
}
}
//aMtrFldYSize
aStr = m_pMtrFldYSize->GetText();
{
- XFillBmpSizeYItem* pItem = NULL;
+ boost::scoped_ptr<XFillBmpSizeYItem> pItem;
TriState eScaleState = m_pTsbScale->GetState();
if( m_pMtrFldYSize->IsEnabled() &&
@@ -1310,19 +1309,19 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
aStr != m_pMtrFldYSize->GetSavedValue() )
{
if( eScaleState == TRISTATE_FALSE )
- pItem = new XFillBmpSizeYItem( GetCoreValue( *m_pMtrFldYSize, ePoolUnit ) );
+ pItem.reset(new XFillBmpSizeYItem( GetCoreValue( *m_pMtrFldYSize, ePoolUnit ) ));
else
{
// Percentage values are set negatively, so that
// they aren't scaled by the MetricItem;
// this is considered in the item.
- pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(m_pMtrFldYSize->GetValue()) ) );
+ pItem.reset(new XFillBmpSizeYItem( -labs( static_cast<long>(m_pMtrFldYSize->GetValue()) ) ));
}
}
else if( m_pTsbOriginal->IsEnabled() &&
m_pTsbOriginal->GetState() == TRISTATE_TRUE &&
!m_pMtrFldYSize->GetSavedValue().isEmpty() )
- pItem = new XFillBmpSizeYItem( 0 );
+ pItem.reset(new XFillBmpSizeYItem( 0 ));
if( pItem )
{
@@ -1332,7 +1331,6 @@ bool SvxAreaTabPage::FillItemSet( SfxItemSet* rAttrs )
rAttrs->Put( *pItem );
bModified = true;
}
- delete pItem;
}
}
@@ -2262,17 +2260,15 @@ IMPL_LINK_NOARG(SvxAreaTabPage, ModifyTileHdl_Impl)
if( m_pMtrFldXSize->IsEnabled() )
{
- XFillBmpSizeXItem* pItem = NULL;
+ boost::scoped_ptr<XFillBmpSizeXItem> pItem;
TriState eScaleState = m_pTsbScale->GetState();
if( eScaleState == TRISTATE_FALSE )
- pItem = new XFillBmpSizeXItem( GetCoreValue( *m_pMtrFldXSize, ePoolUnit ) );
+ pItem.reset(new XFillBmpSizeXItem( GetCoreValue( *m_pMtrFldXSize, ePoolUnit ) ));
else
- pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(m_pMtrFldXSize->GetValue()) ) );
+ pItem.reset(new XFillBmpSizeXItem( -labs( static_cast<long>(m_pMtrFldXSize->GetValue()) ) ));
rXFSet.Put( *pItem );
-
- delete pItem;
}
else if( m_pTsbOriginal->IsEnabled() && m_pTsbOriginal->GetState() == TRISTATE_TRUE )
{
@@ -2283,17 +2279,15 @@ IMPL_LINK_NOARG(SvxAreaTabPage, ModifyTileHdl_Impl)
if( m_pMtrFldYSize->IsEnabled() )
{
- XFillBmpSizeYItem* pItem = NULL;
+ boost::scoped_ptr<XFillBmpSizeYItem> pItem;
TriState eScaleState = m_pTsbScale->GetState();
if( eScaleState == TRISTATE_FALSE )
- pItem = new XFillBmpSizeYItem( GetCoreValue( *m_pMtrFldYSize, ePoolUnit ) );
+ pItem.reset(new XFillBmpSizeYItem( GetCoreValue( *m_pMtrFldYSize, ePoolUnit ) ));
else
- pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(m_pMtrFldYSize->GetValue()) ) );
+ pItem.reset(new XFillBmpSizeYItem( -labs( static_cast<long>(m_pMtrFldYSize->GetValue()) ) ));
rXFSet.Put( *pItem );
-
- delete pItem;
}
else if( m_pTsbOriginal->IsEnabled() && m_pTsbOriginal->GetState() == TRISTATE_TRUE )
{
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index c8d315b..85938a9 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -47,6 +47,7 @@
#include <dialmgr.hxx>
#include "sfx2/opengrf.hxx"
#include "paragrph.hrc"
+#include <boost/scoped_ptr.hpp>
using namespace com::sun::star;
@@ -301,12 +302,12 @@ SfxTabPage* SvxBitmapTabPage::Create( Window* pWindow,
IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
{
- GraphicObject* pGraphicObject = 0;
+ boost::scoped_ptr<GraphicObject> pGraphicObject;
int nPos(m_pLbBitmaps->GetSelectEntryPos());
if(LISTBOX_ENTRY_NOTFOUND != nPos)
{
- pGraphicObject = new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
+ pGraphicObject.reset(new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject()));
}
else
{
@@ -318,7 +319,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
if((drawing::FillStyle_BITMAP == eXFS) && (SFX_ITEM_SET == rOutAttrs.GetItemState(GetWhich(XATTR_FILLBITMAP), true, &pPoolItem)))
{
- pGraphicObject = new GraphicObject(((const XFillBitmapItem*)pPoolItem)->GetGraphicObject());
+ pGraphicObject.reset(new GraphicObject(((const XFillBitmapItem*)pPoolItem)->GetGraphicObject()));
}
}
@@ -329,7 +330,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
if(LISTBOX_ENTRY_NOTFOUND != nPos)
{
- pGraphicObject = new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject());
+ pGraphicObject.reset(new GraphicObject(pBitmapList->GetBitmap(nPos)->GetGraphicObject()));
}
}
}
@@ -411,7 +412,6 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ChangeBitmapHdl_Impl)
m_pCtlPreview->Invalidate();
bBmpChanged = false;
- delete pGraphicObject;
}
return 0;
@@ -428,10 +428,10 @@ long SvxBitmapTabPage::CheckChanges_Impl()
{
ResMgr& rMgr = CUI_MGR();
Image aWarningBoxImage = WarningBox::GetStandardImage();
- SvxMessDialog* aMessDlg = new SvxMessDialog(GetParentDialog(),
+ boost::scoped_ptr<SvxMessDialog> aMessDlg(new SvxMessDialog(GetParentDialog(),
SVX_RES( RID_SVXSTR_BITMAP ),
CUI_RES( RID_SVXSTR_ASK_CHANGE_BITMAP ),
- &aWarningBoxImage );
+ &aWarningBoxImage ));
DBG_ASSERT(aMessDlg, "Dialog creation failed!");
aMessDlg->SetButtonText( MESS_BTN_1, ResId( RID_SVXSTR_CHANGE, rMgr ) );
aMessDlg->SetButtonText( MESS_BTN_2, ResId( RID_SVXSTR_ADD, rMgr ) );
@@ -456,7 +456,6 @@ long SvxBitmapTabPage::CheckChanges_Impl()
case RET_CANCEL:
break;
}
- delete aMessDlg;
}
}
nPos = m_pLbBitmaps->GetSelectEntryPos();
@@ -492,9 +491,9 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialog creation failed!");
- AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
+ boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
DBG_ASSERT(pDlg, "Dialog creation failed!");
- MessageDialog* pWarnBox = NULL;
+ boost::scoped_ptr<MessageDialog> pWarnBox;
sal_uInt16 nError(1);
while( pDlg->Execute() == RET_OK )
@@ -514,17 +513,17 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickAddHdl_Impl)
if( !pWarnBox )
{
- pWarnBox = new MessageDialog( GetParentDialog()
+ pWarnBox.reset(new MessageDialog( GetParentDialog()
,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
+ ,"cui/ui/queryduplicatedialog.ui"));
}
if( pWarnBox->Execute() != RET_OK )
break;
}
- delete pDlg;
- delete pWarnBox;
+ pDlg.reset();
+ pWarnBox.reset();
if( !nError )
{
@@ -594,14 +593,14 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl)
if( !nError )
{
OUString aDesc( ResId(RID_SVXSTR_DESC_EXT_BITMAP, rMgr) );
- MessageDialog* pWarnBox = NULL;
+ boost::scoped_ptr<MessageDialog> pWarnBox;
// convert file URL to UI name
OUString aName;
INetURLObject aURL( aDlg.GetPath() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialog creation failed!");
- AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aURL.GetName().getToken( 0, '.' ), aDesc );
+ boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aURL.GetName().getToken( 0, '.' ), aDesc ));
DBG_ASSERT(pDlg, "Dialog creation failed!");
nError = 1;
@@ -623,17 +622,17 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickImportHdl_Impl)
if( !pWarnBox )
{
- pWarnBox = new MessageDialog( GetParentDialog()
+ pWarnBox.reset(new MessageDialog( GetParentDialog()
,"DuplicateNameDialog"
- ,"cui/ui/queryduplicatedialog.ui");
+ ,"cui/ui/queryduplicatedialog.ui"));
}
if( pWarnBox->Execute() != RET_OK )
break;
}
- delete pDlg;
- delete pWarnBox;
+ pDlg.reset();
+ pWarnBox.reset();
if( !nError )
{
@@ -674,7 +673,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialog creation failed!");
- AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
+ boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc ));
DBG_ASSERT(pDlg, "Dialog creation failed!");
long nCount = pBitmapList->Count();
@@ -719,7 +718,6 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickModifyHdl_Impl)
aBox.Execute();
}
}
- delete pDlg;
}
return 0L;
}
commit 63d24a964c1f40d4a3ace0fc4fd60b24c33e48c6
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Jul 31 11:42:52 2014 +0200
writerfilter: fix ubsan complaints about "-42" enum value
Apparently the StyleType enum is specific to the domain-mapper, the
OOXML filter has integer constants in its model.xml file...
Also surprisingly the section styles only exist in RTF; w_ST_StyleType
in "ECMA-376 3rd Edition" only contains the 4 values of StyleType enum.
Change-Id: I5407800f801824676df309b3705e233cf1382721
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 8f50037..7c698ef 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -427,7 +427,28 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
{
SAL_WARN_IF( m_pImpl->m_pCurrentEntry->nStyleTypeCode != STYLE_TYPE_UNKNOWN,
"writerfilter", "Style type needs to be processed first" );
- StyleType nType = ( StyleType ) nIntValue;
+ StyleType nType(STYLE_TYPE_UNKNOWN);
+ switch (nIntValue)
+ {
+ case 1:
+ nType = STYLE_TYPE_PARA;
+ break;
+ case 2:
+ nType = STYLE_TYPE_CHAR;
+ break;
+ case 3:
+ nType = STYLE_TYPE_TABLE;
+ break;
+ case 4:
+ nType = STYLE_TYPE_LIST;
+ break;
+ default:
+ SAL_WARN("writerfilter", "unknown LN_CT_Style_type " << nType);
+ //fall-through
+ case 0: // explicit unknown set by tokenizer
+ break;
+
+ }
if ( nType == STYLE_TYPE_TABLE )
{
StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
@@ -435,7 +456,7 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
m_pImpl->m_pCurrentEntry = pTableEntry;
}
else
- m_pImpl->m_pCurrentEntry->nStyleTypeCode = (StyleType)nIntValue;
+ m_pImpl->m_pCurrentEntry->nStyleTypeCode = nType;
}
break;
case NS_ooxml::LN_CT_Style_default:
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8ff911a..3bba4c4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3647,7 +3647,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
{
m_nCurrentStyleIndex = nParam;
- RTFValue::Pointer_t pValue(new RTFValue(-42)); // TODO no value in enum StyleType?
+ RTFValue::Pointer_t pValue(new RTFValue(0)); // TODO no value in enum StyleType?
m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // section style
}
break;
@@ -3655,7 +3655,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
{
m_nCurrentStyleIndex = nParam;
- RTFValue::Pointer_t pValue(new RTFValue(-43)); // FIXME the correct value would be 3 but maybe table styles mess things up in dmapper, be cautious and disable them for now
+ RTFValue::Pointer_t pValue(new RTFValue(0)); // FIXME the correct value would be 3 but maybe table styles mess things up in dmapper, be cautious and disable them for now
m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // table style
}
break;
commit f916aa66359b947bc88395e436e561b948bef241
Author: rbuj <robert.buj at gmail.com>
Date: Wed Jul 30 14:13:01 2014 +0200
xmerge: Avoid java.util.ConcurrentModificationException
Fix removeByName function, which deletes elements of the list without an iterator.
Move declarations inside the for loop in the removeByJar function, and delete the comment about removing list elements.
Change-Id: I6a9ba82af2999703d1447c5c0bc5800ec4367b65
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java
index 76b0792..adf2be9 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java
@@ -132,13 +132,11 @@ public final class ConverterInfoMgr {
boolean rc = false;
- Iterator<ConverterInfo> ciIter = converterInfoList.iterator();
- while (ciIter.hasNext())
- {
- ConverterInfo converterInfo = ciIter.next();
+ for (Iterator<ConverterInfo> it = converterInfoList.iterator(); it.hasNext();) {
+ ConverterInfo converterInfo = it.next();
if (jar.equals(converterInfo.getJarName())) {
- ciIter.remove();
- rc = true;
+ it.remove();
+ rc = true;
}
}
return rc;
@@ -157,9 +155,10 @@ public final class ConverterInfoMgr {
boolean rc = false;
- for (ConverterInfo converterInfo : converterInfoList) {
+ for (Iterator<ConverterInfo> it = converterInfoList.iterator(); it.hasNext();) {
+ ConverterInfo converterInfo = it.next();
if (name.equals(converterInfo.getDisplayName())) {
- converterInfoList.remove(converterInfo);
+ it.remove();
rc = true;
}
}
commit 4fd9f9edec7075a8b32cb88baaa2b3ca9e508b9b
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jul 31 10:19:33 2014 +0200
cleanup usage of MapUnit enum
some places were using the wrong enum constant, and some places were
unnnecessarily converting to sal_Int16
Change-Id: I754993533c840cd33106820d99af2dc951f26a80
diff --git a/include/svx/unoapi.hxx b/include/svx/unoapi.hxx
index 07330ac..076f629 100644
--- a/include/svx/unoapi.hxx
+++ b/include/svx/unoapi.hxx
@@ -63,7 +63,7 @@ SvxNumBulletItem* SvxGetNumBulletItemByName( SfxItemPool* pPool, const OUString&
* Maps the vcl MapUnit enum to a API constant MeasureUnit.
* Returns false if conversion is not supported.
*/
-SVX_DLLPUBLIC bool SvxMapUnitToMeasureUnit( const short nVcl, short& eApi ) throw();
+SVX_DLLPUBLIC bool SvxMapUnitToMeasureUnit( const MapUnit nVcl, short& eApi ) throw();
/**
* Maps the API constant MeasureUnit to a vcl MapUnit enum.
diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx
index 63216fe..25ef7fc 100644
--- a/include/xmloff/xmluconv.hxx
+++ b/include/xmloff/xmluconv.hxx
@@ -39,6 +39,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <tools/fldunit.hxx>
+#include <tools/mapunit.hxx>
// predeclarations
@@ -92,18 +93,18 @@ public:
SvXMLUnitConverter(
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& xContext,
- sal_Int16 eCoreMeasureUnit,
- sal_Int16 eXMLMeasureUnit);
+ sal_Int16 eCoreMeasureUnit /*css::util::MeasureUnit*/,
+ sal_Int16 eXMLMeasureUnit /*css::util::MeasureUnit*/);
virtual ~SvXMLUnitConverter();
static sal_Int16 GetMeasureUnit(FieldUnit const nFieldUnit);
/** sets the default unit for numerical measures */
- void SetCoreMeasureUnit( sal_Int16 const eCoreMeasureUnit );
+ void SetCoreMeasureUnit( sal_Int16 const eCoreMeasureUnit /*css::util::MeasureUnit*/);
/** sets the default unit for textual measures */
- void SetXMLMeasureUnit( sal_Int16 const eXMLMeasureUnit );
+ void SetXMLMeasureUnit( sal_Int16 const eXMLMeasureUnit /*css::util::MeasureUnit*/);
/** gets the default unit for textual measures */
sal_Int16 GetXMLMeasureUnit() const;
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index ffcf047..b200d0b 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -217,8 +217,8 @@ ORptExport::ORptExport(const Reference< XComponentContext >& _rxContext, OUStrin
,m_bAllreadyFilled(false)
{
setExportFlags( EXPORT_OASIS | nExportFlag);
- GetMM100UnitConverter().SetCoreMeasureUnit(MAP_100TH_MM);
- GetMM100UnitConverter().SetXMLMeasureUnit(MAP_CM);
+ GetMM100UnitConverter().SetCoreMeasureUnit(css::util::MeasureUnit::MM_100TH);
+ GetMM100UnitConverter().SetXMLMeasureUnit(css::util::MeasureUnit::CM);
// (getExportFlags() & EXPORT_CONTENT) != 0 ? : XML_N_OOO
_GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE ), XML_NAMESPACE_OFFICE );
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 6c1661b..82281dd 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1316,7 +1316,7 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property
break;
sal_Int16 nMeasureUnit = 0;
- SvxMapUnitToMeasureUnit( (const short)pEmbeddedObj->GetMapUnit(), nMeasureUnit );
+ SvxMapUnitToMeasureUnit( pEmbeddedObj->GetMapUnit(), nMeasureUnit );
aAny <<= (sal_Int16)nMeasureUnit;
}
break;
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 7358264..8d0cc2b 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -1008,7 +1008,7 @@ sal_Bool SvxMeasureUnitToMapUnit( const short eApi, int& eVcl ) throw()
/** maps the vcl MapUnit enum to a API constant MeasureUnit.
Returns false if conversion is not supported.
*/
-bool SvxMapUnitToMeasureUnit( const short eVcl, short& eApi ) throw()
+bool SvxMapUnitToMeasureUnit( const MapUnit eVcl, short& eApi ) throw()
{
switch( eVcl )
{
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index c441566..5f3eb01 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -59,8 +59,8 @@ const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11;
struct SvXMLUnitConverter::Impl
{
- sal_Int16 m_eCoreMeasureUnit;
- sal_Int16 m_eXMLMeasureUnit;
+ sal_Int16 m_eCoreMeasureUnit; /*css::util::MeasureUnit*/
+ sal_Int16 m_eXMLMeasureUnit; /*css::util::MeasureUnit*/
util::Date m_aNullDate;
mutable uno::Reference< text::XNumberingTypeInfo > m_xNumTypeInfo;
mutable uno::Reference< i18n::XCharacterClassification > m_xCharClass;
@@ -97,12 +97,12 @@ SvXMLUnitConverter::getNumTypeInfo() const
return m_pImpl->m_xNumTypeInfo;
}
-void SvXMLUnitConverter::SetCoreMeasureUnit(sal_Int16 const eCoreMeasureUnit)
+void SvXMLUnitConverter::SetCoreMeasureUnit(sal_Int16 const eCoreMeasureUnit/*css::util::MeasureUnit*/)
{
m_pImpl->m_eCoreMeasureUnit = eCoreMeasureUnit;
}
-void SvXMLUnitConverter::SetXMLMeasureUnit(sal_Int16 const eXMLMeasureUnit)
+void SvXMLUnitConverter::SetXMLMeasureUnit(sal_Int16 const eXMLMeasureUnit/*css::util::MeasureUnit*/)
{
m_pImpl->m_eXMLMeasureUnit = eXMLMeasureUnit;
}
commit cefb8141c87ede153f07b691af7b9ab3dff70e17
Author: Noel Grandin <noel at peralex.com>
Date: Wed Jul 30 14:15:39 2014 +0200
fix some dodgy FieldUnit conversions
the FieldUnit enum was being converted in some dodgy ways and
in some places the MapUnit enum values were being used.
Change-Id: Ic9aacb84058d1c14c3a4a79ef6676082df9a7270
diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx
index 48f7342..a0136a6 100644
--- a/editeng/source/xml/xmltxtexp.cxx
+++ b/editeng/source/xml/xmltxtexp.cxx
@@ -372,7 +372,7 @@ SvxXMLTextExportComponent::SvxXMLTextExportComponent(
const ESelection& rSel,
const OUString& rFileName,
const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > & xHandler)
-: SvXMLExport( xContext, "", rFileName, xHandler, ((frame::XModel*)new SvxSimpleUnoModel()), MAP_CM ),
+: SvXMLExport( xContext, "", rFileName, xHandler, ((frame::XModel*)new SvxSimpleUnoModel()), FUNIT_CM ),
maSelection( rSel )
{
SvxEditEngineSource aEditSource( pEditEngine );
diff --git a/include/svx/unoapi.hxx b/include/svx/unoapi.hxx
index 74bd154..07330ac 100644
--- a/include/svx/unoapi.hxx
+++ b/include/svx/unoapi.hxx
@@ -27,6 +27,7 @@
#include <svtools/grfmgr.hxx>
#include <svl/poolitem.hxx>
#include <svx/svxdllapi.h>
+#include <tools/fldunit.hxx>
class SvxShape;
class SdrObject;
@@ -68,13 +69,13 @@ SVX_DLLPUBLIC bool SvxMapUnitToMeasureUnit( const short nVcl, short& eApi ) thro
* Maps the API constant MeasureUnit to a vcl MapUnit enum.
* Returns false if conversion is not supported.
*/
-SVX_DLLPUBLIC bool SvxMeasureUnitToFieldUnit( const short eApi, short& nVcl ) throw();
+SVX_DLLPUBLIC bool SvxMeasureUnitToFieldUnit( const short eApi, FieldUnit& nVcl ) throw();
/**
* Maps the vcl MapUnit enum to a API constant MeasureUnit.
* Returns false if conversion is not supported.
*/
-SVX_DLLPUBLIC bool SvxFieldUnitToMeasureUnit( const short nVcl, short& eApi ) throw();
+SVX_DLLPUBLIC bool SvxFieldUnitToMeasureUnit( const FieldUnit nVcl, short& eApi ) throw();
/**
* If the given name is a predefined name for the current language it is replaced by
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index 57cc643..d149aed 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -58,6 +58,7 @@
#include <xmloff/XMLPageExport.hxx>
#include <xmloff/ProgressBarHelper.hxx>
#include <cppuhelper/implbase6.hxx>
+#include <tools/fldunit.hxx>
#include <list>
@@ -287,7 +288,7 @@ public:
const OUString& rFileName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &,
- sal_Int16 const eDefaultFieldUnit );
+ FieldUnit const eDefaultFieldUnit );
virtual ~SvXMLExport();
diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx
index 29a5e37..63216fe 100644
--- a/include/xmloff/xmluconv.hxx
+++ b/include/xmloff/xmluconv.hxx
@@ -38,6 +38,7 @@
#include <com/sun/star/drawing/Position3D.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <tools/fldunit.hxx>
// predeclarations
@@ -96,7 +97,7 @@ public:
virtual ~SvXMLUnitConverter();
- static sal_Int16 GetMeasureUnit(sal_Int16 const nFieldUnit);
+ static sal_Int16 GetMeasureUnit(FieldUnit const nFieldUnit);
/** sets the default unit for numerical measures */
void SetCoreMeasureUnit( sal_Int16 const eCoreMeasureUnit );
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 6e59a83..9c44f8d 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -456,7 +456,7 @@ void ScXMLShapeExport::onExport( const uno::Reference < drawing::XShape >& xShap
}
}
-sal_Int16 ScXMLExport::GetFieldUnit()
+sal_Int16 ScXMLExport::GetMeasureUnit()
{
css::uno::Reference<css::sheet::XGlobalSheetSettings> xProperties =
css::sheet::GlobalSheetSettings::create( comphelper::getProcessComponentContext() );
@@ -467,7 +467,7 @@ sal_Int16 ScXMLExport::GetFieldUnit()
ScXMLExport::ScXMLExport(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
OUString const & implementationName, sal_uInt16 nExportFlag)
-: SvXMLExport( SvXMLUnitConverter::GetMeasureUnit(GetFieldUnit()),
+: SvXMLExport( GetMeasureUnit(),
xContext, implementationName, XML_SPREADSHEET, nExportFlag ),
pDoc(NULL),
nSourceStreamPos(0),
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index a6ed689..d86dd69 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -242,7 +242,7 @@ public:
virtual ~ScXMLExport();
- static sal_Int16 GetFieldUnit();
+ static sal_Int16 GetMeasureUnit();
inline ScDocument* GetDocument() { return pDoc; }
inline const ScDocument* GetDocument() const { return pDoc; }
bool IsMatrix (const ScAddress& aCell,
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 8b3851b..e792db8 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -658,10 +658,10 @@ throw (UnknownPropertyException, PropertyVetoException,
sal_Int16 nValue = 0;
if( *pValues >>= nValue )
{
- short nFieldUnit;
+ FieldUnit nFieldUnit;
if( SvxMeasureUnitToFieldUnit( nValue, nFieldUnit ) )
{
- pDoc->SetUIUnit((FieldUnit)nFieldUnit );
+ pDoc->SetUIUnit( nFieldUnit );
bOk = true;
}
}
@@ -1065,7 +1065,7 @@ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
case HANDLE_MEASUREUNIT:
{
short nMeasure;
- SvxFieldUnitToMeasureUnit( (const short)pDoc->GetUIUnit(), nMeasure );
+ SvxFieldUnitToMeasureUnit( pDoc->GetUIUnit(), nMeasure );
*pValue <<= (sal_Int16)nMeasure;
}
break;
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 67467f8..7358264 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -1034,7 +1034,7 @@ bool SvxMapUnitToMeasureUnit( const short eVcl, short& eApi ) throw()
Returns false if conversion is not supported.
*/
-bool SvxMeasureUnitToFieldUnit( const short eApi, short& eVcl ) throw()
+bool SvxMeasureUnitToFieldUnit( const short eApi, FieldUnit& eVcl ) throw()
{
switch( eApi )
{
@@ -1060,7 +1060,7 @@ bool SvxMeasureUnitToFieldUnit( const short eApi, short& eVcl ) throw()
/** maps the vcl MapUnit enum to a API constant MeasureUnit.
Returns false if conversion is not supported.
*/
-bool SvxFieldUnitToMeasureUnit( const short eVcl, short& eApi ) throw()
+bool SvxFieldUnitToMeasureUnit( const FieldUnit eVcl, short& eApi ) throw()
{
switch( eVcl )
{
diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx
index 511d8ec..475cb2c 100644
--- a/svx/source/xml/xmlxtexp.cxx
+++ b/svx/source/xml/xmlxtexp.cxx
@@ -151,7 +151,7 @@ SvxXMLXTableExportComponent::SvxXMLXTableExportComponent(
const uno::Reference<xml::sax::XDocumentHandler> & rHandler,
const uno::Reference<container::XNameContainer >& xTable,
uno::Reference<document::XGraphicObjectResolver >& xGrfResolver )
-: SvXMLExport( xContext, "", rFileName, rHandler, NULL, MAP_100TH_MM),
+: SvXMLExport( xContext, "", rFileName, rHandler, NULL, FUNIT_100TH_MM),
mxTable( xTable )
{
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index 7f61e42..ad7f677 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -210,7 +210,7 @@ public:
OUString GetDocStatWordDelim() const;
// Pass metric of ModuleConfig (for HTML-export).
- sal_uInt16 GetMetric( bool bWeb ) const;
+ FieldUnit GetMetric( bool bWeb ) const;
// Pass update-statuses.
sal_uInt16 GetLinkUpdMode( bool bWeb ) const;
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index dcdfc01..db6e459 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -557,7 +557,7 @@ OUString SwModule::GetDocStatWordDelim() const
}
// Passing-through of the ModuleConfig's Metric (for HTML-Export)
-sal_uInt16 SwModule::GetMetric( bool bWeb ) const
+FieldUnit SwModule::GetMetric( bool bWeb ) const
{
SwMasterUsrPref* pPref;
if(bWeb)
@@ -572,7 +572,7 @@ sal_uInt16 SwModule::GetMetric( bool bWeb ) const
GetUsrPref(false);
pPref = pUsrPref;
}
- return static_cast< sal_uInt16 >(pPref->GetMetric());
+ return pPref->GetMetric();
}
// Pass-through Update-Status
diff --git a/sw/source/uibase/inc/unomod.hxx b/sw/source/uibase/inc/unomod.hxx
index 839816a..264ae07 100644
--- a/sw/source/uibase/inc/unomod.hxx
+++ b/sw/source/uibase/inc/unomod.hxx
@@ -136,9 +136,9 @@ protected:
const SwViewOption* mpConstViewOption;
bool bObjectValid:1, bWeb:1, mbApplyZoom;
- sal_Int32 eHRulerUnit;
+ FieldUnit eHRulerUnit;
bool mbApplyHRulerMetric;
- sal_Int32 eVRulerUnit;
+ FieldUnit eVRulerUnit;
bool mbApplyVRulerMetric;
virtual void _preSetValues ()
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 4ebd2dd..0e2ec54 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -760,29 +760,29 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c
case HANDLE_VIEWSET_HORI_RULER_METRIC:
case HANDLE_VIEWSET_VERT_RULER_METRIC:
{
- sal_Int32 nUnit = -1;
+ sal_uInt16 nUnit;
if( rValue >>= nUnit )
- switch( nUnit )
- {
+ switch( nUnit )
+ {
case FUNIT_MM:
case FUNIT_CM:
case FUNIT_POINT:
case FUNIT_PICA:
case FUNIT_INCH:
- if( rInfo.mnHandle == HANDLE_VIEWSET_HORI_RULER_METRIC )
- {
- eHRulerUnit = nUnit;
- mbApplyHRulerMetric = true;
- }
- else
- {
- eVRulerUnit = nUnit;
- mbApplyVRulerMetric = true;
- }
- break;
+ if( rInfo.mnHandle == HANDLE_VIEWSET_HORI_RULER_METRIC )
+ {
+ eHRulerUnit = static_cast<FieldUnit>(nUnit);
+ mbApplyHRulerMetric = true;
+ }
+ else
+ {
+ eVRulerUnit = static_cast<FieldUnit>(nUnit);
+ mbApplyVRulerMetric = true;
+ }
+ break;
default:
throw IllegalArgumentException();
- }
+ }
}
break;
default:
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 5e65713..3f7d0e8 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -500,7 +500,7 @@ SvXMLExport::SvXMLExport(
const OUString &rFileName,
const uno::Reference< xml::sax::XDocumentHandler > & rHandler,
const Reference< XModel >& rModel,
- sal_Int16 const eDefaultFieldUnit)
+ FieldUnit const eDefaultFieldUnit)
: mpImpl( new SvXMLExport_Impl ),
m_xContext(xContext), m_implementationName(implementationName),
mxModel( rModel ),
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index d271df3..c441566 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -129,7 +129,7 @@ SvXMLUnitConverter::~SvXMLUnitConverter()
{
}
-sal_Int16 SvXMLUnitConverter::GetMeasureUnit(sal_Int16 const nFieldUnit)
+sal_Int16 SvXMLUnitConverter::GetMeasureUnit(FieldUnit const nFieldUnit)
{
sal_Int16 eUnit = util::MeasureUnit::INCH;
switch( nFieldUnit )
@@ -152,6 +152,12 @@ sal_Int16 SvXMLUnitConverter::GetMeasureUnit(sal_Int16 const nFieldUnit)
case FUNIT_100TH_MM:
eUnit = util::MeasureUnit::MM_100TH;
break;
+ case FUNIT_INCH:
+ eUnit = util::MeasureUnit::INCH;
+ break;
+ default:
+ assert(false);
+ break;
}
return eUnit;
}
commit 6a07862a6f172e28ab553a1166480062303f328f
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Thu Jul 31 11:26:59 2014 +0200
GtkComboBoxText requires gtk >= 2.24 (again).
Broken in 77d083130948fa35f9f404656b8c170060e78043.
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 9a40325..112e03e 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -27,7 +27,11 @@ static int help()
static GtkWidget* pDocView;
static GtkWidget* pDocViewQuad;
static GtkWidget* pVBox;
+// GtkComboBox requires gtk 2.24 or later
+#if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
static GtkComboBoxText* pPartSelector;
+#endif
+
static LibreOfficeKit* pOffice;
static char* pFileName;
commit 8772fbf8a16b5ca3ca867e4b116139b652bbf6a3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 31 10:50:44 2014 +0200
DocxAttributeOutput::WriteSdtBlock: never write <w:id> twice
Change-Id: Iab68a4e809a7924e753db5a85d9914308419b845
diff --git a/sw/qa/extras/ooxmlexport/data/2-id.docx b/sw/qa/extras/ooxmlexport/data/2-id.docx
new file mode 100644
index 0000000..6d05e68
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/2-id.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 76cb592..1e0b98d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -532,6 +532,15 @@ DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-para.docx")
}
}
+DECLARE_OOXMLEXPORT_TEST(test2Id, "2-id.docx")
+{
+ if (xmlDocPtr pXmlDoc = parseExport())
+ {
+ // This was 2, but only one w:id is allowed.
+ assertXPath(pXmlDoc, "//w:sdtPr/w:id", 1);
+ }
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 9078f8b..c66a6ea 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -612,7 +612,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
m_pSerializer->endElement( nSdtPrToken );
}
- else if( (nSdtPrToken > 0) && !(m_bRunTextIsOn && m_rExport.SdrExporter().IsParagraphHasDrawing()))
+ else if( (nSdtPrToken > 0) && nSdtPrToken != FSNS( XML_w, XML_id ) && !(m_bRunTextIsOn && m_rExport.SdrExporter().IsParagraphHasDrawing()))
m_pSerializer->singleElement( nSdtPrToken, FSEND );
if( nSdtPrToken == FSNS( XML_w, XML_id ) || ( bPara && m_bParagraphSdtHasId ) )
commit d767debdb54a4e318556751b86a81c98802c0454
Author: Noel Grandin <noel at peralex.com>
Date: Thu Jul 31 10:38:38 2014 +0200
remove commented out code
and fix up some formatting
Change-Id: I8d24c66901eeaf8a6c7aa5e797821c807edaf6ee
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java
index 1bf160d..76b0792 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java
@@ -31,14 +31,7 @@ import java.io.*;
*/
public final class ConverterInfoMgr {
- private static ArrayList<ConverterInfo> converterInfoList;
-
- /**
- * Constructor
- */
- static {
- converterInfoList = new ArrayList<ConverterInfo>();
- }
+ private static final ArrayList<ConverterInfo> converterInfoList = new ArrayList<ConverterInfo>();
/**
* Adds a converter plug-in to the registry. The
@@ -137,24 +130,12 @@ public final class ConverterInfoMgr {
*/
public static boolean removeByJar(String jar) {
- ConverterInfo converterInfo;
boolean rc = false;
- // FIX (HJ): Has to use an iterator, since we are removing items
- /*Enumeration ciEnum = converterInfoList.elements();
- while (ciEnum.hasMoreElements())
- {
- converterInfo = (ConverterInfo)ciEnum.nextElement();
- if (jar.equals(converterInfo.getJarName())) {
- converterInfoList.remove(converterInfo);
- rc = true;
- }
- }*/
-
Iterator<ConverterInfo> ciIter = converterInfoList.iterator();
while (ciIter.hasNext())
{
- converterInfo = ciIter.next();
+ ConverterInfo converterInfo = ciIter.next();
if (jar.equals(converterInfo.getJarName())) {
ciIter.remove();
rc = true;
@@ -215,7 +196,7 @@ public final class ConverterInfoMgr {
String fromDeviceInfo = fromEnum.next();
if (deviceMime.trim().equals(fromDeviceInfo) &&
officeMime.trim().equals(toDeviceInfo)) {
- return (converterInfo);
+ return converterInfo;
}
}
}
@@ -279,8 +260,7 @@ public final class ConverterInfoMgr {
fromOfficeInfo.equals(toOfficeInfo)) {
// Found a match
-
- return (converterInfo);
+ return converterInfo;
}
}
}
@@ -299,7 +279,7 @@ public final class ConverterInfoMgr {
public static void main(String args[]) {
ConverterInfoReader cir = null;
- boolean validate = false;
+ boolean validate = false;
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
char c = ' ';
@@ -314,7 +294,7 @@ public final class ConverterInfoMgr {
System.out.println("(F)ind ConverterInfo");
System.out.println("(C)ind ConverterInfo chain");
System.out.println("(V)iew plug-ins");
- System.out.println("(T)oggle Validation");
+ System.out.println("(T)oggle Validation");
System.out.println("(Q)uit\n");
try {
@@ -360,14 +340,14 @@ public final class ConverterInfoMgr {
// Unload by Display Name or Jarfile
- } else if (c == 'T') {
- if (validate== true){
- System.out.println("Validation switched off");
- validate=false;
- }else{
- System.out.println("Validation switched on");
- validate=true;
- }
+ } else if (c == 'T') {
+ if (validate== true){
+ System.out.println("Validation switched off");
+ validate=false;
+ } else {
+ System.out.println("Validation switched on");
+ validate=true;
+ }
} else if (c == 'D' || c == 'J') {
if (c == 'D') {
@@ -483,8 +463,8 @@ public final class ConverterInfoMgr {
System.out.println(" Vendor : " + converterInfo.getVendor());
System.out.println(" ClassImpl : " + converterInfo.getClassImpl());
System.out.println(" XsltSerial : " + converterInfo.getXsltSerial());
- System.out.println(" XsltDeserial : " + converterInfo.getXsltDeserial());
- System.out.println(" Serialize : " + converterInfo.canSerialize());
+ System.out.println(" XsltDeserial : " + converterInfo.getXsltDeserial());
+ System.out.println(" Serialize : " + converterInfo.canSerialize());
System.out.println(" Deserialize : " + converterInfo.canDeserialize());
System.out.println(" Merge : " + converterInfo.canMerge());
ciCnt++;
commit 52ecfa0d4fcb9e39297fcc298730bd8ae8938529
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 31 09:36:32 2014 +0200
DOCX export: handle exact end of paragraph w:sdt tags
Previously every paragraph SDT was closed immediately after the
paragraph end. This commit adds support for having multiple paragraphs
inside an SDT.
A few testcases implicitly tested that such SDT's are lost on save,
adjust the relevant XPath expressions now that this works.
Change-Id: I07802b3e067600b087b7e0f9b2e7b3ba17c3379a
diff --git a/sw/qa/extras/ooxmlexport/data/sdt-2-para.docx b/sw/qa/extras/ooxmlexport/data/sdt-2-para.docx
new file mode 100644
index 0000000..b6d6565
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/sdt-2-para.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 9b4b380..76cb592 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -126,7 +126,7 @@ DECLARE_OOXMLEXPORT_TEST(testHyperlineIsEnd, "hyperlink.docx")
// If document.xml miss any ending tag then parseExport() returns NULL which fail the test case.
CPPUNIT_ASSERT(pXmlDoc) ;
// Check hyperlink is properly open.
- assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:hyperlink",1);
+ assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:hyperlink",1);
}
DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx")
@@ -136,7 +136,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx")
if (!pXmlDoc)
return;
- assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[21]/w:hyperlink/w:r[5]/w:t", "15");
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[21]/w:hyperlink/w:r[5]/w:t", "15");
}
DECLARE_OOXMLEXPORT_TEST(testFieldFlagO,"TOC_field_f.docx")
@@ -183,7 +183,7 @@ DECLARE_OOXMLEXPORT_TEST(testPreserveWfieldTOC, "PreserveWfieldTOC.docx")
if (!pXmlDoc)
return;
- assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:instrText", " TOC \\z \\w \\f \\o \"1-3\" \\h");
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " TOC \\z \\w \\f \\o \"1-3\" \\h");
}
DECLARE_OOXMLEXPORT_TEST(testFieldFlagB,"TOC_field_b.docx")
@@ -204,7 +204,7 @@ DECLARE_OOXMLEXPORT_TEST(testPreserveXfieldTOC, "PreserveXfieldTOC.docx")
if (!pXmlDoc)
return;
- assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:instrText", " TOC \\x \\f \\o \"1-3\" \\h");
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " TOC \\x \\f \\o \"1-3\" \\h");
}
DECLARE_OOXMLEXPORT_TEST(testFDO77715,"FDO77715.docx")
@@ -225,7 +225,7 @@ DECLARE_OOXMLEXPORT_TEST(testTOCFlag_u,"testTOCFlag_u.docx")
// FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed
// not to insert an empty paragraph before TOC.
- assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:instrText", " TOC \\z \\o \"1-9\" \\u \\h");
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " TOC \\z \\o \"1-9\" \\u \\h");
}
DECLARE_OOXMLEXPORT_TEST(testfdo73596_RunInStyle,"fdo73596_RunInStyle.docx")
@@ -337,7 +337,7 @@ DECLARE_OOXMLEXPORT_TEST(testPageref, "testPageref.docx")
if (!pXmlDoc)
return;
- assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink/w:r[3]/w:instrText", "PAGEREF _Toc355095261 \\h");
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[2]/w:hyperlink/w:r[3]/w:instrText", "PAGEREF _Toc355095261 \\h");
}
DECLARE_OOXMLEXPORT_TEST(testAlphabeticalIndex_AutoColumn,"alphabeticalIndex_AutoColumn.docx")
@@ -375,7 +375,7 @@ DECLARE_OOXMLEXPORT_TEST(testBibliography,"FDO75133.docx")
if (!pXmlDoc)
return;
- assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[2]/w:instrText", " BIBLIOGRAPHY ");
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r[2]/w:instrText", " BIBLIOGRAPHY ");
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:docPartObj/w:docPartGallery", "val", "Bibliographies");
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:docPartObj/w:docPartUnique", 1);
}
@@ -453,7 +453,7 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78654 , "fdo78654.docx")
return;
// In case of two "Hyperlink" tags in one paragraph and one of them
// contains "PAGEREF" field then field end tag was missing from hyperlink.
- assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:hyperlink[3]/w:r[5]/w:fldChar", "fldCharType", "end" );
+ assertXPath ( pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[2]/w:hyperlink[3]/w:r[5]/w:fldChar", "fldCharType", "end" );
}
@@ -520,6 +520,18 @@ DECLARE_OOXMLEXPORT_TEST(testParagraphSdt, "paragraph-sdt.docx")
}
}
+DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-para.docx")
+{
+ if (xmlDocPtr pXmlDoc = parseExport())
+ {
+ // The problem was that <w:sdt> was closed after "first", not after "second", so the second assert failed.
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r/w:t", "first");
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[2]/w:r/w:t", "second");
+ // Make sure the third paragraph is still outside <w:sdt>.
+ assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r/w:t", "third");
+ }
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0ff219e..9078f8b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -274,6 +274,29 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
}
}
+ // Look up the "sdt end before this paragraph" property early, when it
+ // would normally arrive, it would be too late (would be after the
+ // paragraph start has been written).
+ bool bEndParaSdt = false;
+ SwTxtNode* pTxtNode = m_rExport.pCurPam->GetNode().GetTxtNode();
+ if (pTxtNode && pTxtNode->GetpSwAttrSet())
+ {
+ const SfxItemSet* pSet = pTxtNode->GetpSwAttrSet();
+ if (const SfxPoolItem* pItem = pSet->GetItem(RES_PARATR_GRABBAG))
+ {
+ const SfxGrabBagItem& rParaGrabBag = static_cast<const SfxGrabBagItem&>(*pItem);
+ const std::map<OUString, com::sun::star::uno::Any>& rMap = rParaGrabBag.GetGrabBag();
+ bEndParaSdt = m_bStartedParaSdt && rMap.find("ParaSdtEndBefore") != rMap.end();
+ }
+ }
+ if (bEndParaSdt)
+ {
+ // This is the common case: "close sdt before the current paragraph" was requrested by the next paragraph.
+ EndSdtBlock();
+ bEndParaSdt = false;
+ m_bStartedParaSdt = false;
+ }
+
// this mark is used to be able to enclose the paragraph inside a sdr tag.
// We will only know if we have to do that later.
m_pSerializer->mark();
@@ -518,7 +541,8 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
}
m_pSerializer->endElementNS( XML_w, XML_p );
- if( !m_bAnchorLinkedToNode )
+ // on export sdt blocks are never nested ATM
+ if( !m_bAnchorLinkedToNode && !m_bStartedParaSdt )
WriteSdtBlock( m_nParagraphSdtPrToken, m_pParagraphSdtPrTokenChildren, m_pParagraphSdtPrDataBindingAttrs, m_aParagraphSdtPrAlias, /*bPara=*/true );
else
{
@@ -618,7 +642,13 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
// write the ending tags after the paragraph
if (bPara)
- EndSdtBlock();
+ {
+ m_bStartedParaSdt = true;
+ if (m_tableReference->m_bTableCellOpen)
+ m_tableReference->m_bTableCellParaSdtOpen = true;
+ if (m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen())
+ m_rExport.SdrExporter().setParagraphSdtOpen(true);
+ }
else
// Support multiple runs inside a run-evel SDT: don't close the SDT block yet.
m_bStartedCharSdt = true;
@@ -2902,10 +2932,14 @@ void DocxAttributeOutput::StartTableCell( ww8::WW8TableNodeInfoInner::Pointer_t
void DocxAttributeOutput::EndTableCell( )
{
+ if (m_tableReference->m_bTableCellParaSdtOpen)
+ EndParaSdtBlock();
+
m_pSerializer->endElementNS( XML_w, XML_tc );
m_bBtLr = false;
m_tableReference->m_bTableCellOpen = false;
+ m_tableReference->m_bTableCellParaSdtOpen = false;
}
void DocxAttributeOutput::TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ )
@@ -4583,6 +4617,7 @@ void DocxAttributeOutput::WritePostponedCustomShape()
if(m_postponedCustomShape == NULL)
return;
+ bool bStartedParaSdt = m_bStartedParaSdt;
for( std::list< PostponedDrawing >::iterator it = m_postponedCustomShape->begin();
it != m_postponedCustomShape->end();
++it )
@@ -4592,6 +4627,7 @@ void DocxAttributeOutput::WritePostponedCustomShape()
else
m_rExport.SdrExporter().writeDMLAndVMLDrawing(it->object, *(it->frame), *(it->point), m_anchorId++);
}
+ m_bStartedParaSdt = bStartedParaSdt;
delete m_postponedCustomShape;
m_postponedCustomShape = NULL;
}
@@ -4607,6 +4643,7 @@ void DocxAttributeOutput::WritePostponedDMLDrawing()
std::list<PostponedOLE>* postponedOLE = m_postponedOLE;
m_postponedOLE = 0;
+ bool bStartedParaSdt = m_bStartedParaSdt;
for( std::list< PostponedDrawing >::iterator it = postponedDMLDrawing->begin();
it != postponedDMLDrawing->end();
++it )
@@ -4617,6 +4654,7 @@ void DocxAttributeOutput::WritePostponedDMLDrawing()
else
m_rExport.SdrExporter().writeDMLAndVMLDrawing(it->object, *(it->frame), *(it->point), m_anchorId++);
}
+ m_bStartedParaSdt = bStartedParaSdt;
delete postponedDMLDrawing;
m_postponedOLE = postponedOLE;
@@ -4672,6 +4710,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
OUString sShapeType = xShape->getShapeType();
if ( m_postponedDMLDrawing == NULL )
{
+ bool bStartedParaSdt = m_bStartedParaSdt;
if ( IsAlternateContentChoiceOpen() )
{
// Do not write w:drawing inside w:drawing. Instead Postpone the Inner Drawing.
@@ -4682,6 +4721,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
}
else
m_rExport.SdrExporter().writeDMLAndVMLDrawing( pSdrObj, rFrame.GetFrmFmt(), rNdTopLeft, m_anchorId++);
+ m_bStartedParaSdt = bStartedParaSdt;
m_bPostponedProcessingFly = false ;
}
@@ -5086,6 +5126,16 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectio
}
}
+void DocxAttributeOutput::EndParaSdtBlock()
+{
+ if (m_bStartedParaSdt)
+ {
+ // Paragraph-level SDT still open? Close it now.
+ EndSdtBlock();
+ m_bStartedParaSdt = false;
+ }
+}
+
void DocxAttributeOutput::StartSection()
{
m_pSerializer->startElementNS( XML_w, XML_sectPr, FSEND );
@@ -7921,6 +7971,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_pHyperlinkAttrList( NULL ),
m_bEndCharSdt(false),
m_bStartedCharSdt(false),
+ m_bStartedParaSdt(false),
m_pColorAttrList( NULL ),
m_pBackgroundAttrList( NULL ),
m_endPageRef( false ),
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index ff4ed70..6ba3b48 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -113,6 +113,9 @@ struct TableReference
/// Remember if we are in an open cell, or not.
bool m_bTableCellOpen;
+ /// If paragraph sdt got opened in this table cell.
+ bool m_bTableCellParaSdtOpen;
+
/// Remember the current table depth.
sal_uInt32 m_nTableDepth;
@@ -120,6 +123,7 @@ struct TableReference
TableReference()
: m_bTableCellOpen(false),
+ m_bTableCellParaSdtOpen(false),
m_nTableDepth(0)
{
}
@@ -364,6 +368,8 @@ public:
void WriteBookmarks_Impl( std::vector< OUString >& rStarts, std::vector< OUString >& rEnds );
void WriteAnnotationMarks_Impl( std::vector< OUString >& rStarts, std::vector< OUString >& rEnds );
void ClearRelIdCache();
+ /// End possibly opened paragraph sdt block.
+ void EndParaSdtBlock();
private:
/// Initialize the structures where we are going to collect some of the paragraph properties.
@@ -717,6 +723,8 @@ private:
bool m_bEndCharSdt;
/// If an SDT around runs is currently open.
bool m_bStartedCharSdt;
+ /// If an SDT around paragraphs is currently open.
+ bool m_bStartedParaSdt;
/// Attributes of the run color
::sax_fastparser::FastAttributeList *m_pColorAttrList;
/// Attributes of the paragraph background
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 35b5572..932ec15 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -86,6 +86,11 @@ AttributeOutputBase& DocxExport::AttrOutput() const
return *m_pAttrOutput;
}
+DocxAttributeOutput& DocxExport::DocxAttrOutput() const
+{
+ return *m_pAttrOutput;
+}
+
MSWordSections& DocxExport::Sections() const
{
return *m_pSections;
@@ -711,6 +716,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
m_pAttrOutput->switchHeaderFooter(true, m_nHeadersFootersInSection++);
// do the work
WriteHeaderFooterText( rFmt, bHeader );
+ m_pAttrOutput->EndParaSdtBlock();
//When the stream changes the cache which is maintained for the graphics in case of alternate content is not cleared.
//So clearing the alternate content graphic cache.
@@ -1309,6 +1315,7 @@ void DocxExport::WriteMainText()
WriteText();
// the last section info
+ m_pAttrOutput->EndParaSdtBlock();
const WW8_SepInfo *pSectionInfo = m_pSections? m_pSections->CurrentSectionInfo(): NULL;
if ( pSectionInfo )
SectionProperties( *pSectionInfo );
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 9e2b6b7..3cda882 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -110,6 +110,9 @@ public:
/// Access to the attribute output class.
virtual AttributeOutputBase& AttrOutput() const SAL_OVERRIDE;
+ /// Access to the derived attribute output class.
+ virtual DocxAttributeOutput& DocxAttrOutput() const;
+
/// Access to the sections/headers/footres.
virtual MSWordSections& Sections() const SAL_OVERRIDE;
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 9429443..181c12b 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -42,6 +42,7 @@
#include <drawdoc.hxx>
#include <docxsdrexport.hxx>
#include <docxexport.hxx>
+#include <docxattributeoutput.hxx>
#include <docxexportfilter.hxx>
#include <writerhelper.hxx>
#include <comphelper/seqstream.hxx>
@@ -153,6 +154,7 @@ struct DocxSdrExport::Impl
OStringBuffer m_aTextFrameStyle;
bool m_bFrameBtLr;
bool m_bDrawingOpen;
+ bool m_bParagraphSdtOpen;
bool m_bParagraphHasDrawing; ///Flag for checking drawing in a paragraph.
bool m_bFlyFrameGraphic;
sax_fastparser::FastAttributeList* m_pFlyFillAttrList;
@@ -179,6 +181,7 @@ struct DocxSdrExport::Impl
m_pTextboxAttrList(0),
m_bFrameBtLr(false),
m_bDrawingOpen(false),
+ m_bParagraphSdtOpen(false),
m_bParagraphHasDrawing(false),
m_bFlyFrameGraphic(false),
m_pFlyFillAttrList(0),
@@ -264,6 +267,16 @@ bool DocxSdrExport::IsDrawingOpen()
return m_pImpl->m_bDrawingOpen;
}
+bool DocxSdrExport::isParagraphSdtOpen()
+{
+ return m_pImpl->m_bParagraphSdtOpen;
+}
+
+void DocxSdrExport::setParagraphSdtOpen(bool bParagraphSdtOpen)
+{
+ m_pImpl->m_bParagraphSdtOpen = bParagraphSdtOpen;
+}
+
bool DocxSdrExport::IsDMLAndVMLDrawingOpen()
{
return m_pImpl->m_bDMLAndVMLDrawingOpen;
@@ -1402,6 +1415,11 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo
m_pImpl->m_bFrameBtLr = checkFrameBtlr(m_pImpl->m_rExport.pDoc->GetNodes()[nStt], 0);
m_pImpl->m_bFlyFrameGraphic = true;
m_pImpl->m_rExport.WriteText();
+ if (m_pImpl->m_bParagraphSdtOpen)
+ {
+ m_pImpl->m_rExport.DocxAttrOutput().EndParaSdtBlock();
+ m_pImpl->m_bParagraphSdtOpen = false;
+ }
m_pImpl->m_bFlyFrameGraphic = false;
m_pImpl->m_bFrameBtLr = false;
@@ -1515,6 +1533,11 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly
pFS->startElementNS(XML_w, XML_txbxContent, FSEND);
m_pImpl->m_bFlyFrameGraphic = true;
m_pImpl->m_rExport.WriteText();
+ if (m_pImpl->m_bParagraphSdtOpen)
+ {
+ m_pImpl->m_rExport.DocxAttrOutput().EndParaSdtBlock();
+ m_pImpl->m_bParagraphSdtOpen = false;
+ }
m_pImpl->m_bFlyFrameGraphic = false;
pFS->endElementNS(XML_w, XML_txbxContent);
if (!bTextBoxOnly)
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx
index 5c98a42..8ee6cd7 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -64,6 +64,11 @@ public:
/// Same, as DocxAttributeOutput::m_bBtLr, but for textframe rotation.
bool getFrameBtLr();
+ /// Is paragraph sdt open in the current drawing?
+ bool isParagraphSdtOpen();
+ /// Set if paragraph sdt open in the current drawing.
+ void setParagraphSdtOpen(bool bParagraphSdtOpen);
+
bool IsDrawingOpen();
bool IsDMLAndVMLDrawingOpen();
bool IsParagraphHasDrawing();
More information about the Libreoffice-commits
mailing list