summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2010-07-21 15:32:50 +0200
committerJens-Heiner Rechtien <hr@openoffice.org>2010-07-21 15:32:50 +0200
commitb16e44f08c9819d398955b3699bd30e4a48ab30c (patch)
treed6f6fb86cd44c5ab8b4e16a31decec0bd4ca737b
parent9720a92e9c862560bdeced5931550e6d0f60059c (diff)
parent7d00b8df2b5780299cf17109236767b5591fad83 (diff)
CWS-TOOLING: integrate CWS unoawt2
Notes
split repo tag: calc_ooo/OOO330_m2
-rw-r--r--sc/inc/docpool.hxx1
-rw-r--r--sc/source/core/data/docpool.cxx20
-rwxr-xr-xsc/source/core/data/dpobject.cxx16
-rw-r--r--sc/source/ui/undo/undostyl.cxx4
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx8
-rw-r--r--sc/source/ui/view/formatsh.cxx4
6 files changed, 53 insertions, 0 deletions
diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx
index d366ef1ec25a..59bd70592725 100644
--- a/sc/inc/docpool.hxx
+++ b/sc/inc/docpool.hxx
@@ -65,6 +65,7 @@ public:
static void CheckRef( const SfxPoolItem& );
void StyleDeleted( ScStyleSheet* pStyle ); // Loeschen von Vorlagen im Organizer
+ void CellStyleCreated( const String& rName );
virtual SfxItemPresentation GetPresentation(
const SfxPoolItem& rItem,
SfxItemPresentation ePresentation,
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index cd763cfc0787..8b2f48d8a2cc 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -651,6 +651,26 @@ void ScDocumentPool::StyleDeleted( ScStyleSheet* pStyle )
}
}
+void ScDocumentPool::CellStyleCreated( const String& rName )
+{
+ // If a style was created, don't keep any pattern with its name string in the pool,
+ // because it would compare equal to a pattern with a pointer to the new style.
+ // Calling StyleSheetChanged isn't enough because the pool may still contain items
+ // for undo or clipboard content.
+
+ sal_uInt16 nCount = GetItemCount(ATTR_PATTERN);
+ for (sal_uInt16 i=0; i<nCount; i++)
+ {
+ ScPatternAttr* pPattern = (ScPatternAttr*)GetItem(ATTR_PATTERN, i);
+ if ( pPattern && pPattern->GetStyleSheet() == NULL )
+ {
+ const String* pStyleName = pPattern->GetStyleName();
+ if ( pStyleName && *pStyleName == rName )
+ pPattern->UpdateStyleSheet(); // find and store style pointer
+ }
+ }
+}
+
SfxItemPool* __EXPORT ScDocumentPool::Clone() const
{
return new SfxItemPool (*this, TRUE);
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index a2a10329cf68..7ca41d47f79d 100755
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -73,6 +73,7 @@
#include <comphelper/processfactory.hxx>
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <svl/zforlist.hxx> // IsNumberFormat
#include <vector>
@@ -85,6 +86,8 @@ using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::lang::XComponent;
using ::com::sun::star::sheet::DataPilotTableHeaderData;
using ::com::sun::star::sheet::DataPilotTablePositionData;
using ::com::sun::star::beans::XPropertySet;
@@ -215,6 +218,7 @@ ScDPObject::~ScDPObject()
delete pImpDesc;
delete pServDesc;
mnCacheId = -1; // Wang Xu Ming - DataPilot migration
+ InvalidateSource();
}
ScDataObject* ScDPObject::Clone() const
@@ -530,6 +534,18 @@ void ScDPObject::InvalidateData()
void ScDPObject::InvalidateSource()
{
+ Reference< XComponent > xObjectComp( xSource, UNO_QUERY );
+ if ( xObjectComp.is() )
+ {
+ try
+ {
+ xObjectComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
xSource = NULL;
mpTableData.reset();
}
diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx
index 67a91baa38ee..b4ea7f35448c 100644
--- a/sc/source/ui/undo/undostyl.cxx
+++ b/sc/source/ui/undo/undostyl.cxx
@@ -37,6 +37,7 @@
#include "undostyl.hxx"
#include "docsh.hxx"
+#include "docpool.hxx"
#include "stlpool.hxx"
#include "printfun.hxx"
#include "scmod.hxx"
@@ -166,6 +167,9 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const String& rName,
{
// create style (with new name)
pStyle = &pStlPool->Make( aNewName, eStyleFamily, SFXSTYLEBIT_USERDEF );
+
+ if ( eStyleFamily == SFX_STYLE_FAMILY_PARA )
+ pDoc->GetPool()->CellStyleCreated( aNewName );
}
if ( pStyle )
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 1ceaa424ecd6..50aecbe7f2e3 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -68,6 +68,7 @@
#include "docsh.hxx"
#include "attrib.hxx"
#include "stlpool.hxx"
+#include "docpool.hxx"
#include "unoguard.hxx"
#include "miscuno.hxx"
#include "convuno.hxx"
@@ -830,6 +831,9 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const rtl::OUString& aName, const
{
(void)pStylePool->Make( aNameStr, eFamily, SFXSTYLEBIT_USERDEF );
+ if ( eFamily == SFX_STYLE_FAMILY_PARA && !pDoc->IsImportingXML() )
+ pDoc->GetPool()->CellStyleCreated( aNameStr );
+
pStyleObj->InitDoc( pDocShell, aNameStr ); // Objekt kann benutzt werden
pDocShell->SetDocumentModified(); // verwendet wird der neue Style noch nicht
@@ -1287,6 +1291,10 @@ void SAL_CALL ScStyleObj::setName( const rtl::OUString& aNewName )
{
aStyleName = aString; //! notify other objects for this style?
+ ScDocument* pDoc = pDocShell->GetDocument();
+ if ( eFamily == SFX_STYLE_FAMILY_PARA && !pDoc->IsImportingXML() )
+ pDoc->GetPool()->CellStyleCreated( aString );
+
// Zellvorlagen = 2, Seitenvorlagen = 4
UINT16 nId = ( eFamily == SFX_STYLE_FAMILY_PARA ) ?
SID_STYLE_FAMILY2 : SID_STYLE_FAMILY4;
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index e364705f90b6..12a1bb87211b 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -551,6 +551,8 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq )
if ( bConvertBack )
// Namen zu Style-Pointer
pDoc->UpdStlShtPtrsFrmNms();
+ else
+ pDoc->GetPool()->CellStyleCreated( aStyleName );
// Attribute uebernehmen und Style anwenden
pStyleSheet->GetItemSet().Put( aAttrSet );
@@ -839,6 +841,8 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq )
rNewSet.Put( SvxLanguageItem(
pNew->GetLanguage(), ATTR_LANGUAGE_FORMAT ) );
}
+
+ pDoc->GetPool()->CellStyleCreated( pStyleSheet->GetName() );
}
else
{