[Libreoffice-commits] .: 4 commits - svx/inc svx/source sw/inc sw/source xmloff/inc xmloff/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 29 06:21:23 PST 2013
svx/inc/svx/unofill.hxx | 1
svx/source/unodraw/unogtabl.cxx | 24 +++++++++++--
svx/source/xoutdev/xattr.cxx | 2 -
sw/inc/unotxdoc.hxx | 1
sw/source/core/layout/paintfrm.cxx | 16 ++++++---
sw/source/core/unocore/unoframe.cxx | 22 +++++++++++-
sw/source/ui/uno/unotxdoc.cxx | 8 ++++
xmloff/inc/xmloff/xmltypes.hxx | 1
xmloff/source/core/xmlexp.cxx | 64 +++++++++++++++++++++---------------
xmloff/source/text/txtprhdl.cxx | 15 ++++++++
xmloff/source/text/txtprmap.cxx | 6 +++
11 files changed, 123 insertions(+), 37 deletions(-)
New commits:
commit 80f5a837f2d42cc2bc972dcfe88e5f39aa514d9c
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jan 29 13:02:45 2013 +0100
SwFrm::PaintBackground: paint gradients in one go
Painting only the necessary regions works fine normal background color,
but not for gradients, as the result is obviously different in case of
gradients.
Change-Id: I624410ed08604c13a810f784d6226d592295c5d3
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index e0d0246..d6e1106 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6181,12 +6181,13 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
if ( pPage->GetSortedObjs() )
::lcl_SubtractFlys( this, pPage, aRect, aRegion );
+ /// OD 06.08.2002 #99657# - determine, if background transparency
+ /// have to be considered for drawing.
+ /// --> Status Quo: background transparency have to be
+ /// considered for fly frames
+ const sal_Bool bConsiderBackgroundTransparency = IsFlyFrm();
+ if (!pFillStyleItem || pFillStyleItem->GetValue() != XFILL_GRADIENT || !pFillGradientItem)
{
- /// OD 06.08.2002 #99657# - determine, if background transparency
- /// have to be considered for drawing.
- /// --> Status Quo: background transparency have to be
- /// considered for fly frames
- const sal_Bool bConsiderBackgroundTransparency = IsFlyFrm();
for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
{
if ( 1 < aRegion.size() )
@@ -6204,6 +6205,11 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
bConsiderBackgroundTransparency );
}
}
+ else
+ {
+ ::DrawGraphic( pItem, pFillStyleItem, pFillGradientItem, pOut, aOrigBackRect, aRect, GRFNUM_NO,
+ bConsiderBackgroundTransparency );
+ }
if( pCol )
delete pNewItem;
}
commit ac8aee92c797dd7353978f1e7aec7336b7cb726d
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jan 29 11:44:14 2013 +0100
sw: import draw:fill-gradient-name for Writer textframes
Change-Id: I695cf16bc3b06823ae9e0546cb751e41eb201706
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 2266cdd..561f295 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -3594,7 +3594,7 @@ XFillGradientItem* XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) con
if( pModel )
{
const String aUniqueName = NameOrIndex::CheckNamedItem(
- this, XATTR_FILLGRADIENT, &pModel->GetItemPool(),
+ this, Which(), &pModel->GetItemPool(),
pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : NULL,
XFillGradientItem::CompareValueFunc, RID_SVXSTR_GRADIENT,
pModel->GetPropertyList( XGRADIENT_LIST ) );
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index d9031a4..2e02d0b 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -236,11 +236,29 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SwDoc* pDoc, SfxItemSet& rToSe
XFillGradientItem aFillGradient( static_cast <const :: XFillGradientItem & > ( rFromSet.Get ( RES_FILL_GRADIENT ) ) );
XFillGradientItem* pItem = &aFillGradient;
if (pFillGradient)
+ {
bRet &= ((SfxPoolItem*)pItem)->PutValue(*pFillGradient, MID_FILLGRADIENT);
+ // If gradient is set directly, we always generate an associated style name for it.
+ SdrModel* pModel = pDoc->GetDrawModel();
+ pItem = pItem->checkForUniqueItem( pModel );
+ }
if (pName)
+ {
bRet &= ((SfxPoolItem*)pItem)->PutValue(*pName, MID_NAME);
- SdrModel* pModel = pDoc->GetDrawModel();
- pItem = pItem->checkForUniqueItem( pModel );
+ // Look up the associated style name.
+ SfxItemPool& rPool = pDoc->GetDrawModel()->GetItemPool();
+ const sal_uInt32 nCount = rPool.GetItemCount2(XATTR_FILLGRADIENT);
+ const XFillGradientItem* pStyleItem;
+ for (sal_uInt32 i = 0; i < nCount; ++i)
+ {
+ pStyleItem = (XFillGradientItem*)rPool.GetItem2(XATTR_FILLGRADIENT, i);
+ if (pStyleItem && pStyleItem->GetName() == pItem->GetName())
+ {
+ pItem->SetGradientValue(pStyleItem->GetGradientValue());
+ break;
+ }
+ }
+ }
if (pItem)
{
rToSet.Put(*pItem);
commit bb00150ef62ccd256b3e8ec2dabec5eb2d6a667f
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jan 29 11:10:22 2013 +0100
xmloff: export Wrtier's RES_FILL_STYLE and RES_FILL_GRADIENT
Change-Id: Id0adf3733ac4c2c08ded659c2d621ddbbbb434c5
diff --git a/xmloff/inc/xmloff/xmltypes.hxx b/xmloff/inc/xmloff/xmltypes.hxx
index f972565..b49a1bb 100644
--- a/xmloff/inc/xmloff/xmltypes.hxx
+++ b/xmloff/inc/xmloff/xmltypes.hxx
@@ -272,6 +272,7 @@
#define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 112)
#define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113)
#define XML_TYPE_BOOL_FALSE (XML_TEXT_TYPES_START + 114)
+#define XML_TYPE_FILLSTYLE (XML_TEXT_TYPES_START + 115)
#define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT)
#define XML_PM_TYPES_START (0x5 << XML_TYPE_APP_SHIFT) // page master
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index ca7fde1..b86be39 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -21,6 +21,7 @@
#include <rtl/ustrbuf.hxx>
#include <tools/fontenum.hxx>
#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/style/DropCapFormat.hpp>
#include <com/sun/star/text/FontRelief.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
@@ -49,6 +50,7 @@
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::style;
using namespace ::com::sun::star::text;
@@ -235,6 +237,16 @@ SvXMLEnumMapEntry const pXML_WrapInfluenceOnPosition_Enum[] =
{ XML_TOKEN_INVALID, 0 }
};
+SvXMLEnumMapEntry const pXML_FillStyle_Enum[] =
+{
+ { XML_NONE, drawing::FillStyle_NONE },
+ { XML_SOLID, drawing::FillStyle_SOLID },
+ { XML_BITMAP, drawing::FillStyle_BITMAP },
+ { XML_GRADIENT, drawing::FillStyle_GRADIENT },
+ { XML_HATCH, drawing::FillStyle_HATCH },
+ { XML_TOKEN_INVALID, 0 }
+};
+
// ---------------------------------------------------------------------------
class XMLDropCapPropHdl_Impl : public XMLPropertyHandler
@@ -1419,6 +1431,9 @@ const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler
case XML_TYPE_TEXT_NUMBER8_ONE_BASED:
pHdl = new XMLNumber8OneBasedHdl();
break;
+ case XML_TYPE_FILLSTYLE:
+ pHdl = new XMLConstantsPropertyHandler( pXML_FillStyle_Enum, XML_TOKEN_INVALID );
+ break;
}
return pHdl;
diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx
index f571e5d..def8335 100644
--- a/xmloff/source/text/txtprmap.cxx
+++ b/xmloff/source/text/txtprmap.cxx
@@ -628,6 +628,12 @@ XMLPropertyMapEntry aXMLFramePropMap[] =
MG_E( "BackGraphicFilter",STYLE, FILTER_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_FILTER ),
MG_E( "BackGraphicURL", STYLE, BACKGROUND_IMAGE, MID_FLAG_ELEMENT_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_URL ),
+ // RES_FILL_STYLE
+ MG_E( "FillStyle", DRAW, FILL, XML_TYPE_FILLSTYLE, 0 ),
+
+ // RES_FILL_GRADIENT
+ MG_E( "FillGradientName", DRAW, FILL_GRADIENT_NAME, XML_TYPE_STYLENAME, 0 ),
+
// RES_BOX
MG_ED( "LeftBorder", STYLE, BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_ALLBORDERWIDTH ),
MG_ED( "LeftBorder", STYLE, BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_LEFTBORDERWIDTH ),
commit 81a46fc86a530f028a5bd2f5e52fe0372d50ee38
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Mon Jan 28 18:07:45 2013 +0100
SvXMLExport::_ExportStyles: also try to export text gradients
They are not exported automatically, as SvxUnoNameItemTable needs a
Which ID, and it's different for drawinglayer and Writer gradients.
Change-Id: I5dd7d828b1f0e577e26510e3c5ca74386d000f16
diff --git a/svx/inc/svx/unofill.hxx b/svx/inc/svx/unofill.hxx
index 523905a..75c5237 100644
--- a/svx/inc/svx/unofill.hxx
+++ b/svx/inc/svx/unofill.hxx
@@ -26,6 +26,7 @@
class SdrModel;
SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoGradientTable_createInstance( SdrModel* pModel );
+SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoTextGradientTable_createInstance( SdrModel* pModel, sal_uInt16 nWhich );
SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoHatchTable_createInstance( SdrModel* pModel );
SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoBitmapTable_createInstance( SdrModel* pModel );
SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxUnoTransGradientTable_createInstance( SdrModel* pModel );
diff --git a/svx/source/unodraw/unogtabl.cxx b/svx/source/unodraw/unogtabl.cxx
index deb2e1d..0cabe7a 100644
--- a/svx/source/unodraw/unogtabl.cxx
+++ b/svx/source/unodraw/unogtabl.cxx
@@ -35,8 +35,10 @@ using namespace ::cppu;
class SvxUnoGradientTable : public SvxUnoNameItemTable
{
+ bool m_bTextWhich;
public:
SvxUnoGradientTable( SdrModel* pModel ) throw();
+ SvxUnoGradientTable( SdrModel* pModel, sal_uInt16 nWhich ) throw();
virtual ~SvxUnoGradientTable() throw();
virtual NameOrIndex* createItem() const throw();
@@ -50,7 +52,12 @@ public:
};
SvxUnoGradientTable::SvxUnoGradientTable( SdrModel* pModel ) throw()
- : SvxUnoNameItemTable( pModel, XATTR_FILLGRADIENT, MID_FILLGRADIENT )
+ : SvxUnoNameItemTable( pModel, XATTR_FILLGRADIENT, MID_FILLGRADIENT ), m_bTextWhich(false)
+{
+}
+
+SvxUnoGradientTable::SvxUnoGradientTable( SdrModel* pModel, sal_uInt16 nWhich ) throw()
+ : SvxUnoNameItemTable( pModel, nWhich, MID_FILLGRADIENT ), m_bTextWhich(true)
{
}
@@ -60,14 +67,20 @@ SvxUnoGradientTable::~SvxUnoGradientTable() throw()
OUString SAL_CALL SvxUnoGradientTable::getImplementationName() throw( uno::RuntimeException )
{
- return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoGradientTable") );
+ if (m_bTextWhich)
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextGradientTable") );
+ else
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoGradientTable") );
}
uno::Sequence< OUString > SAL_CALL SvxUnoGradientTable::getSupportedServiceNames( )
throw( uno::RuntimeException )
{
uno::Sequence< OUString > aSNS( 1 );
- aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable" ));
+ if (m_bTextWhich)
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GradientTable" ));
+ else
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable" ));
return aSNS;
}
@@ -93,6 +106,11 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoGradientTable_createInstance( S
return *new SvxUnoGradientTable(pModel);
}
+uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextGradientTable_createInstance( SdrModel* pModel, sal_uInt16 nWhich )
+{
+ return *new SvxUnoGradientTable(pModel, nWhich);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index b0b6b60..d8f3fba 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -547,6 +547,7 @@ class SwXDocumentPropertyHelper : public SvxUnoForbiddenCharsTable
{
css::uno::Reference < css::uno::XInterface > xDashTable;
css::uno::Reference < css::uno::XInterface > xGradientTable;
+ css::uno::Reference < css::uno::XInterface > xTextGradientTable;
css::uno::Reference < css::uno::XInterface > xHatchTable;
css::uno::Reference < css::uno::XInterface > xBitmapTable;
css::uno::Reference < css::uno::XInterface > xTransGradientTable;
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 9977d7b..8c25145 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -153,6 +153,7 @@ using ::osl::FileBase;
#define SW_CREATE_TRANSGRADIENT_TABLE 0x05
#define SW_CREATE_MARKER_TABLE 0x06
#define SW_CREATE_DRAW_DEFAULTS 0x07
+#define SW_CREATE_TEXT_GRADIENT_TABLE 0x08
extern bool sw_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst );
@@ -1679,6 +1680,8 @@ Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServic
{
if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.DocumentSettings") ) )
xRet = Reference < XInterface > ( *new SwXDocumentSettings ( this ) );
+ if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.GradientTable") ) )
+ xRet = GetPropertyHelper()->GetDrawTable(SW_CREATE_TEXT_GRADIENT_TABLE);
}
else if (sCategory == "chart2" )
{
@@ -3880,6 +3883,11 @@ Reference<XInterface> SwXDocumentPropertyHelper::GetDrawTable(short nWhich)
xDrawDefaults = (cppu::OWeakObject*)new SwSvxUnoDrawPool(m_pDoc);
xRet = xDrawDefaults;
break;
+ case SW_CREATE_TEXT_GRADIENT_TABLE :
+ if(!xTextGradientTable.is())
+ xTextGradientTable = SvxUnoTextGradientTable_createInstance( m_pDoc->GetOrCreateDrawModel(), RES_FILL_GRADIENT );
+ xRet = xTextGradientTable;
+ break;
#if OSL_DEBUG_LEVEL > 0
default: OSL_FAIL("which table?");
#endif
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 94e1454..0c5773b 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1540,43 +1540,55 @@ void SvXMLExport::_ExportFontDecls()
mxFontAutoStylePool->exportXML();
}
-void SvXMLExport::_ExportStyles( sal_Bool )
+void lcl_ExportGradientStyle(SvXMLExport& rExport, uno::Reference< lang::XMultiServiceFactory > xFact, OUString aServiceName, std::vector<OUString>& rGradientNames)
{
- uno::Reference< lang::XMultiServiceFactory > xFact( GetModel(), uno::UNO_QUERY );
- if( xFact.is())
+ try
{
- // export (fill-)gradient-styles
- try
+ uno::Reference< container::XNameAccess > xGradient( xFact->createInstance( aServiceName ), uno::UNO_QUERY );
+ if( xGradient.is() )
{
- uno::Reference< container::XNameAccess > xGradient( xFact->createInstance( OUString("com.sun.star.drawing.GradientTable" ) ), uno::UNO_QUERY );
- if( xGradient.is() )
- {
- XMLGradientStyleExport aGradientStyle( *this );
+ XMLGradientStyleExport aGradientStyle( rExport );
- if( xGradient->hasElements() )
+ if( xGradient->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xGradient->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
{
- uno::Sequence< OUString > aNamesSeq ( xGradient->getElementNames() );
- sal_Int32 nCount = aNamesSeq.getLength();
- for( sal_Int32 i=0; i<nCount; i++ )
- {
- const OUString& rStrName = aNamesSeq[ i ];
+ const OUString& rStrName = aNamesSeq[ i ];
- try
- {
- uno::Any aValue = xGradient->getByName( rStrName );
+ // Avoid duplicated style names.
+ if (std::find(rGradientNames.begin(), rGradientNames.end(), rStrName) != rGradientNames.end())
+ continue;
- aGradientStyle.exportXML( rStrName, aValue );
- }
- catch(const container::NoSuchElementException&)
- {
- }
+ try
+ {
+ uno::Any aValue = xGradient->getByName( rStrName );
+
+ aGradientStyle.exportXML( rStrName, aValue );
+ rGradientNames.push_back(rStrName);
+ }
+ catch(const container::NoSuchElementException&)
+ {
}
}
}
}
- catch(const lang::ServiceNotRegisteredException&)
- {
- }
+ }
+ catch(const lang::ServiceNotRegisteredException&)
+ {
+ }
+}
+
+void SvXMLExport::_ExportStyles( sal_Bool )
+{
+ uno::Reference< lang::XMultiServiceFactory > xFact( GetModel(), uno::UNO_QUERY );
+ if( xFact.is())
+ {
+ // export (fill-)gradient-styles
+ std::vector<OUString> aGradientNames;
+ lcl_ExportGradientStyle(*this, xFact, "com.sun.star.drawing.GradientTable", aGradientNames);
+ lcl_ExportGradientStyle(*this, xFact, "com.sun.star.text.GradientTable", aGradientNames);
// export (fill-)hatch-styles
try
More information about the Libreoffice-commits
mailing list