summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-02-06 12:09:48 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-02-06 12:44:37 +0100
commit1a3c90a292c7fc9060604151de9dc51eecf5b6a7 (patch)
tree226567cca6b2f74e749f36cc3ef3b76d67eb91a1
parentfdfd5c111de740456bc03df727b9c74a617237fc (diff)
sw: let drawinglayer manage gradient styles of our textframes
With this, the hacks from commits 81a46fc86a530f028a5bd2f5e52fe0372d50ee38 and d7efffebd9651dd866349915360ade64b97d7301 are no longer necessary.
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/text/GradientTable.idl33
-rw-r--r--svx/inc/svx/unofill.hxx1
-rw-r--r--svx/source/unodraw/unogtabl.cxx24
-rw-r--r--sw/inc/unotxdoc.hxx1
-rw-r--r--sw/source/core/unocore/unoframe.cxx8
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx8
-rw-r--r--xmloff/source/core/xmlexp.cxx64
8 files changed, 37 insertions, 103 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 72a590e4aaf3..eda41014c68d 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1277,7 +1277,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/text,\
GenericTextDocument \
GlobalDocument \
GlobalSettings \
- GradientTable \
IllustrationsIndex \
InContentMetadata \
LineNumberingProperties \
diff --git a/offapi/com/sun/star/text/GradientTable.idl b/offapi/com/sun/star/text/GradientTable.idl
deleted file mode 100644
index b7f433f939fa..000000000000
--- a/offapi/com/sun/star/text/GradientTable.idl
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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/.
- */
-#ifndef __com_sun_star_text_GradientTable_idl__
-#define __com_sun_star_text_GradientTable_idl__
-
-#include <com/sun/star/container/XNameContainer.idl>
-
-
- module com { module sun { module star { module text {
-
-
-/** this is a container for <type scope="com::sun::star::awt">Gradient</type>s, used for Writer TextFrames
-*/
-service GradientTable
-{
- /** this container lets you access the <type scope="com::sun::star::awt">Gradient</type>s that
- are indexed with a name inside Writer.
- */
- interface com::sun::star::container::XNameContainer;
-};
-
-
-}; }; }; };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/inc/svx/unofill.hxx b/svx/inc/svx/unofill.hxx
index 75c5237fb14d..523905a1d97a 100644
--- a/svx/inc/svx/unofill.hxx
+++ b/svx/inc/svx/unofill.hxx
@@ -26,7 +26,6 @@
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 0cabe7a26943..deb2e1d2d656 100644
--- a/svx/source/unodraw/unogtabl.cxx
+++ b/svx/source/unodraw/unogtabl.cxx
@@ -35,10 +35,8 @@ 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();
@@ -52,12 +50,7 @@ public:
};
SvxUnoGradientTable::SvxUnoGradientTable( SdrModel* pModel ) throw()
- : 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)
+ : SvxUnoNameItemTable( pModel, XATTR_FILLGRADIENT, MID_FILLGRADIENT )
{
}
@@ -67,20 +60,14 @@ SvxUnoGradientTable::~SvxUnoGradientTable() throw()
OUString SAL_CALL SvxUnoGradientTable::getImplementationName() throw( uno::RuntimeException )
{
- if (m_bTextWhich)
- return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextGradientTable") );
- else
- return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoGradientTable") );
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoGradientTable") );
}
uno::Sequence< OUString > SAL_CALL SvxUnoGradientTable::getSupportedServiceNames( )
throw( uno::RuntimeException )
{
uno::Sequence< OUString > aSNS( 1 );
- 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" ));
+ aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable" ));
return aSNS;
}
@@ -106,11 +93,6 @@ 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 dea4ea7365b9..e3c6acd4ac5a 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -550,7 +550,6 @@ 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/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 5ca640a00be8..675dcf39a929 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -263,7 +263,15 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SwDoc* pDoc, SfxItemSet& rToSe
{
rToSet.Put(*pItem);
if(pItem != &aFillGradient)
+ {
+ // New name was generated? Then insert it to the drawinglayer style table.
+ uno::Reference<frame::XModel> xModel(pDoc->GetDocShell()->GetModel());
+ uno::Reference<lang::XMultiServiceFactory> xServiceFact(xModel, uno::UNO_QUERY);
+ uno::Reference< container::XNameContainer > xGradients(xServiceFact->createInstance("com.sun.star.drawing.GradientTable"), uno::UNO_QUERY);
+ xGradients->insertByName(pItem->GetName(), *pFillGradient);
+
delete pItem;
+ }
}
}
}
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 12504c3a35ad..d35a18389bc2 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -153,7 +153,6 @@ 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 );
@@ -1692,8 +1691,6 @@ 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" )
{
@@ -3904,11 +3901,6 @@ 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 0c5773b8cdbd..94e145412a34 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1540,55 +1540,43 @@ void SvXMLExport::_ExportFontDecls()
mxFontAutoStylePool->exportXML();
}
-void lcl_ExportGradientStyle(SvXMLExport& rExport, uno::Reference< lang::XMultiServiceFactory > xFact, OUString aServiceName, std::vector<OUString>& rGradientNames)
+void SvXMLExport::_ExportStyles( sal_Bool )
{
- try
+ uno::Reference< lang::XMultiServiceFactory > xFact( GetModel(), uno::UNO_QUERY );
+ if( xFact.is())
{
- uno::Reference< container::XNameAccess > xGradient( xFact->createInstance( aServiceName ), uno::UNO_QUERY );
- if( xGradient.is() )
+ // export (fill-)gradient-styles
+ try
{
- XMLGradientStyleExport aGradientStyle( rExport );
-
- if( xGradient->hasElements() )
+ uno::Reference< container::XNameAccess > xGradient( xFact->createInstance( OUString("com.sun.star.drawing.GradientTable" ) ), uno::UNO_QUERY );
+ if( xGradient.is() )
{
- uno::Sequence< OUString > aNamesSeq ( xGradient->getElementNames() );
- sal_Int32 nCount = aNamesSeq.getLength();
- for( sal_Int32 i=0; i<nCount; i++ )
- {
- const OUString& rStrName = aNamesSeq[ i ];
-
- // Avoid duplicated style names.
- if (std::find(rGradientNames.begin(), rGradientNames.end(), rStrName) != rGradientNames.end())
- continue;
+ XMLGradientStyleExport aGradientStyle( *this );
- try
+ if( xGradient->hasElements() )
+ {
+ uno::Sequence< OUString > aNamesSeq ( xGradient->getElementNames() );
+ sal_Int32 nCount = aNamesSeq.getLength();
+ for( sal_Int32 i=0; i<nCount; i++ )
{
- uno::Any aValue = xGradient->getByName( rStrName );
+ const OUString& rStrName = aNamesSeq[ i ];
- aGradientStyle.exportXML( rStrName, aValue );
- rGradientNames.push_back(rStrName);
- }
- catch(const container::NoSuchElementException&)
- {
+ try
+ {
+ uno::Any aValue = xGradient->getByName( rStrName );
+
+ aGradientStyle.exportXML( rStrName, aValue );
+ }
+ catch(const container::NoSuchElementException&)
+ {
+ }
}
}
}
}
- }
- 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);
+ catch(const lang::ServiceNotRegisteredException&)
+ {
+ }
// export (fill-)hatch-styles
try