[Libreoffice-commits] core.git: sw/inc sw/source
Jakub Trzebiatowski
ubap.dev at gmail.com
Mon Jun 6 07:42:04 UTC 2016
sw/inc/docstyle.hxx | 3 -
sw/inc/poolfmt.hrc | 16 +++++++
sw/inc/poolfmt.hxx | 16 +++++++
sw/source/core/doc/SwStyleNameMapper.cxx | 18 ++++++++
sw/source/core/doc/tblafmt.cxx | 12 ++---
sw/source/core/unocore/unostyle.cxx | 10 ++--
sw/source/ui/utlui/poolfmt.src | 64 +++++++++++++++++++++++++++++++
sw/source/uibase/app/docstyle.cxx | 25 ++++++++++++
8 files changed, 152 insertions(+), 12 deletions(-)
New commits:
commit efb38949a44dec7e9f5fee7e9ec34164633d926c
Author: Jakub Trzebiatowski <ubap.dev at gmail.com>
Date: Sat Jun 4 10:39:41 2016 +0200
fdo47267 fix import crash
fixed import crash introduced in d4188f643db050c962a937547d19a9a08bd2235d
Change-Id: I0bf76fd345438e3cd303ee85c770aa0515c056df
Reviewed-on: https://gerrit.libreoffice.org/25887
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index a58ba3a..89a0745 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -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;
diff --git a/sw/inc/poolfmt.hrc b/sw/inc/poolfmt.hrc
index c1140fb..3cc6858 100644
--- a/sw/inc/poolfmt.hrc
+++ b/sw/inc/poolfmt.hrc
@@ -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
diff --git a/sw/inc/poolfmt.hxx b/sw/inc/poolfmt.hxx
index 65a6d07..6707c43 100644
--- a/sw/inc/poolfmt.hxx
+++ b/sw/inc/poolfmt.hxx
@@ -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
};
diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx
index 4d23cca..f644bbf 100644
--- a/sw/source/core/doc/SwStyleNameMapper.cxx
+++ b/sw/source/core/doc/SwStyleNameMapper.cxx
@@ -317,7 +317,23 @@ const struct SwTableEntry NumRuleProgNameTable [] =
const struct SwTableEntry TableStyleProgNameTable [] =
{
- ENTRY( "Default Style" ), // RES_POOLTABLESTYLE_DEFAULT
+ 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
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 1344b13..6c368a3 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -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;
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 0adfc3f..8ee3615 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -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;
}
diff --git a/sw/source/ui/utlui/poolfmt.src b/sw/source/ui/utlui/poolfmt.src
index 4a206e6..c6efa70 100644
--- a/sw/source/ui/utlui/poolfmt.src
+++ b/sw/source/ui/utlui/poolfmt.src
@@ -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: */
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index dde0a14..82ecf65 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -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
}
More information about the Libreoffice-commits
mailing list