From de9172871b29cea2fddbce9d5c55730f6d64754b Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 28 Jul 2010 13:01:55 +0200 Subject: fwk152: #i113454# accept broken .xcs files containing empty --- configmgr/source/xcsparser.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx index 79e122759fc8..37b46494c6a7 100644 --- a/configmgr/source/xcsparser.cxx +++ b/configmgr/source/xcsparser.cxx @@ -321,15 +321,19 @@ void XcsParser::endElement(XmlReader const & reader) { } else { switch (state_) { case STATE_COMPONENT_SCHEMA: + // To support old, broken extensions with .xcs files that contain + // empty elements: + state_ = STATE_COMPONENT_DONE; + break; + case STATE_TEMPLATES: + state_ = STATE_TEMPLATES_DONE; + break; case STATE_TEMPLATES_DONE: throw css::uno::RuntimeException( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("no component element in ")) + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); - case STATE_TEMPLATES: - state_ = STATE_TEMPLATES_DONE; - break; case STATE_COMPONENT_DONE: break; default: -- cgit From 5136d89453c5a28a7143afcf58c547517d4b6758 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Wed, 28 Jul 2010 13:54:38 +0200 Subject: fwk152: #i113249# Fix broken HTML clipboard --- editeng/source/editeng/eehtml.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 569b80639b6b..e8a2aaad22e2 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -43,7 +43,7 @@ #include #include #include - +#include #define ACTION_INSERTTEXT 1 #define ACTION_INSERTPARABRK 2 @@ -66,6 +66,16 @@ EditHTMLParser::EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValu nNumberingLevel = 0; bFieldsInserted = FALSE; + DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW == GetSrcEncoding( ), "EditHTMLParser::EditHTMLParser: Where does the encoding come from?" ); + DBG_ASSERT( !IsSwitchToUCS2(), "EditHTMLParser::::EditHTMLParser: Switch to UCS2?" ); + + // Altough the real default encoding is ISO8859-1, we use MS-1252 + // als default encoding. + SetSrcEncoding( GetExtendedCompatibilityTextEncoding( RTL_TEXTENCODING_ISO_8859_1 ) ); + + // If the file starts with a BOM, switch to UCS2. + SetSwitchToUCS2( TRUE ); + if ( pHTTPHeaderAttrs ) SetEncodingByHTTPHeader( pHTTPHeaderAttrs ); } -- cgit From 603d34f5ae0fe8cd63a1b16452432991bfa29f29 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 29 Jul 2010 14:57:46 +0200 Subject: sw33bf08: #i113461#: SvxAutoCorrect::AutoCorrect(): apply patch by dtardon: do not freeze after erasing non-breaking space inserted by French AutoCorrection --- editeng/source/misc/svxacorr.cxx | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 64343517c69f..f969a8033f08 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1243,27 +1243,25 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, else if ( bIsNextRun && !IsAutoCorrectChar( cChar ) ) { // Remove the NBSP if it wasn't an autocorrection - if ( NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) && + if ( nInsPos != 0 && NeedsHardspaceAutocorr( rTxt.GetChar( nInsPos - 1 ) ) && cChar != ' ' && cChar != '\t' && cChar != CHAR_HARDBLANK ) { // Look for the last HARD_SPACE xub_StrLen nPos = nInsPos - 1; - bool bFound = false; - while ( nPos != STRING_NOTFOUND && !bFound ) + bool bContinue = true; + while ( bContinue ) { - sal_Unicode cTmpChar = rTxt.GetChar( nPos ); + const sal_Unicode cTmpChar = rTxt.GetChar( nPos ); if ( cTmpChar == CHAR_HARDBLANK ) - bFound = true; - else if ( !NeedsHardspaceAutocorr( cTmpChar ) ) - nPos = STRING_NOTFOUND; + { + rDoc.Delete( nPos, nPos + 1 ); + nRet = AddNonBrkSpace; + bContinue = false; + } + else if ( !NeedsHardspaceAutocorr( cTmpChar ) || nPos == 0 ) + bContinue = false; nPos--; } - - if ( bFound && nPos != STRING_NOTFOUND ) - { - rDoc.Delete( nPos + 1, nPos + 2 ); - nRet = AddNonBrkSpace; - } } } } -- cgit From 6e027a4662f04e311670ec5f36344d931b75a589 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 3 Aug 2010 18:06:21 +0200 Subject: sw33bf08: #i113623#: stgio.cxx: fix operator delete mismatch --- sot/source/sdstor/stgio.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx index 00dd454233e2..2c18429b9d64 100644 --- a/sot/source/sdstor/stgio.cxx +++ b/sot/source/sdstor/stgio.cxx @@ -158,7 +158,7 @@ class EasyFat public: EasyFat( StgIo & rIo, StgStrm *pFatStream, INT32 nPSize ); - ~EasyFat() { delete pFat; delete pFree; } + ~EasyFat() { delete[] pFat; delete[] pFree; } INT32 GetPageSize() { return nPageSize; } INT32 Count() { return nPages; } INT32 operator[]( INT32 nOffset ) { return pFat[ nOffset ]; } -- cgit From fdaebfd0adb0a35d2b5a09a4ed1f93a4bb2dcbfe Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 4 Aug 2010 09:54:13 +0200 Subject: mib18: #162039# clear covered cells when merging via VBA MergeCells symbol --- sc/source/ui/vba/vbarange.cxx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index b50199f025d0..3d541fadf5d4 100755 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -1206,6 +1206,14 @@ inline table::CellRangeAddress lclGetRangeAddress( const uno::Reference< RangeTy return uno::Reference< sheet::XCellRangeAddressable >( rxCellRange, uno::UNO_QUERY_THROW )->getRangeAddress(); } +void lclClearRange( const uno::Reference< table::XCellRange >& rxCellRange ) throw (uno::RuntimeException) +{ + using namespace ::com::sun::star::sheet::CellFlags; + sal_Int32 nFlags = VALUE | DATETIME | STRING | ANNOTATION | FORMULA | HARDATTR | STYLES | EDITATTR | FORMATTED; + uno::Reference< sheet::XSheetOperation > xSheetOperation( rxCellRange, uno::UNO_QUERY_THROW ); + xSheetOperation->clearContents( nFlags ); +} + uno::Reference< sheet::XSheetCellRange > lclExpandToMerged( const uno::Reference< table::XCellRange >& rxCellRange, bool bRecursive ) throw (uno::RuntimeException) { uno::Reference< sheet::XSheetCellRange > xNewCellRange( rxCellRange, uno::UNO_QUERY_THROW ); @@ -1251,15 +1259,27 @@ void lclExpandAndMerge( const uno::Reference< table::XCellRange >& rxCellRange, // Calc cannot merge over merged ranges, always unmerge first xMerge->merge( sal_False ); if( bMerge ) + { + // clear all contents of the covered cells (not the top-left cell) + table::CellRangeAddress aRangeAddr = lclGetRangeAddress( rxCellRange ); + sal_Int32 nLastColIdx = aRangeAddr.EndColumn - aRangeAddr.StartColumn; + sal_Int32 nLastRowIdx = aRangeAddr.EndRow - aRangeAddr.StartRow; + // clear cells of top row, right of top-left cell + if( nLastColIdx > 0 ) + lclClearRange( rxCellRange->getCellRangeByPosition( 1, 0, nLastColIdx, 0 ) ); + // clear all rows below top row + if( nLastRowIdx > 0 ) + lclClearRange( rxCellRange->getCellRangeByPosition( 0, 1, nLastColIdx, nLastRowIdx ) ); + // merge the range xMerge->merge( sal_True ); - // FIXME need to check whether all the cell contents are retained or lost by popping up a dialog + } } util::TriState lclGetMergedState( const uno::Reference< table::XCellRange >& rxCellRange ) throw (uno::RuntimeException) { /* 1) Check if range is completely inside one single merged range. To do this, try to extend from top-left cell only (not from entire range). - This will excude cases where this range consists of several merged + This will exclude cases where this range consists of several merged ranges (or parts of them). */ table::CellRangeAddress aRangeAddr = lclGetRangeAddress( rxCellRange ); uno::Reference< table::XCellRange > xTopLeft( rxCellRange->getCellRangeByPosition( 0, 0, 0, 0 ), uno::UNO_SET_THROW ); @@ -1508,7 +1528,8 @@ ScVbaRange::setValue( const uno::Any &aValue ) throw (uno::RuntimeException) void ScVbaRange::Clear() throw (uno::RuntimeException) { - sal_Int32 nFlags = sheet::CellFlags::VALUE | sheet::CellFlags::STRING | sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR | sheet::CellFlags::FORMULA; + using namespace ::com::sun::star::sheet::CellFlags; + sal_Int32 nFlags = VALUE | DATETIME | STRING | FORMULA | HARDATTR | EDITATTR | FORMATTED; ClearContents( nFlags ); } -- cgit From 403e06a2806cacd8765666f2e85b3647624bc0e6 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 4 Aug 2010 09:56:54 +0200 Subject: mib18: #162937# extract all integer and floating values from an 'Any' for Boolean parameters --- sc/source/ui/vba/vbarange.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 3d541fadf5d4..fef118277d3b 100755 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -2315,8 +2315,7 @@ ScVbaRange::Columns(const uno::Any& aIndex ) throw (uno::RuntimeException) void ScVbaRange::setMergeCells( const uno::Any& aIsMerged ) throw (script::BasicErrorException, uno::RuntimeException) { - bool bMerge = false; - aIsMerged >>= bMerge; + bool bMerge = extractBoolFromAny( aIsMerged ); if( mxRanges.is() ) { @@ -2517,7 +2516,8 @@ ScVbaRange::setWrapText( const uno::Any& aIsWrapped ) throw (script::BasicErrorE } uno::Reference< beans::XPropertySet > xProps(mxRange, ::uno::UNO_QUERY_THROW ); - xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTextWrapped" ) ), aIsWrapped ); + bool bIsWrapped = extractBoolFromAny( aIsWrapped ); + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTextWrapped" ) ), uno::Any( bIsWrapped ) ); } uno::Any @@ -2896,13 +2896,11 @@ ScVbaRange::setHidden( const uno::Any& _hidden ) throw (uno::RuntimeException) return; } - sal_Bool bHidden = sal_False; - _hidden >>= bHidden; - + bool bHidden = extractBoolFromAny( _hidden ); try { uno::Reference< beans::XPropertySet > xProps = getRowOrColumnProps( mxRange, mbIsRows ); - xProps->setPropertyValue( ISVISIBLE, uno::makeAny( !bHidden ) ); + xProps->setPropertyValue( ISVISIBLE, uno::Any( !bHidden ) ); } catch( uno::Exception& e ) { @@ -4931,8 +4929,7 @@ void ScVbaRange::setShowDetail(const uno::Any& aShowDetail) throw ( css::uno::Ru if( m_Areas->getCount() > 1 ) throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can not set Range.ShowDetail attribute ")), uno::Reference< uno::XInterface >() ); - sal_Bool bShowDetail = sal_False; - aShowDetail >>= bShowDetail; + bool bShowDetail = extractBoolFromAny( aShowDetail ); RangeHelper helper( mxRange ); uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = helper.getSheetCellCursor(); -- cgit From d5bb7f0a4a1b9e6a0fbc1f597a1c30ddea67838a Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 4 Aug 2010 09:56:54 +0200 Subject: mib18: #162937# extract all integer and floating values from an 'Any' for Boolean parameters --- vbahelper/inc/vbahelper/vbahelper.hxx | 7 +++++++ vbahelper/source/vbahelper/vbahelper.cxx | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx index a1eca84bbdf8..ccabb9114f2d 100644 --- a/vbahelper/inc/vbahelper/vbahelper.hxx +++ b/vbahelper/inc/vbahelper/vbahelper.hxx @@ -90,6 +90,13 @@ namespace ooo VBAHELPER_DLLPUBLIC void PrintOutHelper( SfxViewShell* pViewShell, const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName, sal_Bool bSelection ); VBAHELPER_DLLPUBLIC void PrintPreviewHelper( const css::uno::Any& EnableChanges, SfxViewShell* ); + /** Extracts a boolean value from the passed Any, which may contain sal_Bool or an integer or floating-point value. + Returns false, if the Any is empty or contains an incompatible type. */ + VBAHELPER_DLLPUBLIC bool extractBoolFromAny( bool& rbValue, const css::uno::Any& rAny ); + /** Extracts a boolean value from the passed Any, which may contain sal_Bool or an integer or floating-point value. + Throws, if the Any is empty or contains an incompatible type. */ + VBAHELPER_DLLPUBLIC bool extractBoolFromAny( const css::uno::Any& rAny ) throw (css::uno::RuntimeException); + VBAHELPER_DLLPUBLIC rtl::OUString getAnyAsString( const css::uno::Any& pvargItem ) throw ( css::uno::RuntimeException ); VBAHELPER_DLLPUBLIC rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike = false); // needs to be in an uno service ( already this code is duplicated in basic ) VBAHELPER_DLLPUBLIC double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt::XDevice >& xDevice, sal_Bool bVertical); diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 7cd82dff9536..14f4e3ff1363 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -625,6 +625,30 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno:: dispatchExecute( pViewShell, SID_VIEWSHELL1 ); } +bool extractBoolFromAny( bool& rbValue, const uno::Any& rAny ) +{ + if( rAny >>= rbValue ) return true; + + sal_Int64 nSigned = 0; + if( rAny >>= nSigned ) { rbValue = nSigned != 0; return true; } + + sal_uInt64 nUnsigned = 0; + if( rAny >>= nUnsigned ) { rbValue = nUnsigned > 0; return true; } + + double fDouble = 0.0; + if( rAny >>= fDouble ) { rbValue = fDouble != 0.0; return true; } + + return false; +} + +bool extractBoolFromAny( const uno::Any& rAny ) throw (uno::RuntimeException) +{ + bool bValue = false; + if( extractBoolFromAny( bValue, rAny ) ) + return bValue; + throw uno::RuntimeException(); +} + rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeException ) { uno::Type aType = pvargItem.getValueType(); -- cgit From 0140f7e96cc04269253d8e60894fa0f7ee892154 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 4 Aug 2010 09:58:00 +0200 Subject: mib18: #163195# set correct parent for range returned by VBA ActiveCell symbol --- sc/source/ui/vba/vbaapplication.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 8f5aba5c4acb..af02398e5a0f 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -302,7 +302,8 @@ ScVbaApplication::getActiveCell() throw (uno::RuntimeException ) sal_Int32 nCursorX = pTabView->GetCurX(); sal_Int32 nCursorY = pTabView->GetCurY(); - return new ScVbaRange( this, mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) ); + uno::Reference< XHelperInterface > xParent( excel::getUnoSheetModuleObj( xRange ), uno::UNO_QUERY_THROW ); + return new ScVbaRange( xParent, mxContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, nCursorX, nCursorY ) ); } uno::Any SAL_CALL -- cgit From 84a60bade63e78c873a5fa124ccf16050b147d09 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 4 Aug 2010 09:59:00 +0200 Subject: mib18: #163198# VBA Names collection must return VBA Name objects --- sc/source/ui/vba/vbanames.cxx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index 2304874bdb1b..9fd22bf89f7a 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -173,11 +173,6 @@ ScVbaNames::getElementType() throw( css::uno::RuntimeException ) uno::Reference< container::XEnumeration > ScVbaNames::createEnumeration() throw (uno::RuntimeException) { - if ( mxNames.is() ) - { - uno::Reference< container::XEnumerationAccess > xAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); - return xAccess->createEnumeration(); - } uno::Reference< container::XEnumerationAccess > xEnumAccess( mxNames, uno::UNO_QUERY_THROW ); return new NamesEnumeration( this, mxContext, xEnumAccess->createEnumeration(), mxModel , mxNames ); } -- cgit From c7821efc469f4bff0fd2a7ddfa922088111a0408 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 4 Aug 2010 12:21:22 +0200 Subject: mib18: #163185# avoid crash when document is closed and a modal dialog is active --- toolkit/source/awt/vclxwindows.cxx | 10 +++++++++- toolkit/source/helper/unowrapper.cxx | 15 ++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 4a68b4c80e3f..68f09abfdb78 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -2363,15 +2363,23 @@ sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException) Dialog* pDlg = (Dialog*) GetWindow(); Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP ); Window* pOldParent = NULL; + Window* pSetParent = NULL; if ( pParent && !pParent->IsReallyVisible() ) { pOldParent = pDlg->GetParent(); Window* pFrame = pDlg->GetWindow( WINDOW_FRAME ); if( pFrame != pDlg ) + { pDlg->SetParent( pFrame ); + pSetParent = pFrame; + } } + nRet = pDlg->Execute(); - if ( pOldParent ) + + // set the parent back only in case no new parent was set from outside + // in other words, revert only own changes + if ( pOldParent && pDlg->GetParent() == pSetParent ) pDlg->SetParent( pOldParent ); } return nRet; diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index d7cec7c17354..c36ae29d4531 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -318,12 +318,17 @@ void UnoWrapper::WindowDestroyed( Window* pWindow ) Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD ); while ( pTopWindowChild ) { - OSL_ENSURE( pTopWindowChild->GetParent() == pWindow, "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" ); + OSL_ENSURE( pTopWindowChild->GetParent() == pWindow, + "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" ); - uno::Reference< lang::XComponent > xComp( pTopWindowChild->GetComponentInterface( FALSE ), uno::UNO_QUERY ); - pTopWindowChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING ); - if ( xComp.is() ) - xComp->dispose(); + Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING ); + + //the window still could be on the stack, so we have to + // use lazy delete ( it will automatically + // disconnect from the currently destroyed parent window ) + pTopWindowChild->doLazyDelete(); + + pTopWindowChild = pNextTopChild; } } } -- cgit From 5a6f0aa8c775d3e33ee6b6eb52afe8720c4b5377 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 4 Aug 2010 16:00:21 +0200 Subject: mib18: #163200# full rework of VBA symbols Application.Intersect and Application.Union --- sc/source/ui/vba/makefile.mk | 92 +++--- sc/source/ui/vba/vbaapplication.cxx | 607 ++++++++++++++---------------------- 2 files changed, 285 insertions(+), 414 deletions(-) diff --git a/sc/source/ui/vba/makefile.mk b/sc/source/ui/vba/makefile.mk index 4cb7e3eb064b..92bb3fd39db0 100644 --- a/sc/source/ui/vba/makefile.mk +++ b/sc/source/ui/vba/makefile.mk @@ -47,63 +47,63 @@ INCPRE=$(INCCOM)$/$(TARGET) # ------------------------------------------------------------------ SLOFILES= \ - $(SLO)$/vbaglobals.obj \ - $(SLO)$/vbaworkbook.obj \ - $(SLO)$/vbaworksheets.obj \ + $(SLO)$/excelvbahelper.obj \ + $(SLO)$/service.obj \ $(SLO)$/vbaapplication.obj \ - $(SLO)$/vbarange.obj \ - $(SLO)$/vbaname.obj \ - $(SLO)$/vbanames.obj \ - $(SLO)$/vbacomment.obj \ - $(SLO)$/vbacomments.obj \ - $(SLO)$/vbaworkbooks.obj \ - $(SLO)$/vbaworksheet.obj \ - $(SLO)$/vbaoutline.obj \ - $(SLO)$/vbafont.obj\ - $(SLO)$/excelvbahelper.obj\ - $(SLO)$/vbainterior.obj\ - $(SLO)$/vbawsfunction.obj\ - $(SLO)$/vbawindow.obj\ - $(SLO)$/vbachart.obj\ - $(SLO)$/vbachartobject.obj\ - $(SLO)$/vbachartobjects.obj\ - $(SLO)$/vbaseriescollection.obj\ - $(SLO)$/vbadialogs.obj \ - $(SLO)$/vbadialog.obj \ - $(SLO)$/vbapivottable.obj \ - $(SLO)$/vbapivotcache.obj \ - $(SLO)$/vbapivottables.obj \ - $(SLO)$/vbawindows.obj \ - $(SLO)$/vbapalette.obj \ + $(SLO)$/vbaassistant.obj \ + $(SLO)$/vbaaxes.obj \ + $(SLO)$/vbaaxis.obj \ + $(SLO)$/vbaaxistitle.obj \ $(SLO)$/vbaborders.obj \ $(SLO)$/vbacharacters.obj \ - $(SLO)$/vbavalidation.obj \ - $(SLO)$/vbasheetobject.obj \ - $(SLO)$/vbasheetobjects.obj \ - $(SLO)$/vbaoleobject.obj \ - $(SLO)$/vbaoleobjects.obj \ - $(SLO)$/vbatextboxshape.obj \ - $(SLO)$/vbapane.obj \ - $(SLO)$/vbatextframe.obj \ - $(SLO)$/vbacharttitle.obj \ + $(SLO)$/vbachart.obj \ + $(SLO)$/vbachartobject.obj \ + $(SLO)$/vbachartobjects.obj \ $(SLO)$/vbacharts.obj \ - $(SLO)$/vbaaxistitle.obj \ - $(SLO)$/vbaaxes.obj \ - $(SLO)$/vbaaxis.obj \ - $(SLO)$/vbaformat.obj \ + $(SLO)$/vbacharttitle.obj \ + $(SLO)$/vbacomment.obj \ + $(SLO)$/vbacomments.obj \ $(SLO)$/vbacondition.obj \ + $(SLO)$/vbadialog.obj \ + $(SLO)$/vbadialogs.obj \ + $(SLO)$/vbaeventshelper.obj \ + $(SLO)$/vbafont.obj \ + $(SLO)$/vbaformat.obj \ $(SLO)$/vbaformatcondition.obj \ $(SLO)$/vbaformatconditions.obj \ - $(SLO)$/vbastyle.obj \ - $(SLO)$/vbastyles.obj \ - $(SLO)$/vbaassistant.obj \ + $(SLO)$/vbaglobals.obj \ $(SLO)$/vbahyperlink.obj \ $(SLO)$/vbahyperlinks.obj \ - $(SLO)$/vbapagesetup.obj \ + $(SLO)$/vbainterior.obj \ + $(SLO)$/vbaname.obj \ + $(SLO)$/vbanames.obj \ + $(SLO)$/vbaoleobject.obj \ + $(SLO)$/vbaoleobjects.obj \ + $(SLO)$/vbaoutline.obj \ $(SLO)$/vbapagebreak.obj \ $(SLO)$/vbapagebreaks.obj \ - $(SLO)$/vbaeventshelper.obj \ - $(SLO)$/service.obj + $(SLO)$/vbapagesetup.obj \ + $(SLO)$/vbapalette.obj \ + $(SLO)$/vbapane.obj \ + $(SLO)$/vbapivotcache.obj \ + $(SLO)$/vbapivottable.obj \ + $(SLO)$/vbapivottables.obj \ + $(SLO)$/vbarange.obj \ + $(SLO)$/vbaseriescollection.obj \ + $(SLO)$/vbasheetobject.obj \ + $(SLO)$/vbasheetobjects.obj \ + $(SLO)$/vbastyle.obj \ + $(SLO)$/vbastyles.obj \ + $(SLO)$/vbatextboxshape.obj \ + $(SLO)$/vbatextframe.obj \ + $(SLO)$/vbavalidation.obj \ + $(SLO)$/vbawindow.obj \ + $(SLO)$/vbawindows.obj \ + $(SLO)$/vbaworkbook.obj \ + $(SLO)$/vbaworkbooks.obj \ + $(SLO)$/vbaworksheet.obj \ + $(SLO)$/vbaworksheets.obj \ + $(SLO)$/vbawsfunction.obj .ENDIF # --- Targets ------------------------------------------------------ diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index af02398e5a0f..f3965393e919 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -88,12 +88,6 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; -// Enable our own join detection for Intersection and Union -// should be more efficient than using ScRangeList::Join ( because -// we already are testing the same things ) - -#define OWN_JOIN 1 - // #TODO is this defined somewhere else? #if ( defined UNX ) || ( defined OS2 ) //unix #define FILE_PATH_SEPERATOR "/" @@ -806,412 +800,289 @@ ScVbaApplication::PathSeparator( ) throw (script::BasicErrorException, uno::Run return sPathSep; } -typedef std::list< ScRange > Ranges; -typedef std::list< ScRangeList > RangesList; +// ---------------------------------------------------------------------------- +// Helpers for Intersect and Union + +namespace { + +typedef ::std::list< ScRange > ListOfScRange; -void lcl_addRangesToVec( RangesList& vRanges, const uno::Any& aArg ) throw ( script::BasicErrorException, uno::RuntimeException ) +/** Appends all ranges of a VBA Range object in the passed Any to the list of ranges. */ +void lclAddToListOfScRange( ListOfScRange& rList, const uno::Any& rArg ) + throw (script::BasicErrorException, uno::RuntimeException) { - ScRangeList theRanges; - uno::Reference< excel::XRange > xRange( aArg, uno::UNO_QUERY_THROW ); - uno::Reference< XCollection > xCol( xRange->Areas( uno::Any() ), uno::UNO_QUERY_THROW ); - sal_Int32 nCount = xCol->getCount(); - for( sal_Int32 i = 1; i <= nCount; ++i ) + if( rArg.hasValue() ) { - uno::Reference< excel::XRange > xAreaRange( xCol->Item( uno::makeAny( sal_Int32(i) ), uno::Any() ), uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XCellRangeAddressable > xAddressable( xAreaRange->getCellRange(), uno::UNO_QUERY_THROW ); - table::CellRangeAddress addr = xAddressable->getRangeAddress(); - ScRange refRange; - ScUnoConversion::FillScRange( refRange, addr ); - theRanges.Append( refRange ); + uno::Reference< excel::XRange > xRange( rArg, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xCol( xRange->Areas( uno::Any() ), uno::UNO_QUERY_THROW ); + for( sal_Int32 nIdx = 1, nCount = xCol->getCount(); nIdx <= nCount; ++nIdx ) + { + uno::Reference< excel::XRange > xAreaRange( xCol->Item( uno::Any( nIdx ), uno::Any() ), uno::UNO_QUERY_THROW ); + uno::Reference< sheet::XCellRangeAddressable > xAddressable( xAreaRange->getCellRange(), uno::UNO_QUERY_THROW ); + ScRange aScRange; + ScUnoConversion::FillScRange( aScRange, xAddressable->getRangeAddress() ); + rList.push_back( aScRange ); + } } - vRanges.push_back( theRanges ); } -void lcl_addRangeToVec( Ranges& vRanges, const uno::Any& aArg ) throw ( script::BasicErrorException, uno::RuntimeException ) +/** Returns true, if the passed ranges can be expressed by a single range. The + new range will be contained in r1 then, the range r2 can be removed. */ +bool lclTryJoin( ScRange& r1, const ScRange& r2 ) { - uno::Reference< excel::XRange > xRange( aArg, uno::UNO_QUERY_THROW ); - uno::Reference< XCollection > xCol( xRange->Areas( uno::Any() ), uno::UNO_QUERY_THROW ); - sal_Int32 nCount = xCol->getCount(); - for( sal_Int32 i = 1; i <= nCount; ++i ) + // 1) r2 is completely inside r1 + if( r1.In( r2 ) ) + return true; + + // 2) r1 is completely inside r2 + if( r2.In( r1 ) ) { - uno::Reference< excel::XRange > xAreaRange( xCol->Item( uno::makeAny( sal_Int32(i) ), uno::Any() ), uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XCellRangeAddressable > xAddressable( xAreaRange->getCellRange(), uno::UNO_QUERY_THROW ); - table::CellRangeAddress addr = xAddressable->getRangeAddress(); - ScRange refRange; - ScUnoConversion::FillScRange( refRange, addr ); - vRanges.push_back( refRange ); + r1 = r2; + return true; } -} -bool lcl_canJoin( ScRange& r1, ScRange& r2 ) -{ - bool bCanJoin = false; - SCCOL startEndColDiff = r2.aStart.Col() - r1.aEnd.Col(); - SCROW startEndRowDiff = r2.aStart.Row() - r1.aEnd.Row(); - SCCOL startColDiff = r2.aStart.Col() - r1.aStart.Col(); - SCCOL endColDiff = r2.aEnd.Col() - r1.aEnd.Col(); - SCROW startRowDiff = r2.aStart.Row() - r1.aStart.Row(); - SCROW endRowDiff = r2.aEnd.Row() - r1.aEnd.Row(); - if ( ( startRowDiff == endRowDiff ) && startRowDiff == 0 && startColDiff >=0 && endColDiff > 0 && ( startEndColDiff <= 1 && startEndColDiff >= -r1.aEnd.Col() ) ) - bCanJoin = true; - else if ( ( startColDiff == endColDiff ) && startColDiff == 0 && startRowDiff >= 0 && endRowDiff > 0 && ( startEndRowDiff <= 1 && startEndRowDiff >= -r1.aEnd.Row() ) ) - bCanJoin = true; -#ifdef DEBUG - String sr1; - String sr2; - r1.Format( sr1, SCA_VALID ) ; - r2.Format( sr2, SCA_VALID ) ; - OSL_TRACE(" canJoin address %s with %s %s ( startRowDiff(%d), endRowDiff(%d), startColDiff(%d) endColDiff(%d) startEndRowDiff(%d), startEndColDiff(%d) ", - rtl::OUStringToOString( sr1, RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( sr2, RTL_TEXTENCODING_UTF8 ).getStr(), bCanJoin ? "true" : "false", startRowDiff, endRowDiff, startColDiff, endColDiff, startEndRowDiff, startEndColDiff ); -#endif - return bCanJoin; -} -// strips out ranges that contain other ranges, also -// if the borders of the intersecting ranges are alligned -// then the the range is extended to the larger -// e.g. Range("A4:D10"), Range("B4:E10") would be combined -// to Range("A4:E10") -void lcl_strip_containedRanges( Ranges& vRanges ) -{ - // get rid of ranges that are surrounded by other ranges - Ranges::iterator it_outer = vRanges.begin(); - while( it_outer != vRanges.end() ) + SCCOL n1L = r1.aStart.Col(); + SCCOL n1R = r1.aEnd.Col(); + SCROW n1T = r1.aStart.Row(); + SCROW n1B = r1.aEnd.Row(); + SCCOL n2L = r2.aStart.Col(); + SCCOL n2R = r2.aEnd.Col(); + SCROW n2T = r2.aStart.Row(); + SCROW n2B = r2.aEnd.Row(); + + // 3) r1 and r2 have equal upper and lower border + if( (n1T == n2T) && (n1B == n2B) ) { - bool it_outer_erased = false; // true = it_outer erased from vRanges - Ranges::iterator it_inner = vRanges.begin(); - /* Exit the inner loop if outer iterator has been erased in its last - iteration (this means it has been joined to last it_inner, or that - the it_inner contains it completely). The inner loop will restart - with next element of the outer loop, and all elements (from the - beginning of the list) will be checked against that new element. */ - while( !it_outer_erased && (it_inner != vRanges.end()) ) + // check that r1 overlaps or touches r2 + if( ((n1L < n2L) && (n2L - 1 <= n1R)) || ((n2L < n1L) && (n1L - 1 <= n2R)) ) { - bool it_inner_erased = false; // true = it_inner erased from vRanges - if ( it_outer != it_inner ) - { -#ifdef DEBUG - String r1; - String r2; - it_outer->Format( r1, SCA_VALID ) ; - it_inner->Format( r2, SCA_VALID ) ; - OSL_TRACE( "try strip/join address %s with %s ", - rtl::OUStringToOString( r1, RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( r2, RTL_TEXTENCODING_UTF8 ).getStr() ); -#endif - if ( it_outer->In( *it_inner ) ) - { - it_inner = vRanges.erase( it_inner ); - it_inner_erased = true; - } - else if ( it_inner->In( *it_outer ) ) - { - it_outer = vRanges.erase( it_outer ); - it_outer_erased = true; - } -#ifndef OWN_JOIN - else if ( (*it_inner).aStart.Row() == (*it_outer).aStart.Row() - && (*it_inner).aEnd.Row() == (*it_outer).aEnd.Row() ) - { - it_outer->ExtendTo( *it_inner ); - it_inner = vRanges.erase( it_inner ); - it_inner_erased = true; - } -#else - else if ( lcl_canJoin( *it_outer, *it_inner ) ) - { - it_outer->ExtendTo( *it_inner ); - it_inner = vRanges.erase( it_inner ); - it_inner_erased = true; - } - else if ( lcl_canJoin( *it_inner, *it_outer) ) - { - it_inner->ExtendTo( *it_outer ); - it_outer = vRanges.erase( it_outer ); - it_outer_erased = true; - } -#endif - } - /* If it_inner has not been erased from vRanges, continue inner - loop with next element. Otherwise, it_inner already points to - the next element (return value of list::erase()). */ - if( !it_inner_erased ) - ++it_inner; + r1.aStart.SetCol( ::std::min( n1L, n2L ) ); + r1.aEnd.SetCol( ::std::max( n1R, n2R ) ); + return true; } - /* If it_outer has not been erased from vRanges, continue outer loop - with next element. Otherwise, it_outer already points to the next - element (return value of list::erase()). */ - if( !it_outer_erased ) - ++it_outer; + return false; } + // 4) r1 and r2 have equal left and right border + if( (n1L == n2L) && (n1R == n2R) ) + { + // check that r1 overlaps or touches r2 + if( ((n1T < n2T) && (n2T + 1 <= n1B)) || ((n2T < n1T) && (n1T + 1 <= n2B)) ) + { + r1.aStart.SetRow( ::std::min( n1T, n2T ) ); + r1.aEnd.SetRow( ::std::max( n1B, n2B ) ); + return true; + } + return false; + } + + // 5) cannot join these ranges + return false; } -Ranges -lcl_intersectionImpl( ScRangeList& rl1, ScRangeList& rl2 ) +/** Strips out ranges that are contained by other ranges, joins ranges that can be joined + together (aligned borders, e.g. A4:D10 and B4:E10 would be combined to A4:E10. */ +void lclJoinRanges( ListOfScRange& rList ) { - Ranges intersections; - for ( USHORT x = 0 ; x < rl1.Count(); ++x ) + ListOfScRange::iterator aOuterIt = rList.begin(); + while( aOuterIt != rList.end() ) { - for ( USHORT y = 0 ; y < rl2.Count(); ++y ) + bool bAnyErased = false; // true = any range erased from rList + ListOfScRange::iterator aInnerIt = rList.begin(); + while( aInnerIt != rList.end() ) { -#ifdef DEBUG - String r1; - String r2; - rl1.GetObject( x )->Format( r1, SCA_VALID ) ; - rl2.GetObject( y )->Format( r2, SCA_VALID ) ; - OSL_TRACE( "comparing address %s with %s ", - rtl::OUStringToOString( r1, RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( r2, RTL_TEXTENCODING_UTF8 ).getStr() ); -#endif - if( rl1.GetObject( x )->Intersects( *rl2.GetObject( y ) ) ) + bool bInnerErased = false; // true = aInnerIt erased from rList + // do not compare a range with itself + if( (aOuterIt != aInnerIt) && lclTryJoin( *aOuterIt, *aInnerIt ) ) { - ScRange aIntersection = ScRange( Max( rl1.GetObject( x )->aStart.Col(), rl2.GetObject( y )->aStart.Col() ), - Max( rl1.GetObject( x )->aStart.Row(), rl2.GetObject( y )->aStart.Row() ), - Max( rl1.GetObject( x )->aStart.Tab(), rl2.GetObject( y )->aStart.Tab() ), - Min( rl1.GetObject( x )->aEnd.Col(), rl2.GetObject( y )->aEnd.Col() ), - Min( rl1.GetObject( x )->aEnd.Row(), rl2.GetObject( y )->aEnd.Row() ), - Min( rl1.GetObject( x )->aEnd.Tab(), rl2.GetObject( y )->aEnd.Tab() ) ); - intersections.push_back( aIntersection ); + // aOuterIt points to joined range, aInnerIt will be removed + aInnerIt = rList.erase( aInnerIt ); + bInnerErased = bAnyErased = true; } + /* If aInnerIt has been erased from rList, it already points to + the next element (return value of list::erase()). */ + if( !bInnerErased ) + ++aInnerIt; } + // if any range has been erased, repeat outer loop with the same range + if( !bAnyErased ) + ++aOuterIt; } - lcl_strip_containedRanges( intersections ); - return intersections; } -// Intersection of a set of ranges ( where each range is represented by a ScRangeList e.g. -// any range can be a multi-area range ) -// An intersection is performed between each range in the set of ranges. -// The resulting set of intersections is then processed to strip out any -// intersections that contain other intersections ( and also ranges that directly line up -// are joined ) ( see lcl_strip_containedRanges ) -RangesList lcl_intersections( RangesList& vRanges ) +/** Intersects the passed list with all ranges of a VBA Range object in the passed Any. */ +void lclIntersectRanges( ListOfScRange& rList, const uno::Any& rArg ) + throw (script::BasicErrorException, uno::RuntimeException) { - RangesList intersections; - RangesList::iterator it = vRanges.begin(); - while( it != vRanges.end() ) + // extract the ranges from the passed argument, will throw on invalid data + ListOfScRange aList2; + lclAddToListOfScRange( aList2, rArg ); + // do nothing, if the passed list is already empty + if( !rList.empty() && !aList2.empty() ) { - Ranges intermediateList; - for( RangesList::iterator it_inner = vRanges.begin(); it_inner != vRanges.end(); ++it_inner ) + // save original list in a local + ListOfScRange aList1; + aList1.swap( rList ); + // join ranges from passed argument + lclJoinRanges( aList2 ); + // calculate intersection of the ranges in both lists + for( ListOfScRange::const_iterator aOuterIt = aList1.begin(), aOuterEnd = aList1.end(); aOuterIt != aOuterEnd; ++aOuterIt ) { - if ( it != it_inner ) + for( ListOfScRange::const_iterator aInnerIt = aList2.begin(), aInnerEnd = aList2.end(); aInnerIt != aInnerEnd; ++aInnerIt ) { - Ranges ranges = lcl_intersectionImpl( *it, *it_inner ); - for ( Ranges::iterator range_it = ranges.begin(); range_it != ranges.end(); ++range_it ) - intermediateList.push_back( *range_it ); + if( aOuterIt->Intersects( *aInnerIt ) ) + { + ScRange aIsectRange( + Max( aOuterIt->aStart.Col(), aInnerIt->aStart.Col() ), + Max( aOuterIt->aStart.Row(), aInnerIt->aStart.Row() ), + Max( aOuterIt->aStart.Tab(), aInnerIt->aStart.Tab() ), + Min( aOuterIt->aEnd.Col(), aInnerIt->aEnd.Col() ), + Min( aOuterIt->aEnd.Row(), aInnerIt->aEnd.Row() ), + Min( aOuterIt->aEnd.Tab(), aInnerIt->aEnd.Tab() ) ); + rList.push_back( aIsectRange ); + } } } - it = vRanges.erase( it ); // remove it so we don't include it in the next pass. - // 'it' is removed uncontidionally from vRanges, so the while loop will terminate - - ScRangeList argIntersect; - lcl_strip_containedRanges( intermediateList ); - - for( Ranges::iterator it_inter = intermediateList.begin(); it_inter != intermediateList.end(); ++it_inter ) -#ifndef OWN_JOIN - argIntersect.Join( *it_inter ); -#else - argIntersect.Append( *it_inter ); -#endif - - intersections.push_back( argIntersect ); - } - return intersections; -} - -uno::Reference< excel::XRange > SAL_CALL -ScVbaApplication::Intersect( const uno::Reference< excel::XRange >& Arg1, const uno::Reference< excel::XRange >& Arg2, const uno::Any& Arg3, const uno::Any& Arg4, const uno::Any& Arg5, const uno::Any& Arg6, const uno::Any& Arg7, const uno::Any& Arg8, const uno::Any& Arg9, const uno::Any& Arg10, const uno::Any& Arg11, const uno::Any& Arg12, const uno::Any& Arg13, const uno::Any& Arg14, const uno::Any& Arg15, const uno::Any& Arg16, const uno::Any& Arg17, const uno::Any& Arg18, const uno::Any& Arg19, const uno::Any& Arg20, const uno::Any& Arg21, const uno::Any& Arg22, const uno::Any& Arg23, const uno::Any& Arg24, const uno::Any& Arg25, const uno::Any& Arg26, const uno::Any& Arg27, const uno::Any& Arg28, const uno::Any& Arg29, const uno::Any& Arg30 ) throw (script::BasicErrorException, uno::RuntimeException) -{ - if ( !Arg1.is() || !Arg2.is() ) - DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); - - RangesList vRanges; - lcl_addRangesToVec( vRanges, uno::makeAny( Arg1 ) ); - lcl_addRangesToVec( vRanges, uno::makeAny( Arg2 ) ); - - if ( Arg3.hasValue() ) - lcl_addRangesToVec( vRanges, Arg3 ); - if ( Arg4.hasValue() ) - lcl_addRangesToVec( vRanges, Arg4 ); - if ( Arg5.hasValue() ) - lcl_addRangesToVec( vRanges, Arg5 ); - if ( Arg6.hasValue() ) - lcl_addRangesToVec( vRanges, Arg6 ); - if ( Arg7.hasValue() ) - lcl_addRangesToVec( vRanges, Arg7 ); - if ( Arg8.hasValue() ) - lcl_addRangesToVec( vRanges, Arg8 ); - if ( Arg9.hasValue() ) - lcl_addRangesToVec( vRanges, Arg9 ); - if ( Arg10.hasValue() ) - lcl_addRangesToVec( vRanges, Arg10 ); - if ( Arg11.hasValue() ) - lcl_addRangesToVec( vRanges, Arg11 ); - if ( Arg12.hasValue() ) - lcl_addRangesToVec( vRanges, Arg12 ); - if ( Arg13.hasValue() ) - lcl_addRangesToVec( vRanges, Arg13 ); - if ( Arg14.hasValue() ) - lcl_addRangesToVec( vRanges, Arg14 ); - if ( Arg15.hasValue() ) - lcl_addRangesToVec( vRanges, Arg15 ); - if ( Arg16.hasValue() ) - lcl_addRangesToVec( vRanges, Arg16 ); - if ( Arg17.hasValue() ) - lcl_addRangesToVec( vRanges, Arg17 ); - if ( Arg18.hasValue() ) - lcl_addRangesToVec( vRanges, Arg18 ); - if ( Arg19.hasValue() ) - lcl_addRangesToVec( vRanges, Arg19 ); - if ( Arg20.hasValue() ) - lcl_addRangesToVec( vRanges, Arg20 ); - if ( Arg21.hasValue() ) - lcl_addRangesToVec( vRanges, Arg21 ); - if ( Arg22.hasValue() ) - lcl_addRangesToVec( vRanges, Arg22 ); - if ( Arg23.hasValue() ) - lcl_addRangesToVec( vRanges, Arg23 ); - if ( Arg24.hasValue() ) - lcl_addRangesToVec( vRanges, Arg24 ); - if ( Arg25.hasValue() ) - lcl_addRangesToVec( vRanges, Arg25 ); - if ( Arg26.hasValue() ) - lcl_addRangesToVec( vRanges, Arg26 ); - if ( Arg27.hasValue() ) - lcl_addRangesToVec( vRanges, Arg27 ); - if ( Arg28.hasValue() ) - lcl_addRangesToVec( vRanges, Arg28 ); - if ( Arg29.hasValue() ) - lcl_addRangesToVec( vRanges, Arg29 ); - if ( Arg30.hasValue() ) - lcl_addRangesToVec( vRanges, Arg30 ); - - uno::Reference< excel::XRange > xRefRange; - - ScRangeList aCellRanges; - // first pass - gets the set of all possible interections of Arg1..ArgN - RangesList intersections = lcl_intersections( vRanges ); - // second pass - gets the intersections of the intersections ( don't ask, but this - // is what seems to happen ) - if ( intersections.size() > 1) - intersections = lcl_intersections( intersections ); - for( RangesList::iterator it = intersections.begin(); it != intersections.end(); ++it ) - { - for ( USHORT x = 0 ; x < it->Count(); ++x ) -#ifndef OWN_JOIN - aCellRanges.Join( *it->GetObject(x) ); -#else - aCellRanges.Append( *it->GetObject(x) ); -#endif + // again, join the result ranges + lclJoinRanges( rList ); } - - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - ScDocShell* pDocShell = excel::getDocShell( xModel ); - if ( aCellRanges.Count() == 1 ) - { - uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pDocShell, *aCellRanges.First() )); - xRefRange = new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), mxContext, xRange ); - } - else if ( aCellRanges.Count() > 1 ) - { - uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) ); - xRefRange = new ScVbaRange( excel::getUnoSheetModuleObj( xRanges ) , mxContext, xRanges ); - - } - return xRefRange; } -uno::Reference< excel::XRange > SAL_CALL -ScVbaApplication::Union( const uno::Reference< excel::XRange >& Arg1, const uno::Reference< excel::XRange >& Arg2, const uno::Any& Arg3, const uno::Any& Arg4, const uno::Any& Arg5, const uno::Any& Arg6, const uno::Any& Arg7, const uno::Any& Arg8, const uno::Any& Arg9, const uno::Any& Arg10, const uno::Any& Arg11, const uno::Any& Arg12, const uno::Any& Arg13, const uno::Any& Arg14, const uno::Any& Arg15, const uno::Any& Arg16, const uno::Any& Arg17, const uno::Any& Arg18, const uno::Any& Arg19, const uno::Any& Arg20, const uno::Any& Arg21, const uno::Any& Arg22, const uno::Any& Arg23, const uno::Any& Arg24, const uno::Any& Arg25, const uno::Any& Arg26, const uno::Any& Arg27, const uno::Any& Arg28, const uno::Any& Arg29, const uno::Any& Arg30 ) throw (script::BasicErrorException, uno::RuntimeException) +/** Creates a VBA Range object from the passed list of ranges. */ +uno::Reference< excel::XRange > lclCreateVbaRange( + const uno::Reference< uno::XComponentContext >& rxContext, + const uno::Reference< frame::XModel >& rxModel, + const ListOfScRange& rList ) throw (uno::RuntimeException) { - if ( !Arg1.is() || !Arg2.is() ) - DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() ); - - uno::Reference< excel::XRange > xRange; - Ranges vRanges; - lcl_addRangeToVec( vRanges, uno::makeAny( Arg1 ) ); - lcl_addRangeToVec( vRanges, uno::makeAny( Arg2 ) ); - - if ( Arg3.hasValue() ) - lcl_addRangeToVec( vRanges, Arg3 ); - if ( Arg4.hasValue() ) - lcl_addRangeToVec( vRanges, Arg4 ); - if ( Arg5.hasValue() ) - lcl_addRangeToVec( vRanges, Arg5 ); - if ( Arg6.hasValue() ) - lcl_addRangeToVec( vRanges, Arg6 ); - if ( Arg7.hasValue() ) - lcl_addRangeToVec( vRanges, Arg7 ); - if ( Arg8.hasValue() ) - lcl_addRangeToVec( vRanges, Arg8 ); - if ( Arg9.hasValue() ) - lcl_addRangeToVec( vRanges, Arg9 ); - if ( Arg10.hasValue() ) - lcl_addRangeToVec( vRanges, Arg10 ); - if ( Arg11.hasValue() ) - lcl_addRangeToVec( vRanges, Arg11 ); - if ( Arg12.hasValue() ) - lcl_addRangeToVec( vRanges, Arg12 ); - if ( Arg13.hasValue() ) - lcl_addRangeToVec( vRanges, Arg13 ); - if ( Arg14.hasValue() ) - lcl_addRangeToVec( vRanges, Arg14 ); - if ( Arg15.hasValue() ) - lcl_addRangeToVec( vRanges, Arg15 ); - if ( Arg16.hasValue() ) - lcl_addRangeToVec( vRanges, Arg16 ); - if ( Arg17.hasValue() ) - lcl_addRangeToVec( vRanges, Arg17 ); - if ( Arg18.hasValue() ) - lcl_addRangeToVec( vRanges, Arg18 ); - if ( Arg19.hasValue() ) - lcl_addRangeToVec( vRanges, Arg19 ); - if ( Arg20.hasValue() ) - lcl_addRangeToVec( vRanges, Arg20 ); - if ( Arg21.hasValue() ) - lcl_addRangeToVec( vRanges, Arg21 ); - if ( Arg22.hasValue() ) - lcl_addRangeToVec( vRanges, Arg22 ); - if ( Arg23.hasValue() ) - lcl_addRangeToVec( vRanges, Arg23 ); - if ( Arg24.hasValue() ) - lcl_addRangeToVec( vRanges, Arg24 ); - if ( Arg25.hasValue() ) - lcl_addRangeToVec( vRanges, Arg25 ); - if ( Arg26.hasValue() ) - lcl_addRangeToVec( vRanges, Arg26 ); - if ( Arg27.hasValue() ) - lcl_addRangeToVec( vRanges, Arg27 ); - if ( Arg28.hasValue() ) - lcl_addRangeToVec( vRanges, Arg28 ); - if ( Arg29.hasValue() ) - lcl_addRangeToVec( vRanges, Arg29 ); - if ( Arg30.hasValue() ) - lcl_addRangeToVec( vRanges, Arg30 ); + ScDocShell* pDocShell = excel::getDocShell( rxModel ); + if( !pDocShell ) throw uno::RuntimeException(); ScRangeList aCellRanges; - lcl_strip_containedRanges( vRanges ); + for( ListOfScRange::const_iterator aIt = rList.begin(), aEnd = rList.end(); aIt != aEnd; ++aIt ) + aCellRanges.Append( *aIt ); - for( Ranges::iterator it = vRanges.begin(); it != vRanges.end(); ++it ) - aCellRanges.Append( *it ); - - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - ScDocShell* pDocShell = excel::getDocShell( xModel ); - if ( aCellRanges.Count() == 1 ) + if( aCellRanges.Count() == 1 ) { - // normal range - uno::Reference< table::XCellRange > xCalcRange( new ScCellRangeObj( pDocShell, *aCellRanges.First() ) ); - xRange = new ScVbaRange( excel::getUnoSheetModuleObj( xCalcRange ), mxContext, xCalcRange ); + uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( pDocShell, *aCellRanges.First() ) ); + return new ScVbaRange( excel::getUnoSheetModuleObj( xRange ), rxContext, xRange ); } - else if ( aCellRanges.Count() > 1 ) // Multi-Area + if( aCellRanges.Count() > 1 ) { uno::Reference< sheet::XSheetCellRangeContainer > xRanges( new ScCellRangesObj( pDocShell, aCellRanges ) ); - xRange = new ScVbaRange( excel::getUnoSheetModuleObj( xRanges ), mxContext, xRanges ); + return new ScVbaRange( excel::getUnoSheetModuleObj( xRanges ), rxContext, xRanges ); } - - // #FIXME need proper (WorkSheet) parent - return xRange; + return 0; +} + +} // namespace + +// ---------------------------------------------------------------------------- + +uno::Reference< excel::XRange > SAL_CALL ScVbaApplication::Intersect( + const uno::Reference< excel::XRange >& rArg1, const uno::Reference< excel::XRange >& rArg2, + const uno::Any& rArg3, const uno::Any& rArg4, const uno::Any& rArg5, const uno::Any& rArg6, + const uno::Any& rArg7, const uno::Any& rArg8, const uno::Any& rArg9, const uno::Any& rArg10, + const uno::Any& rArg11, const uno::Any& rArg12, const uno::Any& rArg13, const uno::Any& rArg14, + const uno::Any& rArg15, const uno::Any& rArg16, const uno::Any& rArg17, const uno::Any& rArg18, + const uno::Any& rArg19, const uno::Any& rArg20, const uno::Any& rArg21, const uno::Any& rArg22, + const uno::Any& rArg23, const uno::Any& rArg24, const uno::Any& rArg25, const uno::Any& rArg26, + const uno::Any& rArg27, const uno::Any& rArg28, const uno::Any& rArg29, const uno::Any& rArg30 ) + throw (script::BasicErrorException, uno::RuntimeException) +{ + if( !rArg1.is() || !rArg2.is() ) + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + + // initialize the result list with 1st parameter, join its ranges together + ListOfScRange aList; + lclAddToListOfScRange( aList, uno::Any( rArg1 ) ); + lclJoinRanges( aList ); + + // process all other parameters, this updates the list with intersection + lclIntersectRanges( aList, uno::Any( rArg2 ) ); + lclIntersectRanges( aList, rArg3 ); + lclIntersectRanges( aList, rArg4 ); + lclIntersectRanges( aList, rArg5 ); + lclIntersectRanges( aList, rArg6 ); + lclIntersectRanges( aList, rArg7 ); + lclIntersectRanges( aList, rArg8 ); + lclIntersectRanges( aList, rArg9 ); + lclIntersectRanges( aList, rArg10 ); + lclIntersectRanges( aList, rArg11 ); + lclIntersectRanges( aList, rArg12 ); + lclIntersectRanges( aList, rArg13 ); + lclIntersectRanges( aList, rArg14 ); + lclIntersectRanges( aList, rArg15 ); + lclIntersectRanges( aList, rArg16 ); + lclIntersectRanges( aList, rArg17 ); + lclIntersectRanges( aList, rArg18 ); + lclIntersectRanges( aList, rArg19 ); + lclIntersectRanges( aList, rArg20 ); + lclIntersectRanges( aList, rArg21 ); + lclIntersectRanges( aList, rArg22 ); + lclIntersectRanges( aList, rArg23 ); + lclIntersectRanges( aList, rArg24 ); + lclIntersectRanges( aList, rArg25 ); + lclIntersectRanges( aList, rArg26 ); + lclIntersectRanges( aList, rArg27 ); + lclIntersectRanges( aList, rArg28 ); + lclIntersectRanges( aList, rArg29 ); + lclIntersectRanges( aList, rArg30 ); + + // create the VBA Range object + return lclCreateVbaRange( mxContext, getCurrentDocument(), aList ); +} + +uno::Reference< excel::XRange > SAL_CALL ScVbaApplication::Union( + const uno::Reference< excel::XRange >& rArg1, const uno::Reference< excel::XRange >& rArg2, + const uno::Any& rArg3, const uno::Any& rArg4, const uno::Any& rArg5, const uno::Any& rArg6, + const uno::Any& rArg7, const uno::Any& rArg8, const uno::Any& rArg9, const uno::Any& rArg10, + const uno::Any& rArg11, const uno::Any& rArg12, const uno::Any& rArg13, const uno::Any& rArg14, + const uno::Any& rArg15, const uno::Any& rArg16, const uno::Any& rArg17, const uno::Any& rArg18, + const uno::Any& rArg19, const uno::Any& rArg20, const uno::Any& rArg21, const uno::Any& rArg22, + const uno::Any& rArg23, const uno::Any& rArg24, const uno::Any& rArg25, const uno::Any& rArg26, + const uno::Any& rArg27, const uno::Any& rArg28, const uno::Any& rArg29, const uno::Any& rArg30 ) + throw (script::BasicErrorException, uno::RuntimeException) +{ + if( !rArg1.is() || !rArg2.is() ) + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + + ListOfScRange aList; + lclAddToListOfScRange( aList, uno::Any( rArg1 ) ); + lclAddToListOfScRange( aList, uno::Any( rArg2 ) ); + lclAddToListOfScRange( aList, rArg3 ); + lclAddToListOfScRange( aList, rArg4 ); + lclAddToListOfScRange( aList, rArg5 ); + lclAddToListOfScRange( aList, rArg6 ); + lclAddToListOfScRange( aList, rArg7 ); + lclAddToListOfScRange( aList, rArg8 ); + lclAddToListOfScRange( aList, rArg9 ); + lclAddToListOfScRange( aList, rArg10 ); + lclAddToListOfScRange( aList, rArg11 ); + lclAddToListOfScRange( aList, rArg12 ); + lclAddToListOfScRange( aList, rArg13 ); + lclAddToListOfScRange( aList, rArg14 ); + lclAddToListOfScRange( aList, rArg15 ); + lclAddToListOfScRange( aList, rArg16 ); + lclAddToListOfScRange( aList, rArg17 ); + lclAddToListOfScRange( aList, rArg18 ); + lclAddToListOfScRange( aList, rArg19 ); + lclAddToListOfScRange( aList, rArg20 ); + lclAddToListOfScRange( aList, rArg21 ); + lclAddToListOfScRange( aList, rArg22 ); + lclAddToListOfScRange( aList, rArg23 ); + lclAddToListOfScRange( aList, rArg24 ); + lclAddToListOfScRange( aList, rArg25 ); + lclAddToListOfScRange( aList, rArg26 ); + lclAddToListOfScRange( aList, rArg27 ); + lclAddToListOfScRange( aList, rArg28 ); + lclAddToListOfScRange( aList, rArg29 ); + lclAddToListOfScRange( aList, rArg30 ); + + // simply join together all ranges as much as possible, strip out covered ranges etc. + lclJoinRanges( aList ); + + // create the VBA Range object + return lclCreateVbaRange( mxContext, getCurrentDocument(), aList ); } void -- cgit From 2ecf87efeb1ec5f4185b80cdb333b84f352a011e Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 4 Aug 2010 18:13:02 +0200 Subject: mib18: #162938# add VBA symbol Worksheet.AutoFilterMode --- oovbaapi/ooo/vba/excel/XWorksheet.idl | 1 + 1 file changed, 1 insertion(+) diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl index fb6261bc06c0..1907fb004cab 100644 --- a/oovbaapi/ooo/vba/excel/XWorksheet.idl +++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl @@ -72,6 +72,7 @@ interface XWorksheet [attribute, readonly] string CodeName; [attribute, readonly] short Index; [attribute] long EnableSelection; + [attribute] boolean AutoFilterMode; void Activate(); void Calculate( ); -- cgit From 8eab4b9f3c47d857bc7ffb7080ba02e7f46fdb78 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 4 Aug 2010 18:13:02 +0200 Subject: mib18: #162938# add VBA symbol Worksheet.AutoFilterMode --- sc/source/ui/vba/vbaworksheet.cxx | 35 +++++++++++++++++++++++++++++++++++ sc/source/ui/vba/vbaworksheet.hxx | 5 +++++ 2 files changed, 40 insertions(+) diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index 4eab79813474..1655d1ff181a 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -319,6 +320,40 @@ ScVbaWorksheet::setEnableSelection( sal_Int32 nSelection ) throw (uno::RuntimeEx } +uno::Reference< beans::XPropertySet > ScVbaWorksheet::getFirstDBRangeProperties() throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xModelProps( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xDBRangesIA( xModelProps->getPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DatabaseRanges" ) ) ), uno::UNO_QUERY_THROW ); + + for( sal_Int32 nIndex = 0, nCount = xDBRangesIA->getCount(); nIndex < nCount; ++nIndex ) + { + uno::Reference< sheet::XCellRangeReferrer > xDBRange( xDBRangesIA->getByIndex( nIndex ), uno::UNO_QUERY_THROW ); + // check if the database area is on this sheet + uno::Reference< sheet::XCellRangeAddressable > xRangeAddr( xDBRange->getReferredCells(), uno::UNO_QUERY_THROW ); + if( getSheetID() == xRangeAddr->getRangeAddress().Sheet ) + return uno::Reference< beans::XPropertySet >( xDBRange, uno::UNO_QUERY_THROW ); + } + return uno::Reference< beans::XPropertySet >(); +} + +sal_Bool SAL_CALL ScVbaWorksheet::getAutoFilterMode() throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xDBRangeProps = getFirstDBRangeProperties(); + sal_Bool bAutoFilterMode = sal_False; + return + xDBRangeProps.is() && + (xDBRangeProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoFilter" ) ) ) >>= bAutoFilterMode) && + bAutoFilterMode; +} + +void SAL_CALL ScVbaWorksheet::setAutoFilterMode( sal_Bool bAutoFilterMode ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xDBRangeProps = getFirstDBRangeProperties(); + if( xDBRangeProps.is() ) + xDBRangeProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoFilter" ) ), uno::Any( bAutoFilterMode ) ); +} + uno::Reference< excel::XRange > ScVbaWorksheet::getUsedRange() throw (uno::RuntimeException) { diff --git a/sc/source/ui/vba/vbaworksheet.hxx b/sc/source/ui/vba/vbaworksheet.hxx index 196a195258d7..fd65c7d698be 100644 --- a/sc/source/ui/vba/vbaworksheet.hxx +++ b/sc/source/ui/vba/vbaworksheet.hxx @@ -68,6 +68,9 @@ class ScVbaWorksheet : public WorksheetImpl_BASE css::uno::Reference< css::container::XNameAccess > getFormControls(); css::uno::Any getControlShape( const rtl::OUString& sName ); + + css::uno::Reference< css::beans::XPropertySet > getFirstDBRangeProperties() throw (css::uno::RuntimeException); + protected: ScVbaWorksheet( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ); @@ -106,6 +109,8 @@ public: virtual sal_Int16 SAL_CALL getIndex() throw (css::uno::RuntimeException); virtual sal_Int32 SAL_CALL getEnableSelection() throw (css::uno::RuntimeException); virtual void SAL_CALL setEnableSelection( sal_Int32 nSelection ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getAutoFilterMode() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoFilterMode( sal_Bool bAutoFilterMode ) throw (css::uno::RuntimeException); // Methods virtual void SAL_CALL Activate() throw (css::uno::RuntimeException); -- cgit From 51bd6db07fa01758f183643f5c6d218087c96510 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 4 Aug 2010 18:55:53 +0200 Subject: mib18: fix broken d.lst --- oox/prj/d.lst | 1 - 1 file changed, 1 deletion(-) diff --git a/oox/prj/d.lst b/oox/prj/d.lst index 482a270926a3..f20db064d7b2 100644 --- a/oox/prj/d.lst +++ b/oox/prj/d.lst @@ -36,7 +36,6 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls ..\inc\oox\ole\vbaproject.hxx %_DEST%\inc%_EXT%\oox\ole\vbaproject.hxx ..\inc\oox\vml\vmldrawing.hxx %_DEST%\inc%_EXT%\oox\vml\vmldrawing.hxx ..\inc\oox\vml\vmlshape.hxx %_DEST%\inc%_EXT%\oox\vml\vmlshape.hxx -..\inc\oox\xls\excelvbaproject.hxx %_DEST%\inc%_EXT%\oox\xls\excelvbaproject.hxx dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" -- cgit From f4f1756a4c4cd35d77ccd2b9ca0f38799e6555af Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Thu, 5 Aug 2010 11:52:07 +0200 Subject: mib18: #163025# Changed RunInit handling for class modules to get right order --- basic/inc/basic/sbmod.hxx | 4 +- basic/source/classes/sb.cxx | 93 ++++++++++++++++++++++++++++++++++++++- basic/source/comp/codegen.cxx | 8 ++-- basic/source/comp/dim.cxx | 3 ++ basic/source/inc/parser.hxx | 5 ++- basic/source/inc/sbintern.hxx | 6 +++ basic/source/runtime/methods1.cxx | 2 - 7 files changed, 112 insertions(+), 9 deletions(-) diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx index bccf8212f10e..abb482f7bfe5 100644 --- a/basic/inc/basic/sbmod.hxx +++ b/basic/inc/basic/sbmod.hxx @@ -44,6 +44,7 @@ class SbProcedureProperty; class SbIfaceMapperMethod; class SbClassModuleObject; +struct ClassModuleRunInitItem; struct SbClassData; class SbModuleImpl; @@ -71,6 +72,7 @@ protected: SbxObjectRef pDocObject; // an impl object ( used by Document Modules ) bool bIsProxyModule; + static void implProcessModuleRunInit( ClassModuleRunInitItem& rItem ); void StartDefinitions(); SbMethod* GetMethod( const String&, SbxDataType ); SbProperty* GetProperty( const String&, SbxDataType ); @@ -134,7 +136,7 @@ public: void SetVBACompat( BOOL bCompat ); INT32 GetModuleType() { return mnType; } void SetModuleType( INT32 nType ) { mnType = nType; } - bool GetIsProxyModule() { return bIsProxyModule; } + bool isProxyModule() { return bIsProxyModule; } void AddVarName( const String& aName ); void RemoveVars(); ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule(); diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index e28b0a304f28..d4520025953e 100755 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -57,6 +57,7 @@ #include #include #include "errobject.hxx" +#include #include #include @@ -726,6 +727,7 @@ SbClassData::SbClassData( void ) void SbClassData::clear( void ) { mxIfaces->Clear(); + maRequiredTypes.clear(); } SbClassFactory::SbClassFactory( void ) @@ -981,6 +983,72 @@ SbModule* StarBASIC::FindModule( const String& rName ) return NULL; } + +struct ClassModuleRunInitItem +{ + SbModule* m_pModule; + bool m_bProcessing; + bool m_bRunInitDone; + //ModuleVector m_vModulesDependingOnThisModule; + + ClassModuleRunInitItem( void ) + : m_pModule( NULL ) + , m_bProcessing( false ) + , m_bRunInitDone( false ) + {} + ClassModuleRunInitItem( SbModule* pModule ) + : m_pModule( pModule ) + , m_bProcessing( false ) + , m_bRunInitDone( false ) + {} +}; + +typedef std::hash_map< ::rtl::OUString, ClassModuleRunInitItem, + ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap; + +static ModuleInitDependencyMap* GpMIDMap = NULL; + +void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem ) +{ + ModuleInitDependencyMap& rMIDMap = *GpMIDMap; + + rItem.m_bProcessing = true; + + //bool bAnyDependencies = true; + SbModule* pModule = rItem.m_pModule; + if( pModule->pClassData != NULL ) + { + StringVector& rReqTypes = pModule->pClassData->maRequiredTypes; + if( rReqTypes.size() > 0 ) + { + for( StringVector::iterator it = rReqTypes.begin() ; it != rReqTypes.end() ; ++it ) + { + String& rStr = *it; + + // Is required type a class module? + ModuleInitDependencyMap::iterator itFind = rMIDMap.find( rStr ); + if( itFind != rMIDMap.end() ) + { + ClassModuleRunInitItem& rParentItem = itFind->second; + if( rParentItem.m_bProcessing ) + { + // TODO: raise error? + DBG_ERROR( "Cyclic module dependency detected" ); + continue; + } + + if( !rParentItem.m_bRunInitDone ) + implProcessModuleRunInit( rParentItem ); + } + } + } + } + + pModule->RunInit(); + rItem.m_bRunInitDone = true; + rItem.m_bProcessing = false; +} + // Run Init-Code of all modules (including inserted libraries) void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) { @@ -994,10 +1062,33 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) // compile modules first then RunInit ( otherwise there is // can be order dependency, e.g. classmodule A has a member // of of type classmodule B and classmodule B hasn't been compiled yet ) + + // Consider required types to init in right order. Class modules + // that are required by other modules have to be initialized first. + ModuleInitDependencyMap aMIDMap; + GpMIDMap = &aMIDMap; + for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) + { + SbModule* pModule = (SbModule*)pModules->Get( nMod ); + String aModuleName = pModule->GetName(); + if( pModule->isProxyModule() ) + aMIDMap[aModuleName] = ClassModuleRunInitItem( pModule ); + } + + ModuleInitDependencyMap::iterator it; + for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it ) + { + ClassModuleRunInitItem& rItem = it->second; + SbModule::implProcessModuleRunInit( rItem ); + } + GpMIDMap = NULL; + + // Call RunInit on standard modules for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) { SbModule* pModule = (SbModule*)pModules->Get( nMod ); - pModule->RunInit(); + if( !pModule->isProxyModule() ) + pModule->RunInit(); } // Check all objects if they are BASIC, diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index 46f829b382e8..e0f23c15d224 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -138,11 +138,10 @@ void SbiCodeGen::Save() pCLASSFAC->AddClassModule( &rMod ); nIfaceCount = pParser->aIfaceVector.size(); + if( !rMod.pClassData ) + rMod.pClassData = new SbClassData; if( nIfaceCount ) { - if( !rMod.pClassData ) - rMod.pClassData = new SbClassData; - for( int i = 0 ; i < nIfaceCount ; i++ ) { const String& rIfaceName = pParser->aIfaceVector[i]; @@ -152,6 +151,8 @@ void SbiCodeGen::Save() pIfaces->Insert( pIfaceVar, pIfaces->Count() ); } } + + rMod.pClassData->maRequiredTypes = pParser->aRequiredTypes; } else { @@ -161,6 +162,7 @@ void SbiCodeGen::Save() rMod.mnType = com::sun::star::script::ModuleType::NORMAL; rMod.bIsProxyModule = false; } + if( pParser->bText ) p->SetFlag( SBIMG_COMPARETEXT ); // GlobalCode-Flag diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index bff3d22dd9b0..b8fa3c089fd8 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -161,6 +161,9 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed ) // In den String-Pool uebernehmen rDef.SetTypeId( aGblStrings.Add( aCompleteName ) ); + + if( rDef.IsNew() && pProc == NULL ) + aRequiredTypes.push_back( aCompleteName ); } eType = SbxOBJECT; break; diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx index 1161c4ed259d..733a65db7f61 100644 --- a/basic/source/inc/parser.hxx +++ b/basic/source/inc/parser.hxx @@ -34,7 +34,7 @@ #include -typedef ::std::vector< String > IfaceVector; +typedef ::std::vector< String > StringVector; struct SbiParseStack; @@ -81,7 +81,8 @@ public: BOOL bText; // OPTION COMPARE TEXT BOOL bExplicit; // TRUE: OPTION EXPLICIT BOOL bClassModule; // TRUE: OPTION ClassModule - IfaceVector aIfaceVector; // Holds all interfaces implemented by a class module + StringVector aIfaceVector; // Holds all interfaces implemented by a class module + StringVector aRequiredTypes; // Types used in Dim As New outside subs SbxDataType eDefTypes[26]; // DEFxxx-Datentypen SbiParser( StarBASIC*, SbModule* ); diff --git a/basic/source/inc/sbintern.hxx b/basic/source/inc/sbintern.hxx index 59cfe21d25a8..4c54e2301bd5 100644 --- a/basic/source/inc/sbintern.hxx +++ b/basic/source/inc/sbintern.hxx @@ -50,10 +50,16 @@ public: virtual SbxObject* CreateObject( const String& ); }; +typedef ::std::vector< String > StringVector; + struct SbClassData { SbxArrayRef mxIfaces; + // types this module depends on because of use in Dim As New + // needed for initialization order of class modules + StringVector maRequiredTypes; + SbClassData( void ); ~SbClassData( void ) { clear(); } diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 8c7da2403705..9d806cac933a 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -1586,8 +1586,6 @@ RTLFUNC(Join) } -typedef ::std::vector< String > StringVector; - RTLFUNC(Split) { (void)pBasic; -- cgit From 048631266fa9fafc357dfb02eb023b409c93e5b1 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 5 Aug 2010 11:53:41 +0200 Subject: fwk152: #i112452# let restart functionality restart quickstarter as well --- desktop/inc/app.hxx | 3 + desktop/source/app/app.cxx | 7 ++ desktop/source/app/appfirststart.cxx | 104 +++++++++++++++------ desktop/win32/source/officeloader/officeloader.cxx | 1 + officecfg/registry/schema/org/openoffice/Setup.xcs | 9 +- 5 files changed, 94 insertions(+), 30 deletions(-) diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 8867a940a6ad..fa7550812bbe 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -134,6 +134,9 @@ class Desktop : public Application static sal_Bool IsFirstStartWizardNeeded(); static sal_Bool CheckExtensionDependencies(); + static void DoRestartActionsIfNecessary( sal_Bool bQuickStart ); + static void SetRestartState(); + void SynchronizeExtensionRepositories(); void SetSplashScreenText( const ::rtl::OUString& rText ); void SetSplashScreenProgress( sal_Int32 ); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 731ffe85d83b..cabec4a05691 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1659,7 +1659,12 @@ void Desktop::Main() ::comphelper::ComponentContext aContext( xSMgr ); xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY ); if ( !xRestartManager.is() || !xRestartManager->isRestartRequested( sal_True ) ) + { + // if this run of the office is triggered by restart, some additional actions should be done + DoRestartActionsIfNecessary( !pCmdLineArgs->IsInvisible() && !pCmdLineArgs->IsNoQuickstart() ); + Execute(); + } } catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg) { @@ -1674,6 +1679,8 @@ void Desktop::Main() // check whether the shutdown is caused by restart sal_Bool bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); + if ( bRestartRequested ) + SetRestartState(); if (xGlobalBroadcaster.is()) { diff --git a/desktop/source/app/appfirststart.cxx b/desktop/source/app/appfirststart.cxx index 2f0d4ab9e538..43c88e6eaa8a 100644 --- a/desktop/source/app/appfirststart.cxx +++ b/desktop/source/app/appfirststart.cxx @@ -36,12 +36,14 @@ #include #include #include +#include #include "app.hxx" -using rtl::OUString; -using namespace desktop; -using namespace com::sun::star::beans; +using ::rtl::OUString; +using namespace ::desktop; +using namespace ::com::sun::star; +using namespace ::com::sun::star::beans; static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ); @@ -128,24 +130,29 @@ sal_Bool Desktop::LicenseNeedsAcceptance() */ } -/* Local function - was the wizard completed already? */ -static sal_Bool impl_isFirstStart() +/* Local function - get access to the configuration */ +static Reference< XPropertySet > impl_getConfigurationAccess( const OUString& rPath ) { - try { - Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - // get configuration provider - Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( - xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + // get configuration provider + Reference< XMultiServiceFactory > xConfigProvider = Reference< XMultiServiceFactory >( + xFactory->createInstance( sConfigSrvc ), UNO_QUERY_THROW ); - Sequence< Any > theArgs(1); - NamedValue v(OUString::createFromAscii("NodePath"), makeAny(OUString::createFromAscii("org.openoffice.Setup/Office"))); - theArgs[0] <<= v; + Sequence< Any > aArgs( 1 ); + NamedValue aValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NodePath" ) ), makeAny( rPath ) ); + aArgs[0] <<= aValue; + return Reference< XPropertySet >( + xConfigProvider->createInstanceWithArguments( sAccessSrvc, aArgs ), UNO_QUERY_THROW ); +} - Reference< XPropertySet > pset = Reference< XPropertySet >( - theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); +/* Local function - was the wizard completed already? */ +static sal_Bool impl_isFirstStart() +{ + try { + Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) ); - Any result = pset->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted")); + Any result = xPSet->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted")); sal_Bool bCompleted = sal_False; if ((result >>= bCompleted) && bCompleted) return sal_False; // wizard was already completed @@ -219,20 +226,9 @@ static sal_Bool impl_isLicenseAccepted() try { - Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - - // get configuration provider - Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( - xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) ); - Sequence< Any > theArgs(1); - NamedValue v(OUString::createFromAscii("NodePath"), - makeAny(OUString::createFromAscii("org.openoffice.Setup/Office"))); - theArgs[0] <<= v; - Reference< XPropertySet > pset = Reference< XPropertySet >( - theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); - - Any result = pset->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate")); + Any result = xPSet->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate")); OUString aAcceptDate; if (result >>= aAcceptDate) @@ -272,3 +268,53 @@ sal_Bool Desktop::IsFirstStartWizardNeeded() return impl_isFirstStart() || !impl_isLicenseAccepted(); } +void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart ) +{ + if ( bQuickStart ) + { + try + { + Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) ); + + OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) ); + Any aRestart = xPSet->getPropertyValue( sPropName ); + sal_Bool bRestart = sal_False; + if ( ( aRestart >>= bRestart ) && bRestart ) + { + xPSet->setPropertyValue( sPropName, makeAny( sal_False ) ); + Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges(); + + sal_Bool bQuickstart = sal_True; + sal_Bool bAutostart = sal_True; + Sequence< Any > aSeq( 2 ); + aSeq[0] <<= sal_True; + aSeq[1] <<= sal_True; + + Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.Quickstart" ) ) ),UNO_QUERY_THROW ); + xQuickstart->initialize( aSeq ); + } + } + catch( uno::Exception& ) + { + // this is no critical operation so it should not prevent office from starting + } + } +} + +void Desktop::SetRestartState() +{ + try + { + Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) ); + OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) ); + xPSet->setPropertyValue( sPropName, makeAny( sal_True ) ); + Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges(); + } + catch( uno::Exception& ) + { + // this is no critical operation, ignore the exception + } + +} + diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index 7c2dafc79bbb..b85a72555935 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -339,6 +339,7 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) p = desktop_win32::commandLineAppend(p, argv[i]); } } + p = desktop_win32::commandLineAppend( p, MY_STRING(L"\" \"-env:OOO_CWD=")); if (cwdLen == 0) { diff --git a/officecfg/registry/schema/org/openoffice/Setup.xcs b/officecfg/registry/schema/org/openoffice/Setup.xcs index 76c4bb17782b..62d3fdcce85d 100644 --- a/officecfg/registry/schema/org/openoffice/Setup.xcs +++ b/officecfg/registry/schema/org/openoffice/Setup.xcs @@ -395,7 +395,14 @@ AS Contains all of the document factories that were installed during setup. - + + + + MAV + The entry specifies that we are in restart process + + false + -- cgit From 5b8f17063e11b53c7c4f7eb978afb05e3da7ac40 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 5 Aug 2010 12:54:16 +0200 Subject: fwk152: #i112895# integrate the patch --- filter/source/config/fragments/filters/MathML_XML__Math_.xcu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter/source/config/fragments/filters/MathML_XML__Math_.xcu b/filter/source/config/fragments/filters/MathML_XML__Math_.xcu index b6ab09ac89cd..7c80e41f6030 100644 --- a/filter/source/config/fragments/filters/MathML_XML__Math_.xcu +++ b/filter/source/config/fragments/filters/MathML_XML__Math_.xcu @@ -1,5 +1,5 @@ - IMPORT EXPORT TEMPLATE ENCRYPTION + IMPORT EXPORT TEMPLATE -- cgit From 2f19a7db1f8b7a03b52b1e18c31b3ac9b62a7de9 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Thu, 5 Aug 2010 15:43:06 +0200 Subject: mib18: #162503# do not create a new Worksheet object in Workbook.ActiveSheet but return existing object supporting VBA module access --- sc/source/ui/vba/vbaworkbook.cxx | 19 +++++++++++-------- sc/source/ui/vba/vbaworksheets.cxx | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx index 365c8b35a00c..28469c4685a2 100644 --- a/sc/source/ui/vba/vbaworkbook.cxx +++ b/sc/source/ui/vba/vbaworkbook.cxx @@ -50,6 +50,7 @@ #include "vbanames.hxx" // Amelia Wang #include "nameuno.hxx" #include "docoptio.hxx" +#include "unonames.hxx" // Much of the impl. for the equivalend UNO module is // sc/source/ui/unoobj/docuno.cxx, viewuno.cxx @@ -208,7 +209,6 @@ ScVbaWorkbook::ScVbaWorkbook( const css::uno::Reference< ov::XHelperInterface ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args, uno::Reference< uno::XComponentContext> const & xContext ) : ScVbaWorkbook_BASE( args, xContext ) - { init(); } @@ -216,21 +216,24 @@ ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args, uno::Reference< excel::XWorksheet > ScVbaWorkbook::getActiveSheet() throw (uno::RuntimeException) { - uno::Reference< frame::XModel > xModel( getCurrentExcelDoc( mxContext ) ); - uno::Reference< sheet::XSpreadsheet > xSheet; + uno::Reference< frame::XModel > xModel( getCurrentExcelDoc( mxContext ), uno::UNO_SET_THROW ); uno::Reference< sheet::XSpreadsheetView > xView( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - if ( xView.is() ) - xSheet = xView->getActiveSheet(); - return new ScVbaWorksheet( this, mxContext, xSheet, xModel ); + uno::Reference< beans::XPropertySet > xSheetProps( xView->getActiveSheet(), uno::UNO_QUERY_THROW ); + // #162503# return the original document module wrapper object, instead of a new instance + ::rtl::OUString aCodeName; + xSheetProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_CODENAME ) ) ) >>= aCodeName; + ScDocShell* pShell = excel::getDocShell( xModel ); + if( !pShell ) + throw uno::RuntimeException(); + return uno::Reference< excel::XWorksheet >( getUnoDocModule( aCodeName, pShell ), uno::UNO_QUERY_THROW ); } + uno::Any SAL_CALL ScVbaWorkbook::Sheets( const uno::Any& aIndex ) throw (uno::RuntimeException) { return Worksheets( aIndex ); } - - uno::Any SAL_CALL ScVbaWorkbook::Worksheets( const uno::Any& aIndex ) throw (uno::RuntimeException) { diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx index 5344e6b3a9be..7fa5196a6b04 100644 --- a/sc/source/ui/vba/vbaworksheets.cxx +++ b/sc/source/ui/vba/vbaworksheets.cxx @@ -52,7 +52,7 @@ #include "vbaglobals.hxx" #include "vbaworksheet.hxx" #include "vbaworkbook.hxx" -#include +#include "unonames.hxx" using namespace ::ooo::vba; using namespace ::com::sun::star; -- cgit From e2b85f96b67ac4bb9f26a60c11cedc98ec52206f Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Fri, 6 Aug 2010 09:35:51 +0200 Subject: mib18: #163121# Declare Rework --- basic/source/comp/codegen.cxx | 4 ++ basic/source/comp/dim.cxx | 61 ++++++++++++++++++++++++++++- basic/source/comp/exprgen.cxx | 69 +++++++++------------------------ basic/source/comp/exprtree.cxx | 10 ----- basic/source/inc/expr.hxx | 3 -- basic/source/inc/symtbl.hxx | 3 +- scripting/source/basprov/basmodnode.cxx | 14 +++++-- scripting/source/basprov/basprov.cxx | 2 +- 8 files changed, 96 insertions(+), 70 deletions(-) diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index e0f23c15d224..93fb18baf86e 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -259,6 +259,10 @@ void SbiCodeGen::Save() if( !pProc->IsPublic() ) pMeth->SetFlag( SBX_PRIVATE ); + // Declare? -> Hidden + if( pProc->GetLib().Len() > 0 ) + pMeth->SetFlag( SBX_HIDDEN ); + pMeth->nStart = pProc->GetAddr(); pMeth->nLine1 = pProc->GetLine1(); pMeth->nLine2 = pProc->GetLine2(); diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index b8fa3c089fd8..27b6e0e51871 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -877,7 +877,7 @@ SbiProcDef* SbiParser::ProcDecl( BOOL bDecl ) } if( bCompatible && Peek() == PARAMARRAY ) { - if( bByVal || bByVal || bOptional ) + if( bByVal || bOptional ) Error( SbERR_UNEXPECTED, PARAMARRAY ); Next(); bParamArray = TRUE; @@ -949,6 +949,8 @@ void SbiParser::DefDeclare( BOOL bPrivate ) Error( SbERR_UNEXPECTED, eCurTok ); else { + bool bFunction = (eCurTok == FUNCTION); + SbiProcDef* pDef = ProcDecl( TRUE ); if( pDef ) { @@ -973,7 +975,64 @@ void SbiParser::DefDeclare( BOOL bPrivate ) aPublics.Add( pDef ); if ( pDef ) + { pDef->SetPublic( !bPrivate ); + + // New declare handling + if( pDef->GetLib().Len() > 0 ) + { + USHORT nSavLine = nLine; + aGen.Statement(); + pDef->Define(); + pDef->SetLine1( nSavLine ); + pDef->SetLine2( nSavLine ); + + SbiSymPool& rPool = pDef->GetParams(); + USHORT nParCount = rPool.GetSize(); + + SbxDataType eType = pDef->GetType(); + if( bFunction ) + aGen.Gen( _PARAM, 0, sal::static_int_cast< UINT16 >( eType ) ); + + if( nParCount > 1 ) + { + aGen.Gen( _ARGC ); + + for( USHORT i = 1 ; i < nParCount ; ++i ) + { + SbiSymDef* pParDef = rPool.Get( i ); + SbxDataType eParType = pParDef->GetType(); + + aGen.Gen( _PARAM, i, sal::static_int_cast< UINT16 >( eParType ) ); + aGen.Gen( _ARGV ); + + USHORT nTyp = sal::static_int_cast< USHORT >( pParDef->GetType() ); + if( pParDef->IsByVal() ) + { + // Reset to avoid additional byval in call to wrapper function + pParDef->SetByVal( FALSE ); + nTyp |= 0x8000; + } + aGen.Gen( _ARGTYP, nTyp ); + } + } + + aGen.Gen( _LIB, aGblStrings.Add( pDef->GetLib() ) ); + + SbiOpcode eOp = pDef->IsCdecl() ? _CALLC : _CALL; + USHORT nId = pDef->GetId(); + if( pDef->GetAlias().Len() ) + nId = ( nId & 0x8000 ) | aGblStrings.Add( pDef->GetAlias() ); + if( nParCount > 1 ) + nId |= 0x8000; + aGen.Gen( eOp, nId, sal::static_int_cast< UINT16 >( eType ) ); + + if( bFunction ) + aGen.Gen( _PUT ); + + aGen.Gen( _LEAVE ); + } + } } } } diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index 60869307aecf..dc4fda0a4682 100644 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -115,13 +115,8 @@ void SbiExprNode::Gen( RecursiveMode eRecMode ) } else { - SbiProcDef* pProc = aVar.pDef->GetProcDef(); - // per DECLARE definiert? - if( pProc && pProc->GetLib().Len() ) - eOp = pProc->IsCdecl() ? _CALLC : _CALL; - else - eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL : - (aVar.pDef->IsGlobal() ? _FIND_G : _FIND); + eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL : + (aVar.pDef->IsGlobal() ? _FIND_G : _FIND); } if( eOp == _FIND ) @@ -187,17 +182,6 @@ void SbiExprNode::GenElement( SbiOpcode eOp ) aVar.pPar->Gen(); } - SbiProcDef* pProc = aVar.pDef->GetProcDef(); - // per DECLARE definiert? - if( pProc ) - { - // Dann evtl. einen LIB-Befehl erzeugen - if( pProc->GetLib().Len() ) - pGen->Gen( _LIB, pGen->GetParser()->aGblStrings.Add( pProc->GetLib() ) ); - // und den Aliasnamen nehmen - if( pProc->GetAlias().Len() ) - nId = ( nId & 0x8000 ) | pGen->GetParser()->aGblStrings.Add( pProc->GetAlias() ); - } pGen->Gen( eOp, nId, sal::static_int_cast< UINT16 >( GetType() ) ); if( aVar.pvMorePar ) @@ -225,11 +209,6 @@ void SbiExprList::Gen() // AB 10.1.96: Typ-Anpassung bei DECLARE USHORT nCount = 1, nParAnz = 0; SbiSymPool* pPool = NULL; - if( pProc ) - { - pPool = &pProc->GetParams(); - nParAnz = pPool->GetSize(); - } for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ ) { pExpr->Gen(); @@ -239,6 +218,7 @@ void SbiExprList::Gen() USHORT nSid = pParser->aGblStrings.Add( pExpr->GetName() ); pParser->aGen.Gen( _ARGN, nSid ); + /* TODO: Check after Declare concept change // AB 10.1.96: Typanpassung bei named -> passenden Parameter suchen if( pProc ) { @@ -246,39 +226,26 @@ void SbiExprList::Gen() pParser->Error( SbERR_NO_NAMED_ARGS ); // Spaeter, wenn Named Args bei DECLARE moeglich - /* - for( USHORT i = 1 ; i < nParAnz ; i++ ) - { - SbiSymDef* pDef = pPool->Get( i ); - const String& rName = pDef->GetName(); - if( rName.Len() ) - { - if( pExpr->GetName().ICompare( rName ) - == COMPARE_EQUAL ) - { - pParser->aGen.Gen( _ARGTYP, pDef->GetType() ); - break; - } - } - } - */ + //for( USHORT i = 1 ; i < nParAnz ; i++ ) + //{ + // SbiSymDef* pDef = pPool->Get( i ); + // const String& rName = pDef->GetName(); + // if( rName.Len() ) + // { + // if( pExpr->GetName().ICompare( rName ) + // == COMPARE_EQUAL ) + // { + // pParser->aGen.Gen( _ARGTYP, pDef->GetType() ); + // break; + // } + // } + //} } + */ } else { pParser->aGen.Gen( _ARGV ); - - // Funktion mit DECLARE -> Typ-Anpassung - if( pProc && nCount < nParAnz ) - { - SbiSymDef* pDef = pPool->Get( nCount ); - USHORT nTyp = sal::static_int_cast< USHORT >( - pDef->GetType() ); - // Zusätzliches Flag für BYVAL einbauen - if( pDef->IsByVal() ) - nTyp |= 0x8000; - pParser->aGen.Gen( _ARGTYP, nTyp ); - } } } } diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx index 42969b98d0d8..7a4ea5965558 100644 --- a/basic/source/comp/exprtree.cxx +++ b/basic/source/comp/exprtree.cxx @@ -338,15 +338,6 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo ) // damit erwischen wir n% = 5 : print n eType = eDefType; } - // Funktion? - if( pDef->GetProcDef() ) - { - SbiProcDef* pProc = pDef->GetProcDef(); - if( pPar && pProc->GetLib().Len() ) // DECLARE benutzt? - pPar->SetProc( pProc ); - // Wenn keine Pars, vorerst nichts machen - // Pruefung auf Typ-Anzahl waere denkbar - } // Typcheck bei Variablen: // ist explizit im Scanner etwas anderes angegeben? // Bei Methoden ist dies OK! @@ -868,7 +859,6 @@ SbiExprList::SbiExprList( SbiParser* p ) { pParser = p; pFirst = NULL; - pProc = NULL; nExpr = nDim = 0; bError = diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index 9b8f51d09dea..851d0d6f1fe5 100644 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -234,7 +234,6 @@ class SbiExprList { // Basisklasse fuer Parameter und Dims protected: SbiParser* pParser; // Parser SbiExpression* pFirst; // Expressions - SbiProcDef* pProc; // DECLARE-Funktion (Parameter-Anpassung) short nExpr; // Anzahl Expressions short nDim; // Anzahl Dimensionen BOOL bError; // TRUE: Fehler @@ -249,8 +248,6 @@ public: SbiExpression* Get( short ); BOOL Test( const SbiProcDef& ); // Parameter-Checks void Gen(); // Code-Erzeugung - // Setzen einer Funktionsdefinition zum Abgleich der Parameter - void SetProc( SbiProcDef* p ) { pProc = p; } void addExpression( SbiExpression* pExpr ); }; diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx index 9bd8cfd49754..f2fbaa0ac1f1 100644 --- a/basic/source/inc/symtbl.hxx +++ b/basic/source/inc/symtbl.hxx @@ -159,7 +159,8 @@ public: void SetOptional() { bOpt = TRUE; } void SetParamArray() { bParamArray = TRUE; } void SetWithEvents() { bWithEvents = TRUE; } - void SetByVal() { bByVal = TRUE; } + void SetByVal( BOOL bByVal_ = TRUE ) + { bByVal = bByVal_; } void SetStatic( BOOL bAsStatic = TRUE ) { bStatic = bAsStatic; } void SetNew() { bNew = TRUE; } void SetDefinedAs() { bAs = TRUE; } diff --git a/scripting/source/basprov/basmodnode.cxx b/scripting/source/basprov/basmodnode.cxx index 22f9e40571a4..fe6ed69fccab 100644 --- a/scripting/source/basprov/basmodnode.cxx +++ b/scripting/source/basprov/basmodnode.cxx @@ -97,14 +97,22 @@ namespace basprov if ( pMethods ) { sal_Int32 nCount = pMethods->Count(); - aChildNodes.realloc( nCount ); + sal_Int32 nRealCount = 0; + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Get( static_cast< USHORT >( i ) ) ); + if ( pMethod && !pMethod->IsHidden() ) + ++nRealCount; + } + aChildNodes.realloc( nRealCount ); Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray(); + sal_Int32 iTarget = 0; for ( sal_Int32 i = 0; i < nCount; ++i ) { SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Get( static_cast< USHORT >( i ) ) ); - if ( pMethod ) - pChildNodes[i] = static_cast< browse::XBrowseNode* >( new BasicMethodNodeImpl( m_xContext, m_sScriptingContext, pMethod, m_bIsAppScript ) ); + if ( pMethod && !pMethod->IsHidden() ) + pChildNodes[iTarget++] = static_cast< browse::XBrowseNode* >( new BasicMethodNodeImpl( m_xContext, m_sScriptingContext, pMethod, m_bIsAppScript ) ); } } } diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx index abd61f6c1285..69cc6f40cd3d 100644 --- a/scripting/source/basprov/basprov.cxx +++ b/scripting/source/basprov/basprov.cxx @@ -412,7 +412,7 @@ namespace basprov if ( pMethods ) { SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( aMethod, SbxCLASS_METHOD ) ); - if ( pMethod ) + if ( pMethod && !pMethod->IsHidden() ) { if ( m_pDocBasicManager == pBasicMgr ) xScript = new BasicScriptImpl( aDescription, pMethod, *m_pDocBasicManager, m_xInvocationContext ); -- cgit From c8852505f8bb9d94214250bf398c5c232dce8e43 Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Fri, 6 Aug 2010 09:35:51 +0200 Subject: mib18: #163121# Declare Rework --- basctl/source/basicide/baside2.cxx | 2 +- basctl/source/basicide/basobj2.cxx | 18 ++++++++++++++---- basctl/source/basicide/macrodlg.cxx | 16 ++++++++++------ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 9f97e1766c3b..d0a8ca1a6ddb 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -365,7 +365,7 @@ BOOL ModulWindow::BasicExecute() break; } } - else if ( !pMethod || ( nStart < nCurMethodStart ) ) + else if ( !pMethod || ( nStart < nCurMethodStart && !pM->IsHidden() ) ) { pMethod = pM; nCurMethodStart = nStart; diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index 3604866b4202..9604a8bd9933 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -364,13 +364,23 @@ Sequence< ::rtl::OUString > GetMethodNames( const ScriptDocument& rDocument, con SbModuleRef xModule = new SbModule( rModName ); xModule->SetSource32( aOUSource ); USHORT nCount = xModule->GetMethods()->Count(); - aSeqMethods.realloc( nCount ); - + USHORT nRealCount = nCount; for ( USHORT i = 0; i < nCount; i++ ) { SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i ); + if( pMethod->IsHidden() ) + --nRealCount; + } + aSeqMethods.realloc( nRealCount ); + + USHORT iTarget = 0; + for ( USHORT i = 0 ; i < nCount; ++i ) + { + SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i ); + if( pMethod->IsHidden() ) + continue; DBG_ASSERT( pMethod, "Method not found! (NULL)" ); - aSeqMethods.getArray()[ i ] = pMethod->GetName(); + aSeqMethods.getArray()[ iTarget++ ] = pMethod->GetName(); } } @@ -392,7 +402,7 @@ BOOL HasMethod( const ScriptDocument& rDocument, const String& rLibName, const S if ( pMethods ) { SbMethod* pMethod = (SbMethod*)pMethods->Find( rMethName, SbxCLASS_METHOD ); - if ( pMethod ) + if ( pMethod && !pMethod->IsHidden() ) bHasMethod = TRUE; } } diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index 41a5fa488950..24bc5beacb30 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -554,11 +554,15 @@ IMPL_LINK( MacroChooser, BasicSelectHdl, SvTreeListBox *, pBox ) // Die Macros sollen in der Reihenfolge angezeigt werden, // wie sie im Modul stehen. MacroList aMacros; - USHORT nMacros = pModule->GetMethods()->Count(); - USHORT nMethod; - for ( nMethod = 0; nMethod < nMacros; nMethod++ ) + USHORT nMacroCount = pModule->GetMethods()->Count(); + USHORT nRealMacroCount = 0; + USHORT iMeth; + for ( iMeth = 0; iMeth < nMacroCount; iMeth++ ) { - SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod ); + SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( iMeth ); + if( pMethod->IsHidden() ) + continue; + ++nRealMacroCount; DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" ); ULONG nPos = LIST_APPEND; // Eventuell weiter vorne ? @@ -580,8 +584,8 @@ IMPL_LINK( MacroChooser, BasicSelectHdl, SvTreeListBox *, pBox ) } aMacroBox.SetUpdateMode( FALSE ); - for ( nMethod = 0; nMethod < nMacros; nMethod++ ) - aMacroBox.InsertEntry( aMacros.GetObject( nMethod )->GetName() ); + for ( iMeth = 0; iMeth < nRealMacroCount; iMeth++ ) + aMacroBox.InsertEntry( aMacros.GetObject( iMeth )->GetName() ); aMacroBox.SetUpdateMode( TRUE ); if ( aMacroBox.GetEntryCount() ) -- cgit From df1e6343ba123c0a45b25eb7ed3ae6d53749b33f Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Fri, 6 Aug 2010 11:14:17 +0200 Subject: mib18: #163175# Implement DoEvents empty --- basic/source/runtime/methods1.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 9d806cac933a..62e9c388f5c5 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -528,11 +528,13 @@ RTLFUNC(DoEvents) (void)pBasic; (void)bWrite; (void)rPar; - Timer aTimer; - aTimer.SetTimeout( 1 ); - aTimer.Start(); - while ( aTimer.IsActive() ) - Application::Yield(); + // Dummy implementation as the following code leads + // to performance problems for unknown reasons + //Timer aTimer; + //aTimer.SetTimeout( 1 ); + //aTimer.Start(); + //while ( aTimer.IsActive() ) + // Application::Reschedule(); } RTLFUNC(GetGUIVersion) -- cgit From 08e2fc04ba183a19609518c7f4fb1c210bfe826e Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 9 Aug 2010 10:47:38 +0200 Subject: fwk152: #i108004# check the URLs correctly --- framework/source/loadenv/loadenv.cxx | 3 ++- sfx2/inc/sfx2/docfile.hxx | 1 - sfx2/source/doc/docfile.cxx | 47 ------------------------------------ sfx2/source/doc/doctemplates.cxx | 2 +- sfx2/source/doc/objmisc.cxx | 2 +- sfx2/source/doc/objstor.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 3 ++- 7 files changed, 7 insertions(+), 53 deletions(-) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 99dd3107f162..75bcc4c4587f 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -103,6 +103,7 @@ #include #include #include +#include #include #include #include @@ -1407,7 +1408,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() // don't check the complete URL here. // use its main part - ignore optional jumpmarks! const ::rtl::OUString sURL = xModel->getURL(); - if (!m_aURL.Main.equals(sURL)) + if (!::utl::UCBContentHelper::EqualURLs( m_aURL.Main, sURL )) { xTask.clear (); continue; diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index e4d3ff023b3b..24885fc27363 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -323,7 +323,6 @@ public: static com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag > GetVersionList( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); - static sal_Bool EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL ); static ::rtl::OUString CreateTempCopyWithExt( const ::rtl::OUString& aURL ); static sal_Bool CallApproveHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, ::com::sun::star::uno::Any aRequest, sal_Bool bAllowAbort ); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 1dea202e0d0e..29081e8e8418 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -3717,53 +3717,6 @@ void SfxMedium::SetCachedSignatureState_Impl( sal_uInt16 nState ) pImp->m_nSignatureState = nState; } -//---------------------------------------------------------------- -sal_Bool SfxMedium::EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL ) -{ - sal_Bool bResult = sal_False; - - if ( aFirstURL.getLength() && aSecondURL.getLength() ) - { - INetURLObject aFirst( aFirstURL ); - INetURLObject aSecond( aSecondURL ); - - if ( aFirst.GetProtocol() != INET_PROT_NOT_VALID && aSecond.GetProtocol() != INET_PROT_NOT_VALID ) - { - try - { - ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get(); - if ( !pBroker ) - throw uno::RuntimeException(); - - uno::Reference< ::com::sun::star::ucb::XContentIdentifierFactory > xIdFac - = pBroker->getContentIdentifierFactoryInterface(); - if ( !xIdFac.is() ) - throw uno::RuntimeException(); - - uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdFirst - = xIdFac->createContentIdentifier( aFirst.GetMainURL( INetURLObject::NO_DECODE ) ); - uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdSecond - = xIdFac->createContentIdentifier( aSecond.GetMainURL( INetURLObject::NO_DECODE ) ); - - if ( xIdFirst.is() && xIdSecond.is() ) - { - uno::Reference< ::com::sun::star::ucb::XContentProvider > xProvider = - pBroker->getContentProviderInterface(); - if ( !xProvider.is() ) - throw uno::RuntimeException(); - bResult = !xProvider->compareContentIds( xIdFirst, xIdSecond ); - } - } - catch( uno::Exception& ) - { - OSL_ENSURE( sal_False, "Can't compare URL's, treat as different!\n" ); - } - } - } - - return bResult; -} - BOOL SfxMedium::HasStorage_Impl() const { return pImp->xStorage.is(); diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index b921f2d97f1f..71f3683c0006 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1919,7 +1919,7 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, aStoreArgs[1].Value <<= rTemplateName; ::rtl::OUString aCurrentDocumentURL = rStorable->getLocation(); - if( !SfxMedium::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() )) + if( !::utl::UCBContentHelper::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() )) rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs ); else rStorable->store(); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index addb648ef2e9..e386b2382acf 100755 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -732,7 +732,7 @@ void SfxObjectShell::FreeSharedFile( const ::rtl::OUString& aTempFileURL ) SetSharedXMLFlag( sal_False ); if ( IsDocShared() && aTempFileURL.getLength() - && !SfxMedium::EqualURLs( aTempFileURL, GetSharedFileURL() ) ) + && !::utl::UCBContentHelper::EqualURLs( aTempFileURL, GetSharedFileURL() ) ) { if ( pImp->m_bAllowShareControlFileClean ) { diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 49188defc4f1..bfe27ee71d97 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1182,7 +1182,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl if ( pMedium && pMedium->GetName().CompareIgnoreCaseToAscii( "private:stream", 14 ) != COMPARE_EQUAL && rMedium.GetName().CompareIgnoreCaseToAscii( "private:stream", 14 ) != COMPARE_EQUAL - && SfxMedium::EqualURLs( pMedium->GetName(), rMedium.GetName() ) ) + && ::utl::UCBContentHelper::EqualURLs( pMedium->GetName(), rMedium.GetName() ) ) { bStoreToSameLocation = sal_True; AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save" ) ) ); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index b5a9536b12c5..9e9e09ebcdf5 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -95,6 +95,7 @@ #include #include #include +#include //________________________________________________________________________________________________________ // includes of my own project @@ -2642,7 +2643,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL sal_Bool bSaved = sal_False; if ( !bSaveTo && m_pData->m_pObjectShell && sURL.getLength() && sURL.compareToAscii( "private:stream", 14 ) != COMPARE_EQUAL - && SfxMedium::EqualURLs( getLocation(), sURL ) ) + && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) ) { // this is the same file URL as the current document location, try to use storeOwn if possible -- cgit From 6fad3bbef4e10023962b2fb8b5157af13148e76c Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 9 Aug 2010 10:47:38 +0200 Subject: fwk152: #i108004# check the URLs correctly --- unotools/inc/unotools/ucbhelper.hxx | 1 + unotools/source/ucbhelper/ucbhelper.cxx | 49 +++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/unotools/inc/unotools/ucbhelper.hxx b/unotools/inc/unotools/ucbhelper.hxx index 687868adbdb4..38b355439c2b 100644 --- a/unotools/inc/unotools/ucbhelper.hxx +++ b/unotools/inc/unotools/ucbhelper.hxx @@ -80,6 +80,7 @@ namespace utl static sal_Bool FindInPath( const String& rPath, const String& rName, String& rFile, char cDelim = ';', BOOL bAllowWildCards = TRUE ); static sal_Bool Find( const String& rFolder, const String& rName, String& rFile, BOOL bAllowWildCards = FALSE ); static sal_Bool IsSubPath( const ::rtl::OUString& rPath, const ::rtl::OUString& rChildCandidate, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >& xContentProvider = ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >() ); + static sal_Bool EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL ); }; } diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index 4160f2f2f443..8befb8a0f209 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -872,5 +872,54 @@ sal_Bool UCBContentHelper::IsSubPath( const ::rtl::OUString& rPath, const ::rtl: return bResult; } +// ----------------------------------------------------------------------- +sal_Bool UCBContentHelper::EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL ) +{ + sal_Bool bResult = sal_False; + + if ( aFirstURL.getLength() && aSecondURL.getLength() ) + { + INetURLObject aFirst( aFirstURL ); + INetURLObject aSecond( aSecondURL ); + + if ( aFirst.GetProtocol() != INET_PROT_NOT_VALID && aSecond.GetProtocol() != INET_PROT_NOT_VALID ) + { + try + { + ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get(); + if ( !pBroker ) + throw uno::RuntimeException(); + + uno::Reference< ::com::sun::star::ucb::XContentIdentifierFactory > xIdFac + = pBroker->getContentIdentifierFactoryInterface(); + if ( !xIdFac.is() ) + throw uno::RuntimeException(); + + uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdFirst + = xIdFac->createContentIdentifier( aFirst.GetMainURL( INetURLObject::NO_DECODE ) ); + uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdSecond + = xIdFac->createContentIdentifier( aSecond.GetMainURL( INetURLObject::NO_DECODE ) ); + + if ( xIdFirst.is() && xIdSecond.is() ) + { + uno::Reference< ::com::sun::star::ucb::XContentProvider > xProvider = + pBroker->getContentProviderInterface(); + if ( !xProvider.is() ) + throw uno::RuntimeException(); + bResult = !xProvider->compareContentIds( xIdFirst, xIdSecond ); + } + } + catch( uno::Exception& ) + { + OSL_ENSURE( sal_False, "Can't compare URL's, treat as different!\n" ); + } + } + } + + return bResult; +} + + + } // namespace utl -- cgit From fefe083877e478d7a09299524ffdde85948a2bff Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Mon, 9 Aug 2010 15:50:34 +0200 Subject: mib18: #163059# Ignore introspection based COM object members --- basic/source/classes/sbunoobj.cxx | 14 ++++++++++++-- basic/source/inc/sbunoobj.hxx | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index df13bc7ec571..7de2d0c02320 100755 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -71,6 +71,7 @@ #include #include #include +#include using com::sun::star::uno::Reference; @@ -2265,6 +2266,7 @@ Reference< XInvocation > createDynamicInvocationFor( const Any& aAny ); SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ ) : SbxObject( aName_ ) , bNeedIntrospection( TRUE ) + , bIgnoreNativeCOMObjectMembers( FALSE ) { static Reference< XIntrospection > xIntrospection; @@ -2310,6 +2312,12 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ ) bNeedIntrospection = FALSE; return; } + + // Ignore introspection based members for COM objects to avoid + // hiding of equally named COM symbols, e.g. XInvocation::getValue + Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY ); + if( xAutomationObject.is() ) + bIgnoreNativeCOMObjectMembers = TRUE; } maTmpUnoObj = aUnoObj_; @@ -2553,7 +2561,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t ) if( !pRes ) { ::rtl::OUString aUName( rName ); - if( mxUnoAccess.is() ) + if( mxUnoAccess.is() && !bIgnoreNativeCOMObjectMembers ) { if( mxExactName.is() ) { @@ -2713,10 +2721,12 @@ void SbUnoObject::implCreateAll( void ) // Instrospection besorgen Reference< XIntrospectionAccess > xAccess = mxUnoAccess; - if( !xAccess.is() ) + if( !xAccess.is() || bIgnoreNativeCOMObjectMembers ) { if( mxInvocation.is() ) xAccess = mxInvocation->getIntrospection(); + else if( bIgnoreNativeCOMObjectMembers ) + return; } if( !xAccess.is() ) return; diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index 2d9836e3530e..78afa9783ca8 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -52,6 +52,7 @@ class SbUnoObject: public SbxObject ::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactName; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation; BOOL bNeedIntrospection; + BOOL bIgnoreNativeCOMObjectMembers; ::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection! // Hilfs-Methode zum Anlegen der dbg_-Properties -- cgit From 2e6db5ef3ba5c811cdab813beec4451ba28c78b1 Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Tue, 10 Aug 2010 06:57:53 +0200 Subject: mib18: #163148# creation og basic modules in library Standard during Workbooks.add --- sc/source/ui/vba/vbaworkbooks.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx index 5298f60e0943..7efee1505dcb 100644 --- a/sc/source/ui/vba/vbaworkbooks.cxx +++ b/sc/source/ui/vba/vbaworkbooks.cxx @@ -76,7 +76,7 @@ void setUpDocumentModules( const uno::Reference< sheet::XSpreadsheetDocument >& uno::Reference xLibContainer = pShell->GetBasicContainer(); uno::Reference xVBACompat( xLibContainer, uno::UNO_QUERY_THROW ); xVBACompat->setVBACompatibilityMode( sal_True ); - String aPrjName( RTL_CONSTASCII_USTRINGPARAM( "VBAProject" ) ); + String aPrjName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); pShell->GetBasicManager()->SetName( aPrjName ); if( xLibContainer.is() ) -- cgit From 9dac2d24f39818d94fe23f642129f87b74d79263 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 10 Aug 2010 10:27:30 +0200 Subject: mib18: #163246# add VBA symbol Worksheet.ProtectScenarios --- sc/source/ui/vba/vbaworksheet.cxx | 10 ++++++++-- sc/source/ui/vba/vbaworksheet.hxx | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index 1655d1ff181a..6ee6fa1f6b19 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -414,7 +414,7 @@ ScVbaWorksheet::getStandardHeight() throw (uno::RuntimeException) sal_Bool ScVbaWorksheet::getProtectionMode() throw (uno::RuntimeException) { - return false; + return sal_False; } sal_Bool @@ -427,7 +427,13 @@ ScVbaWorksheet::getProtectContents()throw (uno::RuntimeException) sal_Bool ScVbaWorksheet::getProtectDrawingObjects() throw (uno::RuntimeException) { - return false; + return sal_False; +} + +sal_Bool +ScVbaWorksheet::getProtectScenarios() throw (uno::RuntimeException) +{ + return sal_False; } void diff --git a/sc/source/ui/vba/vbaworksheet.hxx b/sc/source/ui/vba/vbaworksheet.hxx index fd65c7d698be..78bcc2503a49 100644 --- a/sc/source/ui/vba/vbaworksheet.hxx +++ b/sc/source/ui/vba/vbaworksheet.hxx @@ -98,6 +98,7 @@ public: virtual ::sal_Bool SAL_CALL getProtectionMode() throw (css::uno::RuntimeException); virtual ::sal_Bool SAL_CALL getProtectContents() throw (css::uno::RuntimeException); virtual ::sal_Bool SAL_CALL getProtectDrawingObjects() throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getProtectScenarios() throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getUsedRange() throw (css::uno::RuntimeException) ; virtual css::uno::Any SAL_CALL ChartObjects( const css::uno::Any& Index ) throw (css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XOutline > SAL_CALL Outline( ) throw (css::uno::RuntimeException); -- cgit From 476aa1795b08ffeb43e35823e78442a51a04304b Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 10 Aug 2010 10:27:30 +0200 Subject: mib18: #163246# add VBA symbol Worksheet.ProtectScenarios --- oovbaapi/ooo/vba/excel/XWorksheet.idl | 1 + 1 file changed, 1 insertion(+) diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl index 1907fb004cab..3eb8337798d6 100644 --- a/oovbaapi/ooo/vba/excel/XWorksheet.idl +++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl @@ -66,6 +66,7 @@ interface XWorksheet [attribute, readonly] boolean ProtectionMode; [attribute, readonly] boolean ProtectContents; [attribute, readonly] boolean ProtectDrawingObjects; + [attribute, readonly] boolean ProtectScenarios; [attribute, readonly] XRange UsedRange; [attribute, readonly] XWorksheet Next; [attribute, readonly] XWorksheet Previous; -- cgit From 061332d81d98aa8d3099830e16233b83b37a51f9 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 10 Aug 2010 11:52:54 +0200 Subject: mib18: #163243# enable regular expressions in VBA symbol Range.Find --- sc/source/ui/vba/vbarange.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index fef118277d3b..455af075306c 100755 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -2997,7 +2997,7 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L // return a Range object that represents the first cell where that information is found. rtl::OUString sWhat; sal_Int32 nWhat = 0; - float fWhat = 0.0; + double fWhat = 0.0; // string. if( What >>= sWhat ) @@ -3029,6 +3029,7 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L { uno::Reference< util::XSearchDescriptor > xDescriptor = xSearch->createSearchDescriptor(); xDescriptor->setSearchString( sSearch ); + xDescriptor->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SRCHREGEXP ) ), uno::Any( true ) ); uno::Reference< excel::XRange > xAfterRange; uno::Reference< table::XCellRange > xStartCell; @@ -3134,8 +3135,7 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L ScGlobal::SetSearchItem( newOptions ); - uno::Reference< util::XSearchDescriptor > xSearchDescriptor( xDescriptor, uno::UNO_QUERY ); - uno::Reference< uno::XInterface > xInterface = xStartCell.is() ? xSearch->findNext( xStartCell, xSearchDescriptor) : xSearch->findFirst( xSearchDescriptor ); + uno::Reference< uno::XInterface > xInterface = xStartCell.is() ? xSearch->findNext( xStartCell, xDescriptor) : xSearch->findFirst( xDescriptor ); uno::Reference< table::XCellRange > xCellRange( xInterface, uno::UNO_QUERY ); if ( xCellRange.is() ) { -- cgit From a1f6f3ec0728d2877c96ee8e2bba5a03f6bdc945 Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Tue, 10 Aug 2010 16:55:52 +0200 Subject: mib18: #163120# adding the entrypoint for symbol Debug --- sc/source/ui/vba/vbaglobals.cxx | 19 +++++++++++++++++++ sc/source/ui/vba/vbaglobals.hxx | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx index 03f3ecd3c50c..db3558bdf34a 100644 --- a/sc/source/ui/vba/vbaglobals.cxx +++ b/sc/source/ui/vba/vbaglobals.cxx @@ -219,6 +219,25 @@ ScVbaGlobals::Rows( const uno::Any& aIndex ) throw (uno::RuntimeException) } + +uno::Any SAL_CALL +ScVbaGlobals::getDebug() throw (uno::RuntimeException) +{ + try // return empty object on error + { + uno::Sequence< uno::Any > aArgs( 1 ); + aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this ); + uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); + uno::Reference< uno::XInterface > xVBADebug = xServiceManager->createInstanceWithArgumentsAndContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VbaDebug" ) ), aArgs, mxContext ); + return uno::Any( xVBADebug ); + } + catch( uno::Exception& ) + { + } + return uno::Any(); +} + uno::Sequence< ::rtl::OUString > SAL_CALL ScVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException) { diff --git a/sc/source/ui/vba/vbaglobals.hxx b/sc/source/ui/vba/vbaglobals.hxx index ae34d710240f..c56c62fdb573 100644 --- a/sc/source/ui/vba/vbaglobals.hxx +++ b/sc/source/ui/vba/vbaglobals.hxx @@ -82,7 +82,7 @@ typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::excel::XGlobals > Sc virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw ( css::uno::RuntimeException ); virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Intersect( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException); - + virtual css::uno::Any SAL_CALL getDebug() throw (css::uno::RuntimeException); // XMultiServiceFactory -- cgit From 7c2b94d0a3352ee92e0202b1eba64254583798ae Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Tue, 10 Aug 2010 16:55:52 +0200 Subject: mib18: #163120# adding the entrypoint for symbol Debug --- oovbaapi/ooo/vba/excel/XGlobals.idl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oovbaapi/ooo/vba/excel/XGlobals.idl b/oovbaapi/ooo/vba/excel/XGlobals.idl index 6ed51b2aa4c4..d05d7a75fefa 100644 --- a/oovbaapi/ooo/vba/excel/XGlobals.idl +++ b/oovbaapi/ooo/vba/excel/XGlobals.idl @@ -55,6 +55,8 @@ interface XGlobals: com::sun::star::uno::XInterface [attribute, readonly] ooo::vba::XAssistant Assistant; [attribute, readonly] any Selection; [attribute, readonly] XWorkbook ThisWorkbook; + [attribute, readonly] any Debug; + void Calculate() raises(com::sun::star::script::BasicErrorException); XRange Cells([in] any RowIndex, [in] any ColumnIndex); -- cgit From 47c57a6a16a01121e2c04574652068be4a1acbe2 Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Tue, 10 Aug 2010 18:14:58 +0200 Subject: mib18: #163259# implementation of global symbol Excel --- sc/source/ui/vba/vbaglobals.cxx | 9 +++++++++ sc/source/ui/vba/vbaglobals.hxx | 1 + 2 files changed, 10 insertions(+) diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx index db3558bdf34a..d1c97ae2291e 100644 --- a/sc/source/ui/vba/vbaglobals.cxx +++ b/sc/source/ui/vba/vbaglobals.cxx @@ -80,6 +80,15 @@ ScVbaGlobals::getApplication() throw (uno::RuntimeException) return mxApplication; } + +uno::Reference SAL_CALL +ScVbaGlobals::getExcel() throw (uno::RuntimeException) +{ + return getApplication(); +} + + + uno::Reference< excel::XWorkbook > SAL_CALL ScVbaGlobals::getActiveWorkbook() throw (uno::RuntimeException) { diff --git a/sc/source/ui/vba/vbaglobals.hxx b/sc/source/ui/vba/vbaglobals.hxx index c56c62fdb573..f22e5b19faa4 100644 --- a/sc/source/ui/vba/vbaglobals.hxx +++ b/sc/source/ui/vba/vbaglobals.hxx @@ -82,6 +82,7 @@ typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::excel::XGlobals > Sc virtual css::uno::Any SAL_CALL Names( const css::uno::Any& aIndex ) throw ( css::uno::RuntimeException ); virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Intersect( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException); virtual css::uno::Reference< ov::excel::XRange > SAL_CALL Union( const css::uno::Reference< ov::excel::XRange >& Arg1, const css::uno::Reference< ov::excel::XRange >& Arg2, const css::uno::Any& Arg3, const css::uno::Any& Arg4, const css::uno::Any& Arg5, const css::uno::Any& Arg6, const css::uno::Any& Arg7, const css::uno::Any& Arg8, const css::uno::Any& Arg9, const css::uno::Any& Arg10, const css::uno::Any& Arg11, const css::uno::Any& Arg12, const css::uno::Any& Arg13, const css::uno::Any& Arg14, const css::uno::Any& Arg15, const css::uno::Any& Arg16, const css::uno::Any& Arg17, const css::uno::Any& Arg18, const css::uno::Any& Arg19, const css::uno::Any& Arg20, const css::uno::Any& Arg21, const css::uno::Any& Arg22, const css::uno::Any& Arg23, const css::uno::Any& Arg24, const css::uno::Any& Arg25, const css::uno::Any& Arg26, const css::uno::Any& Arg27, const css::uno::Any& Arg28, const css::uno::Any& Arg29, const css::uno::Any& Arg30 ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Reference< ov::excel::XApplication > SAL_CALL getExcel() throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL getDebug() throw (css::uno::RuntimeException); -- cgit From a72754d198aeaf328100c4d9cd340ffbb759796e Mon Sep 17 00:00:00 2001 From: "Michael E. Bohn" Date: Tue, 10 Aug 2010 18:14:58 +0200 Subject: mib18: #163259# implementation of global symbol Excel --- oovbaapi/ooo/vba/excel/XGlobals.idl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/oovbaapi/ooo/vba/excel/XGlobals.idl b/oovbaapi/ooo/vba/excel/XGlobals.idl index d05d7a75fefa..d79196b00927 100644 --- a/oovbaapi/ooo/vba/excel/XGlobals.idl +++ b/oovbaapi/ooo/vba/excel/XGlobals.idl @@ -42,6 +42,10 @@ #ifndef __ooo_vba_XAssistant_idl__ #include #endif +#ifndef __ooo_vba_excel_XApplication_idl__ +#include +#endif + module ooo { module vba { module excel { interface XRange; @@ -55,6 +59,7 @@ interface XGlobals: com::sun::star::uno::XInterface [attribute, readonly] ooo::vba::XAssistant Assistant; [attribute, readonly] any Selection; [attribute, readonly] XWorkbook ThisWorkbook; + [attribute, readonly] ooo::vba::excel::XApplication Excel; [attribute, readonly] any Debug; -- cgit From de0ee2cfcf30e2675fb64e02704a277bedf31545 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Tue, 10 Aug 2010 20:18:10 +0200 Subject: mib18: adjusted service name to match VBA symbol --- sc/source/ui/vba/vbaglobals.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx index d1c97ae2291e..c70a7f83726d 100644 --- a/sc/source/ui/vba/vbaglobals.cxx +++ b/sc/source/ui/vba/vbaglobals.cxx @@ -238,7 +238,7 @@ ScVbaGlobals::getDebug() throw (uno::RuntimeException) aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this ); uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); uno::Reference< uno::XInterface > xVBADebug = xServiceManager->createInstanceWithArgumentsAndContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VbaDebug" ) ), aArgs, mxContext ); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.Debug" ) ), aArgs, mxContext ); return uno::Any( xVBADebug ); } catch( uno::Exception& ) -- cgit From c28503c38aec7fdc4cc528fac116f8eac798c6de Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Wed, 11 Aug 2010 08:24:45 +0200 Subject: mib18: #163121# Fixed back chain handling for new declare implementation --- basic/source/comp/dim.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx index 27b6e0e51871..59d77e3f3757 100644 --- a/basic/source/comp/dim.cxx +++ b/basic/source/comp/dim.cxx @@ -981,6 +981,12 @@ void SbiParser::DefDeclare( BOOL bPrivate ) // New declare handling if( pDef->GetLib().Len() > 0 ) { + if( bNewGblDefs && nGblChain == 0 ) + { + nGblChain = aGen.Gen( _JUMP, 0 ); + bNewGblDefs = FALSE; + } + USHORT nSavLine = nLine; aGen.Statement(); pDef->Define(); -- cgit From 949e63c1f4ecb4ef61310cf1c1713fb20854c578 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 11 Aug 2010 09:10:07 +0200 Subject: mib18: #163215# handle the closed dialog correctly --- vbahelper/source/msforms/vbauserform.cxx | 47 ++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index 2a4cecfc2338..a1333e0a655b 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -153,28 +153,41 @@ void SAL_CALL ScVbaUserForm::setValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) { uno::Any aObject = getValue( aPropertyName ); - // The Object *must* support XDefaultProperty here because getValue will - // only return properties that are Objects ( e.g. controls ) - // e.g. Userform1.aControl = something - // 'aControl' has to support XDefaultProperty to make sense here - uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW ); - rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName(); - uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) ); - uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW ); - xPropSet->setPropertyValue( aDfltPropName, aValue ); + + // in case the dialog is already closed the VBA implementation should not throw exceptions + if ( aObject.hasValue() ) + { + // The Object *must* support XDefaultProperty here because getValue will + // only return properties that are Objects ( e.g. controls ) + // e.g. Userform1.aControl = something + // 'aControl' has to support XDefaultProperty to make sense here + uno::Reference< script::XDefaultProperty > xDfltProp( aObject, uno::UNO_QUERY_THROW ); + rtl::OUString aDfltPropName = xDfltProp->getDefaultPropertyName(); + uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObject ) ); + uno::Reference< beans::XPropertySet > xPropSet( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY_THROW ); + xPropSet->setPropertyValue( aDfltPropName, aValue ); + } } uno::Any SAL_CALL ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException) { - uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); - uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); - uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); - ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); - ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); - pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); - return uno::makeAny( xVBAControl ); + uno::Any aResult; + + // in case the dialog is already closed the VBA implementation should not throw exceptions + if ( m_xDialog.is() ) + { + uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); + ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); + pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); + aResult = uno::makeAny( xVBAControl ); + } + + return aResult; } ::sal_Bool SAL_CALL -- cgit From 3fb28911c53d6e156f56a159f458a58fe1b6842f Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Wed, 11 Aug 2010 11:11:45 +0200 Subject: mib18: unx compiler warnings --- basic/source/comp/exprgen.cxx | 4 ++-- basic/source/comp/makefile.mk | 33 ++++++++++----------------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index dc4fda0a4682..3e034af204f5 100644 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -207,8 +207,8 @@ void SbiExprList::Gen() { pParser->aGen.Gen( _ARGC ); // AB 10.1.96: Typ-Anpassung bei DECLARE - USHORT nCount = 1, nParAnz = 0; - SbiSymPool* pPool = NULL; + USHORT nCount = 1 /*, nParAnz = 0*/; +// SbiSymPool* pPool = NULL; for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ ) { pExpr->Gen(); diff --git a/basic/source/comp/makefile.mk b/basic/source/comp/makefile.mk index bd3c750df355..d65f6a431e43 100644 --- a/basic/source/comp/makefile.mk +++ b/basic/source/comp/makefile.mk @@ -34,39 +34,26 @@ TARGET=comp .INCLUDE : settings.mk -CXXFILES= \ - sbcomp.cxx \ - dim.cxx \ - exprtree.cxx \ - exprnode.cxx \ - exprgen.cxx \ - codegen.cxx \ - io.cxx \ - loops.cxx \ - parser.cxx \ - scanner.cxx \ - token.cxx \ - symtbl.cxx \ - buffer.cxx - SLOFILES= \ - $(SLO)$/sbcomp.obj \ + $(SLO)$/buffer.obj \ + $(SLO)$/codegen.obj \ $(SLO)$/dim.obj \ - $(SLO)$/exprtree.obj \ - $(SLO)$/exprnode.obj \ $(SLO)$/exprgen.obj \ - $(SLO)$/codegen.obj \ + $(SLO)$/exprnode.obj \ + $(SLO)$/exprtree.obj \ $(SLO)$/io.obj \ $(SLO)$/loops.obj \ $(SLO)$/parser.obj \ + $(SLO)$/sbcomp.obj \ $(SLO)$/scanner.obj \ - $(SLO)$/token.obj \ $(SLO)$/symtbl.obj \ - $(SLO)$/buffer.obj + $(SLO)$/token.obj EXCEPTIONSFILES= \ - $(SLO)$/parser.obj \ - $(SLO)$/exprtree.obj + $(SLO)$/codegen.obj \ + $(SLO)$/dim.obj \ + $(SLO)$/exprtree.obj \ + $(SLO)$/parser.obj # --- Targets -------------------------------------------------------------- -- cgit From 73e504b3e526fe7bbb01e8947d329f1687d84011 Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Wed, 11 Aug 2010 14:18:10 +0200 Subject: mib18: #163237# Changed error handling in StepSET --- basic/source/runtime/step0.cxx | 223 ++++++++++++++++++++--------------------- 1 file changed, 111 insertions(+), 112 deletions(-) diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index 29965c7e9da5..596b30b9d691 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -431,144 +431,143 @@ void SbiRuntime::StepPUT() void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp ) { // #67733 Typen mit Array-Flag sind auch ok - SbxDataType eValType = refVal->GetType(); + + // Check var, !object is no error for sure if, only if type is fixed SbxDataType eVarType = refVar->GetType(); - if( (eValType != SbxOBJECT - && eValType != SbxEMPTY -// seems like when using the default method its possible for objects -// to be empty ( no broadcast has taken place yet ) or the actual value is - - && !bHandleDefaultProp - && !(eValType & SbxARRAY)) || - (eVarType != SbxOBJECT - && eVarType != SbxEMPTY - && !bHandleDefaultProp - && !(eVarType & SbxARRAY) ) ) + if( !bHandleDefaultProp && eVarType != SbxOBJECT && !(eVarType & SbxARRAY) && refVar->IsFixed() ) { Error( SbERR_INVALID_USAGE_OBJECT ); + return; } - else + + // Check value, !object is no error for sure if, only if type is fixed + SbxDataType eValType = refVal->GetType(); + bool bGetValObject = false; + if( !bHandleDefaultProp && eValType != SbxOBJECT && !(eValType & SbxARRAY) && refVal->IsFixed() ) { - // Getting in here causes problems with objects with default properties - // if they are SbxEMPTY I guess - if ( !bHandleDefaultProp || ( bHandleDefaultProp && refVal->GetType() == SbxOBJECT ) ) + Error( SbERR_INVALID_USAGE_OBJECT ); + return; + } + + // Getting in here causes problems with objects with default properties + // if they are SbxEMPTY I guess + if ( !bHandleDefaultProp || ( bHandleDefaultProp && eValType == SbxOBJECT ) ) + { + // Auf refVal GetObject fuer Collections ausloesen + SbxBase* pObjVarObj = refVal->GetObject(); + if( pObjVarObj ) { - // Auf refVal GetObject fuer Collections ausloesen - SbxBase* pObjVarObj = refVal->GetObject(); - if( pObjVarObj ) - { - SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj); + SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj); - // #67733 Typen mit Array-Flag sind auch ok - if( refObjVal ) - refVal = refObjVal; - else if( !(eValType & SbxARRAY) ) - refVal = NULL; - } + // #67733 Typen mit Array-Flag sind auch ok + if( refObjVal ) + refVal = refObjVal; + else if( !(eValType & SbxARRAY) ) + refVal = NULL; } + } - // #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als - // Object deklarierten Variable zugewiesen werden, kann hier - // refVal ungueltig sein! - if( !refVal ) + // #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als + // Object deklarierten Variable zugewiesen werden, kann hier + // refVal ungueltig sein! + if( !refVal ) + { + Error( SbERR_INVALID_USAGE_OBJECT ); + } + else + { + // Store auf die eigene Methode (innerhalb einer Function)? + BOOL bFlagsChanged = FALSE; + USHORT n = 0; + if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) { - Error( SbERR_INVALID_USAGE_OBJECT ); + bFlagsChanged = TRUE; + n = refVar->GetFlags(); + refVar->SetFlag( SBX_WRITE ); } - else - { - // Store auf die eigene Methode (innerhalb einer Function)? - BOOL bFlagsChanged = FALSE; - USHORT n = 0; - if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) - { - bFlagsChanged = TRUE; - n = refVar->GetFlags(); - refVar->SetFlag( SBX_WRITE ); - } - SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar); - if( pProcProperty ) - pProcProperty->setSet( true ); + SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar); + if( pProcProperty ) + pProcProperty->setSet( true ); - if ( bHandleDefaultProp ) + if ( bHandleDefaultProp ) + { + // get default properties for lhs & rhs where necessary + // SbxVariable* defaultProp = NULL; unused variable + bool bLHSHasDefaultProp = false; + // LHS try determine if a default prop exists + if ( refVar->GetType() == SbxOBJECT ) { - // get default properties for lhs & rhs where necessary - // SbxVariable* defaultProp = NULL; unused variable - bool bLHSHasDefaultProp = false; - // LHS try determine if a default prop exists - if ( refVar->GetType() == SbxOBJECT ) + SbxVariable* pDflt = getDefaultProp( refVar ); + if ( pDflt ) { - SbxVariable* pDflt = getDefaultProp( refVar ); - if ( pDflt ) - { - refVar = pDflt; - bLHSHasDefaultProp = true; - } + refVar = pDflt; + bLHSHasDefaultProp = true; } - // RHS only get a default prop is the rhs has one - if ( refVal->GetType() == SbxOBJECT ) - { - // check if lhs is a null object - // if it is then use the object not the default property - SbxObject* pObj = NULL; + } + // RHS only get a default prop is the rhs has one + if ( refVal->GetType() == SbxOBJECT ) + { + // check if lhs is a null object + // if it is then use the object not the default property + SbxObject* pObj = NULL; - pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar); + pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar); - // calling GetObject on a SbxEMPTY variable raises - // object not set errors, make sure its an Object - if ( !pObj && refVar->GetType() == SbxOBJECT ) - { - SbxBase* pObjVarObj = refVar->GetObject(); - pObj = PTR_CAST(SbxObject,pObjVarObj); - } - SbxVariable* pDflt = NULL; - if ( pObj || bLHSHasDefaultProp ) - // lhs is either a valid object || or has a defaultProp - pDflt = getDefaultProp( refVal ); - if ( pDflt ) - refVal = pDflt; + // calling GetObject on a SbxEMPTY variable raises + // object not set errors, make sure its an Object + if ( !pObj && refVar->GetType() == SbxOBJECT ) + { + SbxBase* pObjVarObj = refVar->GetObject(); + pObj = PTR_CAST(SbxObject,pObjVarObj); } + SbxVariable* pDflt = NULL; + if ( pObj || bLHSHasDefaultProp ) + // lhs is either a valid object || or has a defaultProp + pDflt = getDefaultProp( refVal ); + if ( pDflt ) + refVal = pDflt; } + } - // Handle withevents - BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS ); - if ( bWithEvents ) - { - Reference< XInterface > xComListener; - - SbxBase* pObj = refVal->GetObject(); - SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL; - if( pUnoObj != NULL ) - { - Any aControlAny = pUnoObj->getUnoAny(); - String aDeclareClassName = refVar->GetDeclareClassName(); - ::rtl::OUString aVBAType = aDeclareClassName; - ::rtl::OUString aPrefix = refVar->GetName(); - SbxObjectRef xScopeObj = refVar->GetParent(); - xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj ); - - refVal->SetDeclareClassName( aDeclareClassName ); - refVal->SetComListener( xComListener ); // Hold reference - } + // Handle withevents + BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS ); + if ( bWithEvents ) + { + Reference< XInterface > xComListener; - *refVar = *refVal; - } - else + SbxBase* pObj = refVal->GetObject(); + SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL; + if( pUnoObj != NULL ) { - *refVar = *refVal; + Any aControlAny = pUnoObj->getUnoAny(); + String aDeclareClassName = refVar->GetDeclareClassName(); + ::rtl::OUString aVBAType = aDeclareClassName; + ::rtl::OUString aPrefix = refVar->GetName(); + SbxObjectRef xScopeObj = refVar->GetParent(); + xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj ); + + refVal->SetDeclareClassName( aDeclareClassName ); + refVal->SetComListener( xComListener ); // Hold reference } - // lhs is a property who's value is currently (Empty e.g. no broadcast yet) - // in this case if there is a default prop involved the value of the - // default property may infact be void so the type will also be SbxEMPTY - // in this case we do not want to call checkUnoStructCopy 'cause that will - // cause an error also - if ( !bHandleDefaultProp || ( bHandleDefaultProp && ( refVar->GetType() != SbxEMPTY ) ) ) - // #67607 Uno-Structs kopieren - checkUnoStructCopy( refVal, refVar ); - if( bFlagsChanged ) - refVar->SetFlags( n ); + *refVar = *refVal; } + else + { + *refVar = *refVal; + } + + // lhs is a property who's value is currently (Empty e.g. no broadcast yet) + // in this case if there is a default prop involved the value of the + // default property may infact be void so the type will also be SbxEMPTY + // in this case we do not want to call checkUnoStructCopy 'cause that will + // cause an error also + if ( !bHandleDefaultProp || ( bHandleDefaultProp && ( refVar->GetType() != SbxEMPTY ) ) ) + // #67607 Uno-Structs kopieren + checkUnoStructCopy( refVal, refVar ); + if( bFlagsChanged ) + refVar->SetFlags( n ); } } -- cgit From 20e2562e7be5ea6009e42d4cb9818642e9daa5f9 Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Thu, 12 Aug 2010 08:40:35 +0200 Subject: mib18: #163254# Fixed instantiation of class modules for object members --- basic/source/classes/sb.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index d4520025953e..1427e7a74fdf 100755 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -553,6 +553,35 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) USHORT nFlags_ = pProp->GetFlags(); pProp->SetFlag( SBX_NO_BROADCAST ); SbxProperty* pNewProp = new SbxProperty( *pProp ); + + // Special handling for modules instances and collections, they need + // to be instantiated, otherwise all refer to the same base object + SbxDataType eVarType = pProp->GetType(); + if( eVarType == SbxOBJECT ) + { + SbxBase* pObjBase = pProp->GetObject(); + SbxObject* pObj = PTR_CAST(SbxObject,pObjBase); + if( pObj != NULL ) + { + String aObjClass = pObj->GetClassName(); + (void)aObjClass; + + SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase); + if( pClassModuleObj != NULL ) + { + SbModule* pClassModule = pClassModuleObj->getClassModule(); + SbClassModuleObject* pNewObj = new SbClassModuleObject( pClassModule ); + pNewProp->PutObject( pNewObj ); + } + else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) ) + { + String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") ); + BasicCollection* pNewCollection = new BasicCollection( aCollectionName ); + pNewProp->PutObject( pNewCollection ); + } + } + } + pNewProp->ResetFlag( SBX_NO_BROADCAST ); pNewProp->SetParent( this ); pProps->PutDirect( pNewProp, i ); -- cgit From 2f61a21f70c9dc5efa8d0e0a54e06da282a68efb Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 12 Aug 2010 10:00:50 +0200 Subject: fwk152: #i10000# fix warning --- desktop/source/app/appfirststart.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/desktop/source/app/appfirststart.cxx b/desktop/source/app/appfirststart.cxx index 43c88e6eaa8a..c06d94fd0812 100644 --- a/desktop/source/app/appfirststart.cxx +++ b/desktop/source/app/appfirststart.cxx @@ -284,8 +284,6 @@ void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart ) xPSet->setPropertyValue( sPropName, makeAny( sal_False ) ); Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges(); - sal_Bool bQuickstart = sal_True; - sal_Bool bAutostart = sal_True; Sequence< Any > aSeq( 2 ); aSeq[0] <<= sal_True; aSeq[1] <<= sal_True; -- cgit From 7b40b729c0956185ce6bcf6d00b85857fcb9e26b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 12 Aug 2010 15:05:09 +0200 Subject: sw33bf08: #i108078#: ::sfx2::createBaseURI(): manually expand vnd.sun.star.expand: URIs before calling makeAbsolute(). --- sfx2/source/doc/DocumentMetadataAccess.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index 9625ea958830..83ed9b3ccfe8 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -136,6 +137,16 @@ uno::Reference createBaseURI( throw uno::RuntimeException(); } + // #i108078# workaround non-hierarchical vnd.sun.star.expand URIs + // this really should be done somewhere else, not here. + ::rtl::OUString pkgURI(i_rPkgURI); + if (pkgURI.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:"))) + { + // expand it here (makeAbsolute requires hierarchical URI) + pkgURI = pkgURI.copy( sizeof("vnd.sun.star.expand:") - 1 ); + ::rtl::Bootstrap::expandMacros(pkgURI); + } + const uno::Reference xServiceFactory( i_xContext->getServiceManager(), uno::UNO_SET_THROW); const uno::Reference xUriFactory( @@ -146,11 +157,12 @@ uno::Reference createBaseURI( uno::Reference< uri::XUriReference > xBaseURI; const uno::Reference< uri::XUriReference > xPkgURI( - xUriFactory->parse(i_rPkgURI), uno::UNO_SET_THROW ); + xUriFactory->parse(pkgURI), uno::UNO_SET_THROW ); xPkgURI->clearFragment(); + // need to know whether the storage is a FileSystemStorage // XServiceInfo would be better, but it is not implemented -// if ( i_rPkgURI.getLength() && ::utl::UCBContentHelper::IsFolder(i_rPkgURI) ) +// if ( pkgURI.getLength() && ::utl::UCBContentHelper::IsFolder(pkgURI) ) if (true) { xBaseURI.set( xPkgURI, uno::UNO_SET_THROW ); #if 0 -- cgit From f47d90f206047b44993671316cfad21eb471a846 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 12 Aug 2010 16:13:11 +0200 Subject: sw33bf08: #i108078#: ::sfx2::createBaseURI(): decode content of expand URI --- sfx2/source/doc/DocumentMetadataAccess.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index 83ed9b3ccfe8..df0781be8877 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -140,11 +141,19 @@ uno::Reference createBaseURI( // #i108078# workaround non-hierarchical vnd.sun.star.expand URIs // this really should be done somewhere else, not here. ::rtl::OUString pkgURI(i_rPkgURI); - if (pkgURI.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:"))) + if (pkgURI.matchIgnoreAsciiCaseAsciiL( + RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:"))) { // expand it here (makeAbsolute requires hierarchical URI) - pkgURI = pkgURI.copy( sizeof("vnd.sun.star.expand:") - 1 ); - ::rtl::Bootstrap::expandMacros(pkgURI); + pkgURI = pkgURI.copy( RTL_CONSTASCII_LENGTH("vnd.sun.star.expand:") ); + if (pkgURI.getLength() != 0) { + pkgURI = ::rtl::Uri::decode( + pkgURI, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8); + if (pkgURI.getLength() == 0) { + throw uno::RuntimeException(); + } + ::rtl::Bootstrap::expandMacros(pkgURI); + } } const uno::Reference xServiceFactory( -- cgit From d2aa21c67466637572b0fbd06cc941c1d60d9dc4 Mon Sep 17 00:00:00 2001 From: Andreas Bregas Date: Fri, 13 Aug 2010 08:01:31 +0200 Subject: mib18: #163254# Set right name and parent for copied object class members --- basic/source/classes/sb.cxx | 4 ++++ basic/source/comp/sbcomp.cxx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 1427e7a74fdf..dab060500e05 100755 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -571,12 +571,16 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) { SbModule* pClassModule = pClassModuleObj->getClassModule(); SbClassModuleObject* pNewObj = new SbClassModuleObject( pClassModule ); + pNewObj->SetName( pProp->GetName() ); + pNewObj->SetParent( pClassModule->pParent ); pNewProp->PutObject( pNewObj ); } else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) ) { String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") ); BasicCollection* pNewCollection = new BasicCollection( aCollectionName ); + pNewCollection->SetName( pProp->GetName() ); + pNewCollection->SetParent( pClassModule->pParent ); pNewProp->PutObject( pNewCollection ); } } diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx index e6fe73177dd2..5b7e5c70591d 100755 --- a/basic/source/comp/sbcomp.cxx +++ b/basic/source/comp/sbcomp.cxx @@ -261,7 +261,7 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, { aStr.AppendAscii( "Entering " ); } - String aModuleName = pModule->GetName(); + String aModuleName = pTraceMod->GetName(); aStr += aModuleName; if( pMethod != NULL ) { -- cgit From 232ee1a3b01e629ba1d2889e226fe66d8c834224 Mon Sep 17 00:00:00 2001 From: Michael Brauer Date: Fri, 13 Aug 2010 12:52:17 +0200 Subject: mib18: #163285#: Set correct error code in Collection.item and Collection.remove --- basic/source/classes/sb.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index dab060500e05..4afe5cab1e97 100755 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -2086,7 +2086,7 @@ void BasicCollection::CollItem( SbxArray* pPar_ ) if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() ) pRes = xItemArray->Get32( nIndex ); if( !pRes ) - SetError( SbxERR_BAD_INDEX ); + SetError( SbERR_BAD_ARGUMENT ); else *(pPar_->Get(0)) = *pRes; } @@ -2104,6 +2104,6 @@ void BasicCollection::CollRemove( SbxArray* pPar_ ) if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() ) xItemArray->Remove32( nIndex ); else - SetError( SbxERR_BAD_INDEX ); + SetError( SbERR_BAD_ARGUMENT ); } -- cgit From 4d949990ef1438fcae98262519c6af2b47e5ccf5 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 13 Aug 2010 13:28:45 +0200 Subject: mib18: #163225# support long strings in basic --- basic/inc/basic/sbxvar.hxx | 12 +++-- basic/source/classes/sbunoobj.cxx | 2 +- basic/source/sbx/sbxbool.cxx | 18 +++---- basic/source/sbx/sbxbyte.cxx | 10 ++-- basic/source/sbx/sbxchar.cxx | 15 +++--- basic/source/sbx/sbxconv.hxx | 16 +++--- basic/source/sbx/sbxcurr.cxx | 26 +++++----- basic/source/sbx/sbxdate.cxx | 12 +++-- basic/source/sbx/sbxdbl.cxx | 10 ++-- basic/source/sbx/sbxdec.cxx | 20 ++++---- basic/source/sbx/sbxdec.hxx | 4 +- basic/source/sbx/sbxint.cxx | 38 ++++++-------- basic/source/sbx/sbxlng.cxx | 10 ++-- basic/source/sbx/sbxres.cxx | 2 +- basic/source/sbx/sbxres.hxx | 2 +- basic/source/sbx/sbxscan.cxx | 37 ++++++++------ basic/source/sbx/sbxsng.cxx | 10 ++-- basic/source/sbx/sbxstr.cxx | 50 +++++++++--------- basic/source/sbx/sbxuint.cxx | 10 ++-- basic/source/sbx/sbxulng.cxx | 10 ++-- basic/source/sbx/sbxvalue.cxx | 105 ++++++++++++++++++++------------------ basic/source/sbx/sbxvar.cxx | 40 ++++++++------- 22 files changed, 235 insertions(+), 224 deletions(-) diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx index 4d9d19b52a59..0cddcbdf8d17 100644 --- a/basic/inc/basic/sbxvar.hxx +++ b/basic/inc/basic/sbxvar.hxx @@ -178,7 +178,7 @@ struct SbxValues sal_uInt64 uInt64; int nInt; unsigned int nUInt; - String* pString; + ::rtl::OUString* pOUString; SbxDecimal* pDecimal; SbxBase* pObj; @@ -212,7 +212,7 @@ struct SbxValues SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {} SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {} SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {} - SbxValues( const String* _pString ): pString( (String*) _pString ), eType(SbxSTRING) {} + SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {} SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {} SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {} SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {} @@ -237,7 +237,8 @@ class SbxValue : public SbxBase SbxValue* TheRealValue() const; protected: SbxValues aData; // Data - String aPic; // Picture-String + ::rtl::OUString aPic; // Picture-String + String aToolString; // tool string copy virtual void Broadcast( ULONG ); // Broadcast-Call virtual ~SbxValue(); @@ -303,6 +304,7 @@ public: UINT16 GetErr() const; const String& GetString() const; const String& GetCoreString() const; + ::rtl::OUString GetOUString() const; SbxDecimal* GetDecimal() const; SbxBase* GetObject() const; BOOL HasObject() const; @@ -325,8 +327,8 @@ public: BOOL PutDate( double ); BOOL PutBool( BOOL ); BOOL PutErr( USHORT ); - BOOL PutStringExt( const String& ); // with extended analysis (International, "TRUE"/"FALSE") - BOOL PutString( const String& ); + BOOL PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "TRUE"/"FALSE") + BOOL PutString( const ::rtl::OUString& ); BOOL PutString( const sal_Unicode* ); // Type = SbxSTRING BOOL PutpChar( const sal_Unicode* ); // Type = SbxLPSTR BOOL PutDecimal( SbxDecimal* pDecimal ); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 7de2d0c02320..3e775613198b 100755 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -1461,7 +1461,7 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty aRetVal.setValue( &c , getCharCppuType() ); break; } - case TypeClass_STRING: aRetVal <<= ::rtl::OUString( pVar->GetString() ); break; + case TypeClass_STRING: aRetVal <<= pVar->GetOUString(); break; case TypeClass_FLOAT: aRetVal <<= pVar->GetSingle(); break; case TypeClass_DOUBLE: aRetVal <<= pVar->GetDouble(); break; //case TypeClass_OCTET: break; diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx index 728b8e1472b0..3216e401b707 100644 --- a/basic/source/sbx/sbxbool.cxx +++ b/basic/source/sbx/sbxbool.cxx @@ -87,21 +87,20 @@ enum SbxBOOL ImpGetBool( const SbxValues* p ) case SbxSTRING: case SbxLPSTR: nRes = SbxFALSE; - if( p->pString ) + if ( p->pOUString ) { - if( p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_TRUE ) ) ) + if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_TRUE ) ) ) nRes = SbxTRUE; - else if( !p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_FALSE ) ) ) + else if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) ) { // Jetzt kann es noch in eine Zahl konvertierbar sein BOOL bError = TRUE; double n; SbxDataType t; USHORT nLen = 0; - String s( *p->pString ); - if( ImpScan( s, n, t, &nLen ) == SbxERR_OK ) + if( ImpScan( *p->pOUString, n, t, &nLen ) == SbxERR_OK ) { - if( nLen == s.Len() ) + if( nLen == p->pOUString->getLength() ) { bError = FALSE; if( n != 0.0 ) @@ -202,9 +201,10 @@ void ImpPutBool( SbxValues* p, INT16 n ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - *p->pString = SbxRes( n ? STRING_TRUE : STRING_FALSE ); + if ( !p->pOUString ) + p->pOUString = new ::rtl::OUString( SbxRes( n ? STRING_TRUE : STRING_FALSE ) ); + else + *p->pOUString = SbxRes( n ? STRING_TRUE : STRING_FALSE ); break; case SbxOBJECT: diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx index 8485b7105e21..e13c63967fc3 100644 --- a/basic/source/sbx/sbxbyte.cxx +++ b/basic/source/sbx/sbxbyte.cxx @@ -165,13 +165,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXBYTE ) { @@ -279,9 +279,9 @@ void ImpPutByte( SbxValues* p, BYTE n ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx index f9bca67a28d9..bd4ce91f451b 100644 --- a/basic/source/sbx/sbxchar.cxx +++ b/basic/source/sbx/sbxchar.cxx @@ -39,7 +39,7 @@ using namespace rtl; xub_Unicode ImpGetChar( const SbxValues* p ) { SbxValues aTmp; - xub_Unicode nRes; + xub_Unicode nRes = 0; start: switch( +p->eType ) { @@ -156,13 +156,11 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - nRes = 0; - else + if ( p->pOUString ) { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXCHAR ) { @@ -274,9 +272,10 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - *p->pString = n; + if ( !p->pOUString ) + p->pOUString = new ::rtl::OUString( n ); + else + *p->pOUString = ::rtl::OUString( n ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx index c1ada75286ab..16fec542cded 100644 --- a/basic/source/sbx/sbxconv.hxx +++ b/basic/source/sbx/sbxconv.hxx @@ -33,13 +33,13 @@ class SbxArray; // SBXSCAN.CXX -extern void ImpCvtNum( double nNum, short nPrec, String& rRes, BOOL bCoreString=FALSE ); +extern void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString=FALSE ); extern SbxError ImpScan - ( const String& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen, + ( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen, BOOL bAllowIntntl=FALSE, BOOL bOnlyIntntl=FALSE ); // mit erweiterter Auswertung (International, "TRUE"/"FALSE") -extern BOOL ImpConvStringExt( String& rSrc, SbxDataType eTargetType ); +extern BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ); // SBXINT.CXX @@ -116,9 +116,9 @@ void ImpPutDate( SbxValues*, double ); // SBXSTR.CXX -String ImpGetString( const SbxValues* ); -String ImpGetCoreString( const SbxValues* ); -void ImpPutString( SbxValues*, const String* ); +::rtl::OUString ImpGetString( const SbxValues* ); +::rtl::OUString ImpGetCoreString( const SbxValues* ); +void ImpPutString( SbxValues*, const ::rtl::OUString* ); // SBXCHAR.CXX @@ -145,7 +145,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* ); void ImpPutBool( SbxValues*, INT16 ); // ByteArry <--> String -SbxArray* StringToByteArray(const String& rStr); -String ByteArrayToString(SbxArray* pArr); +SbxArray* StringToByteArray(const ::rtl::OUString& rStr); +::rtl::OUString ByteArrayToString(SbxArray* pArr); #endif diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx index 74380f84a75f..e27b11d5166c 100644 --- a/basic/source/sbx/sbxcurr.cxx +++ b/basic/source/sbx/sbxcurr.cxx @@ -37,8 +37,8 @@ #include #include "sbxconv.hxx" -static String ImpCurrencyToString( const SbxINT64& ); -static SbxINT64 ImpStringToCurrency( const String& ); +static ::rtl::OUString ImpCurrencyToString( const SbxINT64& ); +static SbxINT64 ImpStringToCurrency( const ::rtl::OUString& ); SbxINT64 ImpGetCurrency( const SbxValues* p ) { @@ -121,10 +121,10 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes.SetNull(); else - nRes = ImpStringToCurrency( *p->pString ); + nRes = ImpStringToCurrency( *p->pOUString ); break; case SbxOBJECT: { @@ -224,10 +224,10 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; - *p->pString = ImpCurrencyToString( r ); + *p->pOUString = ImpCurrencyToString( r ); break; case SbxOBJECT: { @@ -319,7 +319,7 @@ start: // Hilfs-Funktionen zur Wandlung -static String ImpCurrencyToString( const SbxINT64 &r ) +static ::rtl::OUString ImpCurrencyToString( const SbxINT64 &r ) { BigInt a10000 = 10000; @@ -331,20 +331,20 @@ static String ImpCurrencyToString( const SbxINT64 &r ) aFrac %= a10000; aFrac += a10000; - String aString; + ::rtl::OUString aString; if( r.nHigh < 0 ) - aString = '-'; + aString = ::rtl::OUString( (sal_Unicode)'-' ); aString += aInt.GetString(); - aString += '.'; + aString += ::rtl::OUString( (sal_Unicode)'.' ); aString += aFrac.GetString().GetBuffer()+1; return aString; } -static SbxINT64 ImpStringToCurrency( const String &r ) +static SbxINT64 ImpStringToCurrency( const ::rtl::OUString &r ) { int nDec = 4; String aStr; - const sal_Unicode* p = r.GetBuffer(); + const sal_Unicode* p = r.getStr(); if( *p == '-' ) aStr += *p++; diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx index ce532fed0482..3a0636e4e7fc 100644 --- a/basic/source/sbx/sbxdate.cxx +++ b/basic/source/sbx/sbxdate.cxx @@ -86,7 +86,7 @@ double ImpGetDate( const SbxValues* p ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { @@ -126,7 +126,7 @@ double ImpGetDate( const SbxValues* p ) pFormatter->PutandConvertEntry( aStr, nCheckPos, nType, nIndex, LANGUAGE_GERMAN, eLangType ); - BOOL bSuccess = pFormatter->IsNumberFormat( *p->pString, nIndex, nRes ); + BOOL bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes ); if ( bSuccess ) { short nType_ = pFormatter->GetType( nIndex ); @@ -248,8 +248,8 @@ start: case SbxLPSTR: #ifndef DOS { - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; Color* pColor; LanguageType eLangType = GetpApp()->GetSettings().GetLanguage(); @@ -299,7 +299,9 @@ start: nIndex, LANGUAGE_GERMAN, eLangType ); - pFormatter->GetOutputString( n, nIndex, *p->pString, &pColor ); + String aTmpString; + pFormatter->GetOutputString( n, nIndex, aTmpString, &pColor ); + *p->pOUString = aTmpString; delete pFormatter; #endif break; diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx index 460f331c59b8..be55d3409131 100644 --- a/basic/source/sbx/sbxdbl.cxx +++ b/basic/source/sbx/sbxdbl.cxx @@ -76,7 +76,7 @@ double ImpGetDouble( const SbxValues* p ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) { nRes = 0; if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour @@ -86,7 +86,7 @@ double ImpGetDouble( const SbxValues* p ) { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) { nRes = 0; if ( SbiRuntime::isVBAEnabled() )// VBA only behaviour @@ -188,9 +188,9 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 14, *p->pString, bCoreString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 14, *p->pOUString, bCoreString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx index 319b0aac366c..2191d91c8d82 100644 --- a/basic/source/sbx/sbxdec.cxx +++ b/basic/source/sbx/sbxdec.cxx @@ -211,7 +211,7 @@ void SbxDecimal::setUInt( unsigned int val ) // sbxscan.cxx void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep ); -bool SbxDecimal::setString( String* pString ) +bool SbxDecimal::setString( ::rtl::OUString* pOUString ) { static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ); @@ -224,11 +224,11 @@ bool SbxDecimal::setString( String* pString ) HRESULT hResult; if( cDecimalSep != '.' || cThousandSep != ',' ) { - int nLen = pString->Len(); + int nLen = pOUString->getLength(); sal_Unicode* pBuffer = new sal_Unicode[nLen + 1]; pBuffer[nLen] = 0; - const sal_Unicode* pSrc = pString->GetBuffer(); + const sal_Unicode* pSrc = pOUString->getStr(); int i; for( i = 0 ; i < nLen ; ++i ) pBuffer[i] = pSrc[i]; @@ -248,7 +248,7 @@ bool SbxDecimal::setString( String* pString ) } else { - hResult = VarDecFromStr( (OLECHAR*)pString->GetBuffer(), nLANGID, 0, &maDec ); + hResult = VarDecFromStr( (OLECHAR*)pOUString->getStr(), nLANGID, 0, &maDec ); } bRet = ( hResult == S_OK ); return bRet; @@ -373,7 +373,7 @@ bool SbxDecimal::setSingle( float val ) { (void)val; return false; } bool SbxDecimal::setDouble( double val ) { (void)val; return false; } void SbxDecimal::setInt( int val ) { (void)val; } void SbxDecimal::setUInt( unsigned int val ) { (void)val; } -bool SbxDecimal::setString( String* pString ) { (void)pString; return false; } +bool SbxDecimal::setString( ::rtl::OUString* pOUString ) { (void)pOUString; return false; } bool SbxDecimal::getChar( sal_Unicode& rVal ) { (void)rVal; return false; } bool SbxDecimal::getByte( BYTE& rVal ) { (void)rVal; return false; } @@ -388,7 +388,7 @@ bool SbxDecimal::getUInt( unsigned int& rVal ) { (void)rVal; return false; } #endif -bool SbxDecimal::getString( String& rString ) +bool SbxDecimal::getString( ::rtl::OUString& rString ) { #ifdef WIN32 static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ); @@ -528,7 +528,7 @@ start: case SbxLPSTR: case SbxSTRING: case SbxBYREF | SbxSTRING: - pnDecRes->setString( p->pString ); break; + pnDecRes->setString( p->pOUString ); break; case SbxOBJECT: { SbxValue* pVal = PTR_CAST(SbxValue,p->pObj); @@ -670,10 +670,10 @@ start: case SbxLPSTR: case SbxSTRING: case SbxBYREF | SbxSTRING: - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; // ImpCvtNum( (double) n, 0, *p->pString ); - pDec->getString( *p->pString ); + pDec->getString( *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx index 03f97bec5992..cd80bbad282e 100644 --- a/basic/source/sbx/sbxdec.hxx +++ b/basic/source/sbx/sbxdec.hxx @@ -85,7 +85,7 @@ public: bool setDouble( double val ); void setInt( int val ); void setUInt( unsigned int val ); - bool setString( String* pString ); + bool setString( ::rtl::OUString* pOUString ); void setDecimal( SbxDecimal* pDecimal ) { #ifdef WIN32 @@ -106,7 +106,7 @@ public: bool getDouble( double& rVal ); bool getInt( int& rVal ); bool getUInt( unsigned int& rVal ); - bool getString( String& rString ); + bool getString( ::rtl::OUString& rString ); bool operator -= ( const SbxDecimal &r ); bool operator += ( const SbxDecimal &r ); diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx index 406b8599e568..47c38aecb1c2 100644 --- a/basic/source/sbx/sbxint.cxx +++ b/basic/source/sbx/sbxint.cxx @@ -154,13 +154,13 @@ start: case SbxLPSTR: case SbxSTRING: case SbxBYREF | SbxSTRING: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXINT ) { @@ -275,9 +275,9 @@ start: case SbxLPSTR: case SbxSTRING: case SbxBYREF | SbxSTRING: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { @@ -456,20 +456,19 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { - ::rtl::OUString aOUStr( *p->pString ); ::rtl::OString aOStr = ::rtl::OUStringToOString - ( aOUStr, RTL_TEXTENCODING_ASCII_US ); + ( *p->pOUString, RTL_TEXTENCODING_ASCII_US ); nRes = aOStr.toInt64(); if( nRes == 0 ) { // Check if really 0 or invalid conversion double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else nRes = ImpDoubleToSalInt64( d ); @@ -575,13 +574,12 @@ start: case SbxSTRING: case SbxLPSTR: { - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; ::rtl::OString aOStr = ::rtl::OString::valueOf( n ); - ::rtl::OUString aOUStr = ::rtl::OStringToOUString + (*p->pOUString) = ::rtl::OStringToOUString ( aOStr, RTL_TEXTENCODING_ASCII_US ); - (*p->pString) = aOUStr; break; } case SbxOBJECT: @@ -745,20 +743,19 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { - ::rtl::OUString aOUStr( *p->pString ); ::rtl::OString aOStr = ::rtl::OUStringToOString - ( aOUStr, RTL_TEXTENCODING_ASCII_US ); + ( *p->pOUString, RTL_TEXTENCODING_ASCII_US ); sal_Int64 n64 = aOStr.toInt64(); if( n64 == 0 ) { // Check if really 0 or invalid conversion double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXSALUINT64 ) { @@ -879,16 +876,15 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; if( n > SbxMAXSALINT64 ) SbxBase::SetError( SbxERR_CONVERSION ); else { ::rtl::OString aOStr = ::rtl::OString::valueOf( (sal_Int64)n ); - ::rtl::OUString aOUStr = ::rtl::OStringToOUString + (*p->pOUString) = ::rtl::OStringToOUString ( aOStr, RTL_TEXTENCODING_ASCII_US ); - (*p->pString) = aOUStr; } break; case SbxOBJECT: diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx index c84b087dfc33..1cf2d84061f9 100644 --- a/basic/source/sbx/sbxlng.cxx +++ b/basic/source/sbx/sbxlng.cxx @@ -119,13 +119,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXLNG ) { @@ -240,9 +240,9 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxres.cxx b/basic/source/sbx/sbxres.cxx index f42c400afd91..369349e72069 100644 --- a/basic/source/sbx/sbxres.cxx +++ b/basic/source/sbx/sbxres.cxx @@ -86,6 +86,6 @@ const char* GetSbxRes( USHORT nId ) } SbxRes::SbxRes( USHORT nId ) - : XubString( String::CreateFromAscii( GetSbxRes( nId ) ) ) + : ::rtl::OUString( ::rtl::OUString::createFromAscii( GetSbxRes( nId ) ) ) {} diff --git a/basic/source/sbx/sbxres.hxx b/basic/source/sbx/sbxres.hxx index 8cd0ad26e951..8ed3c7054278 100644 --- a/basic/source/sbx/sbxres.hxx +++ b/basic/source/sbx/sbxres.hxx @@ -75,7 +75,7 @@ #define SBXRES_MAX 44 -class SbxRes : public String +class SbxRes : public ::rtl::OUString { public: SbxRes( USHORT ); diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 3d45818e6401..b8aad9bbf2e4 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -71,10 +71,10 @@ void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep ) // Das ganze gibt auch noch einen Konversionsfehler, wenn der Datentyp // Fixed ist und das ganze nicht hineinpasst! -SbxError ImpScan( const XubString& rWSrc, double& nVal, SbxDataType& rType, +SbxError ImpScan( const ::rtl::OUString& rWSrc, double& nVal, SbxDataType& rType, USHORT* pLen, BOOL bAllowIntntl, BOOL bOnlyIntntl ) { - ByteString aBStr( rWSrc, RTL_TEXTENCODING_ASCII_US ); + ::rtl::OString aBStr( ::rtl::OUStringToOString( rWSrc, RTL_TEXTENCODING_ASCII_US ) ); // Bei International Komma besorgen char cIntntlComma, cIntntl1000; @@ -100,7 +100,7 @@ SbxError ImpScan( const XubString& rWSrc, double& nVal, SbxDataType& rType, cIntntl1000 = (char)cThousandSep; } - const char* pStart = aBStr.GetBuffer(); + const char* pStart = aBStr.getStr(); const char* p = pStart; char buf[ 80 ], *q = buf; BOOL bRes = TRUE; @@ -391,7 +391,7 @@ static void myftoa( double nNum, char * pBuf, short nPrec, short nExpWidth, #pragma warning(disable: 4748) // "... because optimizations are disabled ..." #endif -void ImpCvtNum( double nNum, short nPrec, XubString& rRes, BOOL bCoreString ) +void ImpCvtNum( double nNum, short nPrec, ::rtl::OUString& rRes, BOOL bCoreString ) { char *q; char cBuf[ 40 ], *p = cBuf; @@ -415,18 +415,18 @@ void ImpCvtNum( double nNum, short nPrec, XubString& rRes, BOOL bCoreString ) if( *p == cDecimalSep ) p--; while( *q ) *++p = *q++; *++p = 0; - rRes = String::CreateFromAscii( cBuf ); + rRes = ::rtl::OUString::createFromAscii( cBuf ); } #ifdef _MSC_VER #pragma optimize( "", on ) #endif -BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType ) +BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType ) { // Merken, ob ueberhaupt was geaendert wurde BOOL bChanged = FALSE; - String aNewString; + ::rtl::OUString aNewString; // Nur Spezial-Fälle behandeln, als Default tun wir nichts switch( eTargetType ) @@ -436,7 +436,7 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType ) case SbxDOUBLE: case SbxCURRENCY: { - ByteString aBStr( rSrc, RTL_TEXTENCODING_ASCII_US ); + ::rtl::OString aBStr( ::rtl::OUStringToOString( rSrc, RTL_TEXTENCODING_ASCII_US ) ); // Komma besorgen sal_Unicode cDecimalSep, cThousandSep; @@ -446,10 +446,11 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType ) // Ersetzen, wenn DecimalSep kein '.' (nur den ersten) if( cDecimalSep != (sal_Unicode)'.' ) { - USHORT nPos = aNewString.Search( cDecimalSep ); - if( nPos != STRING_NOTFOUND ) + sal_Int32 nPos = aNewString.indexOf( cDecimalSep ); + if( nPos != -1 ) { - aNewString.SetChar( nPos, '.' ); + sal_Unicode* pStr = (sal_Unicode*)aNewString.getStr(); + pStr[nPos] = (sal_Unicode)'.'; bChanged = TRUE; } } @@ -459,15 +460,15 @@ BOOL ImpConvStringExt( XubString& rSrc, SbxDataType eTargetType ) // Bei BOOL TRUE und FALSE als String pruefen case SbxBOOL: { - if( rSrc.EqualsIgnoreCaseAscii( "true" ) ) + if( rSrc.equalsIgnoreAsciiCaseAscii( "true" ) ) { - aNewString = String::CreateFromInt32(SbxTRUE); + aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxTRUE ); bChanged = TRUE; } else - if( rSrc.EqualsIgnoreCaseAscii( "false" ) ) + if( rSrc.equalsIgnoreAsciiCaseAscii( "false" ) ) { - aNewString = String::CreateFromInt32(SbxFALSE); + aNewString = ::rtl::OUString::valueOf( (sal_Int32)SbxFALSE ); bChanged = TRUE; } break; @@ -935,7 +936,11 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const //old: printfmtnum( GetDouble(), rRes, *pFmt ); } else - ImpCvtNum( GetDouble(), nComma, rRes ); + { + ::rtl::OUString aTmpString( rRes ); + ImpCvtNum( GetDouble(), nComma, aTmpString ); + rRes = aTmpString; + } break; case SbxSTRING: if( pFmt ) diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx index 82507dbe15e9..70ef1653666b 100644 --- a/basic/source/sbx/sbxsng.cxx +++ b/basic/source/sbx/sbxsng.cxx @@ -112,13 +112,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXSNG ) { @@ -237,9 +237,9 @@ start: case SbxSTRING: case SbxLPSTR: { - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 6, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 6, *p->pOUString ); break; } case SbxOBJECT: diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx index 6deb2da29ba1..b4156a116ddc 100644 --- a/basic/source/sbx/sbxstr.cxx +++ b/basic/source/sbx/sbxstr.cxx @@ -44,12 +44,12 @@ using namespace rtl; // Die Konversion eines Items auf String wird ueber die Put-Methoden // der einzelnen Datentypen abgewickelt, um doppelten Code zu vermeiden. -XubString ImpGetString( const SbxValues* p ) +::rtl::OUString ImpGetString( const SbxValues* p ) { SbxValues aTmp; - XubString aRes; + ::rtl::OUString aRes; aTmp.eType = SbxSTRING; - aTmp.pString = &aRes; + aTmp.pOUString = &aRes; switch( +p->eType ) { case SbxNULL: @@ -86,8 +86,8 @@ XubString ImpGetString( const SbxValues* p ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( p->pString ) - aRes = *p->pString; + if ( p->pOUString ) + *aTmp.pOUString = *p->pOUString; break; case SbxOBJECT: { @@ -109,7 +109,7 @@ XubString ImpGetString( const SbxValues* p ) case SbxERROR: // Hier wird der String "Error n" erzeugt aRes = SbxRes( STRING_ERRORMSG ); - aRes += p->nUShort; break; + aRes += ::rtl::OUString( p->nUShort ); break; case SbxDATE: ImpPutDate( &aTmp, p->nDouble ); break; @@ -145,7 +145,7 @@ XubString ImpGetString( const SbxValues* p ) } // AB 10.4.97, neue Funktion fuer SbxValue::GetCoreString() -XubString ImpGetCoreString( const SbxValues* p ) +::rtl::OUString ImpGetCoreString( const SbxValues* p ) { // Vorerst nur fuer double if( ( p->eType & (~SbxBYREF) ) == SbxDOUBLE ) @@ -153,7 +153,6 @@ XubString ImpGetCoreString( const SbxValues* p ) SbxValues aTmp; XubString aRes; aTmp.eType = SbxSTRING; - aTmp.pString = &aRes; if( p->eType == SbxDOUBLE ) ImpPutDouble( &aTmp, p->nDouble, /*bCoreString=*/TRUE ); else @@ -164,15 +163,15 @@ XubString ImpGetCoreString( const SbxValues* p ) return ImpGetString( p ); } -void ImpPutString( SbxValues* p, const XubString* n ) +void ImpPutString( SbxValues* p, const ::rtl::OUString* n ) { SbxValues aTmp; aTmp.eType = SbxSTRING; - XubString* pTmp = NULL; + ::rtl::OUString* pTmp = NULL; // Sicherheitshalber, falls ein NULL-Ptr kommt if( !n ) - n = pTmp = new XubString; - aTmp.pString = (XubString*) n; + n = pTmp = new ::rtl::OUString; + aTmp.pOUString = (::rtl::OUString*)n; switch( +p->eType ) { case SbxCHAR: @@ -209,14 +208,15 @@ void ImpPutString( SbxValues* p, const XubString* n ) case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( n->Len() ) + if( n->getLength() ) { - if( !p->pString ) - p->pString = new XubString; - *p->pString = *n; + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString( *n ); + else + *p->pOUString = *n; } else - delete p->pString, p->pString = NULL; + delete p->pOUString, p->pOUString = NULL; break; case SbxOBJECT: { @@ -258,18 +258,18 @@ void ImpPutString( SbxValues* p, const XubString* n ) } // Convert string to an array of bytes, preserving unicode (2bytes per character) -SbxArray* StringToByteArray(const String& rStr) +SbxArray* StringToByteArray(const ::rtl::OUString& rStr) { - USHORT nArraySize = rStr.Len() * 2; - const sal_Unicode* pSrc = rStr.GetBuffer(); + sal_Int32 nArraySize = rStr.getLength() * 2; + const sal_Unicode* pSrc = rStr.getStr(); SbxDimArray* pArray = new SbxDimArray(SbxBYTE); bool bIncIndex = ( IsBaseIndexOne() && SbiRuntime::isVBAEnabled() ); if( nArraySize ) { if( bIncIndex ) - pArray->AddDim( 1, nArraySize ); + pArray->AddDim32( 1, nArraySize ); else - pArray->AddDim( 0, nArraySize-1 ); + pArray->AddDim32( 0, nArraySize-1 ); } else { @@ -290,7 +290,7 @@ SbxArray* StringToByteArray(const String& rStr) } // Convert an array of bytes to string (2bytes per character) -String ByteArrayToString(SbxArray* pArr) +::rtl::OUString ByteArrayToString(SbxArray* pArr) { USHORT nCount = pArr->Count(); OUStringBuffer aStrBuf; @@ -315,7 +315,5 @@ String ByteArrayToString(SbxArray* pArr) aStrBuf.append(aChar); } - String aStr(aStrBuf.makeStringAndClear()); - - return aStr; + return aStrBuf.makeStringAndClear(); } diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx index ce0aea70b062..5b75a24d6d26 100644 --- a/basic/source/sbx/sbxuint.cxx +++ b/basic/source/sbx/sbxuint.cxx @@ -151,13 +151,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXUINT ) { @@ -272,9 +272,9 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx index 3dd81b8c616d..e0f6f3fa421d 100644 --- a/basic/source/sbx/sbxulng.cxx +++ b/basic/source/sbx/sbxulng.cxx @@ -127,13 +127,13 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) + if( !p->pOUString ) nRes = 0; else { double d; SbxDataType t; - if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK ) + if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK ) nRes = 0; else if( d > SbxMAXULNG ) { @@ -246,9 +246,9 @@ start: case SbxBYREF | SbxSTRING: case SbxSTRING: case SbxLPSTR: - if( !p->pString ) - p->pString = new XubString; - ImpCvtNum( (double) n, 0, *p->pString ); + if( !p->pOUString ) + p->pOUString = new ::rtl::OUString; + ImpCvtNum( (double) n, 0, *p->pOUString ); break; case SbxOBJECT: { diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 7ee31af70556..4ea4836b701b 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -236,7 +236,7 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase() case SbxSINGLE: n |= SbxBYREF; aData.pSingle = (float*) p; break; case SbxDATE: case SbxDOUBLE: n |= SbxBYREF; aData.pDouble = (double*) p; break; - case SbxSTRING: n |= SbxBYREF; aData.pString = (XubString*) p; break; + case SbxSTRING: n |= SbxBYREF; aData.pOUString = (::rtl::OUString*) p; break; case SbxERROR: case SbxUSHORT: case SbxBOOL: n |= SbxBYREF; aData.pUShort = (UINT16*) p; break; @@ -280,8 +280,8 @@ SbxValue::SbxValue( const SbxValue& r ) switch( aData.eType ) { case SbxSTRING: - if( aData.pString ) - aData.pString = new XubString( *aData.pString ); + if( aData.pOUString ) + aData.pOUString = new ::rtl::OUString( *aData.pOUString ); break; case SbxOBJECT: if( aData.pObj ) @@ -309,7 +309,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r ) && aData.pObj && ( aData.pObj->GetType() == (SbxARRAY | SbxBYTE) ) && (r.aData.eType == SbxSTRING) ) { - String aStr = r.GetString(); + ::rtl::OUString aStr = r.GetString(); SbxArray* pArr = StringToByteArray(aStr); PutObject(pArr); return *this; @@ -323,7 +323,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r ) SbxArray* pArr = PTR_CAST(SbxArray, pObj); if( pArr ) { - String aStr = ByteArrayToString( pArr ); + ::rtl::OUString aStr = ByteArrayToString( pArr ); PutString(aStr); return *this; } @@ -385,7 +385,7 @@ void SbxValue::Clear() case SbxVOID: break; case SbxSTRING: - delete aData.pString; aData.pString = NULL; + delete aData.pOUString; aData.pOUString = NULL; break; case SbxOBJECT: if( aData.pObj ) @@ -551,9 +551,9 @@ BOOL SbxValue::Get( SbxValues& rRes ) const case SbxULONG: rRes.nULong = ImpGetULong( &p->aData ); break; case SbxLPSTR: case SbxSTRING: p->aPic = ImpGetString( &p->aData ); - rRes.pString = &p->aPic; break; + rRes.pOUString = &p->aPic; break; case SbxCoreSTRING: p->aPic = ImpGetCoreString( &p->aData ); - rRes.pString = &p->aPic; break; + rRes.pOUString = &p->aPic; break; case SbxINT: #if SAL_TYPES_SIZEOFINT == 2 rRes.nInt = (int) ImpGetInteger( &p->aData ); @@ -618,13 +618,11 @@ const XubString& SbxValue::GetString() const SbxValues aRes; aRes.eType = SbxSTRING; if( Get( aRes ) ) - // Geht in Ordnung, da Ptr eine Kopie ist - return *aRes.pString; + ((SbxValue*) this)->aToolString = *aRes.pOUString; else - { - ((SbxValue*) this)->aPic.Erase(); - return aPic; - } + ((SbxValue*) this)->aToolString.Erase(); + + return aToolString; } const XubString& SbxValue::GetCoreString() const @@ -632,13 +630,22 @@ const XubString& SbxValue::GetCoreString() const SbxValues aRes; aRes.eType = SbxCoreSTRING; if( Get( aRes ) ) - // Geht in Ordnung, da Ptr eine Kopie ist - return *aRes.pString; + ((SbxValue*) this)->aToolString = *aRes.pOUString; else - { - ((SbxValue*) this)->aPic.Erase(); - return aPic; - } + ((SbxValue*) this)->aToolString.Erase(); + + return aToolString; +} + +::rtl::OUString SbxValue::GetOUString() const +{ + ::rtl::OUString aResult; + SbxValues aRes; + aRes.eType = SbxSTRING; + if( Get( aRes ) ) + aResult = *aRes.pOUString; + + return aResult; } BOOL SbxValue::HasObject() const @@ -727,7 +734,7 @@ BOOL SbxValue::Put( const SbxValues& rVal ) case SbxUSHORT: ImpPutUShort( &p->aData, rVal.nUShort ); break; case SbxULONG: ImpPutULong( &p->aData, rVal.nULong ); break; case SbxLPSTR: - case SbxSTRING: ImpPutString( &p->aData, rVal.pString ); break; + case SbxSTRING: ImpPutString( &p->aData, rVal.pOUString ); break; case SbxINT: #if SAL_TYPES_SIZEOFINT == 2 ImpPutInteger( &p->aData, (INT16) rVal.nInt ); @@ -803,10 +810,10 @@ BOOL SbxValue::Put( const SbxValues& rVal ) // werden koennen, wenn Floats mit ',' als Dezimaltrenner oder BOOLs // explizit mit "TRUE" oder "FALSE" angegeben werden. // Implementierung in ImpConvStringExt (SBXSCAN.CXX) -BOOL SbxValue::PutStringExt( const XubString& r ) +BOOL SbxValue::PutStringExt( const ::rtl::OUString& r ) { // Kopieren, bei Unicode gleich konvertieren - String aStr( r ); + ::rtl::OUString aStr( r ); // Eigenen Typ bestimmen (nicht wie in Put() mit TheRealValue(), // Objekte werden sowieso nicht behandelt) @@ -820,9 +827,9 @@ BOOL SbxValue::PutStringExt( const XubString& r ) // sonst Original (Unicode bleibt erhalten) BOOL bRet; if( ImpConvStringExt( aStr, eTargetType ) ) - aRes.pString = (XubString*)&aStr; + aRes.pOUString = (::rtl::OUString*)&aStr; else - aRes.pString = (XubString*)&r; + aRes.pOUString = (::rtl::OUString*)&r; // #34939: Bei Strings. die eine Zahl enthalten und wenn this einen // Num-Typ hat, Fixed-Flag setzen, damit der Typ nicht veraendert wird @@ -851,10 +858,10 @@ BOOL SbxValue::PutStringExt( const XubString& r ) BOOL SbxValue::PutString( const xub_Unicode* p ) { - XubString aVal( p ); + ::rtl::OUString aVal( p ); SbxValues aRes; aRes.eType = SbxSTRING; - aRes.pString = &aVal; + aRes.pOUString = &aVal; Put( aRes ); return BOOL( !IsError() ); } @@ -909,19 +916,19 @@ BOOL SbxValue::fillAutomationDecimal BOOL SbxValue::PutpChar( const xub_Unicode* p ) { - XubString aVal( p ); + ::rtl::OUString aVal( p ); SbxValues aRes; aRes.eType = SbxLPSTR; - aRes.pString = &aVal; + aRes.pOUString = &aVal; Put( aRes ); return BOOL( !IsError() ); } -BOOL SbxValue::PutString( const XubString& r ) +BOOL SbxValue::PutString( const ::rtl::OUString& r ) { SbxValues aRes; aRes.eType = SbxSTRING; - aRes.pString = (XubString*) &r; + aRes.pOUString = (::rtl::OUString*) &r; Put( aRes ); return BOOL( !IsError() ); } @@ -986,14 +993,14 @@ BOOL SbxValue::ImpIsNumeric( BOOL bOnlyIntntl ) const SbxDataType t = GetType(); if( t == SbxSTRING ) { - if( aData.pString ) + if( aData.pOUString ) { - XubString s( *aData.pString ); + ::rtl::OUString s( *aData.pOUString ); double n; SbxDataType t2; USHORT nLen = 0; if( ImpScan( s, n, t2, &nLen, /*bAllowIntntl*/FALSE, bOnlyIntntl ) == SbxERR_OK ) - return BOOL( nLen == s.Len() ); + return BOOL( nLen == s.getLength() ); } return FALSE; } @@ -1046,7 +1053,7 @@ BOOL SbxValue::SetType( SbxDataType t ) switch( aData.eType ) { case SbxSTRING: - delete aData.pString; + delete aData.pOUString; break; case SbxOBJECT: if( aData.pObj && aData.pObj != this ) @@ -1163,14 +1170,14 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) Get( aL ); // #30576: Erstmal testen, ob Wandlung geklappt hat - if( aL.pString != NULL && aR.pString != NULL ) + if( aL.pOUString != NULL && aR.pOUString != NULL ) { - *aL.pString += *aR.pString; + *aL.pOUString += *aR.pOUString; } // Nicht einmal Left OK? - else if( aL.pString == NULL ) + else if( aL.pOUString == NULL ) { - aL.pString = new String(); + aL.pOUString = new ::rtl::OUString(); } Put( aL ); } @@ -1493,17 +1500,17 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const if( Get( aL ) && rOp.Get( aR ) ) switch( eOp ) { case SbxEQ: - bRes = BOOL( *aL.pString == *aR.pString ); break; + bRes = BOOL( *aL.pOUString == *aR.pOUString ); break; case SbxNE: - bRes = BOOL( *aL.pString != *aR.pString ); break; + bRes = BOOL( *aL.pOUString != *aR.pOUString ); break; case SbxLT: - bRes = BOOL( *aL.pString < *aR.pString ); break; + bRes = BOOL( *aL.pOUString < *aR.pOUString ); break; case SbxGT: - bRes = BOOL( *aL.pString > *aR.pString ); break; + bRes = BOOL( *aL.pOUString > *aR.pOUString ); break; case SbxLE: - bRes = BOOL( *aL.pString <= *aR.pString ); break; + bRes = BOOL( *aL.pOUString <= *aR.pOUString ); break; case SbxGE: - bRes = BOOL( *aL.pString >= *aR.pString ); break; + bRes = BOOL( *aL.pOUString >= *aR.pOUString ); break; default: SetError( SbxERR_NOTIMP ); } @@ -1668,9 +1675,9 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT ) XubString aVal; r.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US ); if( aVal.Len() ) - aData.pString = new XubString( aVal ); + aData.pOUString = new ::rtl::OUString( aVal ); else - aData.pString = NULL; // JSM 22.09.1995 + aData.pOUString = NULL; // JSM 22.09.1995 break; } case SbxERROR: @@ -1781,9 +1788,9 @@ BOOL SbxValue::StoreData( SvStream& r ) const break; } case SbxSTRING: - if( aData.pString ) + if( aData.pOUString ) { - r.WriteByteString( *aData.pString, RTL_TEXTENCODING_ASCII_US ); + r.WriteByteString( *aData.pOUString, RTL_TEXTENCODING_ASCII_US ); } else { diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 20060f1f7493..58e3c1ae92c2 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -239,9 +239,9 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const if( i ) aTmp += ','; if( q->nFlags & SBX_OPTIONAL ) - aTmp += SbxRes( STRING_OPTIONAL ); + aTmp += String( SbxRes( STRING_OPTIONAL ) ); if( q->eType & SbxBYREF ) - aTmp += SbxRes( STRING_BYREF ); + aTmp += String( SbxRes( STRING_BYREF ) ); aTmp += q->aName; cType = ' '; // Kurzer Typ? Dann holen, evtl. ist dieser 0. @@ -263,12 +263,12 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const // langer Typ? if( t != SbxNAME_SHORT ) { - aTmp += SbxRes( STRING_AS ); + aTmp += String( SbxRes( STRING_AS ) ); if( nt < 32 ) - aTmp += SbxRes( - sal::static_int_cast< USHORT >( STRING_TYPES + nt ) ); + aTmp += String( SbxRes( + sal::static_int_cast< USHORT >( STRING_TYPES + nt ) ) ); else - aTmp += SbxRes( STRING_ANY ); + aTmp += String( SbxRes( STRING_ANY ) ); } } } @@ -276,15 +276,15 @@ const XubString& SbxVariable::GetName( SbxNameType t ) const // Langer Typ? Dann holen if( t == SbxNAME_LONG_TYPES && et != SbxEMPTY ) { - aTmp += SbxRes( STRING_AS ); + aTmp += String( SbxRes( STRING_AS ) ); if( et < 32 ) - aTmp += SbxRes( - sal::static_int_cast< USHORT >( STRING_TYPES + et ) ); + aTmp += String( SbxRes( + sal::static_int_cast< USHORT >( STRING_TYPES + et ) ) ); else - aTmp += SbxRes( STRING_ANY ); + aTmp += String( SbxRes( STRING_ANY ) ); } - ((SbxVariable*) this)->aPic = aTmp; - return aPic; + ((SbxVariable*) this)->aToolString = aTmp; + return aToolString; } // Einen simplen Hashcode erzeugen: Es werden die ersten 6 Zeichen gewertet. @@ -431,9 +431,10 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) if( nType == SbxNULL && GetClass() == SbxCLASS_METHOD ) nType = SbxEMPTY; SbxValues aTmp; - XubString aVal; + String aTmpString; + ::rtl::OUString aVal; aTmp.eType = aData.eType = (SbxDataType) nType; - aTmp.pString = &aVal; + aTmp.pOUString = &aVal; switch( nType ) { case SbxBOOL: @@ -445,10 +446,10 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) case SbxSINGLE: { // Floats als ASCII - rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US ); + rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US ); double d; SbxDataType t; - if( ImpScan( aVal, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE ) + if( ImpScan( aTmpString, d, t, NULL ) != SbxERR_OK || t == SbxDOUBLE ) { aTmp.nSingle = 0; return FALSE; @@ -460,9 +461,9 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) case SbxDOUBLE: { // Floats als ASCII - rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US ); + rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US ); SbxDataType t; - if( ImpScan( aVal, aTmp.nDouble, t, NULL ) != SbxERR_OK ) + if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK ) { aTmp.nDouble = 0; return FALSE; @@ -470,7 +471,8 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer ) break; } case SbxSTRING: - rStrm.ReadByteString( aVal, RTL_TEXTENCODING_ASCII_US ); + rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US ); + aVal = aTmpString; break; case SbxEMPTY: case SbxNULL: -- cgit From 5df1941a50f21012cb1b44c46e57e8b29467544b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 13 Aug 2010 14:48:18 +0200 Subject: mib18: #163278# handle the internal VBA types correctly --- basic/source/classes/sbunoobj.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 3e775613198b..c9123b06341b 100755 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -301,7 +301,12 @@ SbUnoObject* createOLEObject_Impl( const String& aType ) SbUnoObject* pUnoObj = NULL; if( xOLEFactory.is() ) { - Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aType ); + // some type names available in VBA can not be directly used in COM + ::rtl::OUString aOLEType = aType; + if ( aOLEType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SAXXMLReader30" ) ) ) ) + aOLEType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Msxml2.SAXXMLReader.3.0" ) ); + + Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aOLEType ); if( xOLEObject.is() ) { Any aAny; -- cgit From 41b94861a16cb202c6aeb42c3e206a43f039e793 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Fri, 13 Aug 2010 17:51:00 +0200 Subject: mib18: wae --- basic/source/runtime/step0.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index 596b30b9d691..06a8bb19af00 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -442,7 +442,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b // Check value, !object is no error for sure if, only if type is fixed SbxDataType eValType = refVal->GetType(); - bool bGetValObject = false; +// bool bGetValObject = false; if( !bHandleDefaultProp && eValType != SbxOBJECT && !(eValType & SbxARRAY) && refVal->IsFixed() ) { Error( SbERR_INVALID_USAGE_OBJECT ); -- cgit From c26a9b2de55a47496d9cdbf4d75ccdf3572fc008 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Fri, 13 Aug 2010 17:59:32 +0200 Subject: mib18: wae --- basic/source/classes/sb.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 4afe5cab1e97..056c2ea38c4c 100755 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -569,10 +569,10 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule ) SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase); if( pClassModuleObj != NULL ) { - SbModule* pClassModule = pClassModuleObj->getClassModule(); - SbClassModuleObject* pNewObj = new SbClassModuleObject( pClassModule ); + SbModule* pLclClassModule = pClassModuleObj->getClassModule(); + SbClassModuleObject* pNewObj = new SbClassModuleObject( pLclClassModule ); pNewObj->SetName( pProp->GetName() ); - pNewObj->SetParent( pClassModule->pParent ); + pNewObj->SetParent( pLclClassModule->pParent ); pNewProp->PutObject( pNewObj ); } else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) ) -- cgit From 53cf0e655767a9e7b7a12eae6e856f5064134199 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 17 Aug 2010 12:59:19 +0200 Subject: ooo33gsl06: #i113919# fix page range behavior for 3.3 --- filter/source/pdf/pdfexport.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 8115f36d76f8..43f6f1faf2f1 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -791,7 +791,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue pPDFExtOutDevData->SetIsReduceImageResolution( mbReduceImageResolution ); pPDFExtOutDevData->SetIsExportNamedDestinations( mbExportBmkToDest ); - Sequence< PropertyValue > aRenderOptions( 6 ); + Sequence< PropertyValue > aRenderOptions( 5 ); aRenderOptions[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ); aRenderOptions[ 0 ].Value <<= Reference< awt::XDevice >( pXDevice ); aRenderOptions[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ); @@ -801,10 +801,14 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue aRenderOptions[ 2 ].Value <<= sal_True; aRenderOptions[ 3 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsLastPage" ) ); aRenderOptions[ 3 ].Value <<= sal_False; - aRenderOptions[ 4 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ); - aRenderOptions[ 4 ].Value <<= aPageRange; - aRenderOptions[ 5 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ); - aRenderOptions[ 5 ].Value <<= mbSkipEmptyPages; + aRenderOptions[ 4 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ); + aRenderOptions[ 4 ].Value <<= mbSkipEmptyPages; + #if 0 + // #i113919# writer has to begun "PageRange" for itself changing its renderer count + // we should unify this behavior but not for OOo 3.3 + aRenderOptions[ 5 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ); + aRenderOptions[ 5 ].Value <<= aPageRange; + #endif if( aPageRange.getLength() || !aSelection.hasValue() ) { -- cgit From 30ff826ddc974f37c72d2d74b3934ed691a7ef7e Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 17 Aug 2010 16:46:36 +0200 Subject: cws sw33bf08: #i113584#, #i113587# transliteration fixed --- .../source/transliteration/transliterationImpl.cxx | 1 - .../transliteration/transliteration_body.cxx | 273 +++++++++------------ 2 files changed, 116 insertions(+), 158 deletions(-) diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index dfadecfd5eb7..2109c310b233 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -295,7 +295,6 @@ OUString SAL_CALL TransliterationImpl::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) throw(RuntimeException) { - if (numCascade == 0) return inStr; diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index b58347826470..43222b7a41eb 100755 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -35,6 +35,7 @@ #include #include +#include #include "characterclassificationImpl.hxx" #include "breakiteratorImpl.hxx" @@ -96,7 +97,7 @@ static sal_uInt8 lcl_getMappingTypeForToggleCase( sal_uInt8 nMappingType, sal_Un nRes = MappingTypeLowerToUpper; else { - OSL_ENSURE( nType & 0x01 /* upper case */, "uppercase character expected! 'Toggle case' failed?" ); + // should also work properly for non-upper characters like white spacs, numbers, ... nRes = MappingTypeUpperToLower; } } @@ -330,185 +331,143 @@ Transliteration_titlecase::Transliteration_titlecase() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_titlecase"; } -rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( - const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, - Sequence< sal_Int32 >& /*offset*/ ) - throw(RuntimeException) +#if 0 +struct LigatureData { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - CharacterClassificationImpl aCharClassImpl( xMSF ); - - // possible problem: the locale is not exactly specific for each word in the text... - OUString aRes( aCharClassImpl.toTitle( inStr, startPos, nCount, aLocale ) ); - return aRes; + sal_uInt32 cChar; + sal_Char * pUtf8Text; +}; + +// available Unicode ligatures: +// http://www.unicode.org/charts +// http://www.unicode.org/charts/PDF/UFB00.pdf +static LigatureData aLigatures[] = +{ + { 0x0FB00, "ff" }, + { 0x0FB01, "fi" }, + { 0x0FB02, "fl" }, + { 0x0FB03, "ffi" }, + { 0x0FB04, "ffl" }, + { 0x0FB05, "ft" }, + { 0x0FB06, "st" }, + + { 0x0FB13, "\xD5\xB4\xD5\xB6" }, // Armenian small men now + { 0x0FB14, "\xD5\xB4\xD5\xA5" }, // Armenian small men ech + { 0x0FB15, "\xD5\xB4\xD5\xAB" }, // Armenian small men ini + { 0x0FB16, "\xD5\xBE\xD5\xB6" }, // Armenian small vew now + { 0x0FB17, "\xD5\xB4\xD5\xAD" }, // Armenian small men xeh + { 0x00000, "" } +}; + +static inline bool lcl_IsLigature( sal_uInt32 cChar ) +{ + return (0x0FB00 <= cChar && cChar <= 0x0FB06) || (0x0FB13 <= cChar && cChar <= 0x0FB17); } -Transliteration_sentencecase::Transliteration_sentencecase() +static rtl::OUString lcl_ResolveLigature( sal_uInt32 cChar ) { - nMappingType = MappingTypeToTitle; // though only to be applied to the first word... - transliterationName = "sentence(generic)"; - implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase"; + rtl::OUString aRes; + if (lcl_IsLigature( cChar )) + { + LigatureData *pFound = NULL; + LigatureData *pData = aLigatures; + while (!pFound && pData->cChar != 0) + { + if (pData->cChar == cChar) + pFound = pData; + ++pData; + } + if (pFound) + aRes = rtl::OUString( pFound->pUtf8Text, strlen( pFound->pUtf8Text ), RTL_TEXTENCODING_UTF8 ); + } + else + aRes = rtl::OUString( &cChar, 1 ); + return aRes; } +#endif // if 0 -rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( +static rtl::OUString transliterate_titlecase_Impl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + const Locale &rLocale, Sequence< sal_Int32 >& offset ) throw(RuntimeException) { - // inspired from Transliteration_body::transliterate - sal_Int32 nOffCount = 0, i; - bool bPoint = true; - if (useOffset) - { - for( i = 0; i < nCount; ++i ) { - sal_Unicode c = inStr.getStr()[ i + startPos ]; - if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { - bPoint = true; - nOffCount++; - } - else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) - { - const Mapping* map = 0; - if( bPoint && unicode::isLower( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); - bPoint = false; - } - else if (!bPoint && unicode::isUpper( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); - } - - if(map == 0) - { - nOffCount++; - } - else - { - nOffCount += map->nmap; - } - } - else - { - nOffCount++; - } - } - } - - bPoint = true; - rtl::OUStringBuffer result; + const OUString aText( inStr.copy( startPos, nCount ) ); - if (useOffset) + OUString aRes; + if (aText.getLength() > 0) { - result.ensureCapacity(nOffCount); - if ( nOffCount != offset.getLength() ) - offset.realloc( nOffCount ); - } - - - sal_Int32 j = 0; - sal_Int32 * pArr = offset.getArray(); - for( i = 0; i < nCount; ++i ) { - sal_Unicode c = inStr.getStr()[ i + startPos ]; - if( sal_Unicode('.') == c || sal_Unicode('!') == c || sal_Unicode('?') == c ) { - bPoint = true; - result.append(c); - pArr[j++] = i + startPos; - } - else if( unicode::isAlpha( c ) || unicode::isDigit( c ) ) - { - const Mapping* map = 0; - if( bPoint && unicode::isLower( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeLowerToUpper); - } - else if (!bPoint && unicode::isUpper( c )) - { - map = &casefolding::getValue(&c, 0, 1, aLocale, MappingTypeUpperToLower); - } - - if(map == 0) - { - result.append( c ); - pArr[j++] = i + startPos; - } - else - { - for (sal_Int32 k = 0; k < map->nmap; k++) - { - result.append( map->map[k] ); - pArr[j++] = i + startPos; - } - } - bPoint = false; - } - else + Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + CharacterClassificationImpl aCharClassImpl( xMSF ); + + // because aCharClassImpl.toTitle does not handle ligatures or ß but will raise + // an exception we need to handle the first chara manually... + + // we don't want to change surrogates by accident, thuse we use proper code point iteration + sal_Int32 nPos = 0; + sal_uInt32 cFirstChar = aText.iterateCodePoints( &nPos ); + OUString aResolvedLigature( &cFirstChar, 1 ); //lcl_ResolveLigature( cFirstChar ) ); + // toUpper can be used to properly resolve ligatures and characters like ß + aResolvedLigature = aCharClassImpl.toUpper( aResolvedLigature, 0, aResolvedLigature.getLength(), rLocale ); + // since toTitle will leave all-uppercase text unchanged we first need to + // use toLower to bring possible 2nd and following charas in lowercase + aResolvedLigature = aCharClassImpl.toLower( aResolvedLigature, 0, aResolvedLigature.getLength(), rLocale ); + sal_Int32 nResolvedLen = aResolvedLigature.getLength(); + + // now we can properly use toTitle to get the expected result for the resolved string. + // The rest of the text should just become lowercase. + aRes = aCharClassImpl.toTitle( aResolvedLigature, 0, nResolvedLen, rLocale ); + aRes += aCharClassImpl.toLower( aText, 1, aText.getLength() - 1, rLocale ); + offset.realloc( aRes.getLength() ); + + sal_Int32 *pOffset = offset.getArray(); + sal_Int32 nLen = offset.getLength(); + for (sal_Int32 i = 0; i < nLen; ++i) { - result.append( c ); - pArr[j++] = i + startPos; + sal_Int32 nIdx = 0; + if (i >= nResolvedLen) + nIdx = i - nResolvedLen + 1; + pOffset[i] = nIdx; } } - return result.makeStringAndClear(); +#if OSL_DEBUG_LEVEL > 1 + const sal_Int32 *pCOffset = offset.getConstArray(); + (void) pCOffset; +#endif + + return aRes; } -#if 0 -// TL: alternative implemntation try. But breakiterator has its problem too since -// beginOfSentence does not work as expected with '.'. See comment below. -// For the time being I will leave this code here as a from-scratch sample if the -// breakiterator works better at some point... -rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( - const OUString& inStr, sal_Int32 nStartPos, sal_Int32 nCount, - Sequence< sal_Int32 >& /*offset*/ ) + +// this function expects to be called on a word-by-word basis, +// namely that startPos points to the first char of the word +rtl::OUString SAL_CALL Transliteration_titlecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset ) throw(RuntimeException) { - OUString aRes( inStr.copy( nStartPos, nCount ) ); + return transliterate_titlecase_Impl( inStr, startPos, nCount, aLocale, offset ); +} - if (nStartPos >= 0 && nStartPos < inStr.getLength() && nCount > 0) - { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - BreakIteratorImpl brk( xMSF ); - sal_Int32 nSentenceStart = -1, nOldSentenceStart = -1; - sal_Int32 nPos = nStartPos + nCount - 1; - while (nPos >= nStartPos && nPos != -1) - { - // possible problem: the locale is not exactly specific for each sentence in the text, - // but it is the only one we have... - nOldSentenceStart = nSentenceStart; - nSentenceStart = brk.beginOfSentence( inStr, nPos, aLocale ); - - // since the breakiterator completely ignores '.' characvters as end-of-sentence when - // the next word is lower case we need to take care of that ourself. The drawback: - // la mid-sentence abbreviation like e.g. will now be identified as end-of-sentence. :-( - // Well, at least the other product does it in the same way... - sal_Int32 nFullStopPos = inStr.lastIndexOf( (sal_Unicode)'.', nPos ); - nPos = nSentenceStart; - if (nFullStopPos > 0 && nFullStopPos > nSentenceStart) - { - Boundary aBd2 = brk.nextWord( inStr, nFullStopPos, aLocale, WordType::DICTIONARY_WORD ); - nSentenceStart = aBd2.startPos; - nPos = nFullStopPos; - } +Transliteration_sentencecase::Transliteration_sentencecase() +{ + nMappingType = MappingTypeToTitle; // though only to be applied to the first word... + transliterationName = "sentence(generic)"; + implementationName = "com.sun.star.i18n.Transliteration.Transliteration_sentencecase"; +} - if (nSentenceStart < nOldSentenceStart || nOldSentenceStart == -1) - { - // the sentence start might be a quotation mark or some kind of bracket, thus - // we need the first dictionary word starting or following this position - // Boundary aBd1 = brk.nextWord( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD ); - Boundary aBd2 = brk.getWordBoundary( inStr, nSentenceStart, aLocale, WordType::DICTIONARY_WORD, true ); - // OUString aWord1( inStr.copy( aBd1.startPos, aBd1.endPos - aBd1.startPos + 1 ) ); - OUString aWord2( inStr.copy( aBd2.startPos, aBd2.endPos - aBd2.startPos + 1 ) ); - } - else - break; // prevent endless loop - // continue with previous sentence - if (nPos != -1) - --nPos; - } - } - return aRes; +// this function expects to be called on a sentence-by-sentence basis, +// namely that startPos points to the first word (NOT first char!) in the sentence +rtl::OUString SAL_CALL Transliteration_sentencecase::transliterate( + const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, + Sequence< sal_Int32 >& offset ) + throw(RuntimeException) +{ + return transliterate_titlecase_Impl( inStr, startPos, nCount, aLocale, offset ); } -#endif + } } } } + -- cgit From afb2f41ca982b7e0cbc8a5b4952ea3edfbb2a883 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 17 Aug 2010 16:46:36 +0200 Subject: cws sw33bf08: #i113584#, #i113587# transliteration fixed --- editeng/source/editeng/impedit.hxx | 3 + editeng/source/editeng/impedit4.cxx | 369 ++++++++++++++++++++++++++++++------ 2 files changed, 312 insertions(+), 60 deletions(-) diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index ede5acacc698..c8f5e2948665 100755 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -1002,6 +1003,8 @@ public: void SetAutoCompleteText( const String& rStr, sal_Bool bUpdateTipWindow ); EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode ); + short ReplaceTextOnly( ContentNode* pNode, USHORT nCurrentStart, xub_StrLen nLen, const String& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rOffsets ); + void SetAsianCompressionMode( USHORT n ); USHORT GetAsianCompressionMode() const { return nAsianCompressionMode; } diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 482cd6d71338..6f216f7b22ca 100755 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -76,6 +76,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -83,6 +86,8 @@ #include #include +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -2798,8 +2803,23 @@ void ImpEditEngine::SetAutoCompleteText( const String& rStr, sal_Bool bClearTipW #endif // !SVX_LIGHT } + +struct TransliterationChgData +{ + USHORT nStart; + xub_StrLen nLen; + EditSelection aSelection; + String aNewText; + uno::Sequence< sal_Int32 > aOffsets; +}; + + EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode ) { + uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() ); + if (!_xBI.is()) + return rSelection; + EditSelection aSel( rSelection ); aSel.Adjust( aEditDoc ); @@ -2808,8 +2828,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, EditSelection aNewSel( aSel ); - USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); - USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); + const USHORT nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() ); + const USHORT nEndNode = aEditDoc.GetPos( aSel.Max().GetNode() ); BOOL bChanges = FALSE; BOOL bLenChanged = FALSE; @@ -2832,83 +2852,266 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, USHORT nCurrentEnd = nEndPos; sal_uInt16 nLanguage = LANGUAGE_SYSTEM; - do - { - if ( bConsiderLanguage ) + // since we don't use Hiragana/Katakana or half-width/full-width transliterations here + // it is fine to use ANYWORD_IGNOREWHITESPACES. (ANY_WORD btw is broken and will + // occasionaly miss words in consecutive sentences). Also with ANYWORD_IGNOREWHITESPACES + // text like 'just-in-time' will be converted to 'Just-In-Time' which seems to be the + // proper thing to do. + const sal_Int16 nWordType = i18n::WordType::ANYWORD_IGNOREWHITESPACES; + + //! In order to have less trouble with changing text size, e.g. because + //! of ligatures or � (German small sz) being resolved, we need to process + //! the text replacements from end to start. + //! This way the offsets for the yet to be changed words will be + //! left unchanged by the already replaced text. + //! For this we temporarily save the changes to be done in this vector + std::vector< TransliterationChgData > aChanges; + TransliterationChgData aChgData; + + if (nTransliterationMode == i18n::TransliterationModulesExtra::TITLE_CASE) + { + // for 'capitalize every word' we need to iterate over each word + + i18n::Boundary aSttBndry; + i18n::Boundary aEndBndry; + aSttBndry = _xBI->getWordBoundary( + *pNode, nStartPos, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ), + nWordType, TRUE /*prefer forward direction*/); + aEndBndry = _xBI->getWordBoundary( + *pNode, nEndPos, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ), + nWordType, FALSE /*prefer backward direction*/); + + // prevent backtracking to the previous word if selection is at word boundary + if (aSttBndry.endPos <= nStartPos) + { + aSttBndry = _xBI->nextWord( + *pNode, aSttBndry.endPos, + SvxCreateLocale( GetLanguage( EditPaM( pNode, aSttBndry.endPos + 1 ) ) ), + nWordType); + } + // prevent advancing to the next word if selection is at word boundary + if (aEndBndry.startPos >= nEndPos) { - nLanguage = GetLanguage( EditPaM( pNode, nCurrentStart+1 ), &nCurrentEnd ); - if ( nCurrentEnd > nEndPos ) - nCurrentEnd = nEndPos; + aEndBndry = _xBI->previousWord( + *pNode, aEndBndry.startPos, + SvxCreateLocale( GetLanguage( EditPaM( pNode, aEndBndry.startPos + 1 ) ) ), + nWordType); } - xub_StrLen nLen = nCurrentEnd - nCurrentStart; + i18n::Boundary aCurWordBndry( aSttBndry ); + while (aCurWordBndry.startPos <= aEndBndry.startPos) + { + nCurrentStart = (xub_StrLen)aCurWordBndry.startPos; + nCurrentEnd = (xub_StrLen)aCurWordBndry.endPos; + sal_Int32 nLen = nCurrentEnd - nCurrentStart; + DBG_ASSERT( nLen > 0, "invalid word length of 0" ); +#if OSL_DEBUG_LEVEL > 1 + String aText( pNode->Copy( nCurrentStart, nLen ) ); +#endif + + Sequence< sal_Int32 > aOffsets; + String aNewText( aTranslitarationWrapper.transliterate( *pNode, + GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ), + nCurrentStart, nLen, &aOffsets )); + + if (!pNode->Equals( aNewText, nCurrentStart, nLen )) + { + aChgData.nStart = nCurrentStart; + aChgData.nLen = nLen; + aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) ); + aChgData.aNewText = aNewText; + aChgData.aOffsets = aOffsets; + aChanges.push_back( aChgData ); + } +#if OSL_DEBUG_LEVEL > 1 + String aSelTxt ( GetSelected( aChgData.aSelection ) ); + (void) aSelTxt; +#endif + + aCurWordBndry = _xBI->nextWord( *pNode, nCurrentEnd, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), + nWordType); + } + DBG_ASSERT( nCurrentEnd >= aEndBndry.endPos, "failed to reach end of transliteration" ); + } + else if (nTransliterationMode == i18n::TransliterationModulesExtra::SENTENCE_CASE) + { + // for 'sentence case' we need to iterate sentence by sentence + + sal_Int32 nLastStart = _xBI->beginOfSentence( + *pNode, nEndPos, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ) ); + sal_Int32 nLastEnd = _xBI->endOfSentence( + *pNode, nLastStart, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ) ); - Sequence aOffsets; - String aNewText( aTranslitarationWrapper.transliterate( *pNode, nLanguage, nCurrentStart, nLen, &aOffsets ) ); + // extend nCurrentStart, nCurrentEnd to the current sentence boundaries + nCurrentStart = _xBI->beginOfSentence( + *pNode, nStartPos, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ) ); + nCurrentEnd = _xBI->endOfSentence( + *pNode, nCurrentStart, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) ); - if( ( nLen != aNewText.Len() ) || !pNode->Equals( aNewText, nCurrentStart, nLen ) ) + // prevent backtracking to the previous sentence if selection starts at end of a sentence + if (nCurrentEnd <= nStartPos) { - bChanges = TRUE; - if ( nLen != aNewText.Len() ) - bLenChanged = TRUE; + // now nCurrentStart is probably located on a non-letter word. (unless we + // are in Asian text with no spaces...) + // Thus to get the real sentence start we should locate the next real word, + // that is one found by DICTIONARY_WORD + i18n::Boundary aBndry = _xBI->nextWord( *pNode, nCurrentEnd, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), + i18n::WordType::DICTIONARY_WORD); + + // now get new current sentence boundaries + nCurrentStart = _xBI->beginOfSentence( + *pNode, aBndry.startPos, + SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) ); + nCurrentEnd = _xBI->endOfSentence( + *pNode, nCurrentStart, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) ); + } + // prevent advancing to the next sentence if selection ends at start of a sentence + if (nLastStart >= nEndPos) + { + // now nCurrentStart is probably located on a non-letter word. (unless we + // are in Asian text with no spaces...) + // Thus to get the real sentence start we should locate the previous real word, + // that is one found by DICTIONARY_WORD + i18n::Boundary aBndry = _xBI->previousWord( *pNode, nLastStart, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ), + i18n::WordType::DICTIONARY_WORD); + nLastEnd = _xBI->endOfSentence( + *pNode, aBndry.startPos, + SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) ); + if (nCurrentEnd > nLastEnd) + nCurrentEnd = nLastEnd; + } -#ifndef SVX_LIGHT - // Create UndoAction on Demand.... - if ( !pUndo && IsUndoEnabled() && !IsInUndo() ) - { - ESelection aESel( CreateESel( aSel ) ); - pUndo = new EditUndoTransliteration( this, aESel, nTransliterationMode ); + while (nCurrentStart < nLastEnd) + { + sal_Int32 nLen = nCurrentEnd - nCurrentStart; + DBG_ASSERT( nLen > 0, "invalid word length of 0" ); +#if OSL_DEBUG_LEVEL > 1 + String aText( pNode->Copy( nCurrentStart, nLen ) ); +#endif - if ( ( nStartNode == nEndNode ) && !aSel.Min().GetNode()->GetCharAttribs().HasAttrib( aSel.Min().GetIndex(), aSel.Max().GetIndex() ) ) - pUndo->SetText( aSel.Min().GetNode()->Copy( aSel.Min().GetIndex(), aSel.Max().GetIndex()-aSel.Min().GetIndex() ) ); - else - pUndo->SetText( CreateBinTextObject( aSel, NULL ) ); + Sequence< sal_Int32 > aOffsets; + String aNewText( aTranslitarationWrapper.transliterate( *pNode, + GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ), + nCurrentStart, nLen, &aOffsets )); + + if (!pNode->Equals( aNewText, nCurrentStart, nLen )) + { + aChgData.nStart = nCurrentStart; + aChgData.nLen = nLen; + aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) ); + aChgData.aNewText = aNewText; + aChgData.aOffsets = aOffsets; + aChanges.push_back( aChgData ); } -#endif - // Change text without loosing the attributes - USHORT nCharsAfterTransliteration = - sal::static_int_cast< USHORT >(aOffsets.getLength()); - const sal_Int32* pOffsets = aOffsets.getConstArray(); - short nDiffs = 0; - for ( USHORT n = 0; n < nCharsAfterTransliteration; n++ ) + i18n::Boundary aFirstWordBndry; + aFirstWordBndry = _xBI->nextWord( + *pNode, nCurrentEnd, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), + nWordType); + nCurrentStart = aFirstWordBndry.startPos; + nCurrentEnd = _xBI->endOfSentence( + *pNode, nCurrentStart, + SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) ); + } + DBG_ASSERT( nCurrentEnd >= nLastEnd, "failed to reach end of transliteration" ); + } + else + { + do + { + if ( bConsiderLanguage ) { - USHORT nCurrentPos = nCurrentStart+n; - sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n]; + nLanguage = GetLanguage( EditPaM( pNode, nCurrentStart+1 ), &nCurrentEnd ); + if ( nCurrentEnd > nEndPos ) + nCurrentEnd = nEndPos; + } - if ( !nDiff ) - { - DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" ); - pNode->SetChar( nCurrentPos, aNewText.GetChar(n) ); - } - else if ( nDiff < 0 ) - { - // Replace first char, delete the rest... - DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" ); - pNode->SetChar( nCurrentPos, aNewText.GetChar(n) ); + xub_StrLen nLen = nCurrentEnd - nCurrentStart; - DBG_ASSERT( (nCurrentPos+1) < pNode->Len(), "TransliterateText - String smaller than expected!" ); - GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< USHORT >(-nDiff) ); - } - else - { - DBG_ASSERT( nDiff == 1, "TransliterateText - Diff other than expected! But should work..." ); - GetEditDoc().InsertText( EditPaM( pNode, nCurrentPos ), aNewText.GetChar(n) ); + Sequence< sal_Int32 > aOffsets; + String aNewText( aTranslitarationWrapper.transliterate( *pNode, nLanguage, nCurrentStart, nLen, &aOffsets ) ); - } - nDiffs = sal::static_int_cast< short >(nDiffs + nDiff); + if (!pNode->Equals( aNewText, nCurrentStart, nLen )) + { + aChgData.nStart = nCurrentStart; + aChgData.nLen = nLen; + aChgData.aSelection = EditSelection( EditPaM( pNode, nCurrentStart ), EditPaM( pNode, nCurrentEnd ) ); + aChgData.aNewText = aNewText; + aChgData.aOffsets = aOffsets; + aChanges.push_back( aChgData ); } - if ( nNode == nEndNode ) - aNewSel.Max().GetIndex() = - aNewSel.Max().GetIndex() + nDiffs; + nCurrentStart = nCurrentEnd; + } while( nCurrentEnd < nEndPos ); + } + + if (aChanges.size() > 0) + { +#ifndef SVX_LIGHT + // Create a single UndoAction on Demand for all the changes ... + if ( !pUndo && IsUndoEnabled() && !IsInUndo() ) + { + // adjust selection to include all changes + for (size_t i = 0; i < aChanges.size(); ++i) + { + const EditSelection &rSel = aChanges[i].aSelection; + if (aSel.Min().GetNode() == rSel.Min().GetNode() && + aSel.Min().GetIndex() > rSel.Min().GetIndex()) + aSel.Min().SetIndex( rSel.Min().GetIndex() ); + if (aSel.Max().GetNode() == rSel.Max().GetNode() && + aSel.Max().GetIndex() < rSel.Max().GetIndex()) + aSel.Max().SetIndex( rSel.Max().GetIndex() ); + } + aNewSel = aSel; + + ESelection aESel( CreateESel( aSel ) ); + pUndo = new EditUndoTransliteration( this, aESel, nTransliterationMode ); + + const bool bSingleNode = aSel.Min().GetNode()== aSel.Max().GetNode(); + const bool bHasAttribs = aSel.Min().GetNode()->GetCharAttribs().HasAttrib( aSel.Min().GetIndex(), aSel.Max().GetIndex() ); + if (bSingleNode && !bHasAttribs) + pUndo->SetText( aSel.Min().GetNode()->Copy( aSel.Min().GetIndex(), aSel.Max().GetIndex()-aSel.Min().GetIndex() ) ); + else + pUndo->SetText( CreateBinTextObject( aSel, NULL ) ); + } +#endif + + // now apply the changes from end to start to leave the offsets of the + // yet unchanged text parts remain the same. + for (size_t i = 0; i < aChanges.size(); ++i) + { + const TransliterationChgData &rData = aChanges[ aChanges.size() - 1 - i ]; - ParaPortion* pParaPortion = GetParaPortions()[nNode]; - pParaPortion->MarkSelectionInvalid( nCurrentStart, std::max< USHORT >( nCurrentStart+nLen, nCurrentStart+aNewText.Len() ) ); + bChanges = TRUE; + if (rData.nLen != rData.aNewText.Len()) + bLenChanged = TRUE; + // Change text without loosing the attributes + USHORT nDiffs = ReplaceTextOnly( rData.aSelection.Min().GetNode(), + rData.nStart, rData.nLen, rData.aNewText, rData.aOffsets ); + + // adjust selection in end node to possibly changed size + if (aSel.Max().GetNode() == rData.aSelection.Max().GetNode()) + aNewSel.Max().GetIndex() = aNewSel.Max().GetIndex() + nDiffs; + + USHORT nSelNode = aEditDoc.GetPos( rData.aSelection.Min().GetNode() ); + ParaPortion* pParaPortion = GetParaPortions()[nSelNode]; + pParaPortion->MarkSelectionInvalid( rData.nStart, + std::max< USHORT >( rData.nStart + rData.nLen, + rData.nStart + rData.aNewText.Len() ) ); } - nCurrentStart = nCurrentEnd; - } while( nCurrentEnd < nEndPos ); + } // if (aChanges.size() > 0) } #ifndef SVX_LIGHT @@ -2932,6 +3135,52 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, return aNewSel; } + +short ImpEditEngine::ReplaceTextOnly( + ContentNode* pNode, + USHORT nCurrentStart, xub_StrLen nLen, + const String& rNewText, + const uno::Sequence< sal_Int32 >& rOffsets ) +{ + (void) nLen; + + // Change text without loosing the attributes + USHORT nCharsAfterTransliteration = + sal::static_int_cast< USHORT >(rOffsets.getLength()); + const sal_Int32* pOffsets = rOffsets.getConstArray(); + short nDiffs = 0; + for ( USHORT n = 0; n < nCharsAfterTransliteration; n++ ) + { + USHORT nCurrentPos = nCurrentStart+n; + sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n]; + + if ( !nDiff ) + { + DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" ); + pNode->SetChar( nCurrentPos, rNewText.GetChar(n) ); + } + else if ( nDiff < 0 ) + { + // Replace first char, delete the rest... + DBG_ASSERT( nCurrentPos < pNode->Len(), "TransliterateText - String smaller than expected!" ); + pNode->SetChar( nCurrentPos, rNewText.GetChar(n) ); + + DBG_ASSERT( (nCurrentPos+1) < pNode->Len(), "TransliterateText - String smaller than expected!" ); + GetEditDoc().RemoveChars( EditPaM( pNode, nCurrentPos+1 ), sal::static_int_cast< USHORT >(-nDiff) ); + } + else + { + DBG_ASSERT( nDiff == 1, "TransliterateText - Diff other than expected! But should work..." ); + GetEditDoc().InsertText( EditPaM( pNode, nCurrentPos ), rNewText.GetChar(n) ); + + } + nDiffs = sal::static_int_cast< short >(nDiffs + nDiff); + } + + return nDiffs; +} + + void ImpEditEngine::SetAsianCompressionMode( USHORT n ) { if ( n != nAsianCompressionMode ) -- cgit From 3404d2fe8e50e3bc0efc91ccba9796fef73b3d5c Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 17 Aug 2010 16:46:36 +0200 Subject: cws sw33bf08: #i113584#, #i113587# transliteration fixed --- sw/inc/undobj.hxx | 6 +- sw/source/core/doc/docedt.cxx | 33 +++-- sw/source/core/txtnode/txtedt.cxx | 271 +++++++++++++++++++++++++++++++++----- sw/source/core/undo/unovwr.cxx | 136 +++++++++---------- 4 files changed, 326 insertions(+), 120 deletions(-) diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx index cf92a707e40f..7f16e4e4d44c 100644 --- a/sw/inc/undobj.hxx +++ b/sw/inc/undobj.hxx @@ -27,9 +27,7 @@ #ifndef SW_UNDOBJ_HXX #define SW_UNDOBJ_HXX -// --> OD 2006-11-01 #130889# #include -// <-- #include #include @@ -1718,7 +1716,7 @@ public: struct _UndoTransliterate_Data; class SwUndoTransliterate : public SwUndo, public SwUndRng { - _UndoTransliterate_Data *pData, *pLastData; + std::vector< _UndoTransliterate_Data * > aChanges; sal_uInt32 nType; public: @@ -1732,7 +1730,7 @@ public: void AddChanges( SwTxtNode& rTNd, xub_StrLen nStart, xub_StrLen nLen, ::com::sun::star::uno::Sequence & rOffsets ); - BOOL HasData() const {return 0 != pData; } + BOOL HasData() const { return aChanges.size() > 0; } }; //-------------------------------------------------------------------- diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 31484ac303dd..bdcf8caaff7b 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -72,6 +73,8 @@ #include #include +#include + using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::linguistic2; @@ -2653,8 +2656,9 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) } -void SwDoc::TransliterateText( const SwPaM& rPaM, - utl::TransliterationWrapper& rTrans ) +void SwDoc::TransliterateText( + const SwPaM& rPaM, + utl::TransliterationWrapper& rTrans ) { SwUndoTransliterate* pUndo; if( DoesUndo() ) @@ -2663,15 +2667,17 @@ void SwDoc::TransliterateText( const SwPaM& rPaM, pUndo = 0; const SwPosition* pStt = rPaM.Start(), - * pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark() - : rPaM.GetPoint(); - ULONG nSttNd = pStt->nNode.GetIndex(), nEndNd = pEnd->nNode.GetIndex(); + * pEnd = rPaM.End(); + ULONG nSttNd = pStt->nNode.GetIndex(), + nEndNd = pEnd->nNode.GetIndex(); xub_StrLen nSttCnt = pStt->nContent.GetIndex(), nEndCnt = pEnd->nContent.GetIndex(); SwTxtNode* pTNd = pStt->nNode.GetNode().GetTxtNode(); - if( pStt == pEnd && pTNd ) // no region ? + if( pStt == pEnd && pTNd ) // no selection? { + // set current word as 'area of effect' + Boundary aBndry; if( pBreakIt->GetBreakIter().is() ) aBndry = pBreakIt->GetBreakIter()->getWordBoundary( @@ -2687,21 +2693,24 @@ void SwDoc::TransliterateText( const SwPaM& rPaM, } } - if( nSttNd != nEndNd ) + if( nSttNd != nEndNd ) // is more than one text node involved? { + // iterate over all effected text nodes, the first and the last one + // may be incomplete because the selection starts and/or ends there + SwNodeIndex aIdx( pStt->nNode ); if( nSttCnt ) { aIdx++; if( pTNd ) - pTNd->TransliterateText( rTrans, nSttCnt, - pTNd->GetTxt().Len(), pUndo ); + pTNd->TransliterateText( rTrans, nSttCnt, pTNd->GetTxt().Len(), pUndo ); } for( ; aIdx.GetIndex() < nEndNd; aIdx++ ) + { if( 0 != ( pTNd = aIdx.GetNode().GetTxtNode() )) - pTNd->TransliterateText( rTrans, 0, pTNd->GetTxt().Len(), - pUndo ); + pTNd->TransliterateText( rTrans, 0, pTNd->GetTxt().Len(), pUndo ); + } if( nEndCnt && 0 != ( pTNd = pEnd->nNode.GetNode().GetTxtNode() )) pTNd->TransliterateText( rTrans, 0, nEndCnt, pUndo ); @@ -2721,6 +2730,8 @@ void SwDoc::TransliterateText( const SwPaM& rPaM, } SetModified(); } + + #define MAX_REDLINE_COUNT 250 // ----------------------------------------------------------------------------- void SwDoc::checkRedlining(RedlineMode_t& _rReadlineMode) diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 944eb70b2c3d..0630dbd722b6 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -36,6 +36,7 @@ #include // clock() #include #endif + #include #include #include @@ -46,9 +47,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -86,6 +84,15 @@ #include +#include +#include +#include +#include +#include + +#include + + using rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::frame; @@ -1578,49 +1585,247 @@ void SwLinguStatistik::Flush() #endif + +struct TransliterationChgData +{ + xub_StrLen nStart; + xub_StrLen nLen; + String sChanged; + Sequence< sal_Int32 > aOffsets; +}; + // change text to Upper/Lower/Hiragana/Katagana/... -void SwTxtNode::TransliterateText( utl::TransliterationWrapper& rTrans, - xub_StrLen nStt, xub_StrLen nEnd, SwUndoTransliterate* pUndo ) +void SwTxtNode::TransliterateText( + utl::TransliterationWrapper& rTrans, + xub_StrLen nStt, xub_StrLen nEnd, + SwUndoTransliterate* pUndo ) { - if( nStt < nEnd ) + if (nStt < nEnd && pBreakIt->GetBreakIter().is()) { - SwLanguageIterator* pIter; - if( rTrans.needLanguageForTheMode() ) - pIter = new SwLanguageIterator( *this, nStt ); - else - pIter = 0; + // since we don't use Hiragana/Katakana or half-width/full-width transliterations here + // it is fine to use ANYWORD_IGNOREWHITESPACES. (ANY_WORD btw is broken and will + // occasionaly miss words in consecutive sentences). Also with ANYWORD_IGNOREWHITESPACES + // text like 'just-in-time' will be converted to 'Just-In-Time' which seems to be the + // proper thing to do. + const sal_Int16 nWordType = WordType::ANYWORD_IGNOREWHITESPACES; + + //! In order to have less trouble with changing text size, e.g. because + //! of ligatures or � (German small sz) being resolved, we need to process + //! the text replacements from end to start. + //! This way the offsets for the yet to be changed words will be + //! left unchanged by the already replaced text. + //! For this we temporarily save the changes to be done in this vector + std::vector< TransliterationChgData > aChanges; + TransliterationChgData aChgData; + + if (rTrans.getType() == (sal_uInt32)TransliterationModulesExtra::TITLE_CASE) + { + // for 'capitalize every word' we need to iterate over each word + + Boundary aSttBndry; + Boundary aEndBndry; + aSttBndry = pBreakIt->GetBreakIter()->getWordBoundary( + GetTxt(), nStt, + pBreakIt->GetLocale( GetLang( nStt ) ), + nWordType, + TRUE /*prefer forward direction*/); + aEndBndry = pBreakIt->GetBreakIter()->getWordBoundary( + GetTxt(), nEnd, + pBreakIt->GetLocale( GetLang( nEnd ) ), + nWordType, + FALSE /*prefer backward direction*/); + + // prevent backtracking to the previous word if selection is at word boundary + if (aSttBndry.endPos <= nStt) + { + aSttBndry = pBreakIt->GetBreakIter()->nextWord( + GetTxt(), aSttBndry.endPos, + pBreakIt->GetLocale( GetLang( aSttBndry.endPos ) ), + nWordType); + } + // prevent advancing to the next word if selection is at word boundary + if (aEndBndry.startPos >= nEnd) + { + aEndBndry = pBreakIt->GetBreakIter()->previousWord( + GetTxt(), aEndBndry.startPos, + pBreakIt->GetLocale( GetLang( aEndBndry.startPos ) ), + nWordType); + } - xub_StrLen nEndPos; - sal_uInt16 nLang; - do { - if( pIter ) + Boundary aCurWordBndry( aSttBndry ); + while (aCurWordBndry.startPos <= aEndBndry.startPos) { - nLang = pIter->GetLanguage(); - nEndPos = pIter->GetChgPos(); - if( nEndPos > nEnd ) - nEndPos = nEnd; + nStt = (xub_StrLen)aCurWordBndry.startPos; + nEnd = (xub_StrLen)aCurWordBndry.endPos; + sal_Int32 nLen = nEnd - nStt; + DBG_ASSERT( nLen > 0, "invalid word length of 0" ); +#if OSL_DEBUG_LEVEL > 1 + String aText( GetTxt().Copy( nStt, nLen ) ); +#endif + + Sequence aOffsets; + String sChgd( rTrans.transliterate( GetTxt(), GetLang( nStt ), nStt, nLen, &aOffsets )); + + if (!m_Text.Equals( sChgd, nStt, nLen )) + { + aChgData.nStart = nStt; + aChgData.nLen = nLen; + aChgData.sChanged = sChgd; + aChgData.aOffsets = aOffsets; + aChanges.push_back( aChgData ); + } + + aCurWordBndry = pBreakIt->GetBreakIter()->nextWord( + GetTxt(), nEnd, + pBreakIt->GetLocale( GetLang( nEnd ) ), + nWordType); } - else + } + else if (rTrans.getType() == (sal_uInt32)TransliterationModulesExtra::SENTENCE_CASE) + { + // for 'sentence case' we need to iterate sentence by sentence + + sal_Int32 nLastStart = pBreakIt->GetBreakIter()->beginOfSentence( + GetTxt(), nEnd, + pBreakIt->GetLocale( GetLang( nEnd ) ) ); + sal_Int32 nLastEnd = pBreakIt->GetBreakIter()->endOfSentence( + GetTxt(), nLastStart, + pBreakIt->GetLocale( GetLang( nLastStart ) ) ); + + // extend nStt, nEnd to the current sentence boundaries + sal_Int32 nCurrentStart = pBreakIt->GetBreakIter()->beginOfSentence( + GetTxt(), nStt, + pBreakIt->GetLocale( GetLang( nStt ) ) ); + sal_Int32 nCurrentEnd = pBreakIt->GetBreakIter()->endOfSentence( + GetTxt(), nCurrentStart, + pBreakIt->GetLocale( GetLang( nCurrentStart ) ) ); + + // prevent backtracking to the previous sentence if selection starts at end of a sentence + if (nCurrentEnd <= nStt) + { + // now nCurrentStart is probably located on a non-letter word. (unless we + // are in Asian text with no spaces...) + // Thus to get the real sentence start we should locate the next real word, + // that is one found by DICTIONARY_WORD + i18n::Boundary aBndry = pBreakIt->GetBreakIter()->nextWord( + GetTxt(), nCurrentEnd, + pBreakIt->GetLocale( GetLang( nCurrentEnd ) ), + i18n::WordType::DICTIONARY_WORD); + + // now get new current sentence boundaries + nCurrentStart = pBreakIt->GetBreakIter()->beginOfSentence( + GetTxt(), aBndry.startPos, + pBreakIt->GetLocale( GetLang( aBndry.startPos) ) ); + nCurrentEnd = pBreakIt->GetBreakIter()->endOfSentence( + GetTxt(), nCurrentStart, + pBreakIt->GetLocale( GetLang( nCurrentStart) ) ); + } + // prevent advancing to the next sentence if selection ends at start of a sentence + if (nLastStart >= nEnd) { - nLang = LANGUAGE_SYSTEM; - nEndPos = nEnd; + // now nCurrentStart is probably located on a non-letter word. (unless we + // are in Asian text with no spaces...) + // Thus to get the real sentence start we should locate the previous real word, + // that is one found by DICTIONARY_WORD + i18n::Boundary aBndry = pBreakIt->GetBreakIter()->previousWord( + GetTxt(), nLastStart, + pBreakIt->GetLocale( GetLang( nLastStart) ), + i18n::WordType::DICTIONARY_WORD); + nLastEnd = pBreakIt->GetBreakIter()->endOfSentence( + GetTxt(), aBndry.startPos, + pBreakIt->GetLocale( GetLang( aBndry.startPos) ) ); + if (nCurrentEnd > nLastEnd) + nCurrentEnd = nLastEnd; } - xub_StrLen nLen = nEndPos - nStt; - Sequence aOffsets; - String sChgd( rTrans.transliterate( m_Text, nLang, nStt, nLen, - &aOffsets )); - if( !m_Text.Equals( sChgd, nStt, nLen ) ) + while (nCurrentStart < nLastEnd) { - if ( pUndo ) + sal_Int32 nLen = nCurrentEnd - nCurrentStart; + DBG_ASSERT( nLen > 0, "invalid word length of 0" ); +#if OSL_DEBUG_LEVEL > 1 + String aText( GetTxt().Copy( nCurrentStart, nLen ) ); +#endif + + Sequence aOffsets; + String sChgd( rTrans.transliterate( GetTxt(), + GetLang( nCurrentStart ), nCurrentStart, nLen, &aOffsets )); + + if (!m_Text.Equals( sChgd, nStt, nLen )) { - pUndo->AddChanges( *this, nStt, nLen, aOffsets ); + aChgData.nStart = nCurrentStart; + aChgData.nLen = nLen; + aChgData.sChanged = sChgd; + aChgData.aOffsets = aOffsets; + aChanges.push_back( aChgData ); } - ReplaceTextOnly( nStt, nLen, sChgd, aOffsets ); + + Boundary aFirstWordBndry; + aFirstWordBndry = pBreakIt->GetBreakIter()->nextWord( + GetTxt(), nCurrentEnd, + pBreakIt->GetLocale( GetLang( nCurrentEnd ) ), + nWordType); + nCurrentStart = aFirstWordBndry.startPos; + nCurrentEnd = pBreakIt->GetBreakIter()->endOfSentence( + GetTxt(), nCurrentStart, + pBreakIt->GetLocale( GetLang( nCurrentStart ) ) ); } - nStt = nEndPos; - } while( nEndPos < nEnd && pIter && pIter->Next() ); - delete pIter; + } + else + { + // here we may transliterate over complete language portions... + + SwLanguageIterator* pIter; + if( rTrans.needLanguageForTheMode() ) + pIter = new SwLanguageIterator( *this, nStt ); + else + pIter = 0; + + xub_StrLen nEndPos; + sal_uInt16 nLang; + do { + if( pIter ) + { + nLang = pIter->GetLanguage(); + nEndPos = pIter->GetChgPos(); + if( nEndPos > nEnd ) + nEndPos = nEnd; + } + else + { + nLang = LANGUAGE_SYSTEM; + nEndPos = nEnd; + } + xub_StrLen nLen = nEndPos - nStt; + + Sequence aOffsets; + String sChgd( rTrans.transliterate( m_Text, nLang, nStt, nLen, &aOffsets )); + + if (!m_Text.Equals( sChgd, nStt, nLen )) + { + aChgData.nStart = nStt; + aChgData.nLen = nLen; + aChgData.sChanged = sChgd; + aChgData.aOffsets = aOffsets; + aChanges.push_back( aChgData ); + } + + nStt = nEndPos; + } while( nEndPos < nEnd && pIter && pIter->Next() ); + delete pIter; + } + + if (aChanges.size() > 0) + { + // now apply the changes from end to start to leave the offsets of the + // yet unchanged text parts remain the same. + for (size_t i = 0; i < aChanges.size(); ++i) + { + TransliterationChgData &rData = aChanges[ aChanges.size() - 1 - i ]; + if (pUndo) + pUndo->AddChanges( *this, rData.nStart, rData.nLen, rData.aOffsets ); + ReplaceTextOnly( rData.nStart, rData.nLen, rData.sChanged, rData.aOffsets ); + } + } } } diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index 8254d431b079..91549c84a57e 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -352,16 +352,14 @@ SwRewriter SwUndoOverwrite::GetRewriter() const struct _UndoTransliterate_Data { - String sText; - _UndoTransliterate_Data* pNext; - SwHistory* pHistory; - Sequence * pOffsets; - ULONG nNdIdx; - xub_StrLen nStart, nLen; - - _UndoTransliterate_Data( ULONG nNd, xub_StrLen nStt, xub_StrLen nStrLen, - const String& rTxt ) - : sText( rTxt ), pNext( 0 ), pHistory( 0 ), pOffsets( 0 ), + String sText; + SwHistory* pHistory; + Sequence< sal_Int32 >* pOffsets; + ULONG nNdIdx; + xub_StrLen nStart, nLen; + + _UndoTransliterate_Data( ULONG nNd, xub_StrLen nStt, xub_StrLen nStrLen, const String& rTxt ) + : sText( rTxt ), pHistory( 0 ), pOffsets( 0 ), nNdIdx( nNd ), nStart( nStt ), nLen( nStrLen ) {} ~_UndoTransliterate_Data() { delete pOffsets; delete pHistory; } @@ -369,22 +367,17 @@ struct _UndoTransliterate_Data void SetChangeAtNode( SwDoc& rDoc ); }; -SwUndoTransliterate::SwUndoTransliterate( const SwPaM& rPam, - const utl::TransliterationWrapper& rTrans ) - : SwUndo( UNDO_TRANSLITERATE ), SwUndRng( rPam ), - pData( 0 ), pLastData( 0 ), nType( rTrans.getType() ) +SwUndoTransliterate::SwUndoTransliterate( + const SwPaM& rPam, + const utl::TransliterationWrapper& rTrans ) + : SwUndo( UNDO_TRANSLITERATE ), SwUndRng( rPam ), nType( rTrans.getType() ) { } SwUndoTransliterate::~SwUndoTransliterate() { - _UndoTransliterate_Data* pD = pData; - while( pD ) - { - pData = pD; - pD = pD->pNext; - delete pData; - } + for (size_t i = 0; i < aChanges.size(); ++i) + delete aChanges[i]; } void SwUndoTransliterate::Undo( SwUndoIter& rUndoIter ) @@ -393,8 +386,12 @@ void SwUndoTransliterate::Undo( SwUndoIter& rUndoIter ) BOOL bUndo = rDoc.DoesUndo(); rDoc.DoUndo( FALSE ); - for( _UndoTransliterate_Data* pD = pData; pD; pD = pD->pNext ) - pD->SetChangeAtNode( rDoc ); + // since the changes were added to the vector from the end of the string/node towards + // the start, we need to revert them from the start towards the end now to keep the + // offset information of the undo data in sync with the changing text. + // Thus we need to iterate from the end of the vector to the start + for (sal_Int32 i = aChanges.size() - 1; i >= 0; --i) + aChanges[i]->SetChangeAtNode( rDoc ); rDoc.DoUndo( bUndo ); SetPaM( rUndoIter, TRUE ); @@ -413,8 +410,7 @@ void SwUndoTransliterate::Repeat( SwUndoIter& rUndoIter ) SwPaM& rPam = *rUndoIter.pAktPam; SwDoc& rDoc = rUndoIter.GetDoc(); - utl::TransliterationWrapper aTrans( - ::comphelper::getProcessServiceFactory(), nType ); + utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), nType ); rDoc.TransliterateText( rPam, aTrans ); rUndoIter.pLastUndoObj = this; @@ -428,67 +424,63 @@ void SwUndoTransliterate::AddChanges( SwTxtNode& rTNd, _UndoTransliterate_Data* pNew = new _UndoTransliterate_Data( rTNd.GetIndex(), nStart, (xub_StrLen)nOffsLen, rTNd.GetTxt().Copy( nStart, nLen )); - if( pData ) - pLastData->pNext = pNew; - else - pData = pNew; - pLastData = pNew; + + aChanges.push_back( pNew ); const sal_Int32* pOffsets = rOffsets.getConstArray(); // where did we need less memory ? const sal_Int32* p = pOffsets; for( long n = 0; n < nOffsLen; ++n, ++p ) - if( *p != ( nStart + n )) + if( *p != ( nStart + n )) + { + // create the Offset array + pNew->pOffsets = new Sequence ( nLen ); + sal_Int32* pIdx = pNew->pOffsets->getArray(); + p = pOffsets; + long nMyOff, nNewVal = nStart; + for( n = 0, nMyOff = nStart; n < nOffsLen; ++p, ++n, ++nMyOff ) { - // create the Offset array - pNew->pOffsets = new Sequence ( nLen ); - sal_Int32* pIdx = pNew->pOffsets->getArray(); - p = pOffsets; - long nMyOff, nNewVal = nStart; - for( n = 0, nMyOff = nStart; n < nOffsLen; ++p, ++n, ++nMyOff ) + if( *p < nMyOff ) { - if( *p < nMyOff ) - { - // something is deleted - nMyOff = *p; - *(pIdx-1) = nNewVal++; - } - else if( *p > nMyOff ) - { - for( ; *p > nMyOff; ++nMyOff ) - *pIdx++ = nNewVal; - --nMyOff; - --n; - --p; - } - else - *pIdx++ = nNewVal++; + // something is deleted + nMyOff = *p; + *(pIdx-1) = nNewVal++; } - - // and then we need to save the attributes/bookmarks - // but this data must moved every time to the last in the chain! - _UndoTransliterate_Data* pD = pData; - while( pD != pNew ) + else if( *p > nMyOff ) { - if( pD->nNdIdx == pNew->nNdIdx && pD->pHistory ) - { - // same node and have a history? - pNew->pHistory = pD->pHistory; - pD->pHistory = 0; - break; // more can't exist - } - pD = pD->pNext; + for( ; *p > nMyOff; ++nMyOff ) + *pIdx++ = nNewVal; + --nMyOff; + --n; + --p; } + else + *pIdx++ = nNewVal++; + } - if( !pNew->pHistory ) + // and then we need to save the attributes/bookmarks + // but this data must moved every time to the last in the chain! + for (size_t i = 0; i + 1 < aChanges.size(); ++i) // check all changes but not the current one + { + _UndoTransliterate_Data* pD = aChanges[i]; + if( pD->nNdIdx == pNew->nNdIdx && pD->pHistory ) { - pNew->pHistory = new SwHistory; - SwRegHistory aRHst( rTNd, pNew->pHistory ); - pNew->pHistory->CopyAttr( rTNd.GetpSwpHints(), - pNew->nNdIdx, 0, rTNd.GetTxt().Len(), false ); + // same node and have a history? + pNew->pHistory = pD->pHistory; + pD->pHistory = 0; + break; // more can't exist } - break; } + + if( !pNew->pHistory ) + { + pNew->pHistory = new SwHistory; + SwRegHistory aRHst( rTNd, pNew->pHistory ); + pNew->pHistory->CopyAttr( rTNd.GetpSwpHints(), + pNew->nNdIdx, 0, rTNd.GetTxt().Len(), false ); + } + break; + } } void _UndoTransliterate_Data::SetChangeAtNode( SwDoc& rDoc ) -- cgit From a5afefb8208117e402e64a604d58fd714009d13a Mon Sep 17 00:00:00 2001 From: va Date: Tue, 17 Aug 2010 17:54:18 +0200 Subject: #i112533# Updated Franch AutoCorr --- extras/source/autotext/lang/fr/acor_fr-FR.dat | Bin 31897 -> 4650 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/extras/source/autotext/lang/fr/acor_fr-FR.dat b/extras/source/autotext/lang/fr/acor_fr-FR.dat index 0179749c780e..c2277b6e0d54 100644 Binary files a/extras/source/autotext/lang/fr/acor_fr-FR.dat and b/extras/source/autotext/lang/fr/acor_fr-FR.dat differ -- cgit From 6916ec405e20a62bccc5a11f515c932e7e5cd968 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 18 Aug 2010 13:50:02 +0200 Subject: cws sw33bf08: #i113867# removing en-US dictionaries from Ukrainian language pack --- setup_native/source/packinfo/spellchecker_selection.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/setup_native/source/packinfo/spellchecker_selection.txt b/setup_native/source/packinfo/spellchecker_selection.txt index 8d5cb0fc83b8..1ca0f231bfdc 100644 --- a/setup_native/source/packinfo/spellchecker_selection.txt +++ b/setup_native/source/packinfo/spellchecker_selection.txt @@ -44,6 +44,7 @@ sr = "sr,en-US" sh = "sr,en-US" sw = "sw,en-US" th = "th,en-US" +uk = "ru" vi = "vi,en-US,fr" zh-TW = "EMPTY,en-US" zh-CN = "EMPTY,en-US" -- cgit From cb9da85e07300b35a99fd6fe4b3d702f987d1582 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Wed, 18 Aug 2010 13:53:28 +0200 Subject: cws sw33bf08: #i113867# removing en-US dictionaries from Ukrainian language pack --- setup_native/source/packinfo/spellchecker_selection.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup_native/source/packinfo/spellchecker_selection.txt b/setup_native/source/packinfo/spellchecker_selection.txt index 1ca0f231bfdc..5853a97b141e 100644 --- a/setup_native/source/packinfo/spellchecker_selection.txt +++ b/setup_native/source/packinfo/spellchecker_selection.txt @@ -44,7 +44,7 @@ sr = "sr,en-US" sh = "sr,en-US" sw = "sw,en-US" th = "th,en-US" -uk = "ru" +uk = "ru,en-US" vi = "vi,en-US,fr" zh-TW = "EMPTY,en-US" zh-CN = "EMPTY,en-US" -- cgit -- cgit -- cgit -- cgit -- cgit From f1bcc220319d9d1f2652083f3f5389eb77748081 Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Wed, 18 Aug 2010 16:52:22 +0200 Subject: calc58: #i113820# make TEXT treat string results and inline strings identical to referenced cell text --- sc/source/core/tool/interpr1.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 35c63f52a92b..2e6ce932b466 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7108,10 +7108,6 @@ void ScInterpreter::ScText() case svDouble: fVal = PopDouble(); break; - case svString: - aStr = PopString(); - bString = true; - break; default: { FormulaTokenRef xTok( PopToken()); -- cgit From 7c84033b76922b3c843314354f8dc1bab364ed7d Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 18 Aug 2010 17:59:09 +0200 Subject: #i113857# disable right mouse button to trigger a range selection --- vcl/source/window/seleng.cxx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx index d4ee01c26d61..322b2937b5c9 100644 --- a/vcl/source/window/seleng.cxx +++ b/vcl/source/window/seleng.cxx @@ -218,8 +218,15 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) Point aPos = rMEvt.GetPosPixel(); aLastMove = rMEvt; - pWin->CaptureMouse(); - nFlags |= SELENG_IN_SEL; + if( !rMEvt.IsRight() ) + { + pWin->CaptureMouse(); + nFlags |= SELENG_IN_SEL; + } + else + { + nModifier = 0; + } switch ( nModifier ) { @@ -327,7 +334,7 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt ) |* *************************************************************************/ -BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& /* rMEvt */ ) +BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt ) { aWTimer.Stop(); //DbgOut("Up"); @@ -336,7 +343,11 @@ BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& /* rMEvt */ ) nFlags &= ~(SELENG_CMDEVT | SELENG_WAIT_UPEVT | SELENG_IN_SEL); return FALSE; } - pWin->ReleaseMouse(); + + if( !rMEvt.IsRight() ) + { + pWin->ReleaseMouse(); + } if( (nFlags & SELENG_WAIT_UPEVT) && !(nFlags & SELENG_CMDEVT) && eSelMode != SINGLE_SELECTION) -- cgit From 20cd7f058892c76c9d794c6ff0a776ced306b34d Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Wed, 18 Aug 2010 18:56:10 +0200 Subject: calc58: #i113739# make N return 0 for all strings again --- sc/source/core/tool/interpr1.cxx | 23 +++++++---------------- sc/source/core/tool/interpr4.cxx | 6 ++++++ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 2e6ce932b466..1e4c02967152 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2481,22 +2481,13 @@ void ScInterpreter::ScN() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScN" ); USHORT nErr = nGlobalError; nGlobalError = 0; - double fVal; - if ( GetRawStackType() == svString ) - { - fVal = 0.0; - Pop(); - } - else - { - // Temporarily override the ConvertStringToValue() error for - // GetCellValue() / GetCellValueOrZero() - USHORT nSErr = mnStringNoValueError; - mnStringNoValueError = errCellNoValue; - fVal = GetDouble(); - mnStringNoValueError = nSErr; - } - if ( nGlobalError == NOTAVAILABLE || nGlobalError == errIllegalArgument ) + // Temporarily override the ConvertStringToValue() error for + // GetCellValue() / GetCellValueOrZero() + USHORT nSErr = mnStringNoValueError; + mnStringNoValueError = errCellNoValue; + double fVal = GetDouble(); + mnStringNoValueError = nSErr; + if ( nGlobalError == NOTAVAILABLE || nGlobalError == errCellNoValue ) nGlobalError = 0; // N(#NA) and N("text") are ok if ( !nGlobalError && nErr != NOTAVAILABLE ) nGlobalError = nErr; diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 5c326001ff02..dccb2355b3d5 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -231,6 +231,12 @@ double ScInterpreter::ConvertStringToValue( const String& rStr ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ConvertStringToValue" ); double fValue = 0.0; + if (mnStringNoValueError == errCellNoValue) + { + // Requested that all strings result in 0, error handled by caller. + SetError( mnStringNoValueError); + return fValue; + } ::rtl::OUString aStr( rStr); rtl_math_ConversionStatus eStatus; sal_Int32 nParseEnd; -- cgit From b713c8752927db9001312e794aa0dc9a962ff2e3 Mon Sep 17 00:00:00 2001 From: va Date: Wed, 18 Aug 2010 20:44:18 +0200 Subject: #i110367# Update For AutoCorrection --- extras/source/autotext/lang/pt-BR/acor_pt-BR.dat | Bin 469488 -> 40513 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/extras/source/autotext/lang/pt-BR/acor_pt-BR.dat b/extras/source/autotext/lang/pt-BR/acor_pt-BR.dat index ddfc5f8fae45..8ff201c2c3c7 100644 Binary files a/extras/source/autotext/lang/pt-BR/acor_pt-BR.dat and b/extras/source/autotext/lang/pt-BR/acor_pt-BR.dat differ -- cgit -- cgit -- cgit From d5fb1d1383d2a5e0eaf6304180ccd3a60ac3228d Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Thu, 19 Aug 2010 14:04:41 +0200 Subject: #i1138511# allow symbol-aliasing in adobe single-byte encodings --- sal/textenc/convertadobe.tab | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sal/textenc/convertadobe.tab b/sal/textenc/convertadobe.tab index b657256d7bfe..31ec3305933b 100644 --- a/sal/textenc/convertadobe.tab +++ b/sal/textenc/convertadobe.tab @@ -185,6 +185,7 @@ rtl::textenc::BmpUnicodeToSingleByteRange const unicodeToAdobeSymbolEncoding[] { 0x23D0, 0x23D0 - 0x23D0, 0xBE }, { 0x25CA, 0x25CA - 0x25CA, 0xE0 }, { 0x2660, 0x2660 - 0x2660, 0xAA }, { 0x2663, 0x2663 - 0x2663, 0xA7 }, { 0x2665, 0x2665 - 0x2665, 0xA9 }, { 0x2666, 0x2666 - 0x2666, 0xA8 }, + { 0xF000, 0xF0FF - 0xF000, 0x00 }, // symbol aliasing U+F0XX->S+00XX { 0xF6D9, 0xF6D9 - 0xF6D9, 0xD3 }, { 0xF6DA, 0xF6DA - 0xF6DA, 0xD2 }, { 0xF6DB, 0xF6DB - 0xF6DB, 0xD4 }, { 0xF8E5, 0xF8E5 - 0xF8E5, 0x60 }, { 0xF8E8, 0xF8EA - 0xF8E8, 0xE2 } }; @@ -251,6 +252,7 @@ rtl::textenc::BmpUnicodeToSingleByteRange const unicodeToAdobeDingbatsEncoding[] { 0x2756, 0x2756 - 0x2756, 0x76 }, { 0x2758, 0x275E - 0x2758, 0x78 }, { 0x2761, 0x2767 - 0x2761, 0xA1 }, { 0x2776, 0x2794 - 0x2776, 0xB6 }, { 0x2798, 0x27AF - 0x2798, 0xD8 }, { 0x27B1, 0x27BE - 0x27B1, 0xF1 }, + { 0xF000, 0xF0FF - 0xF000, 0x00 }, // symbol aliasing U+F0XX->S+00XX { 0xF8D7, 0xF8E4 - 0xF8D7, 0x80 }}; rtl::textenc::BmpUnicodeToSingleByteConverterData const -- cgit From e050b9bc7c26f58d9fcd4c261909249e0522f9df Mon Sep 17 00:00:00 2001 From: "Eike Rathke [er]" Date: Thu, 19 Aug 2010 17:12:37 +0200 Subject: calc58: #i113879# add ScMatrix::CloneIfConst() and regard only temporary matrices created by the interpreter as mutable --- sc/inc/scmatrix.hxx | 11 ++++++++++- sc/source/core/tool/interpr4.cxx | 7 ++++++- sc/source/core/tool/interpr5.cxx | 19 ++++++++++++------- sc/source/core/tool/scmatrix.cxx | 5 +++++ 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index 9857d675b7ab..b788672aa715 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -99,6 +99,7 @@ class SC_DLLPUBLIC ScMatrix mutable ULONG nRefCnt; // reference count SCSIZE nColCount; SCSIZE nRowCount; + bool mbCloneIfConst; // Whether the matrix is cloned with a CloneIfConst() call. void ResetIsString(); void DeleteIsString(); @@ -171,11 +172,19 @@ public: /** If nC*nR results in more than GetElementsMax() entries, a 1x1 matrix is created instead and a double error value (errStackOverflow) is set. Compare nC and nR with a GetDimensions() call to check. */ - ScMatrix( SCSIZE nC, SCSIZE nR) : nRefCnt(0) { CreateMatrix( nC, nR); } + ScMatrix( SCSIZE nC, SCSIZE nR) : nRefCnt(0), mbCloneIfConst(true) { CreateMatrix( nC, nR); } /** Clone the matrix. */ ScMatrix* Clone() const; + /** Clone the matrix if mbCloneIfConst (immutable) is set, otherwise + return _this_ matrix, to be assigned to a ScMatrixRef. */ + ScMatrix* CloneIfConst(); + + /** Set the matrix to (im)mutable for CloneIfConst(), only the interpreter + should do this and know the consequences. */ + inline void SetImmutable( bool bVal ) { mbCloneIfConst = bVal; } + /** * Resize the matrix to specified new dimension. Note that this operation * clears all stored values. diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index dccb2355b3d5..47cde7186067 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3970,5 +3970,10 @@ StackVar ScInterpreter::Interpret() while( maxsp-- ) (*p++)->DecRef(); - return xResult->GetType(); + StackVar eType = xResult->GetType(); + if (eType == svMatrix) + // Results are immutable in case they would be reused as input for new + // interpreters. + static_cast(xResult.operator->())->GetMatrix()->SetImmutable( true); + return eType; } diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index ba4322a3281a..73794cf15b2d 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -310,6 +310,9 @@ ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR) RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetNewMat" ); ScMatrix* pMat = new ScMatrix( nC, nR); pMat->SetErrorInterpreter( this); + // A temporary matrix is mutable and ScMatrix::CloneIfConst() returns the + // very matrix. + pMat->SetImmutable( false); SCSIZE nCols, nRows; pMat->GetDimensions( nCols, nRows); if ( nCols != nC || nRows != nR ) @@ -2069,23 +2072,25 @@ bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE { PushIllegalArgument(); return false; - } // if (!pMatY->IsValue(i)) - } // for ( SCSIZE i = 0; i < nCountY; i++ ) + } + } + if ( _bLOG ) { + ScMatrixRef pNewY = pMatY->CloneIfConst(); for (SCSIZE nElem = 0; nElem < nCountY; nElem++) { - const double fVal = pMatY->GetDouble(nElem); + const double fVal = pNewY->GetDouble(nElem); if (fVal <= 0.0) { PushIllegalArgument(); return false; } else - pMatY->PutDouble(log(fVal), nElem); - } // for (nElem = 0; nElem < nCountY; nElem++) - } // if ( _bRKP ) - + pNewY->PutDouble(log(fVal), nElem); + } + pMatY = pNewY; + } if (pMatX) { diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index fbb859b64ebf..2ecc20f53405 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -81,6 +81,11 @@ ScMatrix* ScMatrix::Clone() const return pScMat; } +ScMatrix* ScMatrix::CloneIfConst() +{ + return (mbCloneIfConst || IsEternalRef()) ? Clone() : this; +} + void ScMatrix::Resize( SCSIZE nC, SCSIZE nR) { Clear(); -- cgit From 5f40c752230c3536bfd9cbf685919d2693a108e6 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 20 Aug 2010 09:37:47 +0200 Subject: txtl10n: allow localizing xtx files to a non-default location (XTX_TARGET_PATH) --- solenv/inc/tg_xmerge.mk | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/solenv/inc/tg_xmerge.mk b/solenv/inc/tg_xmerge.mk index fa3e2297184f..f8f78796faac 100755 --- a/solenv/inc/tg_xmerge.mk +++ b/solenv/inc/tg_xmerge.mk @@ -27,23 +27,22 @@ .IF "$(XTXFILES)"!="" -ALLTAR : $(MISC)/$(TARGET).xtx.pmerge.mk $(XTXFILES) +L10NEXT*=.txt +XTX_TARGET_PATH*=$(MISC)/$(TARGET) -.IF "$(L10NEXT)"=="" -L10NEXT:=.txt -.ENDIF +ALLTAR : $(XTX_TARGET_PATH).xtx.pmerge.mk $(XTXFILES) -$(MISC)/$(TARGET).xtx.pmerge.mk : $(XTXFILES) +$(XTX_TARGET_PATH).xtx.pmerge.mk : $(XTXFILES) $(XTXFILES) : $(LOCALIZESDF) -.INCLUDE .IGNORE : $(MISC)/$(TARGET).xtx.pmerge.mk +.INCLUDE .IGNORE : $(XTX_TARGET_PATH).xtx.pmerge.mk .IF "$(alllangiso)"!="$(last_merge)" XTXMERGEPHONY:=.PHONY .ENDIF # "$(alllangiso)" != "$(last_merge)" -$(MISC)/$(TARGET)/%$(L10NEXT) $(XTXMERGEPHONY) : %.xtx +$(XTX_TARGET_PATH)/%$(L10NEXT) $(XTXMERGEPHONY) : %.xtx @@-$(MKDIRHIER) $(@:d) .IF "$(WITH_LANG)"=="" $(COMMAND_ECHO)$(COPY) $< $@ @@ -53,7 +52,7 @@ $(MISC)/$(TARGET)/%$(L10NEXT) $(XTXMERGEPHONY) : %.xtx $(COMMAND_ECHO)@noop $(assign XTXDESTDIR:=$(@:d)) .ENDIF # "$(WITH_LANG)"=="" -$(MISC)/$(TARGET).xtx.pmerge.mk : $(XTXMERGELIST) +$(XTX_TARGET_PATH).xtx.pmerge.mk : $(XTXMERGELIST) .IF "$(WITH_LANG)"!="" # xtxex command file requirements: # - one file per line -- cgit From 9c2ea353ead0291d5a298b88c3bae597caafe2f5 Mon Sep 17 00:00:00 2001 From: Thomas Benisch Date: Fri, 20 Aug 2010 13:03:55 +0200 Subject: calc58: #i113946# undo does not work for deleting shapes --- chart2/source/controller/main/ChartController_Tools.cxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index ffe752f43a7a..779e3c32f1e7 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -827,16 +827,14 @@ bool ChartController::executeDispatch_Delete() else { //remove additional shape - uno::Reference< drawing::XShape > xShape( m_aSelection.getSelectedAdditionalShape() ); - if( xShape.is() ) + impl_ClearSelection(); { - impl_ClearSelection(); + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + if ( m_pDrawViewWrapper ) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex()); - if( m_pDrawViewWrapper ) - m_pDrawViewWrapper->UnmarkAll(); + m_pDrawViewWrapper->DeleteMarked(); + bReturn = true; } - bReturn = DrawModelWrapper::removeShape( xShape ); } } return bReturn; -- cgit From 3417318f27cdc15af6bdcb3ea5b7c6bb554352ab Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Fri, 20 Aug 2010 13:12:52 +0200 Subject: #i10000# supress bytecode generation --- l10ntools/scripts/xtxex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10ntools/scripts/xtxex b/l10ntools/scripts/xtxex index 28529506e3a2..52baab0693d0 100755 --- a/l10ntools/scripts/xtxex +++ b/l10ntools/scripts/xtxex @@ -32,8 +32,8 @@ exit 1 fi if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then - exec python $SOLARVERSION/$INPATH/bin/xtxex.py "$@" + exec python -B $SOLARVERSION/$INPATH/bin/xtxex.py "$@" else - exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@" + exec python -B $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@" fi -- cgit From fffe7fed17cdbba6d3be3ee35b21a1456dc83159 Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Fri, 20 Aug 2010 13:13:16 +0200 Subject: #i10000# supress bytecode generation --- l10ntools/scripts/xhtex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/l10ntools/scripts/xhtex b/l10ntools/scripts/xhtex index 659cd06e16d4..ad18d8c94eab 100755 --- a/l10ntools/scripts/xhtex +++ b/l10ntools/scripts/xhtex @@ -32,8 +32,8 @@ exit 1 fi if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then - exec python $SOLARVERSION/$INPATH/bin/xhtex.py "$@" + exec python -B $SOLARVERSION/$INPATH/bin/xhtex.py "$@" else - exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@" + exec python -B $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@" fi -- cgit From b07c2a4cb2b8060addbf0326970afedf62f7ecc9 Mon Sep 17 00:00:00 2001 From: Thomas Benisch Date: Fri, 20 Aug 2010 13:23:46 +0200 Subject: calc58: #i113948# office crashes after resizing chart --- chart2/source/model/main/ChartModel.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 950169395c95..5a30d97118c5 100755 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -1043,6 +1043,7 @@ void SAL_CALL ChartModel::setVisualAreaSize( ::sal_Int64 nAspect, const awt::Siz { if( nAspect == embed::Aspects::MSOLE_CONTENT ) { + ControllerLockGuard aLockGuard( this ); bool bChanged = (m_aVisualAreaSize.Width != aSize.Width || m_aVisualAreaSize.Height != aSize.Height); -- cgit From 46bd96bc7c2f8fac93546f8aa905023a9a59f8ca Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 20 Aug 2010 16:30:57 +0200 Subject: ext004: just copy en-US file without modifications --- l10ntools/scripts/tool/xtxex.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/l10ntools/scripts/tool/xtxex.py b/l10ntools/scripts/tool/xtxex.py index 2c5f132530a6..96912754b7df 100644 --- a/l10ntools/scripts/tool/xtxex.py +++ b/l10ntools/scripts/tool/xtxex.py @@ -39,7 +39,8 @@ class Xtxex(AbstractL10nTool): def merge_file(self, inputfilename, outputfilename, parsed_file_ref, lang, is_forced_lang, sdfdata): # Special handling for en-US files if lang == "en-US": - mod_outputfilename = outputfilename.replace("_en-US",'') + mod_outputfilename = outputfilename + # mod here if needed self.copy_file(inputfilename, mod_outputfilename) return # merge usual lang -- cgit From fe18bcac5f611b1bb0f3cf69abb2357a48d19106 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 20 Aug 2010 19:47:14 +0200 Subject: ooo33gsl07: #i113898# catch a NULL ptr --- vcl/unx/gtk/a11y/atkutil.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index 13492f3d4a5c..51297109ca43 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -92,7 +92,7 @@ atk_wrapper_focus_idle_handler (gpointer data) // also emit state-changed:focused event under the same condition. { AtkObjectWrapper* wrapper_obj = ATK_OBJECT_WRAPPER (atk_obj); - if( !wrapper_obj->mpText && wrapper_obj->mpContext ) + if( wrapper_obj && !wrapper_obj->mpText && wrapper_obj->mpContext ) { uno::Any any = wrapper_obj->mpContext->queryInterface( accessibility::XAccessibleText::static_type(NULL) ); if ( typelib_TypeClass_INTERFACE == any.pType->eTypeClass && -- cgit From 7a8299db7e19f4597558a3ccbee9c9284d253c1b Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Mon, 23 Aug 2010 09:23:55 +0200 Subject: automationooo330m5: #114058# fix error in window_functions.inc --- testautomation/framework/required/includes/window_functions.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/testautomation/framework/required/includes/window_functions.inc b/testautomation/framework/required/includes/window_functions.inc index 6917639d30f8..008248a1c57d 100755 --- a/testautomation/framework/required/includes/window_functions.inc +++ b/testautomation/framework/required/includes/window_functions.inc @@ -196,9 +196,6 @@ end sub testcase tCheckWindowTitle( sApplication as string, sReference as string ) - if ( sApplication = "soffice" ) then - - printlog( "Update test for the office window titles" ) ' This is a Testtool-only problem that the product name is not displayed -- cgit From 5bb4afebe46a4b9bb50db60624867ce149cfb589 Mon Sep 17 00:00:00 2001 From: "Helge Delfs [hde]" Date: Mon, 23 Aug 2010 12:53:51 +0200 Subject: automationooo330m5#i113978#added exception loading file swdos.txt --- testautomation/writer/optional/includes/loadsave/w_loadsave.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/testautomation/writer/optional/includes/loadsave/w_loadsave.inc b/testautomation/writer/optional/includes/loadsave/w_loadsave.inc index 7454f733665d..e4871e78f400 100644 --- a/testautomation/writer/optional/includes/loadsave/w_loadsave.inc +++ b/testautomation/writer/optional/includes/loadsave/w_loadsave.inc @@ -52,6 +52,7 @@ testcase tExportAllReadableFormatsIntoODF Dim SavedCorrectly as Boolean Dim sExportFilter as string Dim sExportFile as string + Dim sExceptionFile as string Dim i as Integer WorkDirectory = ( ConvertPath ( gOfficePath + "user\work\" + gPlatgroup + "\export\")) @@ -77,8 +78,12 @@ testcase tExportAllReadableFormatsIntoODF For i = 1 to listCount(ImportFileList()) printlog "- " & i & ". load: " & ImportFileList(i) sExportFile = ImportFileList(i) + sExceptionFile = DateiExtract ( sExportFile ) + printlog sExceptionFile if GetExtention ( sExportFile ) = "psw" then - QAErrorlog "#i102221#Pocket Word filter puts General I/O Error" + QAErrorlog "#i102221#Pocket Word filter puts General I/O Error" + elseif LCase( sExceptionFile ) = "swdos.txt" then + QAErrorlog "#i114062#General I/O error loading StarWriter DOS file" else Call hFileOpen ( ImportFileList(i) ) printlog "- done" -- cgit From bac81bf225dd7b7d0d7d85ae4bd513314a0902d6 Mon Sep 17 00:00:00 2001 From: Juergen Schmidt Date: Mon, 23 Aug 2010 13:45:23 +0200 Subject: i113538: add XHPDEST variable to make destination of generarted xhp file sconfigurable --- solenv/inc/tg_help.mk | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) mode change 100644 => 100755 solenv/inc/tg_help.mk diff --git a/solenv/inc/tg_help.mk b/solenv/inc/tg_help.mk old mode 100644 new mode 100755 index aa62b1cf477f..b98e0c6de3cc --- a/solenv/inc/tg_help.mk +++ b/solenv/inc/tg_help.mk @@ -31,13 +31,15 @@ aux_alllangiso*:=$(alllangiso) SHELL_PACKAGE:=$(subst,/,$/ $(PACKAGE)) -HLANGXHPFILES:=$(foreach,i,$(XHPFILES) $(foreach,j,$(aux_alllangiso) $(COMMONMISC)$/$j$/$(SHELL_PACKAGE)$/$(i:f))) +XHPDEST*:=$(COMMONMISC) + +HLANGXHPFILES:=$(foreach,i,$(XHPFILES) $(foreach,j,$(aux_alllangiso) $(XHPDEST)$/$j$/$(SHELL_PACKAGE)$/$(i:f))) ALLTAR : $(COMMONMISC)$/$(TARGET).done $(COMMONMISC)$/xhp_changed.flag optix $(HLANGXHPFILES) : $$(@:d)thisdir.created -$(COMMONMISC)$/{$(aux_alllangiso)}$/$(SHELL_PACKAGE)$/%.xhp :| %.xhp +$(XHPDEST)$/{$(aux_alllangiso)}$/$(SHELL_PACKAGE)$/%.xhp :| %.xhp @$(TOUCH) $@ # internal dependencies not sufficient to trigger merge? # @$(NULL) @@ -45,9 +47,9 @@ $(COMMONMISC)$/{$(aux_alllangiso)}$/$(SHELL_PACKAGE)$/%.xhp :| %.xhp $(COMMONMISC)$/$(TARGET).done : $(HLANGXHPFILES) .IF "$(WITH_LANG)"!="" - $(AUGMENT_LIBRARY_PATH) $(HELPEX) -QQ -p $(PRJNAME) -r $(PRJ) -i @$(mktmp $(uniq $(foreach,i,$? $(!eq,$(i:f),$(i:f:s/.xhp//) $(i:f) $(XHPFILES))))) -x $(COMMONMISC) -y $(SHELL_PACKAGE) -l all -lf $(aux_alllangiso:t",") -m $(LOCALIZESDF) && $(TOUCH) $@ + $(AUGMENT_LIBRARY_PATH) $(HELPEX) -QQ -p $(PRJNAME) -r $(PRJ) -i @$(mktmp $(uniq $(foreach,i,$? $(!eq,$(i:f),$(i:f:s/.xhp//) $(i:f) $(XHPFILES))))) -x $(XHPDEST) -y $(SHELL_PACKAGE) -l all -lf $(aux_alllangiso:t",") -m $(LOCALIZESDF) && $(TOUCH) $@ .ELSE # "$(WITH_LANG)"!="" - cp $(uniq $(foreach,i,$? $(!eq,$(i:f),$(i:f:s/.xhp//) $(i:f) $(XHPFILES)))) $(COMMONMISC)$/en-US$/$(SHELL_PACKAGE) && $(TOUCH) $@ + cp $(uniq $(foreach,i,$? $(!eq,$(i:f),$(i:f:s/.xhp//) $(i:f) $(XHPFILES)))) $(XHPDEST)$/en-US$/$(SHELL_PACKAGE) && $(TOUCH) $@ .ENDIF # "$(WITH_LANG)"!="" .IF "$(OS)"=="SOLARIS" @$(ECHONL) " " -- cgit From 49c3b9399521b7dd16ccba87d3bdfed1418a842b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 23 Aug 2010 14:38:35 +0200 Subject: ooo33gsl07: #i110881# workaround compiz (mwm hints should have no effect whatsoever on fullscreen) --- vcl/unx/source/app/wmadaptor.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx index 1a116fcbe8d6..aa2e4c84ef24 100644 --- a/vcl/unx/source/app/wmadaptor.cxx +++ b/vcl/unx/source/app/wmadaptor.cxx @@ -2180,6 +2180,15 @@ void NetWMAdaptor::showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const if( m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] ) { pFrame->mbFullScreen = bFullScreen; + if( bFullScreen ) + { + if( m_aWMAtoms[ MOTIF_WM_HINTS ] ) + { + XDeleteProperty( m_pDisplay, + pFrame->GetShellWindow(), + m_aWMAtoms[ MOTIF_WM_HINTS ] ); + } + } if( pFrame->bMapped_ ) { // window already mapped, send WM a message -- cgit From 1aa1fd127f4e9eb669b0f685790031e24b11d049 Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Mon, 23 Aug 2010 15:27:44 +0200 Subject: automationooo330m5: #114064# testcases did not work under mac osx --- .../dbaccess/optional/includes/db_Mozilla.inc | 34 +++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/testautomation/dbaccess/optional/includes/db_Mozilla.inc b/testautomation/dbaccess/optional/includes/db_Mozilla.inc index 45cf9456d290..236b6a5e79ed 100755 --- a/testautomation/dbaccess/optional/includes/db_Mozilla.inc +++ b/testautomation/dbaccess/optional/includes/db_Mozilla.inc @@ -32,22 +32,35 @@ '\*********************************************************************** sub db_Mozilla - ' Information for this test under - ' http://wiki.services.openoffice.org/wiki/Database_Automatic_Testing#Testing_the_mozilla_Address_book - - if fCreateMozillaAddressbookDatasource(gOfficePath + ConvertPath("user/work/TT_Mozilla.odb")) then - - tQueryAddressbook(gOfficePath + ConvertPath("user/work/TT_Mozilla.odb")) - tSortAddressbook(gOfficePath + ConvertPath("user/work/TT_Mozilla.odb")) - else + if(gPlatform = "osx") then + ' on Mac platform the Mozilla address book is not available + ' so I call only the testcases to satisfied the database tQueryAddressbook("") tSortAddressbook("") + else + + ' Information for this test under + ' http://wiki.services.openoffice.org/wiki/Database_Automatic_Testing#Testing_the_mozilla_Address_book + + if fCreateMozillaAddressbookDatasource(gOfficePath + ConvertPath("user/work/TT_Mozilla.odb")) then + + tQueryAddressbook(gOfficePath + ConvertPath("user/work/TT_Mozilla.odb")) + tSortAddressbook(gOfficePath + ConvertPath("user/work/TT_Mozilla.odb")) + else + tQueryAddressbook("") + tSortAddressbook("") + endif endif end sub '------------------------------------------------------------------------- testcase tQueryAddressbook( sFileName ) + if(gPlatform = "osx") then + printlog "mozilla address book not available on Mac" + goto endsub + endif + if ( not fOpenDatabase(sFileName) ) then warnlog "Database can't be open" printlog "May be you find a solution under http://wiki.services.openoffice.org/wiki/Database_Automatic_Testing#Testing_the_mozilla_Address_book" @@ -86,6 +99,11 @@ endcase '------------------------------------------------------------------------- testcase tSortAddressbook( sFileName ) + if(gPlatform = "osx") then + printlog "mozilla address book not available on Mac" + goto endsub + endif + Dim sRecordCount as String '/// open the database file created in the bas file -- cgit From a1615ed8a913ea0d35d8368425f5cbe0b77d9d8c Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Mon, 23 Aug 2010 15:30:19 +0200 Subject: automationooo330m5: #113492# clear the layout and add one sleep --- testautomation/graphics/required/includes/impress/im_003_.inc | 3 +++ testautomation/graphics/required/includes/impress/im_004_.inc | 1 + 2 files changed, 4 insertions(+) diff --git a/testautomation/graphics/required/includes/impress/im_003_.inc b/testautomation/graphics/required/includes/impress/im_003_.inc index 685a9d7e69cd..0eec59322e25 100644 --- a/testautomation/graphics/required/includes/impress/im_003_.inc +++ b/testautomation/graphics/required/includes/impress/im_003_.inc @@ -216,6 +216,9 @@ testcase tiViewToolbar_1 printlog "open application " Call hNewDocument + + printlog "use the empty layout" + call sSelectEmptyLayout printlog "Insert->Graphic... : global\input\graf_inp\desp.bmp " hUseAsyncSlot( "InsertGraphicsFromFile" ) diff --git a/testautomation/graphics/required/includes/impress/im_004_.inc b/testautomation/graphics/required/includes/impress/im_004_.inc index 02587ea83df9..2c55bc4c2f13 100644 --- a/testautomation/graphics/required/includes/impress/im_004_.inc +++ b/testautomation/graphics/required/includes/impress/im_004_.inc @@ -49,6 +49,7 @@ testcase tiInsertSlideExpandSummary Kontext "DocumentImpressOutlineView" printlog "Type 2 rows " DocumentImpressOutlineView.TypeKeys "HerbertRudi" + sleep(1) printlog "View->Master View->Drawing View " ViewWorkspaceDrawingView WaitSlot() -- cgit -- cgit -- cgit From 4cc5448ed82f13bb107695b65f39589df1e46cb9 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 23 Aug 2010 16:32:34 +0200 Subject: ooo33gsl07: #i113253# use paper bin from user setup when appropriate --- vcl/source/gdi/print3.cxx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 375c570f1a16..51f33ed17f6c 100755 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -173,6 +173,7 @@ public: // if set, pages are centered and trimmed onto the fixed page Size maFixedPageSize; sal_Int32 mnDefaultPaperBin; + sal_Int32 mnFixedPaperBin; ImplPrinterControllerData() : mbFirstPage( sal_True ), @@ -180,7 +181,8 @@ public: mbReversePageOrder( sal_False ), meJobState( view::PrintableState_JOB_STARTED ), mpProgress( NULL ), - mnDefaultPaperBin( -1 ) + mnDefaultPaperBin( -1 ), + mnFixedPaperBin( -1 ) {} ~ImplPrinterControllerData() { delete mpProgress; } @@ -726,6 +728,7 @@ void PrinterController::setPrinter( const boost::shared_ptr& i_rPrinter setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), makeAny( rtl::OUString( i_rPrinter->GetName() ) ) ); mpImplData->mnDefaultPaperBin = mpImplData->mpPrinter->GetPaperBin(); + mpImplData->mnFixedPaperBin = -1; } bool PrinterController::setupPrinter( Window* i_pParent ) @@ -733,15 +736,20 @@ bool PrinterController::setupPrinter( Window* i_pParent ) bool bRet = false; if( mpImplData->mpPrinter.get() ) { + // get old data Size aPaperSize( mpImplData->mpPrinter->PixelToLogic( mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + USHORT nPaperBin = mpImplData->mpPrinter->GetPaperBin(); + + // call driver setup bRet = mpImplData->mpPrinter->Setup( i_pParent ); if( bRet ) { - // was the papersize overridden ? if so we need to take action + // was papersize or bin overridden ? if so we need to take action Size aNewPaperSize( mpImplData->mpPrinter->PixelToLogic( mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); - if( aNewPaperSize != aPaperSize ) + USHORT nNewPaperBin = mpImplData->mpPrinter->GetPaperBin(); + if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin ) { mpImplData->maFixedPageSize = aNewPaperSize; mpImplData->maPageCache.invalidate(); @@ -750,6 +758,7 @@ bool PrinterController::setupPrinter( Window* i_pParent ) aOverrideSize.Height = aNewPaperSize.Height(); setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OverridePageSize" ) ), makeAny( aOverrideSize ) ); + mpImplData->mnFixedPaperBin = nNewPaperBin; } } } @@ -1147,8 +1156,13 @@ void PrinterController::printFilteredPage( int i_nPage ) mpImplData->mpPrinter->SetMapMode( MAP_100TH_MM ); // aPageSize was filtered through mpImplData->getRealPaperSize already by getFilteredPageFile() mpImplData->mpPrinter->SetPaperSizeUser( aPageSize.aSize, ! mpImplData->isFixedPageSize() ); + if( mpImplData->mnFixedPaperBin != -1 && + mpImplData->mpPrinter->GetPaperBin() != mpImplData->mnFixedPaperBin ) + { + mpImplData->mpPrinter->SetPaperBin( mpImplData->mnFixedPaperBin ); + } - // if full paper are is meant, move the output to accomodate for pageoffset + // if full paper is meant to be used, move the output to accomodate for pageoffset if( aPageSize.bFullPaper ) { Point aPageOffset( mpImplData->mpPrinter->GetPageOffset() ); -- cgit From b2cd101018ea5184e2dc93aeab88af7c5e808168 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Aug 2010 21:04:03 +0200 Subject: ext004: without WITH_LANG, ensure the XTX file nonetheless has the en-US prefix --- solenv/inc/tg_xmerge.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/inc/tg_xmerge.mk b/solenv/inc/tg_xmerge.mk index f8f78796faac..ac1ddab663ff 100755 --- a/solenv/inc/tg_xmerge.mk +++ b/solenv/inc/tg_xmerge.mk @@ -45,7 +45,7 @@ XTXMERGEPHONY:=.PHONY $(XTX_TARGET_PATH)/%$(L10NEXT) $(XTXMERGEPHONY) : %.xtx @@-$(MKDIRHIER) $(@:d) .IF "$(WITH_LANG)"=="" - $(COMMAND_ECHO)$(COPY) $< $@ + $(COMMAND_ECHO)$(COPY) $< $(@:f)_en-US$(L10NEXT) .ELSE # "$(WITH_LANG)"=="" @@-$(RM) $@ $(COMMAND_ECHO)@noop $(assign XTXMERGELIST+:=$(<:f)) -- cgit From f1957b34630f59301b15031764dcb0854e031576 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Aug 2010 21:13:50 +0200 Subject: ext004: correction to the previous fix --- solenv/inc/tg_xmerge.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/inc/tg_xmerge.mk b/solenv/inc/tg_xmerge.mk index ac1ddab663ff..6ff412bb022f 100755 --- a/solenv/inc/tg_xmerge.mk +++ b/solenv/inc/tg_xmerge.mk @@ -45,7 +45,7 @@ XTXMERGEPHONY:=.PHONY $(XTX_TARGET_PATH)/%$(L10NEXT) $(XTXMERGEPHONY) : %.xtx @@-$(MKDIRHIER) $(@:d) .IF "$(WITH_LANG)"=="" - $(COMMAND_ECHO)$(COPY) $< $(@:f)_en-US$(L10NEXT) + $(COMMAND_ECHO)$(COPY) $< $(@:d)$(@:b)_en-US$(L10NEXT) .ELSE # "$(WITH_LANG)"=="" @@-$(RM) $@ $(COMMAND_ECHO)@noop $(assign XTXMERGELIST+:=$(<:f)) -- cgit From 5caf38ef235115c8255f37a35887f52d5cad6676 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Aug 2010 21:18:17 +0200 Subject: ext004: also recognize a set, but empty WITH_LANG --- solenv/bin/transform_description.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solenv/bin/transform_description.pl b/solenv/bin/transform_description.pl index 0d6ab34583b3..87dcb21deb53 100644 --- a/solenv/bin/transform_description.pl +++ b/solenv/bin/transform_description.pl @@ -55,9 +55,9 @@ sub parse_args # check which languages to use my $languages = $ENV{WITH_LANG}; - if ( ! defined $languages ) + if ( ( ! defined $languages ) || ( "$languages" eq "" ) ) { - print STDERR "$0: WITH_LANG not set, defaulting to 'en-US'\n"; + print STDERR "$0: WITH_LANG not set or empty, defaulting to 'en-US'\n"; $languages = "en-US"; } @languages = split ( ' ', $languages ); -- cgit From 7fab09514c2975d9d936c840889e3dd2938bccad Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 24 Aug 2010 11:00:05 +0200 Subject: ooo33gsl07: #i114002# add missing license headers --- extensions/source/plugin/unx/npnapi.cxx | 31 +++++++++++++++++++++++++------ extensions/source/plugin/unx/nppapi.cxx | 31 +++++++++++++++++++++++++------ 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/extensions/source/plugin/unx/npnapi.cxx b/extensions/source/plugin/unx/npnapi.cxx index 003b4d0943a5..4a88577c5b71 100644 --- a/extensions/source/plugin/unx/npnapi.cxx +++ b/extensions/source/plugin/unx/npnapi.cxx @@ -1,10 +1,29 @@ /************************************************************************* - - Source Code Control System - Header - - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/extensions/source/plugin/unx/npnapi.cxx,v 1.11 2008-01-14 14:53:25 ihi Exp $ - -*************************************************************************/ + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_extensions.hxx" diff --git a/extensions/source/plugin/unx/nppapi.cxx b/extensions/source/plugin/unx/nppapi.cxx index 6dc1b7a30407..5e5c2dba1cf5 100644 --- a/extensions/source/plugin/unx/nppapi.cxx +++ b/extensions/source/plugin/unx/nppapi.cxx @@ -1,10 +1,29 @@ /************************************************************************* - - Source Code Control System - Header - - $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/extensions/source/plugin/unx/nppapi.cxx,v 1.7 2008-01-14 14:53:38 ihi Exp $ - -*************************************************************************/ + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_extensions.hxx" -- cgit From b628a0a0158468eb04729e6ecd98008a7f814f1f Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 24 Aug 2010 14:49:48 +0200 Subject: ooo33gsl07: #i110881# fix fullscreen mode with compiz and metacity ... again --- vcl/unx/gtk/window/gtkframe.cxx | 64 +++++++++++++++++++++++++++--------- vcl/unx/inc/plugins/gtk/gtkframe.hxx | 4 +++ 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index c6ff16f8395b..e8b55ebfa895 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1452,12 +1452,6 @@ void GtkSalFrame::setMinMaxSize() aHints |= GDK_HINT_MAX_SIZE; } } - if( m_bFullscreen ) - { - aGeo.max_width = m_aMaxSize.Width(); - aGeo.max_height = m_aMaxSize.Height(); - aHints |= GDK_HINT_MAX_SIZE; - } if( aHints ) gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow), NULL, @@ -1832,7 +1826,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) // workaround different legacy version window managers have different opinions about // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin) if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) + { + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) ); + } if( bVisible ) Show( TRUE ); } @@ -1863,11 +1861,8 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) { if( bFullScreen ) { - if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) - { - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); - } + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE ); gtk_window_fullscreen( GTK_WINDOW(m_pWindow) ); moveToScreen( nScreen ); Size aScreenSize = pDisp->GetScreenSize( m_nScreen ); @@ -1879,11 +1874,8 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen ) else { gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) ); - if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() ) - { - if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) - gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); - } + if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) ) + gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE ); moveToScreen( nScreen ); } } @@ -2849,12 +2841,52 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f return FALSE; } +IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG ) +{ + Atom nStateAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE); + Atom nFSAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE_FULLSCREEN ); + if( nStateAtom && nFSAtom ) + { + /* #i110881# workaround a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8) + gtk_window_fullscreen can fail due to a race condition, request an additional status change + to fullscreen to be safe + */ + XEvent aEvent; + aEvent.type = ClientMessage; + aEvent.xclient.display = getDisplay()->GetDisplay(); + aEvent.xclient.window = GDK_WINDOW_XWINDOW(m_pWindow->window); + aEvent.xclient.message_type = nStateAtom; + aEvent.xclient.format = 32; + aEvent.xclient.data.l[0] = 1; + aEvent.xclient.data.l[1] = nFSAtom; + aEvent.xclient.data.l[2] = 0; + aEvent.xclient.data.l[3] = 0; + aEvent.xclient.data.l[4] = 0; + XSendEvent( getDisplay()->GetDisplay(), + getDisplay()->GetRootWindow( m_nScreen ), + False, + SubstructureNotifyMask | SubstructureRedirectMask, + &aEvent + ); + } + + return 0; +} + gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame ) { GtkSalFrame* pThis = (GtkSalFrame*)frame; GTK_YIELD_GRAB(); + if( pThis->m_bFullscreen ) + { + /* #i110881# workaorund a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8) + gtk_window_fullscreen can run into a race condition with the window's showstate + */ + Application::PostUserEvent( LINK( pThis, GtkSalFrame, ImplDelayedFullScreenHdl ) ); + } + bool bSetFocus = pThis->m_bSetFocusOnMap; pThis->m_bSetFocusOnMap = false; if( ImplGetSVData()->mbIsTestTool ) diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index 18dd476fc2c4..d47e5fb50fca 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -38,6 +38,8 @@ #include #include +#include "tools/link.hxx" + #include #include @@ -265,6 +267,8 @@ class GtkSalFrame : public SalFrame void setMinMaxSize(); void createNewWindow( XLIB_Window aParent, bool bXEmbed, int nScreen ); void askForXEmbedFocus( sal_Int32 nTimecode ); + + DECL_LINK( ImplDelayedFullScreenHdl, void* ); public: GtkSalFrame( SalFrame* pParent, ULONG nStyle ); GtkSalFrame( SystemParentData* pSysData ); -- cgit From 3d7260e438aa59c8d40ef9ce0c151cb2a2817628 Mon Sep 17 00:00:00 2001 From: Juergen Schmidt Date: Wed, 25 Aug 2010 15:25:30 +0200 Subject: coc03: merge changes from ext004, and introduce XHPDEST --- solenv/bin/transform_description.pl | 4 ++-- solenv/inc/tg_help.mk | 2 +- solenv/inc/tg_xmerge.mk | 17 ++++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/solenv/bin/transform_description.pl b/solenv/bin/transform_description.pl index 0d6ab34583b3..87dcb21deb53 100644 --- a/solenv/bin/transform_description.pl +++ b/solenv/bin/transform_description.pl @@ -55,9 +55,9 @@ sub parse_args # check which languages to use my $languages = $ENV{WITH_LANG}; - if ( ! defined $languages ) + if ( ( ! defined $languages ) || ( "$languages" eq "" ) ) { - print STDERR "$0: WITH_LANG not set, defaulting to 'en-US'\n"; + print STDERR "$0: WITH_LANG not set or empty, defaulting to 'en-US'\n"; $languages = "en-US"; } @languages = split ( ' ', $languages ); diff --git a/solenv/inc/tg_help.mk b/solenv/inc/tg_help.mk index b98e0c6de3cc..bfd5a0dad5c1 100644 --- a/solenv/inc/tg_help.mk +++ b/solenv/inc/tg_help.mk @@ -47,7 +47,7 @@ $(XHPDEST)$/{$(aux_alllangiso)}$/$(SHELL_PACKAGE)$/%.xhp :| %.xhp $(COMMONMISC)$/$(TARGET).done : $(HLANGXHPFILES) .IF "$(WITH_LANG)"!="" - $(AUGMENT_LIBRARY_PATH) $(HELPEX) -QQ -p $(PRJNAME) -r $(PRJ) -i @$(mktmp $(uniq $(foreach,i,$? $(!eq,$(i:f),$(i:f:s/.xhp//) $(i:f) $(XHPFILES))))) -x $(XHPDEST) -y $(SHELL_PACKAGE) -l all -lf $(aux_alllangiso:t",") -m $(LOCALIZESDF) && $(TOUCH) $@ + $(AUGMENT_LIBRARY_PATH) $(HELPEX) -p $(PRJNAME) -r $(PRJ) -i @$(mktmp $(uniq $(foreach,i,$? $(!eq,$(i:f),$(i:f:s/.xhp//) $(i:f) $(XHPFILES))))) -x $(XHPDEST) -y $(SHELL_PACKAGE) -l all -lf $(aux_alllangiso:t",") -m $(LOCALIZESDF) && $(TOUCH) $@ .ELSE # "$(WITH_LANG)"!="" cp $(uniq $(foreach,i,$? $(!eq,$(i:f),$(i:f:s/.xhp//) $(i:f) $(XHPFILES)))) $(XHPDEST)$/en-US$/$(SHELL_PACKAGE) && $(TOUCH) $@ .ENDIF # "$(WITH_LANG)"!="" diff --git a/solenv/inc/tg_xmerge.mk b/solenv/inc/tg_xmerge.mk index fa3e2297184f..6ff412bb022f 100755 --- a/solenv/inc/tg_xmerge.mk +++ b/solenv/inc/tg_xmerge.mk @@ -27,33 +27,32 @@ .IF "$(XTXFILES)"!="" -ALLTAR : $(MISC)/$(TARGET).xtx.pmerge.mk $(XTXFILES) +L10NEXT*=.txt +XTX_TARGET_PATH*=$(MISC)/$(TARGET) -.IF "$(L10NEXT)"=="" -L10NEXT:=.txt -.ENDIF +ALLTAR : $(XTX_TARGET_PATH).xtx.pmerge.mk $(XTXFILES) -$(MISC)/$(TARGET).xtx.pmerge.mk : $(XTXFILES) +$(XTX_TARGET_PATH).xtx.pmerge.mk : $(XTXFILES) $(XTXFILES) : $(LOCALIZESDF) -.INCLUDE .IGNORE : $(MISC)/$(TARGET).xtx.pmerge.mk +.INCLUDE .IGNORE : $(XTX_TARGET_PATH).xtx.pmerge.mk .IF "$(alllangiso)"!="$(last_merge)" XTXMERGEPHONY:=.PHONY .ENDIF # "$(alllangiso)" != "$(last_merge)" -$(MISC)/$(TARGET)/%$(L10NEXT) $(XTXMERGEPHONY) : %.xtx +$(XTX_TARGET_PATH)/%$(L10NEXT) $(XTXMERGEPHONY) : %.xtx @@-$(MKDIRHIER) $(@:d) .IF "$(WITH_LANG)"=="" - $(COMMAND_ECHO)$(COPY) $< $@ + $(COMMAND_ECHO)$(COPY) $< $(@:d)$(@:b)_en-US$(L10NEXT) .ELSE # "$(WITH_LANG)"=="" @@-$(RM) $@ $(COMMAND_ECHO)@noop $(assign XTXMERGELIST+:=$(<:f)) $(COMMAND_ECHO)@noop $(assign XTXDESTDIR:=$(@:d)) .ENDIF # "$(WITH_LANG)"=="" -$(MISC)/$(TARGET).xtx.pmerge.mk : $(XTXMERGELIST) +$(XTX_TARGET_PATH).xtx.pmerge.mk : $(XTXMERGELIST) .IF "$(WITH_LANG)"!="" # xtxex command file requirements: # - one file per line -- cgit From e301c8006b0ebebaa1059f1712ab7269a684c540 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 25 Aug 2010 16:36:33 +0200 Subject: #i10000# removed obsolete switch --- l10ntools/scripts/localize.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10ntools/scripts/localize.pl b/l10ntools/scripts/localize.pl index 4b7040d6583d..7a9d8beb6f15 100644 --- a/l10ntools/scripts/localize.pl +++ b/l10ntools/scripts/localize.pl @@ -492,7 +492,7 @@ sub collectfiles{ # -e # if ( -x $command ){ if( $command ){ - if( !$bVerbose ){ $args .= " -QQ "; } + if( !$bVerbose ){ $args .= " "; } $args .= " -e -f $localizeSDF -l "; my $bFlag=""; if( $bAll ) {$args .= " en-US";} -- cgit From 0f5cf8b1ece166ffb32af79b54fe46ec5dc9a6f8 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 25 Aug 2010 19:09:27 +0200 Subject: #i10000# set dummy fields to 0 for string DB --- l10ntools/scripts/tool/sdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l10ntools/scripts/tool/sdf.py b/l10ntools/scripts/tool/sdf.py index 2afcbaf4bb1f..dd413b14f75f 100644 --- a/l10ntools/scripts/tool/sdf.py +++ b/l10ntools/scripts/tool/sdf.py @@ -113,7 +113,7 @@ class SdfEntity: const._TITLE_POS = 13 const._DATE_POS = 14 - def __init__(self, project="", source_file="", dummy1="", resource_type="", gid="", lid="", helpid="", platform="", dummy2="", langid="", + def __init__(self, project="", source_file="", dummy1="0", resource_type="", gid="", lid="", helpid="", platform="", dummy2="0", langid="", text="", helptext="", quickhelptext="", title="", date="2002-02-02 02:02:02"): self.project = project; self.source_file = source_file; -- cgit From d4db8f570730be85039435919ec78b119d7da3f5 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 26 Aug 2010 13:17:12 +0200 Subject: masterfix: #i10000# modify extract date and dummy fields for string database --- l10ntools/java/jpropex/java/JPropEx.java | 7 +++++-- l10ntools/scripts/tool/sdf.py | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/l10ntools/java/jpropex/java/JPropEx.java b/l10ntools/java/jpropex/java/JPropEx.java index be59d7f29479..ceeeb5083982 100644 --- a/l10ntools/java/jpropex/java/JPropEx.java +++ b/l10ntools/java/jpropex/java/JPropEx.java @@ -145,8 +145,11 @@ public class JPropEx //String path = makeAbs( inputFileArg ); path = path.replace( rootArg + "/" , "" ); path = path.replace("/","\\"); - return new SdfEntity( projectArg , path , "" /* dummy1 */ , resourceType , "", "" , "" , "" , "" /* dummy2 */ , - sourceLanguage , "", "" , "" , "" , "2002-02-02 02:02:02" ); + // TODO: Make this static + java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String date = dateformat.format( new Date() ); + return new SdfEntity( projectArg , path , "0" /* dummy1 */ , resourceType , "", "" , "" , "" , "0" /* dummy2 */ , + sourceLanguage , "", "" , "" , "" , date ); } private void merge() diff --git a/l10ntools/scripts/tool/sdf.py b/l10ntools/scripts/tool/sdf.py index dd413b14f75f..96afbed1452c 100644 --- a/l10ntools/scripts/tool/sdf.py +++ b/l10ntools/scripts/tool/sdf.py @@ -26,6 +26,7 @@ #************************************************************************* from pseudo import PseudoSet,PseudoOrderedDict +from time import gmtime, strftime class SdfData: _filename = ""; @@ -114,7 +115,7 @@ class SdfEntity: const._DATE_POS = 14 def __init__(self, project="", source_file="", dummy1="0", resource_type="", gid="", lid="", helpid="", platform="", dummy2="0", langid="", - text="", helptext="", quickhelptext="", title="", date="2002-02-02 02:02:02"): + text="", helptext="", quickhelptext="", title="", date=""): self.project = project; self.source_file = source_file; self.dummy1 = dummy1; @@ -129,7 +130,11 @@ class SdfEntity: self.helptext = helptext; self.quickhelptext = quickhelptext; self.title = title; - self.date = date; + if date != "": + self.date = date; + else: + self.date = strftime("%Y-%m-%d %H:%M:%S",gmtime()) + def set_properties(self, line): splitted = line.split("\t") -- cgit From 27abc9f772c33fa9d187c9d5de59df4520d08977 Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Thu, 26 Aug 2010 17:43:27 +0200 Subject: OOO330 --- solenv/inc/minor.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index a6e3941d89af..11e864f0c0ba 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,5 +1,5 @@ RSCVERSION=330 -RSCREVISION=330m5(Build:9521) -BUILD=9521 -LAST_MINOR=m5 +RSCREVISION=330m6(Build:9524) +BUILD=9524 +LAST_MINOR=m6 SOURCEVERSION=OOO330 -- cgit From 9e685a7e47924f184d076c43acde64548cb5925d Mon Sep 17 00:00:00 2001 From: obo Date: Fri, 27 Aug 2010 11:31:33 +0200 Subject: masterfix OOO330: #i10000# unknown -B option for Python (Windows) --- l10ntools/scripts/xhtex | 9 ++++++++- l10ntools/scripts/xtxex | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/l10ntools/scripts/xhtex b/l10ntools/scripts/xhtex index ad18d8c94eab..ca307cf2d4a4 100755 --- a/l10ntools/scripts/xhtex +++ b/l10ntools/scripts/xhtex @@ -31,9 +31,16 @@ if [ x${SOLARENV}x = xx ]; then exit 1 fi +if [ ${GUI} = "WNT" ]; then +if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then + exec python $SOLARVERSION/$INPATH/bin/xhtex.py "$@" +else + exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@" +fi +else if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then exec python -B $SOLARVERSION/$INPATH/bin/xhtex.py "$@" else exec python -B $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xhtex.py "$@" fi - +fi diff --git a/l10ntools/scripts/xtxex b/l10ntools/scripts/xtxex index 52baab0693d0..fb54c1aee36c 100755 --- a/l10ntools/scripts/xtxex +++ b/l10ntools/scripts/xtxex @@ -31,9 +31,17 @@ if [ x${SOLARENV}x = xx ]; then exit 1 fi +if [ ${GUI} = "WNT" ]; then +if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then + exec python $SOLARVERSION/$INPATH/bin/xtxex.py "$@" +else + exec python $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@" +fi +else if [ x${SOLARVER}x = xx -o x${UPDMINOREXT}x = xx ]; then exec python -B $SOLARVERSION/$INPATH/bin/xtxex.py "$@" else exec python -B $SOLARVERSION/$INPATH/bin$UPDMINOREXT/xtxex.py "$@" fi +fi -- cgit From 926a7b29e05856d8ed567e3e4ff8640340d1ebfc Mon Sep 17 00:00:00 2001 From: obo Date: Fri, 27 Aug 2010 13:01:02 +0200 Subject: masterfix OOO330: #i10000# solve merge problem / WaE --- desktop/source/app/app.cxx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index cf19af655a1b..f5d6979bc4b1 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1558,6 +1558,7 @@ void Desktop::Main() std::auto_ptr pLanguageOptions; std::auto_ptr pPathOptions; + Reference< ::com::sun::star::task::XRestartManager > xRestartManager; sal_Bool bRestartRequested( sal_False ); sal_Bool bUseSystemFileDialog(sal_True); int nAcquireCount( 0 ); @@ -1761,7 +1762,6 @@ void Desktop::Main() impl_checkRecoveryState(bCrashed, bExistsRecoveryData, bExistsSessionData); RTL_LOGFILE_CONTEXT_TRACE( aLog, "} impl_checkRecoveryState" ); - Reference< ::com::sun::star::task::XRestartManager > xRestartManager; { ::comphelper::ComponentContext aContext( xSMgr ); xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY ); @@ -1929,7 +1929,6 @@ void Desktop::Main() // call Application::Execute to process messages in vcl message loop RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" ); - Reference< ::com::sun::star::task::XRestartManager > xRestartManager; try { // The JavaContext contains an interaction handler which is used when @@ -1937,9 +1936,10 @@ void Desktop::Main() com::sun::star::uno::ContextLayer layer2( new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) ); - ::comphelper::ComponentContext aContext( xSMgr ); - xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY ); - if ( !xRestartManager.is() || !xRestartManager->isRestartRequested( sal_True ) ) + // check whether the shutdown is caused by restart just before entering the Execute + bRestartRequested = bRestartRequested || ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); + + if ( !bRestartRequested ) { // if this run of the office is triggered by restart, some additional actions should be done DoRestartActionsIfNecessary( !pCmdLineArgs->IsInvisible() && !pCmdLineArgs->IsNoQuickstart() ); @@ -1957,13 +1957,11 @@ void Desktop::Main() OfficeIPCThread::SetDowning(); FatalError( MakeStartupErrorMessage(exAnyCfg.Message) ); } - - // check whether the shutdown is caused by restart - sal_Bool bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); - if ( bRestartRequested ) - SetRestartState(); } + if ( bRestartRequested ) + SetRestartState(); + if (xGlobalBroadcaster.is()) { css::document::EventObject aEvent; -- cgit From 550c1339601b93ac54faf3333df47796e8ea118d Mon Sep 17 00:00:00 2001 From: obo Date: Fri, 27 Aug 2010 13:02:34 +0200 Subject: masterfix OOO330: #i10000# new exception file unovwr.cxx --- sw/source/core/undo/makefile.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/sw/source/core/undo/makefile.mk b/sw/source/core/undo/makefile.mk index d6e6766a0fd4..c381761adba1 100644 --- a/sw/source/core/undo/makefile.mk +++ b/sw/source/core/undo/makefile.mk @@ -49,6 +49,7 @@ EXCEPTIONSFILES = \ $(SLO)$/unattr.obj \ $(SLO)$/undobj.obj \ $(SLO)$/undraw.obj \ + $(SLO)$/unovwr.obj \ $(SLO)$/untbl.obj SLOFILES = \ -- cgit