[Libreoffice-commits] .: 7 commits - sc/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Thu Nov 25 12:12:04 PST 2010
sc/source/core/tool/interpr1.cxx | 11 ++++++++---
sc/source/filter/xml/xmlimprt.cxx | 3 +++
sc/source/ui/dbgui/filtdlg.cxx | 1 +
sc/source/ui/view/preview.cxx | 7 +++++++
sc/source/ui/view/viewfun3.cxx | 7 +++++++
5 files changed, 26 insertions(+), 3 deletions(-)
New commits:
commit ac4b6cabe2bbf5787d64cf2eb7ca407f966aa2a2
Merge: 5c579ae... e169227...
Author: Jan Holesovsky <kendy at suse.cz>
Date: Thu Nov 25 20:58:31 2010 +0100
Merge branch 'master' of ssh://git.freedesktop.org/git/libreoffice/calc
commit 5c579aec2bbdfec4de0db8faf2176a0879851b52
Merge: 3532aa1... 5d8e16b...
Author: Jan Holesovsky <kendy at suse.cz>
Date: Thu Nov 25 14:26:48 2010 +0100
Merge remote branch 'origin/libreoffice-3-3'
Conflicts:
sc/source/filter/xml/xmlimprt.cxx
diff --cc sc/source/filter/xml/xmlimprt.cxx
index 894cd43,5600150..b698bcc
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@@ -2798,54 -2798,47 +2798,57 @@@ void ScXMLImport::SetNamedRanges(
ScMyNamedExpressions::iterator aItr(pNamedExpressions->begin());
ScMyNamedExpressions::const_iterator aEndItr(pNamedExpressions->end());
table::CellAddress aCellAddress;
- rtl::OUString sTempContent(RTL_CONSTASCII_USTRINGPARAM("0"));
- while (aItr != aEndItr)
+ OUString sTempContent(RTL_CONSTASCII_USTRINGPARAM("0"));
+
+ for (; aItr != aEndItr; ++aItr)
{
- sal_Int32 nOffset(0);
- if (ScRangeStringConverter::GetAddressFromString(
- aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
+ sal_Int32 nOffset = 0;
+ bool bSuccess = ScRangeStringConverter::GetAddressFromString(
+ aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset);
+
+ if (!bSuccess)
+ // Conversion of base cell address failed. Skip this.
+ continue;
+
+ try
{
- try
- {
- xNamedRanges->addNewByName((*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
- }
- catch( uno::RuntimeException& )
+ xNamedRanges->addNewByName(
+ (*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
+ }
+ catch( uno::RuntimeException& )
+ {
+ DBG_ERROR("here are some Named Ranges with the same name");
+ uno::Reference < container::XIndexAccess > xIndex(xNamedRanges, uno::UNO_QUERY);
+ if (xIndex.is())
{
- DBG_ERROR("here are some Named Ranges with the same name");
- uno::Reference < container::XIndexAccess > xIndex(xNamedRanges, uno::UNO_QUERY);
- if (xIndex.is())
+ sal_Int32 nMax = xIndex->getCount();
+ bool bInserted = false;
+ sal_Int32 nCount = 1;
+ OUStringBuffer sName((*aItr)->sName);
+ sName.append(sal_Unicode('_'));
+ while (!bInserted && nCount <= nMax)
{
- sal_Int32 nMax(xIndex->getCount());
- sal_Bool bInserted(sal_False);
- sal_Int32 nCount(1);
- rtl::OUStringBuffer sName((*aItr)->sName);
- sName.append(sal_Unicode('_'));
- while (!bInserted && nCount <= nMax)
+ OUStringBuffer sTemp(sName);
+ sTemp.append(OUString::valueOf(nCount));
+ try
{
- rtl::OUStringBuffer sTemp(sName);
- sTemp.append(rtl::OUString::valueOf(nCount));
- try
- {
- xNamedRanges->addNewByName(sTemp.makeStringAndClear(), sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
- bInserted = sal_True;
- }
- catch( uno::RuntimeException& )
- {
- ++nCount;
- }
+ xNamedRanges->addNewByName(
+ sTemp.makeStringAndClear(), sTempContent, aCellAddress,
+ GetRangeType((*aItr)->sRangeType));
+ bInserted = true;
+ }
+ catch( uno::RuntimeException& )
+ {
+ ++nCount;
}
}
++ UnlockSolarMutex();
}
}
- ++aItr;
++ delete *aItr;
++ aItr = pNamedExpressions->erase(aItr);
}
+
aItr = pNamedExpressions->begin();
while (aItr != aEndItr)
{
diff --cc sc/source/ui/view/viewfun3.cxx
index 9c51b5f,69d608d..409686b
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@@ -650,6 -680,10 +650,10 @@@ void ScViewFunc::PasteFromSystem(
{
// If it's a Writer object, insert RTF instead of OLE
+ // Else, if the class id is all-zero, and SYLK is available,
- // it probably is spreadsheet cells that have been put
++ // it probably is spreadsheet cells that have been put
+ // on the clipboard by OOo, so use the SYLK. (fdo#31077)
+
BOOL bDoRtf = FALSE;
TransferableObjectDescriptor aObjDesc;
if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) )
commit 5d8e16bda040c8bc64d1619d034e5c49217fbf03
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Nov 19 18:18:50 2010 -0500
No automatic width adjustment of the dropdown popups. (fdo#31710)
Let's not automatically adjust the width of the dropdown popups of
the Values combo boxes in the standard filter dialog. It looks
better that way.
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 025e3a9..d33a674 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -497,6 +497,7 @@ void ScFilterDlg::UpdateValueList( USHORT nList )
}
}
pValList->SetText( aCurValue );
+ pValList->EnableDDAutoWidth(false);
}
UpdateHdrInValueList( nList );
commit 5d75f3d8c0689b3dea34747ca4334096ff66913c
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Thu Nov 18 13:50:30 2010 -0500
Make VLOOKUP work with an external reference once again. (fdo#31718)
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index ee317f2..f561317 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5638,7 +5638,8 @@ void ScInterpreter::CalculateLookup(BOOL HLookup)
SCCOL nCol2 = 0;
SCROW nRow2 = 0;
SCTAB nTab2;
- if (GetStackType() == svDoubleRef)
+ StackVar eType = GetStackType();
+ if (eType == svDoubleRef)
{
PopDoubleRef(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
if (nTab1 != nTab2)
@@ -5647,9 +5648,13 @@ void ScInterpreter::CalculateLookup(BOOL HLookup)
return;
}
}
- else if (GetStackType() == svMatrix)
+ else if (eType == svMatrix || eType == svExternalDoubleRef)
{
- pMat = PopMatrix();
+ if (eType == svMatrix)
+ pMat = PopMatrix();
+ else
+ PopExternalDoubleRef(pMat);
+
if (pMat)
pMat->GetDimensions(nC, nR);
else
commit 27d40392c0164cd616c621b3500adac237a23ca2
Author: Tor Lillqvist <tlillqvist at novell.com>
Date: Thu Nov 18 18:14:38 2010 +0200
Add workaround to avoid pasting data from OOo Calc as an OLE object
Help for fdo#31077.
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index e374252..69d608d 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -680,6 +680,10 @@ void ScViewFunc::PasteFromSystem()
{
// If it's a Writer object, insert RTF instead of OLE
+ // Else, if the class id is all-zero, and SYLK is available,
+ // it probably is spreadsheet cells that have been put
+ // on the clipboard by OOo, so use the SYLK. (fdo#31077)
+
BOOL bDoRtf = FALSE;
TransferableObjectDescriptor aObjDesc;
if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) )
@@ -690,6 +694,9 @@ void ScViewFunc::PasteFromSystem()
}
if ( bDoRtf )
PasteFromSystem( FORMAT_RTF );
+ else if ( aObjDesc.maClassName == SvGlobalName( 0,0,0,0,0,0,0,0,0,0,0 )
+ && aDataHelper.HasFormat( SOT_FORMATSTR_ID_SYLK ))
+ PasteFromSystem( SOT_FORMATSTR_ID_SYLK );
else
PasteFromSystem( SOT_FORMATSTR_ID_EMBED_SOURCE );
}
commit 88fb06d76f75c2b907d3ed024dec53cf11a382e0
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Wed Nov 10 15:51:56 2010 -0500
Disable document modify and broadcasting of changes on range names.
We don't need to set document status modified & broadcast changes
on every single addition of range names during document import.
Doing so would make the document import painfully slow esp with
docs with lots of range names defined. (n#634257)
Note: this is a backport of the same fix from master. Please don't
merge this back into master.
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ddbb1e8..3dc346c 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1561,6 +1561,7 @@ public:
BOOL GetNoSetDirty() const { return bNoSetDirty; }
void SetInsertingFromOtherDoc( BOOL bVal ) { bInsertingFromOtherDoc = bVal; }
BOOL IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
+ bool IsLoadingMedium() const;
void SetLoadingMedium( bool bVal );
void SetImportingXML( bool bVal );
bool IsImportingXML() const { return bImportingXML; }
diff --git a/sc/inc/nameuno.hxx b/sc/inc/nameuno.hxx
index bc92f98..f691c9f 100644
--- a/sc/inc/nameuno.hxx
+++ b/sc/inc/nameuno.hxx
@@ -52,7 +52,7 @@
class ScDocShell;
class ScRangeData;
class ScTokenArray;
-
+class ScNamedRangesObj;
class ScNamedRangeObj : public ::cppu::WeakImplHelper6<
::com::sun::star::sheet::XNamedRange,
@@ -64,6 +64,7 @@ class ScNamedRangeObj : public ::cppu::WeakImplHelper6<
public SfxListener
{
private:
+ ScNamedRangesObj* mpParent;
ScDocShell* pDocShell;
String aName;
@@ -75,7 +76,7 @@ private:
const formula::FormulaGrammar::Grammar eGrammar );
public:
- ScNamedRangeObj(ScDocShell* pDocSh, const String& rNm);
+ ScNamedRangeObj(ScNamedRangesObj* pParent, ScDocShell* pDocSh, const String& rNm);
virtual ~ScNamedRangeObj();
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
@@ -173,10 +174,11 @@ public:
};
-class ScNamedRangesObj : public ::cppu::WeakImplHelper5<
+class ScNamedRangesObj : public ::cppu::WeakImplHelper6<
::com::sun::star::sheet::XNamedRanges,
::com::sun::star::container::XEnumerationAccess,
::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::beans::XPropertySet,
::com::sun::star::document::XActionLockable,
::com::sun::star::lang::XServiceInfo >,
public SfxListener
@@ -184,6 +186,11 @@ class ScNamedRangesObj : public ::cppu::WeakImplHelper5<
private:
ScDocShell* pDocShell;
+ // if true, adding new name or modifying existing one will set the
+ // document 'modified' and broadcast the change. We turn this off during
+ // import.
+ sal_Bool mbModifyAndBroadcast;
+
ScNamedRangeObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
ScNamedRangeObj* GetObjectByName_Impl(const ::rtl::OUString& aName);
@@ -200,6 +207,8 @@ public:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ bool IsModifyAndBroadcast() const;
+
// XNamedRanges
virtual void SAL_CALL addNewByName( const ::rtl::OUString& aName, const ::rtl::OUString& aContent,
const ::com::sun::star::table::CellAddress& aPosition, sal_Int32 nType )
@@ -238,6 +247,47 @@ public:
throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ SAL_CALL getPropertySetInfo()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
+ const ::rtl::OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
// XActionLockable
virtual sal_Bool SAL_CALL isActionLocked() throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addActionLock() throw(::com::sun::star::uno::RuntimeException);
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 2b90cf0..473697e 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -643,14 +643,15 @@
// Solver
#define SC_UNONAME_TIMEOUT "Timeout"
-
#define SC_UNO_SHAREDOC "IsDocumentShared"
// EventDescriptor
-
#define SC_UNO_EVENTTYPE "EventType"
#define SC_UNO_SCRIPT "Script"
+// Named ranges
+#define SC_UNO_MODIFY_BROADCAST "ModifyAndBroadcast"
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index af7e762..c036f4d 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -675,6 +675,11 @@ void ScDocument::UpdateFontCharSet()
}
}
+bool ScDocument::IsLoadingMedium() const
+{
+ return bLoadingMedium;
+}
+
void ScDocument::SetLoadingMedium( bool bVal )
{
bLoadingMedium = bVal;
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 0c98142..5600150 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -93,6 +93,7 @@
#include <com/sun/star/sheet/XNamedRange.hpp>
#include <com/sun/star/sheet/XLabelRanges.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#define SC_LOCALE "Locale"
#define SC_STANDARDFORMAT "StandardFormat"
@@ -106,9 +107,10 @@
using namespace com::sun::star;
using namespace ::xmloff::token;
using namespace ::formula;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
using ::rtl::OUString;
-
-using rtl::OUString;
+using ::rtl::OUStringBuffer;
OUString SAL_CALL ScXMLImport_getImplementationName() throw()
{
@@ -2742,89 +2744,126 @@ void ScXMLImport::SetLabelRanges()
}
}
+namespace {
+
+/**
+ * Used to switch off document modify and broadcast while populating named
+ * ranges during import.
+ */
+class NamedRangesSwitch
+{
+public:
+ NamedRangesSwitch(Reference<beans::XPropertySet>& xPropSet) :
+ mxPropSet(xPropSet), maPropName(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_MODIFY_BROADCAST))
+ {
+ uno::Any any;
+ any <<= sal_False;
+ mxPropSet->setPropertyValue(maPropName, any);
+ }
+
+ ~NamedRangesSwitch()
+ {
+ uno::Any any;
+ any <<= sal_True;
+ mxPropSet->setPropertyValue(maPropName, any);
+ }
+
+private:
+ Reference<beans::XPropertySet>& mxPropSet;
+ OUString maPropName;
+};
+
+}
+
void ScXMLImport::SetNamedRanges()
{
- ScMyNamedExpressions* pNamedExpressions(GetNamedExpressions());
- if (pNamedExpressions)
+ ScMyNamedExpressions* pNamedExpressions = GetNamedExpressions();
+ if (!pNamedExpressions)
+ return;
+
+ uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
+ if (!xPropertySet.is())
+ return;
+
+ uno::Reference <sheet::XNamedRanges> xNamedRanges(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_NAMEDRANGES))), uno::UNO_QUERY);
+ if (!xNamedRanges.is())
+ return;
+
+ Reference<beans::XPropertySet> xPropSet(xNamedRanges, UNO_QUERY);
+ if (!xPropSet.is())
+ return;
+
+ NamedRangesSwitch aSwitch(xPropSet);
+
+ ScMyNamedExpressions::iterator aItr(pNamedExpressions->begin());
+ ScMyNamedExpressions::const_iterator aEndItr(pNamedExpressions->end());
+ table::CellAddress aCellAddress;
+ rtl::OUString sTempContent(RTL_CONSTASCII_USTRINGPARAM("0"));
+ while (aItr != aEndItr)
{
- uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
- if (xPropertySet.is())
+ sal_Int32 nOffset(0);
+ if (ScRangeStringConverter::GetAddressFromString(
+ aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
{
- uno::Reference <sheet::XNamedRanges> xNamedRanges(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_NAMEDRANGES))), uno::UNO_QUERY);
- if (xNamedRanges.is())
+ try
+ {
+ xNamedRanges->addNewByName((*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
+ }
+ catch( uno::RuntimeException& )
{
- ScMyNamedExpressions::iterator aItr(pNamedExpressions->begin());
- ScMyNamedExpressions::const_iterator aEndItr(pNamedExpressions->end());
- table::CellAddress aCellAddress;
- rtl::OUString sTempContent(RTL_CONSTASCII_USTRINGPARAM("0"));
- while (aItr != aEndItr)
+ DBG_ERROR("here are some Named Ranges with the same name");
+ uno::Reference < container::XIndexAccess > xIndex(xNamedRanges, uno::UNO_QUERY);
+ if (xIndex.is())
{
- sal_Int32 nOffset(0);
- if (ScRangeStringConverter::GetAddressFromString(
- aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
+ sal_Int32 nMax(xIndex->getCount());
+ sal_Bool bInserted(sal_False);
+ sal_Int32 nCount(1);
+ rtl::OUStringBuffer sName((*aItr)->sName);
+ sName.append(sal_Unicode('_'));
+ while (!bInserted && nCount <= nMax)
{
+ rtl::OUStringBuffer sTemp(sName);
+ sTemp.append(rtl::OUString::valueOf(nCount));
try
{
- xNamedRanges->addNewByName((*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
+ xNamedRanges->addNewByName(sTemp.makeStringAndClear(), sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
+ bInserted = sal_True;
}
catch( uno::RuntimeException& )
{
- DBG_ERROR("here are some Named Ranges with the same name");
- uno::Reference < container::XIndexAccess > xIndex(xNamedRanges, uno::UNO_QUERY);
- if (xIndex.is())
- {
- sal_Int32 nMax(xIndex->getCount());
- sal_Bool bInserted(sal_False);
- sal_Int32 nCount(1);
- rtl::OUStringBuffer sName((*aItr)->sName);
- sName.append(sal_Unicode('_'));
- while (!bInserted && nCount <= nMax)
- {
- rtl::OUStringBuffer sTemp(sName);
- sTemp.append(rtl::OUString::valueOf(nCount));
- try
- {
- xNamedRanges->addNewByName(sTemp.makeStringAndClear(), sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
- bInserted = sal_True;
- }
- catch( uno::RuntimeException& )
- {
- ++nCount;
- }
- }
- }
+ ++nCount;
}
}
- ++aItr;
}
- aItr = pNamedExpressions->begin();
- while (aItr != aEndItr)
+ }
+ }
+ ++aItr;
+ }
+ aItr = pNamedExpressions->begin();
+ while (aItr != aEndItr)
+ {
+ sal_Int32 nOffset(0);
+ if (ScRangeStringConverter::GetAddressFromString(
+ aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
+ {
+ uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName((*aItr)->sName), uno::UNO_QUERY);
+ if (xNamedRange.is())
+ {
+ LockSolarMutex();
+ ScNamedRangeObj* pNamedRangeObj = ScNamedRangeObj::getImplementation( xNamedRange);
+ if (pNamedRangeObj)
{
- sal_Int32 nOffset(0);
- if (ScRangeStringConverter::GetAddressFromString(
- aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
- {
- uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName((*aItr)->sName), uno::UNO_QUERY);
- if (xNamedRange.is())
- {
- LockSolarMutex();
- ScNamedRangeObj* pNamedRangeObj = ScNamedRangeObj::getImplementation( xNamedRange);
- if (pNamedRangeObj)
- {
- sTempContent = (*aItr)->sContent;
- // Get rid of leading sheet dots in simple ranges.
- if (!(*aItr)->bIsExpression)
- ScXMLConverter::ParseFormula( sTempContent, false);
- pNamedRangeObj->SetContentWithGrammar( sTempContent, (*aItr)->eGrammar);
- }
- UnlockSolarMutex();
- }
- }
- delete *aItr;
- aItr = pNamedExpressions->erase(aItr);
+ sTempContent = (*aItr)->sContent;
+ // Get rid of leading sheet dots in simple ranges.
+ if (!(*aItr)->bIsExpression)
+ ScXMLConverter::ParseFormula( sTempContent, false);
+ pNamedRangeObj->SetContentWithGrammar( sTempContent, (*aItr)->eGrammar);
}
+ UnlockSolarMutex();
}
}
+ delete *aItr;
+ aItr = pNamedExpressions->erase(aItr);
}
}
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index fbc480f..ae77794 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1502,7 +1502,7 @@ void ScPosWnd::FillFunctions()
SetText(aFirstName);
}
-void __EXPORT ScPosWnd::Notify( SfxBroadcaster&, const SfxHint& rHint )
+void ScPosWnd::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
if ( !bFormulaMode )
{
@@ -1707,7 +1707,7 @@ void ScPosWnd::DoEnter()
if ( aNewRanges.Insert(pNew) )
{
ScDocFunc aFunc(*pDocShell);
- aFunc.ModifyRangeNames( aNewRanges, FALSE );
+ aFunc.ModifyRangeNames( aNewRanges );
pViewSh->UpdateInputHandler(TRUE);
}
else
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index ac22335..be84aa5 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -4506,12 +4506,12 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, BOOL bRecord, BO
//------------------------------------------------------------------------
-BOOL ScDocFunc::ModifyRangeNames( const ScRangeName& rNewRanges, BOOL bApi )
+bool ScDocFunc::ModifyRangeNames( const ScRangeName& rNewRanges )
{
- return SetNewRangeNames( new ScRangeName( rNewRanges ), bApi );
+ return SetNewRangeNames( new ScRangeName(rNewRanges) );
}
-BOOL ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, BOOL /* bApi */ ) // takes ownership of pNewRanges
+bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc ) // takes ownership of pNewRanges
{
ScDocShellModificator aModificator( rDocShell );
@@ -4539,10 +4539,13 @@ BOOL ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, BOOL /* bApi */ )
if ( bCompile )
pDoc->CompileNameFormula( FALSE ); // CompileFormulaString
- aModificator.SetDocumentModified();
- SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
+ if (bModifyDoc)
+ {
+ aModificator.SetDocumentModified();
+ SFX_APP()->Broadcast( SfxSimpleHint(SC_HINT_AREAS_CHANGED) );
+ }
- return TRUE;
+ return true;
}
//------------------------------------------------------------------------
@@ -4691,7 +4694,7 @@ BOOL ScDocFunc::CreateNames( const ScRange& rRange, USHORT nFlags, BOOL bApi )
if ( bBottom && bRight )
CreateOneName( aNewRanges, nEndCol,nEndRow,nTab, nContX1,nContY1,nContX2,nContY2, bCancel, bApi );
- bDone = ModifyRangeNames( aNewRanges, bApi );
+ bDone = ModifyRangeNames( aNewRanges );
aModificator.SetDocumentModified();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREAS_CHANGED ) );
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 1a2c424..671b261 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -433,7 +433,7 @@ private:
BOOL ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor )
{
- RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "sb99857", "ScDocShell::LoadXML" );
+ LoadMediumGuard aLoadGuard(&aDocument);
// MacroCallMode is no longer needed, state is kept in SfxObjectShell now
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index 030b2dc..422a716 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -180,8 +180,8 @@ public:
BOOL UnmergeCells( const ScRange& rRange, BOOL bRecord, BOOL bApi );
bool UnmergeCells( const ScCellMergeOption& rOption, BOOL bRecord, BOOL bApi );
- BOOL SetNewRangeNames( ScRangeName* pNewRanges, BOOL bApi ); // takes ownership of pNewRanges
- BOOL ModifyRangeNames( const ScRangeName& rNewRanges, BOOL bApi );
+ bool SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc = true ); // takes ownership of pNewRanges
+ bool ModifyRangeNames( const ScRangeName& rNewRanges );
BOOL CreateNames( const ScRange& rRange, USHORT nFlags, BOOL bApi );
BOOL InsertNameList( const ScAddress& rStartPos, BOOL bApi );
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 4f1c0df..6130f1c 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -389,7 +389,7 @@ IMPL_LINK( ScNameDlg, OkBtnHdl, void *, EMPTYARG )
{
ScDocShell* pDocSh = pViewData->GetDocShell();
ScDocFunc aFunc(*pDocSh);
- aFunc.ModifyRangeNames( aLocalRangeName, FALSE );
+ aFunc.ModifyRangeNames( aLocalRangeName );
Close();
}
return 0;
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 686cad9..d85f24f 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -39,6 +39,8 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
#include "nameuno.hxx"
@@ -70,6 +72,16 @@ const SfxItemPropertyMapEntry* lcl_GetNamedRangeMap()
return aNamedRangeMap_Impl;
}
+const SfxItemPropertyMapEntry* lcl_GetNamedRangesMap()
+{
+ static SfxItemPropertyMapEntry aNamedRangesMap_Impl[] =
+ {
+ {MAP_CHAR_LEN(SC_UNO_MODIFY_BROADCAST), 0, &getBooleanCppuType(), 0, 0 },
+ {0,0,0,0,0,0}
+ };
+ return aNamedRangesMap_Impl;
+}
+
//------------------------------------------------------------------------
#define SCNAMEDRANGEOBJ_SERVICE "com.sun.star.sheet.NamedRange"
@@ -89,7 +101,8 @@ sal_Bool lcl_UserVisibleName( const ScRangeData* pData )
//------------------------------------------------------------------------
-ScNamedRangeObj::ScNamedRangeObj(ScDocShell* pDocSh, const String& rNm) :
+ScNamedRangeObj::ScNamedRangeObj(ScNamedRangesObj* pParent, ScDocShell* pDocSh, const String& rNm) :
+ mpParent(pParent),
pDocShell( pDocSh ),
aName( rNm )
{
@@ -174,7 +187,7 @@ void ScNamedRangeObj::Modify_Impl( const String* pNewName, const ScTokenArray* p
if ( pNewRanges->Insert(pNew) )
{
ScDocFunc aFunc(*pDocShell);
- aFunc.SetNewRangeNames( pNewRanges, sal_True );
+ aFunc.SetNewRangeNames( pNewRanges, mpParent->IsModifyAndBroadcast());
aName = aInsName; //! broadcast?
}
@@ -478,7 +491,8 @@ ScNamedRangeObj* ScNamedRangeObj::getImplementation( const uno::Reference<uno::X
//------------------------------------------------------------------------
ScNamedRangesObj::ScNamedRangesObj(ScDocShell* pDocSh) :
- pDocShell( pDocSh )
+ pDocShell( pDocSh ),
+ mbModifyAndBroadcast(true)
{
pDocShell->GetDocument()->AddUnoObject(*this);
}
@@ -500,6 +514,11 @@ void ScNamedRangesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
}
+bool ScNamedRangesObj::IsModifyAndBroadcast() const
+{
+ return mbModifyAndBroadcast;
+}
+
// sheet::XNamedRanges
ScNamedRangeObj* ScNamedRangesObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
@@ -517,7 +536,7 @@ ScNamedRangeObj* ScNamedRangesObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
if (lcl_UserVisibleName(pData)) // interne weglassen
{
if ( nPos == nIndex )
- return new ScNamedRangeObj( pDocShell, pData->GetName() );
+ return new ScNamedRangeObj(this, pDocShell, pData->GetName());
++nPos;
}
}
@@ -529,7 +548,7 @@ ScNamedRangeObj* ScNamedRangesObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
ScNamedRangeObj* ScNamedRangesObj::GetObjectByName_Impl(const rtl::OUString& aName)
{
if ( pDocShell && hasByName(aName) )
- return new ScNamedRangeObj( pDocShell, String(aName) );
+ return new ScNamedRangeObj(this, pDocShell, String(aName));
return NULL;
}
@@ -563,7 +582,7 @@ void SAL_CALL ScNamedRangesObj::addNewByName( const rtl::OUString& aName,
if ( pNewRanges->Insert(pNew) )
{
ScDocFunc aFunc(*pDocShell);
- aFunc.SetNewRangeNames( pNewRanges, sal_True );
+ aFunc.SetNewRangeNames(pNewRanges, mbModifyAndBroadcast);
bDone = TRUE;
}
else
@@ -623,7 +642,7 @@ void SAL_CALL ScNamedRangesObj::removeByName( const rtl::OUString& aName )
ScRangeName* pNewRanges = new ScRangeName(*pNames);
pNewRanges->AtFree(nPos);
ScDocFunc aFunc(*pDocShell);
- aFunc.SetNewRangeNames( pNewRanges, sal_True );
+ aFunc.SetNewRangeNames( pNewRanges, mbModifyAndBroadcast);
bDone = TRUE;
}
}
@@ -699,6 +718,41 @@ sal_Bool SAL_CALL ScNamedRangesObj::hasElements() throw(uno::RuntimeException)
return ( getCount() != 0 );
}
+Reference<beans::XPropertySetInfo> SAL_CALL ScNamedRangesObj::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ static Reference<beans::XPropertySetInfo> aRef(
+ new SfxItemPropertySetInfo(lcl_GetNamedRangesMap()));
+ return aRef;
+}
+
+void SAL_CALL ScNamedRangesObj::setPropertyValue(
+ const rtl::OUString& rPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ if (rPropertyName.equalsAscii(SC_UNO_MODIFY_BROADCAST))
+ {
+ aValue >>= mbModifyAndBroadcast;
+ }
+}
+
+Any SAL_CALL ScNamedRangesObj::getPropertyValue( const rtl::OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ Any aRet;
+ if (rPropertyName.equalsAscii(SC_UNO_MODIFY_BROADCAST))
+ {
+ aRet <<= mbModifyAndBroadcast;
+ }
+
+ return aRet;
+}
+
+SC_IMPL_DUMMY_PROPERTY_LISTENER( ScNamedRangesObj )
+
uno::Any SAL_CALL ScNamedRangesObj::getByName( const rtl::OUString& aName )
throw(container::NoSuchElementException,
lang::WrappedTargetException, uno::RuntimeException)
commit f853b153ceb623624a9a531535b1e1cac5bc58a7
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Wed Nov 17 11:52:30 2010 -0500
Changing margins in print preview should mark the document modified.
This fixes fdo#31219.
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 88c7749..6e970f3 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -1152,11 +1152,13 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
{
aLRItem.SetLeft( (long)( aButtonUpPt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS ));
rStyleSet.Put( aLRItem );
+ pDocShell->SetModified(true);
}
else if( bRightRulerChange && bRightRulerMove )
{
aLRItem.SetRight( (long)( nWidth - aButtonUpPt.X() / HMM_PER_TWIPS - aOffset.X() / HMM_PER_TWIPS ));
rStyleSet.Put( aLRItem );
+ pDocShell->SetModified(true);
}
ScStyleSaveData aNewData;
@@ -1220,11 +1222,13 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
{
aULItem.SetUpperValue( (USHORT)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS ) );
rStyleSet.Put( aULItem );
+ pDocShell->SetModified(true);
}
else if( bBottomRulerMove && bBottomRulerChange )
{
aULItem.SetLowerValue( (USHORT)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS ) );
rStyleSet.Put( aULItem );
+ pDocShell->SetModified(true);
}
else if( bHeaderRulerMove && bHeaderRulerChange )
{
@@ -1238,6 +1242,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
SvxSetItem aNewHeader( (const SvxSetItem&)rStyleSet.Get(ATTR_PAGE_HEADERSET) );
aNewHeader.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aHeaderSize ) );
rStyleSet.Put( aNewHeader );
+ pDocShell->SetModified(true);
}
}
else if( bFooterRulerMove && bFooterRulerChange )
@@ -1252,6 +1257,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
SvxSetItem aNewFooter( (const SvxSetItem&)rStyleSet.Get(ATTR_PAGE_FOOTERSET) );
aNewFooter.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aFooterSize ) );
rStyleSet.Put( aNewFooter );
+ pDocShell->SetModified(true);
}
}
@@ -1319,6 +1325,7 @@ void __EXPORT ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
if( nNewColWidth >= 0 )
{
aFunc.SetWidthOrHeight( TRUE, 1,nCols, nTab, SC_SIZE_DIRECT, (USHORT)nNewColWidth, TRUE, TRUE);
+ pDocShell->SetModified(true);
}
if ( ValidTab( nTab ) )
{
More information about the Libreoffice-commits
mailing list