[Libreoffice-commits] .: 3 commits - editeng/source sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Apr 18 11:57:23 PDT 2012
editeng/source/editeng/editattr.cxx | 31 ++++++++++++++++++++++++-------
editeng/source/editeng/editattr.hxx | 17 ++++++-----------
editeng/source/editeng/editdoc.cxx | 2 +-
editeng/source/editeng/impedit2.cxx | 2 +-
editeng/source/editeng/impedit3.cxx | 4 ++--
sc/inc/address.hxx | 18 +++++-------------
sc/source/ui/optdlg/tpdefaults.cxx | 11 ++++-------
sc/source/ui/vba/vbaapplication.cxx | 5 +++--
8 files changed, 46 insertions(+), 44 deletions(-)
New commits:
commit 8edf5c5ee61b85c17389ceb48f78daa06edf36f4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Apr 18 14:57:20 2012 -0400
This is no longer relevant. Removing.
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 182fba1..5f104b3 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -108,18 +108,6 @@ const SCROW SCROWS32K = 32000;
const SCCOL SCCOL_REPEAT_NONE = SCCOL_MAX;
const SCROW SCROW_REPEAT_NONE = SCROW_MAX;
-
-// We hope to get rid of the binary file format. If not, these are the places
-// we'd have to investigate because variable types changed. Just place code in
-// #if SC_ROWLIMIT_STREAM_ACCESS for now.
-#define SC_ROWLIMIT_STREAM_ACCESS 0
-// usage:
-//#if SC_ROWLIMIT_STREAM_ACCESS
-//#error address types changed!
-//... code ...
-//#endif // SC_ROWLIMIT_STREAM_ACCESS
-
-
// For future reference, place in code where more than 64k rows would need a
// special handling:
// #if SC_ROWLIMIT_MORE_THAN_64K
commit 670db0daa2ed638ec9df0d5d569d7c43ae1bf786
Author: Albert Thuswaldner <albert.thuswaldner at gmail.com>
Date: Wed Apr 18 00:31:02 2012 +0200
Use global constants for initial tab count bounds checking
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 6c45311..182fba1 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -95,7 +95,11 @@ const SCROW MAXROW = MAXROWCOUNT - 1;
const SCCOL MAXCOL = MAXCOLCOUNT - 1;
const SCTAB MAXTAB = MAXTABCOUNT - 1;
const SCCOLROW MAXCOLROW = MAXROW;
-
+// Limit the initial tab count to prevent users to set the count too high,
+// which could cause the memory usage of blank documents to exceed the
+// available system memory.
+const SCTAB MAXINITTAB = 1024;
+const SCTAB MININITTAB = 1;
// Special values
const SCTAB SC_TAB_APPEND = SCTAB_MAX;
diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx
index bc5b988..b67e87b 100644
--- a/sc/source/ui/optdlg/tpdefaults.cxx
+++ b/sc/source/ui/optdlg/tpdefaults.cxx
@@ -36,9 +36,6 @@
#include "defaultsoptions.hxx"
#include "document.hxx"
-#define INIT_SHEETS_MIN 1
-#define INIT_SHEETS_MAX 1024
-
using ::rtl::OUString;
ScTpDefaultsOptions::ScTpDefaultsOptions(Window *pParent, const SfxItemSet &rCoreSet) :
@@ -119,10 +116,10 @@ int ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/)
void ScTpDefaultsOptions::CheckNumSheets()
{
sal_Int64 nVal = aEdNSheets.GetValue();
- if (nVal > INIT_SHEETS_MAX)
- aEdNSheets.SetValue(INIT_SHEETS_MAX);
- if (nVal < INIT_SHEETS_MIN)
- aEdNSheets.SetValue(INIT_SHEETS_MIN);
+ if (nVal > MAXINITTAB)
+ aEdNSheets.SetValue(MAXINITTAB);
+ if (nVal < MININITTAB)
+ aEdNSheets.SetValue(MININITTAB);
}
void ScTpDefaultsOptions::CheckPrefix(Edit* pEdit)
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index 478e8f4..4204ba0 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -945,9 +945,10 @@ sal_Int32 SAL_CALL ScVbaApplication::getSheetsInNewWorkbook() throw (uno::Runtim
void SAL_CALL ScVbaApplication::setSheetsInNewWorkbook( sal_Int32 SheetsInNewWorkbook ) throw (script::BasicErrorException, uno::RuntimeException)
{
- if ( SheetsInNewWorkbook < 1 || SheetsInNewWorkbook > MAXTAB )
+ if ( SheetsInNewWorkbook < MININITTAB
+ || SheetsInNewWorkbook > MAXINITTAB )
{
- DebugHelper::exception( OUString(RTL_CONSTASCII_USTRINGPARAM("The number must be between 1 and 255")),
+ DebugHelper::exception( OUString(RTL_CONSTASCII_USTRINGPARAM("The number must be between 1 and 10000")),
uno::Exception(), SbERR_METHOD_FAILED, OUString() );
}
else
commit e4784750705b3d2649b461ade363c84bd1b2b10b
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Wed Apr 18 11:58:06 2012 -0400
String & bool cleanup.
diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx
index 131f889..d5b640f 100644
--- a/editeng/source/editeng/editattr.cxx
+++ b/editeng/source/editeng/editattr.cxx
@@ -328,6 +328,23 @@ void EditCharAttribField::SetFont( SvxFont& rFont, OutputDevice* )
rFont.SetColor( *pTxtColor );
}
+const rtl::OUString& EditCharAttribField::GetFieldValue() const
+{
+ return aFieldValue;
+}
+
+void EditCharAttribField::SetFieldValue(const rtl::OUString& rVal)
+{
+ aFieldValue = rVal;
+}
+
+void EditCharAttribField::Reset()
+{
+ aFieldValue = rtl::OUString();
+ delete pTxtColor; pTxtColor = NULL;
+ delete pFldColor; pFldColor = NULL;
+}
+
EditCharAttribField::EditCharAttribField( const EditCharAttribField& rAttr )
: EditCharAttrib( *rAttr.GetItem(), rAttr.GetStart(), rAttr.GetEnd() ),
aFieldValue( rAttr.aFieldValue )
@@ -342,22 +359,22 @@ EditCharAttribField::~EditCharAttribField()
Reset();
}
-sal_Bool EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) const
+bool EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) const
{
if ( aFieldValue != rAttr.aFieldValue )
- return sal_False;
+ return false;
if ( ( pTxtColor && !rAttr.pTxtColor ) || ( !pTxtColor && rAttr.pTxtColor ) )
- return sal_False;
+ return false;
if ( ( pTxtColor && rAttr.pTxtColor ) && ( *pTxtColor != *rAttr.pTxtColor ) )
- return sal_False;
+ return false;
if ( ( pFldColor && !rAttr.pFldColor ) || ( !pFldColor && rAttr.pFldColor ) )
- return sal_False;
+ return false;
if ( ( pFldColor && rAttr.pFldColor ) && ( *pFldColor != *rAttr.pFldColor ) )
- return sal_False;
+ return false;
- return sal_True;
+ return true;
}
// -------------------------------------------------------------------------
diff --git a/editeng/source/editeng/editattr.hxx b/editeng/source/editeng/editattr.hxx
index 4a0f711..1a371d0 100644
--- a/editeng/source/editeng/editattr.hxx
+++ b/editeng/source/editeng/editattr.hxx
@@ -342,7 +342,7 @@ public:
// -------------------------------------------------------------------------
class EditCharAttribField: public EditCharAttrib
{
- XubString aFieldValue;
+ rtl::OUString aFieldValue;
Color* pTxtColor;
Color* pFldColor;
@@ -353,23 +353,18 @@ public:
EditCharAttribField( const EditCharAttribField& rAttr );
~EditCharAttribField();
- sal_Bool operator == ( const EditCharAttribField& rAttr ) const;
- sal_Bool operator != ( const EditCharAttribField& rAttr ) const
+ bool operator == ( const EditCharAttribField& rAttr ) const;
+ bool operator != ( const EditCharAttribField& rAttr ) const
{ return !(operator == ( rAttr ) ); }
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
Color*& GetTxtColor() { return pTxtColor; }
Color*& GetFldColor() { return pFldColor; }
- const XubString& GetFieldValue() const { return aFieldValue; }
- XubString& GetFieldValue() { return aFieldValue; }
+ const rtl::OUString& GetFieldValue() const;
+ void SetFieldValue(const rtl::OUString& rVal);
- void Reset()
- {
- aFieldValue.Erase();
- delete pTxtColor; pTxtColor = 0;
- delete pFldColor; pFldColor = 0;
- }
+ void Reset();
};
// -------------------------------------------------------------------------
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 3b8244a..c24e72b 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2146,7 +2146,7 @@ sal_uLong EditDoc::GetTextLen() const
const EditCharAttrib& rAttr = rAttrs[--nAttr];
if (rAttr.Which() == EE_FEATURE_FIELD)
{
- sal_uInt16 nFieldLen = static_cast<const EditCharAttribField&>(rAttr).GetFieldValue().Len();
+ sal_Int32 nFieldLen = static_cast<const EditCharAttribField&>(rAttr).GetFieldValue().getLength();
if ( !nFieldLen )
nLen--;
else
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 202b8fa..e4ec620 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2999,7 +2999,7 @@ sal_Bool ImpEditEngine::UpdateFields()
static_cast<const SvxFieldItem&>(*rField.GetItem()),
nPara, rField.GetStart(), rField.GetTxtColor(), rField.GetFldColor());
- rField.GetFieldValue() = aFldValue;
+ rField.SetFieldValue(aFldValue);
if (rField != *pCurrent)
{
bChanges = true;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 5ea5d71..a08a6c7 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1003,10 +1003,10 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
aTmpFont.SetPhysFont( GetRefDevice() );
ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
- String aFieldValue = cChar ? String(cChar) : ((EditCharAttribField*)pNextFeature)->GetFieldValue();
+ rtl::OUString aFieldValue = cChar ? rtl::OUString(cChar) : ((EditCharAttribField*)pNextFeature)->GetFieldValue();
if ( bCalcCharPositions || !pPortion->HasValidSize() )
{
- pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), aFieldValue, 0, aFieldValue.Len(), 0 );
+ pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), aFieldValue, 0, aFieldValue.getLength(), 0 );
// So no scrolling for oversized fields
if ( pPortion->GetSize().Width() > nXWidth )
pPortion->GetSize().Width() = nXWidth;
More information about the Libreoffice-commits
mailing list