diff options
author | Armin Le Grand <alg@apache.org> | 2014-07-14 19:09:11 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2014-07-14 19:09:11 +0000 |
commit | 3c1d4742e649fe9c8aed8c2817fe3e1f3364f298 (patch) | |
tree | e0c6e02c89aa9227726c9469da1001b3e29c41df /svtools/source | |
parent | c5c31e2aeaedbdf76e1f38d3c385e34f5ed875ca (diff) |
Resync to trunk, windows non-pro build
aoo/aw080
Diffstat (limited to 'svtools/source')
-rw-r--r-- | svtools/source/brwbox/brwbox1.cxx | 2 | ||||
-rw-r--r-- | svtools/source/brwbox/brwbox2.cxx | 4 | ||||
-rw-r--r-- | svtools/source/brwbox/editbrowsebox.cxx | 2 | ||||
-rw-r--r-- | svtools/source/config/itemholder2.hxx | 2 | ||||
-rw-r--r-- | svtools/source/config/test/test.cxx | 2 | ||||
-rw-r--r-- | svtools/source/contnr/contentenumeration.hxx | 6 | ||||
-rw-r--r-- | svtools/source/contnr/fileview.cxx | 2 | ||||
-rw-r--r-- | svtools/source/control/roadmap.cxx | 3 | ||||
-rw-r--r-- | svtools/source/filter/filter.cxx | 11 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 49 | ||||
-rw-r--r-- | svtools/source/graphic/grfmgr2.cxx | 75 | ||||
-rw-r--r-- | svtools/source/svrtf/svparser.cxx | 4 | ||||
-rw-r--r-- | svtools/source/uno/wizard/unowizard.cxx | 2 | ||||
-rw-r--r-- | svtools/source/uno/wizard/wizardshell.cxx | 5 | ||||
-rw-r--r-- | svtools/source/uno/wizard/wizardshell.hxx | 6 |
15 files changed, 147 insertions, 28 deletions
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 863dc4c03a83..24e3c0829aef 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -441,7 +441,7 @@ void BrowseBox::FreezeColumn( sal_uInt16 nItemId, sal_Bool bFreeze ) // to be moved? if ( nItemPos != FrozenColCount()-1 ) { - // move to the leftmost scrollable colum + // move to the leftmost scrollable column sal_uInt16 nFirstScrollable = FrozenColCount(); BrowserColumn *pColumn = pCols->GetObject(nItemPos); pCols->Remove( (sal_uLong) nItemPos ); diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 9bbcfc6b8a2f..53a4adc56903 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -1028,7 +1028,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_ { // clip the column's output to the field area if (_bForeignDevice) - { // (not neccessary if painting onto the data window) + { // (not necessary if painting onto the data window) Size aFieldSize(pCol->Width(), nDataRowHeigt); if (aPos.X() + aFieldSize.Width() > aOverallAreaBRPos.X()) @@ -1535,7 +1535,7 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt ) } } - // event occured out of data area + // event occurred out of data area if ( rEvt.IsRight() ) pDataWin->Command( CommandEvent( Point( 1, LONG_MAX ), COMMAND_CONTEXTMENU, sal_True ) ); diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index d7ea003a7fb1..b57069c4407f 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -943,7 +943,7 @@ namespace svt { Window& rWindow = GetDataWindow(); // don't paint too much - // update the status immediatly if possible + // update the status immediately if possible if ((nEditRow >= 0) && (GetBrowserFlags() & EBBF_NO_HANDLE_COLUMN_CONTENT) == 0) { Rectangle aRect = GetFieldRectPixel(nEditRow, 0, sal_False ); diff --git a/svtools/source/config/itemholder2.hxx b/svtools/source/config/itemholder2.hxx index 5ab71d70d896..042ba4256437 100644 --- a/svtools/source/config/itemholder2.hxx +++ b/svtools/source/config/itemholder2.hxx @@ -35,7 +35,7 @@ // namespaces #ifdef css -#error "Cant use css as namespace alias." +#error "Can't use css as namespace alias." #else #define css ::com::sun::star #endif diff --git a/svtools/source/config/test/test.cxx b/svtools/source/config/test/test.cxx index a414fc080e5b..10a624f9fcfc 100644 --- a/svtools/source/config/test/test.cxx +++ b/svtools/source/config/test/test.cxx @@ -149,7 +149,7 @@ void TestApplication::Main() // Init global servicemanager and set it for external services. ::comphelper::setProcessServiceFactory( TestApplication::getUNOServiceManager() ); - // Control sucess of operation. + // Control success of operation. OSL_ENSURE( !(::comphelper::getProcessServiceFactory()!=TestApplication::getUNOServiceManager()), "TestApplication::Main()\nGlobal servicemanager not right initialized.\n" ); /**-*********************************************************************************************************** diff --git a/svtools/source/contnr/contentenumeration.hxx b/svtools/source/contnr/contentenumeration.hxx index f3a71739cf2f..585cd257ab41 100644 --- a/svtools/source/contnr/contentenumeration.hxx +++ b/svtools/source/contnr/contentenumeration.hxx @@ -48,7 +48,7 @@ namespace svt { private: ::rtl::OUString maFilename; // only filename in upper case - for compare purposes - ::rtl::OUString maTitle; // -> be carefull when changing maTitle to update maFilename only when new + ::rtl::OUString maTitle; // -> be careful when changing maTitle to update maFilename only when new ::rtl::OUString maLowerTitle; @@ -135,8 +135,8 @@ namespace svt //==================================================================== enum EnumerationResult { - SUCCESS, /// the enumration was successfull - ERROR, /// the enumration was unsuccessfull + SUCCESS, /// the enumration was successful + ERROR, /// the enumration was unsuccessful RUNNING /// the enumeration is still running, and the maximum wait time has passed }; diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index fb14fe2a9d02..d2027be8d1e0 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -1430,7 +1430,7 @@ sal_Bool SvtFileView::GetParentURL( String& rParentURL ) const } catch( Exception const & ) { - // perhaps an unkown url protocol (e.g. "private:newdoc") + // perhaps an unknown url protocol (e.g. "private:newdoc") } return bRet; diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index 5178b69796a1..ad4c75af574e 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -766,7 +766,8 @@ namespace svt SetFont( aFont ); RoadmapTypes::ItemId curItemID = GetCurrentRoadmapItemID(); RoadmapItem* pLabelItem = GetByID( curItemID ); - pLabelItem->ToggleBackgroundColor(rStyleSettings.GetHighlightColor()); + if ( pLabelItem != NULL ) + pLabelItem->ToggleBackgroundColor(rStyleSettings.GetHighlightColor()); Invalidate(); } } diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx index 7b474884d1e2..71f3f90f29e7 100644 --- a/svtools/source/filter/filter.cxx +++ b/svtools/source/filter/filter.cxx @@ -1630,8 +1630,8 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, if( !ImportXPM( rIStream, rGraphic ) ) nStatus = GRFILTER_FILTERERROR; } - else if( aFilterName.EqualsIgnoreCaseAscii( IMP_BMP ) || - aFilterName.EqualsIgnoreCaseAscii( IMP_SVMETAFILE ) ) + else if ( aFilterName.EqualsIgnoreCaseAscii( IMP_BMP ) + || aFilterName.EqualsIgnoreCaseAscii( IMP_SVMETAFILE ) ) { // SV interne Importfilter fuer Bitmaps und MetaFiles rIStream >> rGraphic; @@ -1642,8 +1642,11 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, } else { - // #15508# added BMP type (checked, works) - eLinkType = GFX_LINK_TYPE_NATIVE_BMP; + if ( aFilterName.EqualsIgnoreCaseAscii( IMP_BMP ) ) + { + // #15508# added BMP type (checked, works) + eLinkType = GFX_LINK_TYPE_NATIVE_BMP; + } } } else if( aFilterName.EqualsIgnoreCaseAscii( IMP_WMF ) || diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 417a5676d47e..8e087ccafb80 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -74,6 +74,21 @@ struct GrfSimpleCacheObj // - GraphicObject - // ----------------- +// unique increasing ID for being able to detect the GraphicObject with the +// oldest last data changes +static sal_uLong aIncrementingTimeOfLastDataChange = 1; + +void GraphicObject::ImplAfterDataChange() +{ + // set unique timestamp ID of last data change + mnDataChangeTimeStamp = aIncrementingTimeOfLastDataChange++; + + // check memory footprint of all GraphicObjects managed and evtl. take action + GetGraphicManager().ImplCheckSizeOfSwappedInGraphics(); +} + +// ----------------------------------------------------------------------------- + GraphicObject::GraphicObject( const GraphicManager* pMgr ) : mpLink ( NULL ), mpUserData ( NULL ) @@ -169,6 +184,9 @@ void GraphicObject::ImplConstruct() mbAutoSwapped = sal_False; mbIsInSwapIn = sal_False; mbIsInSwapOut = sal_False; + + // Init with a unique, increasing ID + mnDataChangeTimeStamp = aIncrementingTimeOfLastDataChange++; } // ----------------------------------------------------------------------------- @@ -286,6 +304,9 @@ void GraphicObject::ImplAutoSwapIn() if( !mbAutoSwapped && mpMgr ) mpMgr->ImplGraphicObjectWasSwappedIn( *this ); } + + // Handle evtl. needed AfterDataChanges + ImplAfterDataChange(); } } @@ -910,6 +931,9 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pC if( mpSwapOutTimer ) mpSwapOutTimer->Start(); + + // Handle evtl. needed AfterDataChanges + ImplAfterDataChange(); } // ----------------------------------------------------------------------------- @@ -1251,7 +1275,9 @@ sal_Bool GraphicObject::SwapIn() bRet = sal_True; } else if( mpMgr && mpMgr->ImplFillSwappedGraphicObject( *this, maGraphic ) ) + { bRet = sal_True; + } else { bRet = maGraphic.SwapIn(); @@ -1261,8 +1287,13 @@ sal_Bool GraphicObject::SwapIn() } if( bRet ) + { ImplAssignGraphicData(); + // Handle evtl. needed AfterDataChanges + ImplAfterDataChange(); + } + return bRet; } @@ -1278,7 +1309,9 @@ sal_Bool GraphicObject::SwapIn( SvStream* pIStm ) bRet = sal_True; } else if( mpMgr && mpMgr->ImplFillSwappedGraphicObject( *this, maGraphic ) ) + { bRet = sal_True; + } else { bRet = maGraphic.SwapIn( pIStm ); @@ -1288,8 +1321,13 @@ sal_Bool GraphicObject::SwapIn( SvStream* pIStm ) } if( bRet ) + { ImplAssignGraphicData(); + // + ImplAfterDataChange(); + } + return bRet; } @@ -1449,4 +1487,15 @@ basegfx::B2DVector GraphicObject::calculateCropScaling( return basegfx::B2DVector(fFactorX,fFactorY); } +// ------------------------------------------------------------------------ +// restart SwapOut timer + +void GraphicObject::restartSwapOutTimer() const +{ + if( mpSwapOutTimer && mpSwapOutTimer->IsActive() ) + { + mpSwapOutTimer->Start(); + } +} + // eof diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index c599a1d3f48d..5cac068d0603 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -295,9 +295,82 @@ ByteString GraphicManager::ImplGetUniqueID( const GraphicObject& rObj ) const // ----------------------------------------------------------------------------- +namespace +{ + struct simpleSortByDataChangeTimeStamp + { + bool operator() (GraphicObject* p1, GraphicObject* p2) const + { + return p1->GetDataChangeTimeStamp() < p2->GetDataChangeTimeStamp(); + } + }; +} // end of anonymous namespace + +void GraphicManager::ImplCheckSizeOfSwappedInGraphics() +{ + // only necessary for 32bit systems + if(SAL_TYPES_SIZEOFPOINTER <= 4) + { + // get the currently used memory footprint of all swapped in bitmap graphics + // of this graphic manager. Remember candidates in a vector. The size in bytes is + // already available, thus this loop is not expensive to execute + sal_uLong nUsedSize(0); + GraphicObject* pObj = 0; + std::vector< GraphicObject* > aCandidates; + + for(pObj = (GraphicObject*)maObjList.First(); pObj; pObj = (GraphicObject*)maObjList.Next()) + { + if(pObj->meType == GRAPHIC_BITMAP && !pObj->IsSwappedOut() && pObj->GetSizeBytes()) + { + aCandidates.push_back(pObj); + nUsedSize += pObj->GetSizeBytes(); + } + } + + // detect maximum allowed memory footprint. Use the user-settings of MaxCacheSize (defaulted + // to 20MB) and add a decent multiplicator (expecrimented to find one). Limit to + // a useful maximum for 32Bit address space + + // default is 20MB, so allow 200MB initially + static sal_uLong aMultiplicator(10); + + // max at 500MB; I experimented with 800 for debug and 750 for non-debug settings (pics start + // missing when AOO reaches a mem footprint of 1.5GB) but some secure left over space for + // app activity is needed + static sal_uLong aMaxSize32Bit(500 * 1024 * 1024); + + // calc max allowed cache size + const sal_uLong nMaxCacheSize(::std::min(GetMaxCacheSize() * aMultiplicator, aMaxSize32Bit)); + + if(nUsedSize >= nMaxCacheSize && !aCandidates.empty()) + { + // if we use more currently, sort by last DataChangeTimeStamp + // sort by DataChangeTimeStamp so that the oldest get removed first + ::std::sort(aCandidates.begin(), aCandidates.end(), simpleSortByDataChangeTimeStamp()); + + for(sal_uInt32 a(0); nUsedSize >= nMaxCacheSize && a < aCandidates.size(); a++) + { + // swap out until we have no more or the goal to use less than nMaxCacheSize + // is reached + pObj = aCandidates[a]; + const sal_uLong nSizeBytes(pObj->GetSizeBytes()); + + // do not swap out when we have less than 16KB data objects + if(nSizeBytes >= (16 * 1024)) + { + pObj->FireSwapOutRequest(); + nUsedSize = (nSizeBytes < nUsedSize) ? nUsedSize - nSizeBytes : 0; + } + } + } + } +} + +// ----------------------------------------------------------------------------- + sal_Bool GraphicManager::ImplFillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ) { - return( mpCache->FillSwappedGraphicObject( rObj, rSubstitute ) ); + return mpCache->FillSwappedGraphicObject(rObj, rSubstitute); } // ----------------------------------------------------------------------------- diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index a8626d5f5c45..faaa0e8a29d7 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -288,7 +288,7 @@ sal_Unicode SvParser::GetNextChar() &nInfo, &nCvtBytes); if( (nInfo&RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) != 0 ) { - // The conversion wasn't successfull because we haven't + // The conversion wasn't successful because we haven't // read enough characters. if( pImplData->hContext != (rtl_TextToUnicodeContext)1 ) { @@ -377,7 +377,7 @@ sal_Unicode SvParser::GetNextChar() } else if( 1 == nChars && 0 == nInfo ) { - // The conversion was successfull + // The conversion was successful DBG_ASSERT( nCvtBytes == 1, "no all bytes have been converted!" ); c = cUC; diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index 845adfc9fa7d..b1da984af319 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -228,7 +228,7 @@ namespace svt { namespace uno //-------------------------------------------------------------------- Dialog* Wizard::createDialog( Window* i_pParent ) { - WizardShell* pDialog( new WizardShell( i_pParent, this, m_xController, m_aWizardSteps ) ); + WizardShell* pDialog( new WizardShell( i_pParent, m_xController, m_aWizardSteps ) ); pDialog->SetHelpId( lcl_getHelpId( m_sHelpURL ) ); pDialog->setTitleBase( m_sTitle ); return pDialog; diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index 51d85e6b8630..a78503e1f7e4 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -72,14 +72,13 @@ namespace svt { namespace uno //= WizardShell //================================================================================================================== //------------------------------------------------------------------------------------------------------------------ - WizardShell::WizardShell( Window* i_pParent, const Reference< XWizard >& i_rWizard, const Reference< XWizardController >& i_rController, + WizardShell::WizardShell( Window* i_pParent, const Reference< XWizardController >& i_rController, const Sequence< Sequence< sal_Int16 > >& i_rPaths ) :WizardShell_Base( i_pParent, WB_MOVEABLE | WB_CLOSEABLE ) - ,m_xWizard( i_rWizard ) ,m_xController( i_rController ) ,m_nFirstPageID( lcl_determineFirstPageID( i_rPaths ) ) { - ENSURE_OR_THROW( m_xWizard.is() && m_xController.is(), "invalid wizard/controller" ); + ENSURE_OR_THROW( m_xController.is(), "invalid controller" ); // declare the paths for ( sal_Int32 i=0; i<i_rPaths.getLength(); ++i ) diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index 0587f0d1e58e..6f218bcac6af 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -51,7 +51,6 @@ namespace svt { namespace uno public: WizardShell( Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& i_rWizard, const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths ); @@ -70,10 +69,6 @@ namespace svt { namespace uno virtual IWizardPageController* getPageController( TabPage* _pCurrentPage ) const; - // attribute access - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard >& - getWizard() const { return m_xWizard; } - static sal_Int16 convertCommitReasonToTravelType( const CommitPageReason i_eReason ); // operations @@ -131,7 +126,6 @@ namespace svt { namespace uno private: typedef ::std::map< TabPage*, PWizardPageController > Page2ControllerMap; - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizard > m_xWizard; const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController > m_xController; const sal_Int16 m_nFirstPageID; Page2ControllerMap m_aPageControllers; |