summaryrefslogtreecommitdiff
path: root/sw/source/uibase/app
diff options
context:
space:
mode:
authorJakub Trzebiatowski <ubap.dev@gmail.com>2016-06-04 12:02:37 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-07 13:12:24 +0000
commit45a6fdad8101e4ba552ca4d4532d0b03b79dd15a (patch)
tree262cb8e027b6498bc0843382cdda9f7b0b55f141 /sw/source/uibase/app
parent934908168ebdb4a021e18e6bea57accc21d5ad86 (diff)
sw UNO Cell Style family, SwXTextCellStyle
Cell Family :: getByName Cell Family :: getElementNames Cell Family :: getCount Change-Id: I37d567ee284054f847c704d9fce370d174a0c48c Reviewed-on: https://gerrit.libreoffice.org/25896 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/app')
-rw-r--r--sw/source/uibase/app/docstyle.cxx66
1 files changed, 66 insertions, 0 deletions
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 82ecf653374e..277c222bc60c 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -77,6 +77,7 @@
#define cPAGE (sal_Unicode)'g'
#define cNUMRULE (sal_Unicode)'n'
#define cTABSTYLE (sal_Unicode)'t'
+#define cCELLSTYLE (sal_Unicode)'b'
using namespace com::sun::star;
@@ -320,6 +321,40 @@ static const SwTableAutoFormat* lcl_FindTableStyle(SwDoc& rDoc, const OUString&
return pFormat;
}
+static const SwBoxAutoFormat* lcl_FindCellStyle(SwDoc& rDoc, const OUString& rName, SwDocStyleSheet *pStyle = nullptr)
+{
+ const SwBoxAutoFormat* pFormat = nullptr;
+
+ auto aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
+ SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
+ for (size_t i=0; i < rTableStyles.size() && !pFormat; ++i)
+ {
+ const SwTableAutoFormat& rTableStyle = rTableStyles[i];
+ for (size_t nBoxFormat=0; nBoxFormat < aTableTemplateMap.size() && !pFormat; ++nBoxFormat)
+ {
+ const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
+ const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
+ OUString sBoxFormatName;
+ SwStyleNameMapper::FillProgName(rTableStyle.GetName(), sBoxFormatName, nsSwGetPoolIdFromName::GET_POOLID_CELLSTYLE, true);
+ sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
+ if (rName == sBoxFormatName)
+ pFormat = &rBoxFormat;
+ }
+ }
+
+ 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)
{
@@ -346,6 +381,9 @@ sal_uInt32 SwStyleSheetIterator::SwPoolFormatList::FindName(SfxStyleFamily eFam,
case SfxStyleFamily::Table:
cStyle = cTABSTYLE;
break;
+ case SfxStyleFamily::Cell:
+ cStyle = cCELLSTYLE;
+ break;
default:
cStyle = ' ';
break;
@@ -1945,6 +1983,11 @@ bool SwDocStyleSheet::FillStyleSheet(
pTableFormat = lcl_FindTableStyle(rDoc, aName, this);
bRet = bPhysical = (nullptr != pTableFormat);
break;
+
+ case SfxStyleFamily::Cell:
+ pBoxFormat = lcl_FindCellStyle(rDoc, aName, this);
+ bRet = bPhysical = (nullptr != pBoxFormat);
+ break;
default:; //prevent warning
}
@@ -2529,6 +2572,9 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const OUString& rName,
}
break;
+ case SfxStyleFamily::Table:
+ case SfxStyleFamily::Cell:
+ break;
default:
OSL_ENSURE(false, "unknown style family");
}
@@ -2941,6 +2987,26 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
}
}
+ if( nSearchFamily == SfxStyleFamily::Cell ||
+ nSearchFamily == SfxStyleFamily::All )
+ {
+ const std::vector<sal_Int32> aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
+ const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
+ for(size_t i = 0; i < rTableStyles.size(); ++i)
+ {
+ const SwTableAutoFormat& rTableStyle = rTableStyles[i];
+ for(size_t nBoxFormat = 0; nBoxFormat < aTableTemplateMap.size(); ++nBoxFormat)
+ {
+ const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
+ const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
+ OUString sBoxFormatName;
+ SwStyleNameMapper::FillProgName(rTableStyle.GetName(), sBoxFormatName, nsSwGetPoolIdFromName::GET_POOLID_CELLSTYLE, true);
+ sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
+ aLst.Append( cCELLSTYLE, sBoxFormatName );
+ }
+ }
+ }
+
if(!aLst.empty())
{
nLastPos = SAL_MAX_UINT32;