sd: replace hardcoded table styles with xml file

Including a new set of default styles, provided by Rafael Lima.
Some ui tests had to be modified, because the new borders are
thicker.

If you intend to edit the xml file, please keep in mind the
following requirements:

1) There should be a table template called "default". It's
applied to newly inserted tables.

2) There should be a cell style called "default". It's used for
new table styles.

3) Please make all cell styles inherit from "default" (directly
or indirectly), unless you intend to specify font names in them.
"default" has its font names filled programmatically based on
officecfg/registry/data/org/openoffice/VCL.xcu.

4) Whenever possible please use <style:table-cell-properties>
for cell properties, instead of the incorrect
<style:paragraph-properties> and <loext:graphic-properties>
we currently use for export. See tdf#72238 and tdf#72239.

Change-Id: I73dd4492fefb65b1870238aec7dc64f8076f6e95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141825
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
This commit is contained in:
Maxim Monastirsky 2022-11-22 14:07:12 +02:00
parent 7830ecc2e4
commit daab698b34
12 changed files with 284 additions and 210 deletions

View file

@ -36,7 +36,10 @@
class SvXMLStyleContext;
typedef std::map< OUString, OUString > XMLTableTemplate;
typedef std::map < OUString, std::shared_ptr< XMLTableTemplate > > XMLTableTemplateMap;
// Not using a map here, as we want the templates to be
// inserted in the same order they were defined in the
// xml (at least for sd built in templates):
typedef std::vector< std::pair< OUString, std::shared_ptr< XMLTableTemplate > > > XMLTableTemplateMap;
class XMLOFF_DLLPUBLIC XMLTableImport final : public salhelper::SimpleReferenceObject
{

View file

@ -14,6 +14,7 @@ $(eval $(call gb_Package_add_files,sd_xml,$(LIBO_SHARE_FOLDER)/config/soffice.cf
transitions.xml \
layoutlist.xml \
objectlist.xml \
styles.xml \
))
# vim: set noet sw=4 ts=4:

View file

@ -67,13 +67,6 @@
#define HID_PSEUDOSHEET_NOTES (HID_SD_START + 98)
#define HID_PSEUDOSHEET_SUBTITLE (HID_SD_START + 101)
#define HID_SD_CELL_STYLE_DEFAULT (HID_SD_START + 194)
#define HID_SD_CELL_STYLE_BANDED (HID_SD_START + 195)
#define HID_SD_CELL_STYLE_HEADER (HID_SD_START + 196)
#define HID_SD_CELL_STYLE_TOTAL (HID_SD_START + 197)
#define HID_SD_CELL_STYLE_FIRST_COLUMN (HID_SD_START + 198)
#define HID_SD_CELL_STYLE_LAST_COLUMN (HID_SD_START + 199)
#define SID_PAGESETUP (SID_SD_START+2)
// FREE
#define SID_COPYOBJECTS (SID_SD_START+4)

View file

@ -360,11 +360,6 @@
#define STR_PSEUDOSHEET_NOTES NC_("STR_PSEUDOSHEET_NOTES", "Notes" )
#define STR_POWERPOINT_IMPORT NC_("STR_POWERPOINT_IMPORT", "PowerPoint Import")
#define STR_SAVE_DOC NC_("STR_SAVE_DOC", "Save Document" )
#define STR_POOLSHEET_BANDED_CELL NC_("STR_POOLSHEET_BANDED_CELL", "Banding cell" )
#define STR_POOLSHEET_HEADER NC_("STR_POOLSHEET_HEADER", "Header" )
#define STR_POOLSHEET_TOTAL NC_("STR_POOLSHEET_TOTAL", "Total line" )
#define STR_POOLSHEET_FIRST_COLUMN NC_("STR_POOLSHEET_FIRST_COLUMN", "First column" )
#define STR_POOLSHEET_LAST_COLUMN NC_("STR_POOLSHEET_LAST_COLUMN", "Last column" )
#define STR_SHRINK_FONT_SIZE NC_("STR_SHRINK_FONT_SIZE", "Shrink font size")
#define STR_GROW_FONT_SIZE NC_("STR_GROW_FONT_SIZE", "Grow font size")

View file

@ -23,8 +23,8 @@ class tdf139511(UITestCase):
self.xUITest.executeCommand(".uno:InsertTable?Columns:short=4&Rows:short=4")
self.assertEqual(8004, document.DrawPages[0].getByIndex(2).BoundRect.Height)
self.assertEqual(14104, document.DrawPages[0].getByIndex(2).BoundRect.Width)
self.assertEqual(8036, document.DrawPages[0].getByIndex(2).BoundRect.Height)
self.assertEqual(14136, document.DrawPages[0].getByIndex(2).BoundRect.Width)
with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog:
@ -43,9 +43,9 @@ class tdf139511(UITestCase):
# Without the fix in place, this test would have failed with
# AssertionError: 5005 != 8004
self.assertEqual(5005, document.DrawPages[0].getByIndex(2).BoundRect.Height)
self.assertEqual(10005, document.DrawPages[0].getByIndex(2).BoundRect.Width)
# AssertionError: 5037 != 8036
self.assertEqual(5037, document.DrawPages[0].getByIndex(2).BoundRect.Height)
self.assertEqual(10037, document.DrawPages[0].getByIndex(2).BoundRect.Width)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -25,7 +25,7 @@ class tdf91762(UITestCase):
self.assertEqual('5', get_state_as_dict(xDialog.getChild('columns'))['Text'])
self.assertEqual('2', get_state_as_dict(xDialog.getChild('rows'))['Text'])
self.assertEqual(1929, document.DrawPages[0].getByIndex(1).BoundRect.Height)
self.assertEqual(1961, document.DrawPages[0].getByIndex(1).BoundRect.Height)
self.assertEqual(25198, document.DrawPages[0].getByIndex(1).Size.Width)
self.assertEqual(1923, document.DrawPages[0].getByIndex(1).Size.Height)
@ -38,9 +38,8 @@ class tdf91762(UITestCase):
xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"}))
xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
# tdf#138011: Without the fix in place, this test would have failed with
# AssertionError: 5504 != 3559
self.assertEqual(5504, document.DrawPages[0].getByIndex(1).BoundRect.Height)
# tdf#138011: Without the fix in place, it will be much lower
self.assertEqual(5466, document.DrawPages[0].getByIndex(1).BoundRect.Height)
# vim: set shiftwidth=4 softtabstop=4 expandtab:

View file

@ -18,10 +18,14 @@
*/
#include <sal/config.h>
#include <config_folders.h>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/form/XReset.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/sax/XFastParser.hpp>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <sfx2/dispatch.hxx>
@ -31,6 +35,11 @@
#include <DrawDocShell.hxx>
#include <editeng/eeitem.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
#include <rtl/bootstrap.hxx>
#include <unotools/streamwrap.hxx>
#include <tools/stream.hxx>
#include <tools/UnitConversion.hxx>
#include <vcl/idle.hxx>
@ -593,63 +602,28 @@ void SdDrawDocument::CreateLayoutTemplates()
pSSPool->CreateLayoutStyleSheets(aPrefix);
}
static Any implMakeSolidCellStyle( SdStyleSheetPool* pSSPool, const OUString& rName, const OUString& rParent, const Color& rColor )
{
SfxStyleSheetBase* pSheet = &(pSSPool->Make(rName, SfxStyleFamily::Frame, SfxStyleSearchBits::Auto));
pSheet->SetParent(rParent);
SfxItemSet* pISet = &pSheet->GetItemSet();
pISet->Put(XFillStyleItem(drawing::FillStyle_SOLID));
pISet->Put(XFillColorItem(OUString(), rColor));
return Any( Reference< XStyle >( static_cast< XWeak* >( pSheet ), UNO_QUERY ) );
}
static void implCreateTableTemplate( const Reference< XNameContainer >& xTableFamily, const OUString& rName, const Any& rBody, const Any& rHeading, const Any& rBanding )
{
if( !xTableFamily.is() )
return;
try
{
if( !xTableFamily->hasByName( rName ) )
{
Reference< XSingleServiceFactory > xFactory( xTableFamily, UNO_QUERY_THROW );
Reference< XNameReplace > xDefaultTableStyle( xFactory->createInstance(), UNO_QUERY_THROW );
xTableFamily->insertByName( rName, Any( xDefaultTableStyle ) );
xDefaultTableStyle->replaceByName( "body", rBody );
xDefaultTableStyle->replaceByName( "odd-rows" , rBanding );
xDefaultTableStyle->replaceByName( "odd-columns" , rBanding );
xDefaultTableStyle->replaceByName( "first-row" , rHeading );
xDefaultTableStyle->replaceByName( "first-column" , rHeading );
xDefaultTableStyle->replaceByName( "last-row" , rHeading );
xDefaultTableStyle->replaceByName( "last-column" , rHeading );
}
}
catch( Exception& )
{
TOOLS_WARN_EXCEPTION( "sd", "sd::implCreateTableTemplate()");
}
}
void SdDrawDocument::CreateDefaultCellStyles()
{
SdStyleSheetPool* pSSPool = static_cast< SdStyleSheetPool* >(GetStyleSheetPool());
SfxStyleSheetBase* pSheet = nullptr;
Reference<css::uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
Reference<css::document::XImporter> xImporter(xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
"com.sun.star.comp.Draw.XMLOasisStylesImporter",
{ Any(comphelper::makePropertyValue("OrganizerMode", true)) }, xContext), UNO_QUERY);
if (xImporter)
xImporter->setTargetDocument(mpDocSh->GetModel());
Reference< XNameContainer > xTableFamily( pSSPool->getByName( "table" ), UNO_QUERY );
OUString aURL("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/config/soffice.cfg/simpress/styles.xml");
rtl::Bootstrap::expandMacros(aURL);
SvFileStream aFile(aURL, StreamMode::READ);
Reference<css::io::XInputStream> xInputStream(new utl::OInputStreamWrapper(aFile));
// ---- Default -----------------------------------------------
OUString aDefaultCellStyleName( "default" );
pSheet = &(pSSPool->Make(aDefaultCellStyleName, SfxStyleFamily::Frame, SfxStyleSearchBits::Auto));
pSheet->SetHelpId( OUString(), HID_SD_CELL_STYLE_DEFAULT );
SfxItemSet& rISet = pSheet->GetItemSet();
rISet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
rISet.Put(XFillColorItem(OUString(), Color(0x00ccccff)));
css::xml::sax::InputSource aParserInput;
aParserInput.sPublicId = aURL;
aParserInput.aInputStream = xInputStream;
Reference<css::xml::sax::XFastParser> xFastParser(xImporter, UNO_QUERY);
if (xFastParser)
xFastParser->parseStream(aParserInput);
// Set default fonts, if they were not defined in the xml.
vcl::Font aLatinFont, aCJKFont, aCTLFont;
getDefaultFonts( aLatinFont, aCJKFont, aCTLFont );
@ -663,131 +637,28 @@ void SdDrawDocument::CreateDefaultCellStyles()
SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamilyType(), aCTLFont.GetFamilyName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(),
aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL );
rISet.Put( aSvxFontItem );
rISet.Put( aSvxFontItemCJK );
rISet.Put( aSvxFontItemCTL );
SdStyleSheetPool* pSSPool = static_cast<SdStyleSheetPool*>(GetStyleSheetPool());
SfxStyleSheetBase* pDefaultStyle = pSSPool->Find("default", SfxStyleFamily::Frame);
if (pDefaultStyle)
{
SfxItemSet& rSet(pDefaultStyle->GetItemSet());
if (!rSet.HasItem(EE_CHAR_FONTINFO))
rSet.Put(aSvxFontItem);
if (!rSet.HasItem(EE_CHAR_FONTINFO_CJK))
rSet.Put(aSvxFontItemCJK);
if (!rSet.HasItem(EE_CHAR_FONTINFO_CTL))
rSet.Put(aSvxFontItemCTL);
}
rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT ) ); // sj: (i33745) changed default from 24 to 18 pt
rISet.Put( SvxFontHeightItem( 635, 100, EE_CHAR_FONTHEIGHT_CJK ) ); // 18 pt
rISet.Put( SvxFontHeightItem( convertFontHeightToCTL( 635 ), 100, EE_CHAR_FONTHEIGHT_CTL ) ); // 18 pt
// Reset the user defined flag.
SfxStyleSheetBase* pSheet = pSSPool->First(SfxStyleFamily::Frame);
while (pSheet)
{
pSheet->SetMask(SfxStyleSearchBits::Auto);
pSheet = pSSPool->Next();
}
rISet.Put(SvxColorItem(COL_AUTO, EE_CHAR_COLOR ));
// Paragraph attributes (Edit Engine)
rISet.Put(SvxLRSpaceItem(EE_PARA_LRSPACE));
rISet.Put(SvxULSpaceItem(EE_PARA_ULSPACE));
rISet.Put( makeSdrTextLeftDistItem( 250 ) );
rISet.Put( makeSdrTextRightDistItem( 250 ) );
rISet.Put( makeSdrTextUpperDistItem( 130 ) );
rISet.Put( makeSdrTextLowerDistItem( 130 ) );
rISet.Put( SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL ) );
rISet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
rISet.Put( SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP) );
rISet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT) );
Color aWhite( COL_WHITE );
::editeng::SvxBorderLine aBorderLine(
&aWhite, 1, SvxBorderLineStyle::SOLID);
SvxBoxItem aBoxItem( SDRATTR_TABLE_BORDER );
aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::TOP );
aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::BOTTOM );
aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::LEFT );
aBoxItem.SetLine( &aBorderLine, SvxBoxItemLine::RIGHT );
rISet.Put( aBoxItem );
// ---- default --------------------------------------------------
Any aGray1( implMakeSolidCellStyle( pSSPool, "gray1" , aDefaultCellStyleName, Color(230,230,230)));
Any aGray2( implMakeSolidCellStyle( pSSPool, "gray2" , aDefaultCellStyleName, Color(204,204,204)));
Any aGray3( implMakeSolidCellStyle( pSSPool, "gray3" , aDefaultCellStyleName, Color(179,179,179)));
implCreateTableTemplate( xTableFamily, "default" , aGray1, aGray3, aGray2 );
// ---- BW ------------------------------------------------
Any aBW1( implMakeSolidCellStyle( pSSPool, "bw1" , aDefaultCellStyleName, Color(255,255,255)));
Any aBW2( implMakeSolidCellStyle( pSSPool, "bw2" , aDefaultCellStyleName, Color(230,230,230)));
Any aBW3( implMakeSolidCellStyle( pSSPool, "bw3" , aDefaultCellStyleName, Color(0,0,0)));
implCreateTableTemplate( xTableFamily, "bw" , aBW1, aBW3, aBW2 );
// ---- Orange --------------------------------------------------
Any aOrange1( implMakeSolidCellStyle( pSSPool, "orange1" , aDefaultCellStyleName, Color(255,204,153)));
Any aOrange2( implMakeSolidCellStyle( pSSPool, "orange2" , aDefaultCellStyleName, Color(255,153,102)));
Any aOrange3( implMakeSolidCellStyle( pSSPool, "orange3" , aDefaultCellStyleName, Color(255,102,51)));
implCreateTableTemplate( xTableFamily, "orange" , aOrange1, aOrange3, aOrange2 );
// ---- Turquoise --------------------------------------------------
Any aTurquoise1( implMakeSolidCellStyle( pSSPool, "turquoise1" , aDefaultCellStyleName, Color(71,184,184)));
Any aTurquoise2( implMakeSolidCellStyle( pSSPool, "turquoise2" , aDefaultCellStyleName, Color(51,163,163)));
Any aTurquoise3( implMakeSolidCellStyle( pSSPool, "turquoise3" , aDefaultCellStyleName, Color(25,138,138)));
implCreateTableTemplate( xTableFamily, "turquoise" , aTurquoise1, aTurquoise3, aTurquoise2 );
// ---- Gray ------------------------------------------------
Any aBlue1( implMakeSolidCellStyle( pSSPool, "blue1" , aDefaultCellStyleName, Color(153,204,255)));
Any aBlue2( implMakeSolidCellStyle( pSSPool, "blue2" , aDefaultCellStyleName, Color(0,153,255)));
Any aBlue3( implMakeSolidCellStyle( pSSPool, "blue3" , aDefaultCellStyleName, Color(0,102,204)));
implCreateTableTemplate( xTableFamily, "blue" , aBlue1, aBlue3, aBlue2 );
// ---- Sun ------------------------------------------------
Any aSun1( implMakeSolidCellStyle( pSSPool, "sun1" , aDefaultCellStyleName, Color(230,230,255)));
Any aSun2( implMakeSolidCellStyle( pSSPool, "sun2" , aDefaultCellStyleName, Color(204,204,255)));
Any aSun3( implMakeSolidCellStyle( pSSPool, "sun3" , aDefaultCellStyleName, Color(153,153,255)));
implCreateTableTemplate( xTableFamily, "sun" , aSun1, aSun3, aSun2 );
// ---- Earth ----------------------------------------------
Any aEarth1( implMakeSolidCellStyle( pSSPool, "earth1" , aDefaultCellStyleName, Color(255,255,204)));
Any aEarth2( implMakeSolidCellStyle( pSSPool, "earth2" , aDefaultCellStyleName, Color(255,204,153)));
Any aEarth3( implMakeSolidCellStyle( pSSPool, "earth3" , aDefaultCellStyleName, Color(204,102,51)));
implCreateTableTemplate( xTableFamily, "earth" , aEarth1, aEarth3, aEarth2 );
// ---- Green ----------------------------------------------
Any aGreen1( implMakeSolidCellStyle( pSSPool, "green1" , aDefaultCellStyleName, Color(255,255,204)));
Any aGreen2( implMakeSolidCellStyle( pSSPool, "green2" , aDefaultCellStyleName, Color(148,189,94)));
Any aGreen3( implMakeSolidCellStyle( pSSPool, "green3" , aDefaultCellStyleName, Color(92,133,38)));
implCreateTableTemplate( xTableFamily, "green" , aGreen1, aGreen3, aGreen2 );
// ---- Seaweed ----------------------------------------------
Any aSeetang1( implMakeSolidCellStyle( pSSPool, "seetang1" , aDefaultCellStyleName, Color(204,255,255)));
Any aSeetang2( implMakeSolidCellStyle( pSSPool, "seetang2" , aDefaultCellStyleName, Color(71,184,184)));
Any aSeetang3( implMakeSolidCellStyle( pSSPool, "seetang3" , aDefaultCellStyleName, Color(51,163,163)));
implCreateTableTemplate( xTableFamily, "seetang" , aSeetang1, aSeetang3, aSeetang2 );
// ---- LightBlue ----------------------------------------------
Any aLightBlue1( implMakeSolidCellStyle( pSSPool, "lightblue1" , aDefaultCellStyleName, Color(255,255,255)));
Any aLightBlue2( implMakeSolidCellStyle( pSSPool, "lightblue2" , aDefaultCellStyleName, Color(230,230,255)));
Any aLightBlue3( implMakeSolidCellStyle( pSSPool, "lightblue3" , aDefaultCellStyleName, Color(153,153,204)));
implCreateTableTemplate( xTableFamily, "lightblue" , aLightBlue1, aLightBlue3, aLightBlue2 );
// ---- Yellow ----------------------------------------------
Any aYellow1( implMakeSolidCellStyle( pSSPool, "yellow1" , aDefaultCellStyleName, Color(255,255,204)));
Any aYellow2( implMakeSolidCellStyle( pSSPool, "yellow2" , aDefaultCellStyleName, Color(255,255,153)));
Any aYellow3( implMakeSolidCellStyle( pSSPool, "yellow3" , aDefaultCellStyleName, Color(255,204,153)));
implCreateTableTemplate( xTableFamily, "yellow" , aYellow1, aYellow3, aYellow2 );
Reference<form::XReset> xReset(xTableFamily, UNO_QUERY);
Reference<form::XReset> xReset(pSSPool->getByName("table"), UNO_QUERY);
if (xReset)
xReset->reset();
}

View file

@ -973,13 +973,6 @@ void SdStyleSheetPool::UpdateStdNames()
case HID_PSEUDOSHEET_BACKGROUND: pNameId = STR_PSEUDOSHEET_BACKGROUND; break;
case HID_PSEUDOSHEET_NOTES: pNameId = STR_PSEUDOSHEET_NOTES; break;
case HID_SD_CELL_STYLE_DEFAULT: pNameId = STR_STANDARD_STYLESHEET_NAME; break;
case HID_SD_CELL_STYLE_BANDED: pNameId = STR_POOLSHEET_BANDED_CELL; break;
case HID_SD_CELL_STYLE_HEADER: pNameId = STR_POOLSHEET_HEADER; break;
case HID_SD_CELL_STYLE_TOTAL: pNameId = STR_POOLSHEET_TOTAL; break;
case HID_SD_CELL_STYLE_FIRST_COLUMN: pNameId = STR_POOLSHEET_FIRST_COLUMN; break;
case HID_SD_CELL_STYLE_LAST_COLUMN: pNameId = STR_POOLSHEET_LAST_COLUMN; break;
default:
// 0 or wrong (old) HelpId
bHelpKnown = false;

196
sd/xml/styles.xml Normal file
View file

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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/.
*
-->
<office:styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0">
<style:style style:name="default" style:family="table-cell">
<style:table-cell-properties fo:background-color="#ffffff" fo:border="0.28pt solid #ffffff" fo:padding="0.1cm" style:vertical-align="top"/>
<style:text-properties style:use-window-font-color="true" fo:font-size="18pt" style:font-size-asian="18pt" style:font-size-complex="18pt" style:letter-kerning="true"/>
</style:style>
<style:style style:name="bg-none" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="transparent" fo:border="0.28pt solid #000000"/>
</style:style>
<style:style style:name="gray" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#cccccc"/>
</style:style>
<style:style style:name="dark-gray" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#999999"/>
</style:style>
<style:style style:name="black" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#000000"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="black-with-border" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#000000" fo:border="0.28pt solid #666666"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="gray-with-border" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#cccccc" fo:border="0.28pt solid #666666"/>
</style:style>
<style:style style:name="white" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#ffffff"/>
</style:style>
<style:style style:name="white-with-border" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#ffffff" fo:border="0.28pt solid #666666"/>
</style:style>
<style:style style:name="blue-title" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#5983B0"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="blue-title-with-border" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#5983B0" fo:border="0.28pt solid #666666"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="blue-banded" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#B4C7DC"/>
</style:style>
<style:style style:name="blue-normal" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#DEE6EF"/>
</style:style>
<style:style style:name="orange-title" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#FF860D"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="orange-title-with-border" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#FF860D" fo:border="0.28pt solid #666666"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="orange-banded" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#FFB66C"/>
</style:style>
<style:style style:name="orange-normal" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#FFDBB6"/>
</style:style>
<style:style style:name="teal-title" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#50938A"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="teal-title-with-border" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#50938A" fo:border="0.28pt solid #666666"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="teal-banded" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#B3CAC7"/>
</style:style>
<style:style style:name="teal-normal" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#DEE7E5"/>
</style:style>
<style:style style:name="magenta-title" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#D62E4E"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="magenta-title-with-border" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#D62E4E" fo:border="0.28pt solid #666666"/>
<style:text-properties fo:color="#ffffff"/>
</style:style>
<style:style style:name="magenta-banded" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#EC9BA4"/>
</style:style>
<style:style style:name="magenta-normal" style:family="table-cell" style:parent-style-name="default">
<style:table-cell-properties fo:background-color="#F7D1D5"/>
</style:style>
<table:table-template table:name="default">
<table:first-row table:style-name="bg-none"/>
<table:last-row table:style-name="bg-none"/>
<table:first-column table:style-name="bg-none"/>
<table:last-column table:style-name="bg-none"/>
<table:body table:style-name="bg-none"/>
<table:odd-rows table:style-name="bg-none"/>
<table:odd-columns table:style-name="bg-none"/>
</table:table-template>
<table:table-template table:name="black-dark">
<table:first-row table:style-name="black"/>
<table:last-row table:style-name="black"/>
<table:first-column table:style-name="black"/>
<table:last-column table:style-name="black"/>
<table:body table:style-name="gray"/>
<table:odd-rows table:style-name="dark-gray"/>
<table:odd-columns table:style-name="dark-gray"/>
</table:table-template>
<table:table-template table:name="black-gray">
<table:first-row table:style-name="black-with-border"/>
<table:last-row table:style-name="black-with-border"/>
<table:first-column table:style-name="black-with-border"/>
<table:last-column table:style-name="black-with-border"/>
<table:body table:style-name="white-with-border"/>
<table:odd-rows table:style-name="gray-with-border"/>
<table:odd-columns table:style-name="gray-with-border"/>
</table:table-template>
<table:table-template table:name="blue-dark">
<table:first-row table:style-name="blue-title"/>
<table:last-row table:style-name="blue-title"/>
<table:first-column table:style-name="blue-title"/>
<table:last-column table:style-name="blue-title"/>
<table:body table:style-name="blue-normal"/>
<table:odd-rows table:style-name="blue-banded"/>
<table:odd-columns table:style-name="blue-banded"/>
</table:table-template>
<table:table-template table:name="blue-gray">
<table:first-row table:style-name="blue-title-with-border"/>
<table:last-row table:style-name="blue-title-with-border"/>
<table:first-column table:style-name="blue-title-with-border"/>
<table:last-column table:style-name="blue-title-with-border"/>
<table:body table:style-name="white-with-border"/>
<table:odd-rows table:style-name="gray-with-border"/>
<table:odd-columns table:style-name="gray-with-border"/>
</table:table-template>
<table:table-template table:name="orange-dark">
<table:first-row table:style-name="orange-title"/>
<table:last-row table:style-name="orange-title"/>
<table:first-column table:style-name="orange-title"/>
<table:last-column table:style-name="orange-title"/>
<table:body table:style-name="orange-normal"/>
<table:odd-rows table:style-name="orange-banded"/>
<table:odd-columns table:style-name="orange-banded"/>
</table:table-template>
<table:table-template table:name="orange-gray">
<table:first-row table:style-name="orange-title-with-border"/>
<table:last-row table:style-name="orange-title-with-border"/>
<table:first-column table:style-name="orange-title-with-border"/>
<table:last-column table:style-name="orange-title-with-border"/>
<table:body table:style-name="white-with-border"/>
<table:odd-rows table:style-name="gray-with-border"/>
<table:odd-columns table:style-name="gray-with-border"/>
</table:table-template>
<table:table-template table:name="teal-dark">
<table:first-row table:style-name="teal-title"/>
<table:last-row table:style-name="teal-title"/>
<table:first-column table:style-name="teal-title"/>
<table:last-column table:style-name="teal-title"/>
<table:body table:style-name="teal-normal"/>
<table:odd-rows table:style-name="teal-banded"/>
<table:odd-columns table:style-name="teal-banded"/>
</table:table-template>
<table:table-template table:name="teal-gray">
<table:first-row table:style-name="teal-title-with-border"/>
<table:last-row table:style-name="teal-title-with-border"/>
<table:first-column table:style-name="teal-title-with-border"/>
<table:last-column table:style-name="teal-title-with-border"/>
<table:body table:style-name="white-with-border"/>
<table:odd-rows table:style-name="gray-with-border"/>
<table:odd-columns table:style-name="gray-with-border"/>
</table:table-template>
<table:table-template table:name="magenta-dark">
<table:first-row table:style-name="magenta-title"/>
<table:last-row table:style-name="magenta-title"/>
<table:first-column table:style-name="magenta-title"/>
<table:last-column table:style-name="magenta-title"/>
<table:body table:style-name="magenta-normal"/>
<table:odd-rows table:style-name="magenta-banded"/>
<table:odd-columns table:style-name="magenta-banded"/>
</table:table-template>
<table:table-template table:name="magenta-gray">
<table:first-row table:style-name="magenta-title-with-border"/>
<table:last-row table:style-name="magenta-title-with-border"/>
<table:first-column table:style-name="magenta-title-with-border"/>
<table:last-column table:style-name="magenta-title-with-border"/>
<table:body table:style-name="white-with-border"/>
<table:odd-rows table:style-name="gray-with-border"/>
<table:odd-columns table:style-name="gray-with-border"/>
</table:table-template>
</office:styles>

View file

@ -813,7 +813,11 @@ void TableDesignFamily::removeVetoableChangeListener( const OUString& , const Re
void TableDesignFamily::reset()
{
for (const auto& aDesign : maDesigns)
static_cast<TableDesignStyle*>(aDesign.get())->resetUserDefined();
{
auto aStyle = static_cast<TableDesignStyle*>(aDesign.get());
aStyle->resetUserDefined();
aStyle->setModified(false);
}
}
void TableDesignFamily::addResetListener( const Reference<form::XResetListener>& )

View file

@ -333,6 +333,9 @@ void SAL_CALL SdXMLImport::setTargetDocument( const uno::Reference< lang::XCompo
if(xFamSup.is())
mxDocStyleFamilies = xFamSup->getStyleFamilies();
if (!mbLoadDoc)
return;
// prepare access to master pages
uno::Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), uno::UNO_QUERY);
if(xMasterPagesSupplier.is())
@ -372,6 +375,16 @@ void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
{
SvXMLImport::initialize( aArguments );
OUString const sOrganizerMode("OrganizerMode");
bool bStyleOnly(false);
css::beans::PropertyValue aPropValue;
if (aArguments.hasElements() && (aArguments[0] >>= aPropValue) && aPropValue.Name == sOrganizerMode)
{
aPropValue.Value >>= bStyleOnly;
mbLoadDoc = !bStyleOnly;
}
uno::Reference< beans::XPropertySet > xInfoSet( getImportInfo() );
if( !xInfoSet.is() )
return;
@ -384,11 +397,8 @@ void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
if( xInfoSetInfo->hasPropertyByName( gsPreview ) )
xInfoSet->getPropertyValue( gsPreview ) >>= mbPreview;
OUString const sOrganizerMode(
"OrganizerMode");
if (xInfoSetInfo->hasPropertyByName(sOrganizerMode))
{
bool bStyleOnly(false);
if (xInfoSet->getPropertyValue(sOrganizerMode) >>= bStyleOnly)
{
mbLoadDoc = !bStyleOnly;
@ -419,6 +429,11 @@ SvXMLImportContext *SdXMLImport::CreateFastContext( sal_Int32 nElement,
pContext = new SdXMLFlatDocContext_Impl( *this, xDPS->getDocumentProperties());
}
break;
case XML_ELEMENT( OFFICE, XML_STYLES ):
// internal xml file for built in styles
if (!mbLoadDoc)
pContext = CreateStylesContext();
break;
}
return pContext;
}

View file

@ -285,12 +285,16 @@ void XMLTableImport::addTableTemplate( const OUString& rsStyleName, XMLTableTemp
{
auto xPtr = std::make_shared<XMLTableTemplate>();
xPtr->swap( xTableTemplate );
maTableTemplates[rsStyleName] = xPtr;
maTableTemplates.emplace_back(rsStyleName, xPtr);
}
void XMLTableImport::insertTabletemplate(const OUString& rsStyleName, bool bOverwrite)
{
XMLTableTemplateMap::iterator it = maTableTemplates.find(rsStyleName);
// FIXME: All templates will be inserted eventually, but
// instead of simply iterating them, like in finishStyles(),
// we search here by name again and again.
auto it = std::find_if(maTableTemplates.begin(), maTableTemplates.end(),
[&rsStyleName](const auto& item) { return rsStyleName == item.first; });
if (it == maTableTemplates.end())
return;