fdo47267 fix import crash

fixed import crash introduced in d4188f643db050c962a937547d19a9a08bd2235d

Change-Id: I0bf76fd345438e3cd303ee85c770aa0515c056df
Reviewed-on: https://gerrit.libreoffice.org/25887
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Jakub Trzebiatowski 2016-06-04 10:39:41 +02:00 committed by Miklos Vajna
parent e319ef1171
commit efb38949a4
8 changed files with 152 additions and 12 deletions

View File

@ -36,6 +36,7 @@ class SwCharFormat;
class SwTextFormatColl;
class SwFrameFormat;
class SwNumRule;
class SwTableAutoFormat;
// Temporary StyleSheet.
class SW_DLLPUBLIC SwDocStyleSheet : public SfxStyleSheetBase
@ -48,7 +49,7 @@ class SW_DLLPUBLIC SwDocStyleSheet : public SfxStyleSheetBase
SwFrameFormat* pFrameFormat;
const SwPageDesc* pDesc;
const SwNumRule* pNumRule;
const SwTableAutoFormat* pTableFormat;
SwDoc& rDoc;
SfxItemSet aCoreSet;

View File

@ -266,6 +266,22 @@
// Table styles
#define STR_TABSTYLE_DEFAULT (RC_POOLTABSTYLE_BEGIN+ 0)
#define STR_TABSTYLE_3D (RC_POOLTABSTYLE_BEGIN+ 1)
#define STR_TABSTYLE_BLACK1 (RC_POOLTABSTYLE_BEGIN+ 2)
#define STR_TABSTYLE_BLACK2 (RC_POOLTABSTYLE_BEGIN+ 3)
#define STR_TABSTYLE_BLUE (RC_POOLTABSTYLE_BEGIN+ 4)
#define STR_TABSTYLE_BROWN (RC_POOLTABSTYLE_BEGIN+ 5)
#define STR_TABSTYLE_CURRENCY (RC_POOLTABSTYLE_BEGIN+ 6)
#define STR_TABSTYLE_CURRENCY_3D (RC_POOLTABSTYLE_BEGIN+ 7)
#define STR_TABSTYLE_CURRENCY_GRAY (RC_POOLTABSTYLE_BEGIN+ 8)
#define STR_TABSTYLE_CURRENCY_LAVENDER (RC_POOLTABSTYLE_BEGIN+ 9)
#define STR_TABSTYLE_CURRENCY_TURQUOISE (RC_POOLTABSTYLE_BEGIN+ 10)
#define STR_TABSTYLE_GRAY (RC_POOLTABSTYLE_BEGIN+ 11)
#define STR_TABSTYLE_GREEN (RC_POOLTABSTYLE_BEGIN+ 12)
#define STR_TABSTYLE_LAVENDER (RC_POOLTABSTYLE_BEGIN+ 13)
#define STR_TABSTYLE_RED (RC_POOLTABSTYLE_BEGIN+ 14)
#define STR_TABSTYLE_TURQUOISE (RC_POOLTABSTYLE_BEGIN+ 15)
#define STR_TABSTYLE_YELLOW (RC_POOLTABSTYLE_BEGIN+ 16)
#endif

View File

@ -203,6 +203,22 @@ enum RES_POOL_TABSTYLE_TYPE
{
RES_POOLTABSTYLE_BEGIN = POOLGRP_TABSTYLE,
RES_POOLTABSTYLE_DEFAULT = RES_POOLTABSTYLE_BEGIN,
RES_POOLTABLESTYLE_3D,
RES_POOLTABLESTYLE_BLACK1,
RES_POOLTABLESTYLE_BLACK2,
RES_POOLTABLESTYLE_BLUE,
RES_POOLTABLESTYLE_BROWN,
RES_POOLTABLESTYLE_CURRENCY,
RES_POOLTABLESTYLE_CURRENCY_3D,
RES_POOLTABLESTYLE_CURRENCY_GRAY,
RES_POOLTABLESTYLE_CURRENCY_LAVENDER,
RES_POOLTABLESTYLE_CURRENCY_TURQUOISE,
RES_POOLTABLESTYLE_GRAY,
RES_POOLTABLESTYLE_GREEN,
RES_POOLTABLESTYLE_LAVENDER,
RES_POOLTABLESTYLE_RED,
RES_POOLTABLESTYLE_TURQUOISE,
RES_POOLTABLESTYLE_YELLOW,
RES_POOLTABSTYLE_END
};

View File

@ -318,6 +318,22 @@ const struct SwTableEntry NumRuleProgNameTable [] =
const struct SwTableEntry TableStyleProgNameTable [] =
{
ENTRY( "Default Style" ), // RES_POOLTABLESTYLE_DEFAULT
ENTRY( "3D" ), // RES_POOLTABLESTYLE_3D
ENTRY( "Black 1" ), // RES_POOLTABLESTYLE_BLACK1
ENTRY( "Black 2" ), // RES_POOLTABLESTYLE_BLACK2
ENTRY( "Blue" ), // RES_POOLTABLESTYLE_BLUE
ENTRY( "Brown" ), // RES_POOLTABLESTYLE_BROWN
ENTRY( "Currency" ), // RES_POOLTABLESTYLE_CURRENCY
ENTRY( "Currency 3D" ), // RES_POOLTABLESTYLE_CURRENCY_3D
ENTRY( "Currency Gray" ), // RES_POOLTABLESTYLE_CURRENCY_GRAY
ENTRY( "Currency Lavender" ), // RES_POOLTABLESTYLE_CURRENCY_LAVENDER
ENTRY( "Currency Turquoise" ),// RES_POOLTABLESTYLE_CURRENCY_TURQUOISE
ENTRY( "Gray" ), // RES_POOLTABLESTYLE_GRAY
ENTRY( "Green" ), // RES_POOLTABLESTYLE_GREEN
ENTRY( "Lavender" ), // RES_POOLTABLESTYLE_LAVENDER
ENTRY( "Red" ), // RES_POOLTABLESTYLE_RED
ENTRY( "Turquoise" ), // RES_POOLTABLESTYLE_TURQUOISE
ENTRY( "Yellow" ), // RES_POOLTABLESTYLE_YELLOW
{ 0, nullptr }
};
#undef ENTRY

View File

@ -28,7 +28,6 @@
#include <unotools/pathoptions.hxx>
#include <sfx2/app.hxx>
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
#include <swtable.hxx>
#include <swtblfmt.hxx>
#include <com/sun/star/text/VertOrientation.hpp>
@ -940,11 +939,12 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions )
if( AUTOFORMAT_DATA_ID_552 <= nVal )
{
rStream.ReadUInt16( nStrResId );
sal_uInt16 nId = RID_SVXSTR_TBLAFMT_BEGIN + nStrResId;
if( RID_SVXSTR_TBLAFMT_BEGIN <= nId &&
nId < RID_SVXSTR_TBLAFMT_END )
// start from 3d because default is added via constructor
sal_uInt16 nId = RES_POOLTABLESTYLE_3D + nStrResId;
if( RES_POOLTABLESTYLE_3D <= nId &&
nId < RES_POOLTABSTYLE_END )
{
m_aName = SVX_RESSTR( nId );
m_aName = SwStyleNameMapper::GetUIName(nId, m_aName);
}
else
nStrResId = USHRT_MAX;
@ -1095,7 +1095,7 @@ SwTableAutoFormatTable::SwTableAutoFormatTable()
{
OUString sNm;
std::unique_ptr<SwTableAutoFormat> pNew(new SwTableAutoFormat(
SwStyleNameMapper::GetUIName(RES_POOLCOLL_STANDARD, sNm)));
SwStyleNameMapper::GetUIName(RES_POOLTABSTYLE_DEFAULT, sNm)));
SwBoxAutoFormat aNew;

View File

@ -817,8 +817,8 @@ uno::Any XStyleFamily::getByName(const OUString& rName)
SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.m_aPoolId, true);
if(!m_pBasePool)
throw uno::RuntimeException();
std::shared_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL);
SfxStyleSheetBase* pBase = pIt->Find(sStyleName);
m_pBasePool->SetSearchMask(m_rEntry.m_eFamily);
SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName);
if(!pBase)
throw container::NoSuchElementException();
uno::Reference<style::XStyle> xStyle = FindStyle(sStyleName);
@ -850,8 +850,8 @@ sal_Bool XStyleFamily::hasByName(const OUString& rName) throw( uno::RuntimeExcep
throw uno::RuntimeException();
OUString sStyleName;
SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.m_aPoolId, true);
std::shared_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL);
SfxStyleSheetBase* pBase = pIt->Find(sStyleName);
m_pBasePool->SetSearchMask(m_rEntry.m_eFamily);
SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName);
return nullptr != pBase;
}
@ -4345,6 +4345,8 @@ void SAL_CALL SwXTextTableStyle::setParentStyle(const OUString& /*aParentStyle*/
//XNamed
OUString SAL_CALL SwXTextTableStyle::getName() throw(uno::RuntimeException, std::exception)
{
OUString sProgName;
SwStyleNameMapper::FillProgName(m_sTableAutoFormatName, sProgName, nsSwGetPoolIdFromName::GET_POOLID_TABSTYLE, true);
return m_sTableAutoFormatName;
}

View File

@ -765,5 +765,69 @@ String STR_TABSTYLE_DEFAULT
{
Text [ en-US ] = "Default Style";
};
String STR_TABSTYLE_3D
{
Text [ en-US ] = "3D";
};
String STR_TABSTYLE_BLACK1
{
Text [ en-US ] = "Black 1";
};
String STR_TABSTYLE_BLACK2
{
Text [ en-US ] = "Black 2";
};
String STR_TABSTYLE_BLUE
{
Text [ en-US ] = "Blue";
};
String STR_TABSTYLE_BROWN
{
Text [ en-US ] = "Brown";
};
String STR_TABSTYLE_CURRENCY
{
Text [ en-US ] = "Currency";
};
String STR_TABSTYLE_CURRENCY_3D
{
Text [ en-US ] = "Currency 3D";
};
String STR_TABSTYLE_CURRENCY_GRAY
{
Text [ en-US ] = "Currency Gray";
};
String STR_TABSTYLE_CURRENCY_LAVENDER
{
Text [ en-US ] = "Currency Lavender";
};
String STR_TABSTYLE_CURRENCY_TURQUOISE
{
Text [ en-US ] = "Currency Turquoise";
};
String STR_TABSTYLE_GRAY
{
Text [ en-US ] = "Gray";
};
String STR_TABSTYLE_GREEN
{
Text [ en-US ] = "Green";
};
String STR_TABSTYLE_LAVENDER
{
Text [ en-US ] = "Lavender";
};
String STR_TABSTYLE_RED
{
Text [ en-US ] = "Red";
};
String STR_TABSTYLE_TURQUOISE
{
Text [ en-US ] = "Turquoise";
};
String STR_TABSTYLE_YELLOW
{
Text [ en-US ] = "Yellow";
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -300,6 +300,26 @@ static const SwNumRule* lcl_FindNumRule( SwDoc& rDoc,
return pRule;
}
static const SwTableAutoFormat* lcl_FindTableStyle(SwDoc& rDoc, const OUString& rName, SwDocStyleSheet *pStyle = nullptr)
{
const SwTableAutoFormat* pFormat = nullptr;
if (!rName.isEmpty())
pFormat = rDoc.GetTableStyles().FindAutoFormat(rName);
if(pStyle)
{
if(pFormat)
{
pStyle->SetPhysical(true);
pStyle->PresetParent(OUString());
}
else
pStyle->SetPhysical(false);
}
return pFormat;
}
sal_uInt32 SwStyleSheetIterator::SwPoolFormatList::FindName(SfxStyleFamily eFam,
const OUString &rName)
{
@ -1920,6 +1940,11 @@ bool SwDocStyleSheet::FillStyleSheet(
if( bDeleteInfo )
pNumRule = nullptr;
break;
case SfxStyleFamily::Table:
pTableFormat = lcl_FindTableStyle(rDoc, aName, this);
bRet = bPhysical = (nullptr != pTableFormat);
break;
default:; //prevent warning
}