diff options
Diffstat (limited to 'svtools/source')
312 files changed, 6987 insertions, 7989 deletions
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 09fe2880fec0..31e4a187574f 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,8 +47,6 @@ DBG_NAME(BrowseBox) extern const char* BrowseBoxCheckInvariants( const void* pVoid ); -DECLARE_LIST( BrowserColumns, BrowserColumn* ) - #define SCROLL_FLAGS (SCROLL_CLIP | SCROLL_NOCHILDREN) #define getDataWindow() ((BrowserDataWin*)pDataWin) @@ -60,27 +59,6 @@ using namespace svt; //------------------------------------------------------------------- -#ifdef DBG_MI -void DoLog_Impl( const BrowseBox *pThis, const char *pWhat, const char *pWho ) -{ - SvFileStream aLog( "d:\\cursor.log", STREAM_WRITE|STREAM_NOCREATE ); - if ( aLog.IsOpen() ) - { - aLog.Seek( STREAM_SEEK_TO_END ); - String aEntry( (long) pThis ); - aEntry += "(row="; - aEntry += pThis->GetCurRow(); - aEntry += "): "; - aEntry += pWhat; - aEntry += " from "; - aEntry += pWho; - aEntry += " => "; - aEntry += pThis->GetCursorHideCount(); - aLog.WriteLine( aEntry ); - } -} -#endif - namespace { void disposeAndClearHeaderCell(::svt::BrowseBoxImpl::THeaderCellMap& _rHeaderCell) @@ -98,7 +76,7 @@ namespace void BrowseBox::ConstructImpl( BrowserMode nMode ) { - DBG_TRACE1( "BrowseBox: %p->ConstructImpl", this ); + OSL_TRACE( "BrowseBox: %p->ConstructImpl", this ); bMultiSelection = sal_False; pColSel = 0; pDataWin = 0; @@ -147,7 +125,6 @@ void BrowseBox::ConstructImpl( BrowserMode nMode ) bHasFocus = HasChildPathFocus(); getDataWindow()->nCursorHidden = ( bHasFocus ? 0 : 1 ) + ( GetUpdateMode() ? 0 : 1 ); - LOG( this, "ConstructImpl", "*" ); } //------------------------------------------------------------------- @@ -178,7 +155,7 @@ BrowseBox::BrowseBox( Window* pParent, const ResId& rId, BrowserMode nMode ) BrowseBox::~BrowseBox() { DBG_DTOR(BrowseBox,BrowseBoxCheckInvariants); - DBG_TRACE1( "BrowseBox: %p~", this ); + OSL_TRACE( "BrowseBox: %p~", this ); if ( m_pImpl->m_pAccessible ) { @@ -194,8 +171,9 @@ BrowseBox::~BrowseBox() delete pVScroll; // free columns-space - for ( sal_uInt16 n = 0; n < pCols->Count(); ++n ) - delete pCols->GetObject(n); + for ( size_t i = 0, n = pCols->size(); i < n; ++i ) + delete (*pCols)[ i ]; + pCols->clear(); delete pCols; delete pColSel; if ( bMultiSelection ) @@ -211,11 +189,7 @@ short BrowseBox::GetCursorHideCount() const //------------------------------------------------------------------- -void BrowseBox::DoShowCursor( const char * -#ifdef DBG_MI -pWhoLogs -#endif -) +void BrowseBox::DoShowCursor( const char * ) { short nHiddenCount = --getDataWindow()->nCursorHidden; if (PaintCursorIfHiddenOnce()) @@ -228,16 +202,11 @@ pWhoLogs if (0 == nHiddenCount) DrawCursor(); } - LOG( this, "DoShowCursor", pWhoLogs ); } //------------------------------------------------------------------- -void BrowseBox::DoHideCursor( const char * -#ifdef DBG_MI -pWhoLogs -#endif -) +void BrowseBox::DoHideCursor( const char * ) { short nHiddenCount = ++getDataWindow()->nCursorHidden; if (PaintCursorIfHiddenOnce()) @@ -250,7 +219,6 @@ pWhoLogs if (1 == nHiddenCount) DrawCursor(); } - LOG( this, "DoHideCursor", pWhoLogs ); } //------------------------------------------------------------------- @@ -282,7 +250,7 @@ void BrowseBox::InsertHandleColumn( sal_uLong nWidth ) { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - pCols->Insert( new BrowserColumn( 0, Image(), String(), nWidth, GetZoom(), 0 ), (sal_uLong) 0 ); + pCols->insert( pCols->begin(), new BrowserColumn( 0, Image(), String(), nWidth, GetZoom(), 0 ) ); FreezeColumn( 0 ); // Headerbar anpassen @@ -294,9 +262,6 @@ void BrowseBox::InsertHandleColumn( sal_uLong nWidth ) ); } - /*if ( getDataWindow()->pHeaderBar ) - getDataWindow()->pHeaderBar->InsertItem( USHRT_MAX - 1, - "", nWidth, HIB_FIXEDPOS|HIB_FIXED, 0 );*/ ColumnInserted( 0 ); } @@ -306,8 +271,16 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const Image& rImage, { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - pCols->Insert( new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ), - Min( nPos, (sal_uInt16)(pCols->Count()) ) ); + if ( nPos < pCols->size() ) + { + BrowserColumns::iterator it = pCols->begin(); + ::std::advance( it, nPos ); + pCols->insert( it, new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) ); + } + else + { + pCols->push_back( new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) ); + } if ( nCurColId == 0 ) nCurColId = nItemId; if ( getDataWindow()->pHeaderBar ) @@ -329,8 +302,16 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const XubString& rText, { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - pCols->Insert( new BrowserColumn( nItemId, Image(), rText, nWidth, GetZoom(), nBits ), - Min( nPos, (sal_uInt16)(pCols->Count()) ) ); + if ( nPos < pCols->size() ) + { + BrowserColumns::iterator it = pCols->begin(); + ::std::advance( it, nPos ); + pCols->insert( it, new BrowserColumn( nItemId, Image(), rText, nWidth, GetZoom(), nBits ) ); + } + else + { + pCols->push_back( new BrowserColumn( nItemId, Image(), rText, nWidth, GetZoom(), nBits ) ); + } if ( nCurColId == 0 ) nCurColId = nItemId; @@ -355,8 +336,17 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - pCols->Insert( new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ), - Min( nPos, (sal_uInt16)(pCols->Count()) ) ); + if ( nPos < pCols->size() ) + { + BrowserColumns::iterator it = pCols->begin(); + ::std::advance( it, nPos ); + pCols->insert( it, new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) ); + } + else + { + pCols->push_back( new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) ); + } + if ( nCurColId == 0 ) nCurColId = nItemId; if ( getDataWindow()->pHeaderBar ) @@ -384,7 +374,7 @@ sal_uInt16 BrowseBox::ToggleSelectedColumn() { DoHideCursor( "ToggleSelectedColumn" ); ToggleSelection(); - nSelectedColId = pCols->GetObject(pColSel->FirstSelected())->GetId(); + nSelectedColId = (*pCols)[ pColSel->FirstSelected() ]->GetId(); pColSel->SelectAll(sal_False); } return nSelectedColId; @@ -396,7 +386,7 @@ void BrowseBox::SetToggledSelectedColumn(sal_uInt16 _nSelectedColumnId) { pColSel->Select( GetColumnPos( _nSelectedColumnId ) ); ToggleSelection(); - DBG_TRACE1( "BrowseBox: %p->SetToggledSelectedColumn", this ); + OSL_TRACE( "BrowseBox: %p->SetToggledSelectedColumn", this ); DoShowCursor( "SetToggledSelectedColumn" ); } } @@ -410,13 +400,13 @@ void BrowseBox::FreezeColumn( sal_uInt16 nItemId, sal_Bool bFreeze ) return; // get the position in the current array - sal_uInt16 nItemPos = GetColumnPos( nItemId ); - if ( nItemPos >= pCols->Count() ) + size_t nItemPos = GetColumnPos( nItemId ); + if ( nItemPos >= pCols->size() ) // not available! return; // doesn't the state change? - if ( pCols->GetObject(nItemPos)->IsFrozen() == bFreeze ) + if ( (*pCols)[ nItemPos ]->IsFrozen() == bFreeze ) return; // remark the column selection @@ -426,14 +416,18 @@ void BrowseBox::FreezeColumn( sal_uInt16 nItemId, sal_Bool bFreeze ) if ( bFreeze ) { // to be moved? - if ( nItemPos != 0 && !pCols->GetObject(nItemPos-1)->IsFrozen() ) + if ( nItemPos != 0 && !(*pCols)[ nItemPos-1 ]->IsFrozen() ) { // move to the right of the last frozen column sal_uInt16 nFirstScrollable = FrozenColCount(); - BrowserColumn *pColumn = pCols->GetObject(nItemPos); - pCols->Remove( (sal_uLong) nItemPos ); + BrowserColumn *pColumn = (*pCols)[ nItemPos ]; + BrowserColumns::iterator it = pCols->begin(); + ::std::advance( it, nItemPos ); + pCols->erase( it ); nItemPos = nFirstScrollable; - pCols->Insert( pColumn, (sal_uLong) nItemPos ); + it = pCols->begin(); + ::std::advance( it, nItemPos ); + pCols->insert( it, pColumn ); } // adjust the number of the first scrollable and visible column @@ -443,14 +437,18 @@ void BrowseBox::FreezeColumn( sal_uInt16 nItemId, sal_Bool bFreeze ) else { // to be moved? - if ( nItemPos != FrozenColCount()-1 ) + if ( (sal_Int32)nItemPos != FrozenColCount()-1 ) { // move to the leftmost scrollable colum sal_uInt16 nFirstScrollable = FrozenColCount(); - BrowserColumn *pColumn = pCols->GetObject(nItemPos); - pCols->Remove( (sal_uLong) nItemPos ); + BrowserColumn *pColumn = (*pCols)[ nItemPos ]; + BrowserColumns::iterator it = pCols->begin(); + ::std::advance( it, nItemPos ); + pCols->erase( it ); nItemPos = nFirstScrollable; - pCols->Insert( pColumn, (sal_uLong) nItemPos ); + it = pCols->begin(); + ::std::advance( it, nItemPos ); + pCols->insert( it, pColumn ); } // adjust the number of the first scrollable and visible column @@ -458,7 +456,7 @@ void BrowseBox::FreezeColumn( sal_uInt16 nItemId, sal_Bool bFreeze ) } // toggle the freeze-state of the column - pCols->GetObject(nItemPos)->Freeze( bFreeze ); + (*pCols)[ nItemPos ]->Freeze( bFreeze ); // align the scrollbar-range UpdateScrollbars(); @@ -480,12 +478,12 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos ) return; // do not move handle column - if (nPos == 0 && !pCols->GetObject(0)->GetId()) + if (nPos == 0 && !(*pCols)[ 0 ]->GetId()) return; // get the position in the current array sal_uInt16 nOldPos = GetColumnPos( nColumnId ); - if ( nOldPos >= pCols->Count() ) + if ( nOldPos >= pCols->size() ) // not available! return; @@ -507,11 +505,19 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos ) if ( nOldPos > nPos ) nNextPos = nOldPos - 1; - BrowserColumn *pNextCol = pCols->GetObject(nNextPos); + BrowserColumn *pNextCol = (*pCols)[ nNextPos ]; Rectangle aNextRect(GetFieldRect( pNextCol->GetId() )); // move column internally - pCols->Insert( pCols->Remove( nOldPos ), nPos ); + { + BrowserColumns::iterator it = pCols->begin(); + ::std::advance( it, nOldPos ); + BrowserColumn* pTemp = *it; + pCols->erase( it ); + it = pCols->begin(); + ::std::advance( it, nPos ); + pCols->insert( it, pTemp ); + } // determine new column area Rectangle aToRect( GetFieldRect( nColumnId ) ); @@ -597,13 +603,13 @@ void BrowseBox::SetColumnMode( sal_uInt16 nColumnId, BrowserColumnMode nFlags ) return; // get the position in the current array - sal_uInt16 nColumnPos = GetColumnPos( nColumnId ); - if ( nColumnPos >= pCols->Count() ) + size_t nColumnPos = GetColumnPos( nColumnId ); + if ( nColumnPos >= pCols->size() ) // not available! return; // does the state change? - BrowserColumn *pCol = pCols->GetObject(nColumnPos); + BrowserColumn *pCol = (*pCols)[ nColumnPos ]; if ( pCol->Flags() != nFlags ) { pCol->Flags() = sal::static_int_cast< HeaderBarItemBits >(nFlags); @@ -627,12 +633,12 @@ void BrowseBox::SetColumnTitle( sal_uInt16 nItemId, const String& rTitle ) // get the position in the current array sal_uInt16 nItemPos = GetColumnPos( nItemId ); - if ( nItemPos >= pCols->Count() ) + if ( nItemPos >= pCols->size() ) // not available! return; // does the state change? - BrowserColumn *pCol = pCols->GetObject(nItemPos); + BrowserColumn *pCol = (*pCols)[ nItemPos ]; if ( pCol->Title() != rTitle ) { ::rtl::OUString sNew(rTitle); @@ -669,18 +675,18 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); // get the position in the current array - sal_uInt16 nItemPos = GetColumnPos( nItemId ); - if ( nItemPos >= pCols->Count() ) + size_t nItemPos = GetColumnPos( nItemId ); + if ( nItemPos >= pCols->size() ) return; // does the state change? nWidth = QueryColumnResize( nItemId, nWidth ); - if ( nWidth >= LONG_MAX || pCols->GetObject(nItemPos)->Width() != nWidth ) + if ( nWidth >= LONG_MAX || (*pCols)[ nItemPos ]->Width() != nWidth ) { - long nOldWidth = pCols->GetObject(nItemPos)->Width(); + long nOldWidth = (*pCols)[ nItemPos ]->Width(); // ggf. letzte Spalte anpassen - if ( IsVisible() && nItemPos == pCols->Count() - 1 ) + if ( IsVisible() && nItemPos == pCols->size() - 1 ) { long nMaxWidth = pDataWin->GetSizePixel().Width(); nMaxWidth -= getDataWindow()->bAutoSizeLastCol @@ -702,7 +708,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) // soll die Aenderung sofort dargestellt werden? sal_Bool bUpdate = GetUpdateMode() && - ( pCols->GetObject(nItemPos)->IsFrozen() || nItemPos >= nFirstCol ); + ( (*pCols)[ nItemPos ]->IsFrozen() || nItemPos >= nFirstCol ); if ( bUpdate ) { @@ -714,15 +720,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) } // Breite setzen - pCols->GetObject(nItemPos)->SetWidth(nWidth, GetZoom()); -#if 0 - if ( nItemPos != pCols->Count() - 1 ) - { - long nLastColMaxWidth = pDataWin->GetSizePixel().Width() - - GetFieldRect(GetColumnId(pCols->Count()-1)).Left(); - pCols->GetObject(pCols->Count()-1)->Width() = nLastColMaxWidth; - } -#endif + (*pCols)[ nItemPos ]->SetWidth(nWidth, GetZoom()); // scroll and invalidate if ( bUpdate ) @@ -731,7 +729,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) long nX = 0; for ( sal_uInt16 nCol = 0; nCol < nItemPos; ++nCol ) { - BrowserColumn *pCol = pCols->GetObject(nCol); + BrowserColumn *pCol = (*pCols)[ nCol ]; if ( pCol->IsFrozen() || nCol >= nFirstCol ) nX += pCol->Width(); } @@ -774,7 +772,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) nItemId ? nItemId : USHRT_MAX - 1, nWidth ); // adjust last column - if ( nItemPos != pCols->Count() - 1 ) + if ( nItemPos != pCols->size() - 1 ) AutoSizeLastColumn(); } @@ -787,7 +785,7 @@ void BrowseBox::AutoSizeLastColumn() if ( getDataWindow()->bAutoSizeLastCol && getDataWindow()->GetUpdateMode() ) { - sal_uInt16 nId = GetColumnId( (sal_uInt16)pCols->Count() - 1 ); + sal_uInt16 nId = GetColumnId( (sal_uInt16)pCols->size() - 1 ); SetColumnWidth( nId, LONG_MAX ); ColumnResized( nId ); } @@ -814,7 +812,10 @@ void BrowseBox::RemoveColumn( sal_uInt16 nItemId ) nCurColId = 0; // Spalte entfernen - delete( pCols->Remove( (sal_uLong) nPos )); + BrowserColumns::iterator it = pCols->begin(); + ::std::advance( it, nPos ); + delete *it; + pCols->erase( it ); // OJ #93534# if ( nFirstCol >= nPos && nFirstCol > FrozenColCount() ) { @@ -881,10 +882,12 @@ void BrowseBox::RemoveColumns() { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - unsigned int nOldCount = pCols->Count(); + size_t nOldCount = pCols->size(); + // alle Spalten entfernen - while ( pCols->Count() ) - delete ( pCols->Remove( (sal_uLong) 0 )); + for ( size_t i = 0; i < nOldCount; ++i ) + delete (*pCols)[ i ]; + pCols->clear(); // Spaltenselektion korrigieren if ( pColSel ) @@ -912,7 +915,7 @@ void BrowseBox::RemoveColumns() if ( isAccessibleAlive() ) { - if ( pCols->Count() != nOldCount ) + if ( pCols->size() != nOldCount ) { // all columns should be removed, so we remove the column header bar and append it again // to avoid to notify every column remove @@ -952,9 +955,9 @@ String BrowseBox::GetColumnTitle( sal_uInt16 nId ) const DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); sal_uInt16 nItemPos = GetColumnPos( nId ); - if ( nItemPos >= pCols->Count() ) + if ( nItemPos >= pCols->size() ) return String(); - return pCols->GetObject(nItemPos)->Title(); + return (*pCols)[ nItemPos ]->Title(); } //------------------------------------------------------------------- @@ -970,7 +973,7 @@ sal_uInt16 BrowseBox::ColCount() const { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - return (sal_uInt16) pCols->Count(); + return (sal_uInt16) pCols->size(); } //------------------------------------------------------------------- @@ -1013,8 +1016,7 @@ long BrowseBox::ScrollColumns( long nCols ) DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); if ( nFirstCol + nCols < 0 || - nFirstCol + nCols >= (long)pCols->Count() ) - //?MI: pCols->GetObject( nFirstCol + nCols )->IsFrozen() ) + nFirstCol + nCols >= (long)pCols->size() ) return 0; // implicitly hides cursor while scrolling @@ -1036,7 +1038,7 @@ long BrowseBox::ScrollColumns( long nCols ) } else { - long nDelta = pCols->GetObject(nFirstCol-1)->Width(); + long nDelta = (*pCols)[ nFirstCol-1 ]->Width(); long nFrozenWidth = GetFrozenWidth(); Rectangle aScrollRect( Point( nFrozenWidth + nDelta, 0 ), @@ -1082,7 +1084,7 @@ long BrowseBox::ScrollColumns( long nCols ) } else { - long nDelta = pCols->GetObject(nFirstCol)->Width(); + long nDelta = (*pCols)[ nFirstCol ]->Width(); long nFrozenWidth = GetFrozenWidth(); Rectangle aScrollRect( Point( nFrozenWidth, 0 ), @@ -1121,13 +1123,13 @@ long BrowseBox::ScrollColumns( long nCols ) if ( getDataWindow()->pHeaderBar ) { long nWidth = 0; - for ( sal_uInt16 nCol = 0; - nCol < pCols->Count() && nCol < nFirstCol; + for ( size_t nCol = 0; + nCol < pCols->size() && nCol < nFirstCol; ++nCol ) { // HandleColumn nicht - if ( pCols->GetObject(nCol)->GetId() ) - nWidth += pCols->GetObject(nCol)->Width(); + if ( (*pCols)[ nCol ]->GetId() ) + nWidth += (*pCols)[ nCol ]->Width(); } getDataWindow()->pHeaderBar->SetOffset( nWidth ); @@ -1313,16 +1315,6 @@ void BrowseBox::RowInserted( long nRow, long nNumRows, sal_Bool bDoPaint, sal_Bo if ( nNumRows <= 0 ) return; -#if 0 - // Zerlegung in einzelne RowInserted-Aufrufe: - if (nNumRows > 1) - { - for (long i = 0; i < nNumRows; i++) - RowInserted(nRow + i,1,bDoPaint); - return; - } -#endif - // adjust total row count sal_Bool bLastRow = nRow >= nRowCount; nRowCount += nNumRows; @@ -1435,7 +1427,7 @@ void BrowseBox::RowRemoved( long nRow, long nNumRows, sal_Bool bDoPaint ) if ( bDoPaint ) { // hide cursor and selection - DBG_TRACE1( "BrowseBox: %p->HideCursor", this ); + OSL_TRACE( "BrowseBox: %p->HideCursor", this ); ToggleSelection(); DoHideCursor( "RowRemoved" ); } @@ -1514,7 +1506,7 @@ void BrowseBox::RowRemoved( long nRow, long nNumRows, sal_Bool bDoPaint ) { // reshow cursor and selection ToggleSelection(); - DBG_TRACE1( "BrowseBox: %p->ShowCursor", this ); + OSL_TRACE( "BrowseBox: %p->ShowCursor", this ); DoShowCursor( "RowRemoved" ); // adjust the vertical scrollbar @@ -1711,7 +1703,7 @@ sal_Bool BrowseBox::GoToColumnId( sal_uInt16 nColId, sal_Bool bMakeVisible, sal_ if ( nColId != nCurColId || (bMakeVisible && !IsFieldVisible(nCurRow, nColId, sal_True))) { sal_uInt16 nNewPos = GetColumnPos(nColId); - BrowserColumn* pColumn = pCols->GetObject( nNewPos ); + BrowserColumn* pColumn = (nNewPos < pCols->size()) ? (*pCols)[ nNewPos ] : NULL; DBG_ASSERT( pColumn, "no column object - invalid id?" ); if ( !pColumn ) return sal_False; @@ -1786,7 +1778,7 @@ void BrowseBox::SetNoSelection() // nothing to do return; - DBG_TRACE1( "BrowseBox: %p->HideCursor", this ); + OSL_TRACE( "BrowseBox: %p->HideCursor", this ); ToggleSelection(); // unselect all @@ -1802,7 +1794,7 @@ void BrowseBox::SetNoSelection() bSelect = sal_True; // restore screen - DBG_TRACE1( "BrowseBox: %p->ShowCursor", this ); + OSL_TRACE( "BrowseBox: %p->ShowCursor", this ); if ( isAccessibleAlive() ) { @@ -1822,7 +1814,7 @@ void BrowseBox::SetSelection( const MultiSelection &rSel ) DBG_ASSERT( bMultiSelection, "SetSelection only allowed with Multi-Selection-Mode" ); // prepare inverted areas - DBG_TRACE1( "BrowseBox: %p->HideCursor", this ); + OSL_TRACE( "BrowseBox: %p->HideCursor", this ); ToggleSelection(); // assign Selection @@ -1839,7 +1831,7 @@ void BrowseBox::SetSelection( const MultiSelection &rSel ) // restore screen ToggleSelection(); - DBG_TRACE1( "BrowseBox: %p->ShowCursor", this ); + OSL_TRACE( "BrowseBox: %p->ShowCursor", this ); if ( isAccessibleAlive() ) { @@ -1860,7 +1852,7 @@ void BrowseBox::SelectAll() if ( !bMultiSelection ) return; - DBG_TRACE1( "BrowseBox: %p->HideCursor", this ); + OSL_TRACE( "BrowseBox: %p->HideCursor", this ); ToggleSelection(); // select all rows @@ -1869,7 +1861,7 @@ void BrowseBox::SelectAll() uRow.pSel->SelectAll(sal_True); // Handle-Column nicht highlighten - BrowserColumn *pFirstCol = pCols->GetObject(0); + BrowserColumn *pFirstCol = (*pCols)[ 0 ]; long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); // highlight the row selection @@ -1893,7 +1885,7 @@ void BrowseBox::SelectAll() bSelect = sal_True; // restore screen - DBG_TRACE1( "BrowseBox: %p->ShowCursor", this ); + OSL_TRACE( "BrowseBox: %p->ShowCursor", this ); if ( isAccessibleAlive() ) { @@ -1932,7 +1924,7 @@ void BrowseBox::SelectRow( long nRow, sal_Bool _bSelect, sal_Bool bExpand ) return; } - DBG_TRACE1( "BrowseBox: %p->HideCursor", this ); + OSL_TRACE( "BrowseBox: %p->HideCursor", this ); // remove old selection? if ( !bExpand || !bMultiSelection ) @@ -1958,7 +1950,7 @@ void BrowseBox::SelectRow( long nRow, sal_Bool _bSelect, sal_Bool bExpand ) ) { // Handle-Column nicht highlighten - BrowserColumn *pFirstCol = pCols->GetObject(0); + BrowserColumn *pFirstCol = (*pCols)[ 0 ]; long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); // highlight only newly selected part @@ -1974,7 +1966,7 @@ void BrowseBox::SelectRow( long nRow, sal_Bool _bSelect, sal_Bool bExpand ) bSelect = sal_True; // restore screen - DBG_TRACE1( "BrowseBox: %p->ShowCursor", this ); + OSL_TRACE( "BrowseBox: %p->ShowCursor", this ); if ( isAccessibleAlive() ) { @@ -2014,16 +2006,16 @@ void BrowseBox::SelectColumnPos( sal_uInt16 nNewColPos, sal_Bool _bSelect, sal_B if ( !bMultiSelection ) { if ( _bSelect ) - GoToColumnId( pCols->GetObject(nNewColPos)->GetId(), bMakeVisible ); + GoToColumnId( (*pCols)[ nNewColPos ]->GetId(), bMakeVisible ); return; } else { - if ( !GoToColumnId( pCols->GetObject( nNewColPos )->GetId(), bMakeVisible ) ) + if ( !GoToColumnId( (*pCols)[ nNewColPos ]->GetId(), bMakeVisible ) ) return; } - DBG_TRACE1( "BrowseBox: %p->HideCursor", this ); + OSL_TRACE( "BrowseBox: %p->HideCursor", this ); ToggleSelection(); if ( bMultiSelection ) uRow.pSel->SelectAll(sal_False); @@ -2040,7 +2032,7 @@ void BrowseBox::SelectColumnPos( sal_uInt16 nNewColPos, sal_Bool _bSelect, sal_B Rectangle aFieldRectPix( GetFieldRectPixel( nCurRow, nCurColId, sal_False ) ); Rectangle aRect( Point( aFieldRectPix.Left() - MIN_COLUMNWIDTH, 0 ), - Size( pCols->GetObject(nNewColPos)->Width(), + Size( (*pCols)[ nNewColPos ]->Width(), pDataWin->GetOutputSizePixel().Height() ) ); pDataWin->Invalidate( aRect ); if ( !bSelecting ) @@ -2065,7 +2057,7 @@ void BrowseBox::SelectColumnPos( sal_uInt16 nNewColPos, sal_Bool _bSelect, sal_B } // restore screen - DBG_TRACE1( "BrowseBox: %p->ShowCursor", this ); + OSL_TRACE( "BrowseBox: %p->ShowCursor", this ); } //------------------------------------------------------------------- @@ -2324,14 +2316,14 @@ Rectangle BrowseBox::ImplFieldRectPixel( long nRow, sal_uInt16 nColumnId ) const // compute the X-coordinte realtiv to DataWin by accumulation long nColX = 0; sal_uInt16 nFrozenCols = FrozenColCount(); - sal_uInt16 nCol; + size_t nCol; for ( nCol = 0; - nCol < pCols->Count() && pCols->GetObject(nCol)->GetId() != nColumnId; + nCol < pCols->size() && (*pCols)[ nCol ]->GetId() != nColumnId; ++nCol ) - if ( pCols->GetObject(nCol)->IsFrozen() || nCol >= nFirstCol ) - nColX += pCols->GetObject(nCol)->Width(); + if ( (*pCols)[ nCol ]->IsFrozen() || nCol >= nFirstCol ) + nColX += (*pCols)[ nCol ]->Width(); - if ( nCol >= pCols->Count() || ( nCol >= nFrozenCols && nCol < nFirstCol ) ) + if ( nCol >= pCols->size() || ( nCol >= nFrozenCols && nCol < nFirstCol ) ) return Rectangle(); // compute the Y-coordinate relative to DataWin @@ -2342,7 +2334,7 @@ Rectangle BrowseBox::ImplFieldRectPixel( long nRow, sal_uInt16 nColumnId ) const // assemble the Rectangle relative to DataWin return Rectangle( Point( nColX + MIN_COLUMNWIDTH, nRowY ), - Size( pCols->GetObject(nCol)->Width() - 2*MIN_COLUMNWIDTH, + Size( (*pCols)[ nCol ]->Width() - 2*MIN_COLUMNWIDTH, GetDataRowHeight() - 1 ) ); } @@ -2384,10 +2376,9 @@ sal_uInt16 BrowseBox::GetColumnAtXPosPixel( long nX, sal_Bool ) const // accumulate the withds of the visible columns long nColX = 0; - sal_uInt16 nCol; - for ( nCol = 0; nCol < sal_uInt16(pCols->Count()); ++nCol ) + for ( size_t nCol = 0; nCol < pCols->size(); ++nCol ) { - BrowserColumn *pCol = pCols->GetObject(nCol); + BrowserColumn *pCol = (*pCols)[ nCol ]; if ( pCol->IsFrozen() || nCol >= nFirstCol ) nColX += pCol->Width(); @@ -2430,27 +2421,6 @@ void BrowseBox::SetMode( BrowserMode nMode ) { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); -#ifdef DBG_MIx - Sound::Beep(); - nMode = -// BROWSER_COLUMNSELECTION | -// BROWSER_MULTISELECTION | - BROWSER_THUMBDRAGGING | - BROWSER_KEEPHIGHLIGHT | - BROWSER_HLINES | - BROWSER_VLINES | -// BROWSER_HIDECURSOR | -// BROWSER_NO_HSCROLL | -// BROWSER_NO_SCROLLBACK | - BROWSER_AUTO_VSCROLL | - BROWSER_AUTO_HSCROLL | - BROWSER_TRACKING_TIPS | -// BROWSER_HIGHLIGHT_NONE | - BROWSER_HEADERBAR_NEW | -// BROWSER_AUTOSIZE_LASTCOL | - 0; -#endif - getDataWindow()->bAutoHScroll = BROWSER_AUTO_HSCROLL == ( nMode & BROWSER_AUTO_HSCROLL ); getDataWindow()->bAutoVScroll = BROWSER_AUTO_VSCROLL == ( nMode & BROWSER_AUTO_VSCROLL ); getDataWindow()->bNoHScroll = BROWSER_NO_HSCROLL == ( nMode & BROWSER_NO_HSCROLL ); @@ -2536,7 +2506,7 @@ void BrowseBox::SetMode( BrowserMode nMode ) if ( bColumnCursor ) { pColSel = pOldColSel ? pOldColSel : new MultiSelection; - pColSel->SetTotalRange( Range( 0, pCols->Count()-1 ) ); + pColSel->SetTotalRange( Range( 0, pCols->size()-1 ) ); } else { @@ -2718,11 +2688,11 @@ void BrowseBox::CursorMoved() void BrowseBox::LoseFocus() { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - DBG_TRACE1( "BrowseBox: %p->LoseFocus", this ); + OSL_TRACE( "BrowseBox: %p->LoseFocus", this ); if ( bHasFocus ) { - DBG_TRACE1( "BrowseBox: %p->HideCursor", this ); + OSL_TRACE( "BrowseBox: %p->HideCursor", this ); DoHideCursor( "LoseFocus" ); if ( !bKeepHighlight ) @@ -2741,7 +2711,7 @@ void BrowseBox::LoseFocus() void BrowseBox::GetFocus() { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - DBG_TRACE1( "BrowseBox: %p->GetFocus", this ); + OSL_TRACE( "BrowseBox: %p->GetFocus", this ); if ( !bHasFocus ) { @@ -2759,3 +2729,4 @@ void BrowseBox::GetFocus() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index c37fb6915725..9c9796baa90b 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,8 +34,6 @@ #include <svtools/colorcfg.hxx> #include <vcl/salgtype.hxx> -#ifndef GCC -#endif #include <tools/multisel.hxx> #include <algorithm> @@ -51,8 +50,6 @@ DBG_NAMEEX(BrowseBox) extern const char* BrowseBoxCheckInvariants( const void * pVoid ); -DECLARE_LIST( BrowserColumns, BrowserColumn* ) - //=================================================================== void BrowseBox::StartDrag( sal_Int8 /* _nAction */, const Point& /* _rPosPixel */ ) @@ -205,11 +202,11 @@ void BrowseBox::StateChanged( StateChangedType nStateChange ) pHeaderBar->SetZoom(GetZoom()); // let the cols calc their new widths and adjust the header bar - for ( sal_uInt16 nPos = 0; nPos < pCols->Count(); ++nPos ) + for ( size_t nPos = 0; nPos < pCols->size(); ++nPos ) { - pCols->GetObject(nPos)->ZoomChanged(GetZoom()); + (*pCols)[ nPos ]->ZoomChanged(GetZoom()); if ( pHeaderBar ) - pHeaderBar->SetItemSize( pCols->GetObject(nPos)->GetId(), pCols->GetObject(nPos)->Width() ); + pHeaderBar->SetItemSize( (*pCols)[ nPos ]->GetId(), (*pCols)[ nPos ]->Width() ); } // all our controls have to be repositioned @@ -218,7 +215,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange ) else if (STATE_CHANGE_ENABLE == nStateChange) { // do we have a handle column? - sal_Bool bHandleCol = pCols->Count() && (0 == pCols->GetObject(0)->GetId()); + sal_Bool bHandleCol = !pCols->empty() && (0 == (*pCols)[ 0 ]->GetId()); // do we have a header bar sal_Bool bHeaderBar = (NULL != static_cast<BrowserDataWin&>(GetDataWindow()).pHeaderBar); @@ -310,7 +307,6 @@ void BrowseBox::ColumnMoved( sal_uInt16 ) void BrowseBox::StartScroll() { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - //((Control*)pDataWin)->HideFocus(); DoHideCursor( "StartScroll" ); } @@ -351,7 +347,7 @@ void BrowseBox::ToggleSelection( sal_Bool bForce ) long nLastRowInRect = 0; // fuer den CFront // Handle-Column nicht highlighten - BrowserColumn *pFirstCol = pCols->GetObject(0); + BrowserColumn *pFirstCol = pCols->empty() ? NULL : (*pCols)[ 0 ]; long nOfsX = (!pFirstCol || pFirstCol->GetId()) ? 0 : pFirstCol->Width(); // accumulate old row selection @@ -369,20 +365,21 @@ void BrowseBox::ToggleSelection( sal_Bool bForce ) Rectangle aAddRect( Point( nOfsX, (nRow-nTopRow)*GetDataRowHeight() ), Size( pDataWin->GetSizePixel().Width(), GetDataRowHeight() ) ); - if ( aHighlightList.Count() && nLastRowInRect == ( nRow - 1 ) ) - aHighlightList.First()->Union( aAddRect ); + if ( aHighlightList.size() && nLastRowInRect == ( nRow - 1 ) ) + aHighlightList[ 0 ]->Union( aAddRect ); else - aHighlightList.Insert( new Rectangle( aAddRect ), (sal_uLong) 0 ); + aHighlightList.insert( aHighlightList.begin(), new Rectangle( aAddRect ) ); nLastRowInRect = nRow; } // unhighlight the old selection (if any) - while ( aHighlightList.Count() ) + for ( size_t i = aHighlightList.size(); i > 0; ) { - Rectangle *pRect = aHighlightList.Remove( aHighlightList.Count() - 1 ); + Rectangle *pRect = aHighlightList[ --i ]; pDataWin->Invalidate( *pRect ); delete pRect; } + aHighlightList.clear(); // unhighlight old column selection (if any) for ( long nColId = pColSel ? pColSel->FirstSelected() : BROWSER_ENDOFSELECTION; @@ -390,7 +387,7 @@ void BrowseBox::ToggleSelection( sal_Bool bForce ) nColId = pColSel->NextSelected() ) { Rectangle aRect( GetFieldRectPixel(nCurRow, - pCols->GetObject(nColId)->GetId(), + (*pCols)[ nColId ]->GetId(), sal_False ) ); aRect.Left() -= MIN_COLUMNWIDTH; aRect.Right() += MIN_COLUMNWIDTH; @@ -437,15 +434,14 @@ void BrowseBox::DrawCursor() if ( bColumnCursor ) { aCursor = GetFieldRectPixel( nCurRow, nCurColId, sal_False ); - //! --aCursor.Bottom(); aCursor.Left() -= MIN_COLUMNWIDTH; aCursor.Right() += 1; aCursor.Bottom() += 1; } else aCursor = Rectangle( - Point( ( pCols->Count() && pCols->GetObject(0)->GetId() == 0 ) ? - pCols->GetObject(0)->Width() : 0, + Point( ( !pCols->empty() && (*pCols)[ 0 ]->GetId() == 0 ) ? + (*pCols)[ 0 ]->Width() : 0, (nCurRow - nTopRow) * GetDataRowHeight() + 1 ), Size( pDataWin->GetOutputSizePixel().Width() + 1, GetDataRowHeight() - 2 ) ); @@ -456,8 +452,6 @@ void BrowseBox::DrawCursor() --aCursor.Bottom(); } - //!mi_mac pDataWin->Update(); - if (m_aCursorColor == COL_TRANSPARENT) { // auf diesem Plattformen funktioniert der StarView-Focus richtig @@ -486,9 +480,9 @@ sal_uLong BrowseBox::GetColumnWidth( sal_uInt16 nId ) const DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); sal_uInt16 nItemPos = GetColumnPos( nId ); - if ( nItemPos >= pCols->Count() ) + if ( nItemPos >= pCols->size() ) return 0; - return pCols->GetObject(nItemPos)->Width(); + return (*pCols)[ nItemPos ]->Width(); } //------------------------------------------------------------------- @@ -497,9 +491,9 @@ sal_uInt16 BrowseBox::GetColumnId( sal_uInt16 nPos ) const { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - if ( nPos >= pCols->Count() ) + if ( nPos >= pCols->size() ) return 0; - return pCols->GetObject(nPos)->GetId(); + return (*pCols)[ nPos ]->GetId(); } //------------------------------------------------------------------- @@ -508,8 +502,8 @@ sal_uInt16 BrowseBox::GetColumnPos( sal_uInt16 nId ) const { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - for ( sal_uInt16 nPos = 0; nPos < pCols->Count(); ++nPos ) - if ( pCols->GetObject(nPos)->GetId() == nId ) + for ( sal_uInt16 nPos = 0; nPos < pCols->size(); ++nPos ) + if ( (*pCols)[ nPos ]->GetId() == nId ) return nPos; return BROWSER_INVALIDID; } @@ -520,9 +514,9 @@ sal_Bool BrowseBox::IsFrozen( sal_uInt16 nColumnId ) const { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - for ( sal_uInt16 nPos = 0; nPos < pCols->Count(); ++nPos ) - if ( pCols->GetObject(nPos)->GetId() == nColumnId ) - return pCols->GetObject(nPos)->IsFrozen(); + for ( size_t nPos = 0; nPos < pCols->size(); ++nPos ) + if ( (*pCols)[ nPos ]->GetId() == nColumnId ) + return (*pCols)[ nPos ]->IsFrozen(); return sal_False; } @@ -599,7 +593,7 @@ void BrowseBox::Resize() DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); if ( !bBootstrapped && IsReallyVisible() ) BrowseBox::StateChanged( STATE_CHANGE_INITSHOW ); - if ( !pCols->Count() ) + if ( pCols->empty() ) { getDataWindow()->bResizeOnPaint = sal_True; return; @@ -619,7 +613,7 @@ void BrowseBox::Resize() // did we need a horiz. scroll bar oder gibt es eine Control Area? if ( !getDataWindow()->bNoHScroll && - ( ( pCols->Count() - FrozenColCount() ) > 1 ) ) + ( ( pCols->size() - FrozenColCount() ) > 1 ) ) aHScroll.Show(); else aHScroll.Hide(); @@ -659,7 +653,7 @@ void BrowseBox::Resize() if ( pHeaderBar ) { // Handle-Column beruecksichtigen - BrowserColumn *pFirstCol = pCols->GetObject(0); + BrowserColumn *pFirstCol = (*pCols)[ 0 ]; long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); pHeaderBar->SetPosSizePixel( Point( nOfsX, 0 ), Size( GetOutputSizePixel().Width() - nOfsX, GetTitleHeight() ) ); } @@ -677,10 +671,10 @@ void BrowseBox::Paint( const Rectangle& rRect ) // initializations if ( !bBootstrapped && IsReallyVisible() ) BrowseBox::StateChanged( STATE_CHANGE_INITSHOW ); - if ( !pCols->Count() ) + if ( pCols->empty() ) return; - BrowserColumn *pFirstCol = pCols->GetObject(0); + BrowserColumn *pFirstCol = (*pCols)[ 0 ]; sal_Bool bHandleCol = pFirstCol && pFirstCol->GetId() == 0; sal_Bool bHeaderBar = getDataWindow()->pHeaderBar != NULL; @@ -709,20 +703,20 @@ void BrowseBox::Paint( const Rectangle& rRect ) { // iterate through columns to redraw long nX = 0; - sal_uInt16 nCol; + size_t nCol; for ( nCol = 0; - nCol < pCols->Count() && nX < rRect.Right(); + nCol < pCols->size() && nX < rRect.Right(); ++nCol ) { // skip invisible colums between frozen and scrollable area - if ( nCol < nFirstCol && !pCols->GetObject(nCol)->IsFrozen() ) + if ( nCol < nFirstCol && !(*pCols)[ nCol ]->IsFrozen() ) nCol = nFirstCol; // nur die HandleCol ? if (bHeaderBar && bHandleCol && nCol > 0) break; - BrowserColumn *pCol = pCols->GetObject(nCol); + BrowserColumn *pCol = (*pCols)[ nCol ]; // draw the column and increment position if ( pCol->Width() > 4 ) @@ -749,7 +743,7 @@ void BrowseBox::Paint( const Rectangle& rRect ) } // retouching - if ( !bHeaderBar && nCol == pCols->Count() ) + if ( !bHeaderBar && nCol == pCols->size() ) { const StyleSettings &rSettings = GetSettings().GetStyleSettings(); Color aColFace( rSettings.GetFaceColor() ); @@ -820,10 +814,10 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, nDataRowHeight = nForeignHeightPixel; // this counts for the column widths, too - sal_uInt16 nPos; - for ( nPos = 0; nPos < pCols->Count(); ++nPos ) + size_t nPos; + for ( nPos = 0; nPos < pCols->size(); ++nPos ) { - BrowserColumn* pCurrent = pCols->GetObject(nPos); + BrowserColumn* pCurrent = (*pCols)[ nPos ]; long nWidthLogic = PixelToLogic(Size(pCurrent->Width(), 0), MAP_10TH_MM).Width(); long nForeignWidthPixel = pDev->LogicToPixel(Size(nWidthLogic, 0), MAP_10TH_MM).Width(); @@ -846,7 +840,7 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, long nTitleHeight = PixelToLogic(Size(0, GetTitleHeight()), MAP_10TH_MM).Height(); nTitleHeight = pDev->LogicToPixel(Size(0, nTitleHeight), MAP_10TH_MM).Height(); - BrowserColumn* pFirstCol = pCols->Count() ? pCols->GetObject(0) : NULL; + BrowserColumn* pFirstCol = !pCols->empty() ? (*pCols)[ 0 ] : NULL; Point aHeaderPos(pFirstCol && (pFirstCol->GetId() == 0) ? pFirstCol->Width() : 0, 0); Size aHeaderSize(aRealSize.Width() - aHeaderPos.X(), nTitleHeight); @@ -900,9 +894,9 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, // restore the column widths/data row height nDataRowHeight = nOriginalHeight; - for ( nPos = 0; nPos < pCols->Count(); ++nPos ) + for ( nPos = 0; nPos < pCols->size(); ++nPos ) { - BrowserColumn* pCurrent = pCols->GetObject(nPos); + BrowserColumn* pCurrent = (*pCols)[ nPos ]; long nForeignWidthLogic = pDev->PixelToLogic(Size(pCurrent->Width(), 0), MAP_10TH_MM).Width(); long nWidthPixel = LogicToPixel(Size(nForeignWidthLogic, 0), MAP_10TH_MM).Width(); @@ -939,15 +933,12 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_ Color aOldTextColor = _rOut.GetTextColor(); Color aOldFillColor = _rOut.GetFillColor(); Color aOldLineColor = _rOut.GetLineColor(); - long nHLineX = 0 == pCols->GetObject(0)->GetId() - ? pCols->GetObject(0)->Width() - : 0; + long nHLineX = 0 == (*pCols)[ 0 ]->GetId() ? (*pCols)[ 0 ]->Width() : 0; nHLineX += aOverallAreaPos.X(); Color aDelimiterLineColor( ::svtools::ColorConfig().GetColorValue( ::svtools::CALCGRID ).nColor ); // redraw the invalid fields - sal_Bool bRetouching = sal_False; for ( sal_uLong nRelRow = nRelTopRow; nRelRow <= nRelBottomRow && (sal_uLong)nTopRow+nRelRow < (sal_uLong)nRowCount; ++nRelRow, aPos.Y() += nDataRowHeigt ) @@ -961,7 +952,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_ // prepare row sal_uLong nRow = nTopRow+nRelRow; if ( !SeekRow( nRow) ) { - DBG_ERROR("BrowseBox::ImplPaintData: SeekRow gescheitert"); + OSL_FAIL("BrowseBox::ImplPaintData: SeekRow gescheitert"); } _rOut.SetClipRegion(); aPos.X() = aOverallAreaPos.X(); @@ -985,11 +976,11 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_ } // iterate through columns to redraw - sal_uInt16 nCol; - for ( nCol = 0; nCol < pCols->Count(); ++nCol ) + size_t nCol; + for ( nCol = 0; nCol < pCols->size(); ++nCol ) { // get column - BrowserColumn *pCol = pCols->GetObject(nCol); + BrowserColumn *pCol = (*pCols)[ nCol ]; // at end of invalid area if ( aPos.X() >= _rRect.Right() ) @@ -999,11 +990,11 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_ if ( nCol < nFirstCol && !pCol->IsFrozen() ) { nCol = nFirstCol; - pCol = pCols->GetObject(nCol); + pCol = (nCol < pCols->size() ) ? (*pCols)[ nCol ] : NULL; if (!pCol) { // FS - 21.05.99 - 66325 // ist zwar eigentlich woanders (an der richtigen Stelle) gefixt, aber sicher ist sicher ... - DBG_ERROR("BrowseBox::PaintData : nFirstCol is probably invalid !"); + OSL_FAIL("BrowseBox::PaintData : nFirstCol is probably invalid !"); break; } } @@ -1066,9 +1057,6 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_ aPos.X() += pCol->Width(); } - if ( nCol == pCols->Count() ) - bRetouching = sal_True; - // reset auto-highlight if ( bRowSelected ) { @@ -1103,14 +1091,14 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_ aOldLineColor = _rOut.GetLineColor(); aOldFillColor = _rOut.GetFillColor(); _rOut.SetFillColor( rSettings.GetFaceColor() ); - if ( pCols->Count() && ( pCols->GetObject(0)->GetId() == 0 ) && ( aPos.Y() <= _rRect.Bottom() ) ) + if ( !pCols->empty() && ( (*pCols)[ 0 ]->GetId() == 0 ) && ( aPos.Y() <= _rRect.Bottom() ) ) { // fill rectangle gray below handle column // DG: fill it only until the end of the drawing rect and not to the end, as this may overpaint handle columns _rOut.SetLineColor( Color( COL_BLACK ) ); _rOut.DrawRect( Rectangle( Point( aOverallAreaPos.X() - 1, aPos.Y() - 1 ), - Point( aOverallAreaPos.X() + pCols->GetObject(0)->Width() - 1, + Point( aOverallAreaPos.X() + (*pCols)[ 0 ]->Width() - 1, _rRect.Bottom() + 1) ) ); } _rOut.SetFillColor( aOldFillColor ); @@ -1129,16 +1117,16 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, sal_ _rOut.SetLineColor( aDelimiterLineColor ); Point aVertPos( aOverallAreaPos.X() - 1, aOverallAreaPos.Y() ); long nDeltaY = aOverallAreaBRPos.Y(); - for ( sal_uInt16 nCol = 0; nCol < pCols->Count(); ++nCol ) + for ( size_t nCol = 0; nCol < pCols->size(); ++nCol ) { // get column - BrowserColumn *pCol = pCols->GetObject(nCol); + BrowserColumn *pCol = (*pCols)[ nCol ]; // skip invisible colums between frozen and scrollable area if ( nCol < nFirstCol && !pCol->IsFrozen() ) { nCol = nFirstCol; - pCol = pCols->GetObject(nCol); + pCol = (*pCols)[ nCol ]; } // skip column @@ -1171,7 +1159,7 @@ void BrowseBox::PaintData( Window& rWin, const Rectangle& rRect ) BrowseBox::StateChanged( STATE_CHANGE_INITSHOW ); // initializations - if ( !pCols || !pCols->Count() || !rWin.IsUpdateMode() ) + if ( !pCols || pCols->empty() || !rWin.IsUpdateMode() ) return; if ( getDataWindow()->bResizeOnPaint ) Resize(); @@ -1231,7 +1219,7 @@ void BrowseBox::UpdateScrollbars() sal_uInt16 nFrozenCols = FrozenColCount(); sal_Bool bNeedsHScroll = getDataWindow()->bAutoHScroll - ? ( nFirstCol > nFrozenCols ) || ( nLastCol <= pCols->Count() ) + ? ( nFirstCol > nFrozenCols ) || ( nLastCol <= pCols->size() ) : !getDataWindow()->bNoHScroll; if ( !bNeedsHScroll ) { @@ -1260,19 +1248,11 @@ void BrowseBox::UpdateScrollbars() Size( aDataWinSize.Width() - nHScrX, nCornerSize ) ); // Scrollable Columns insgesamt - short nScrollCols = short(pCols->Count()) - (short)nFrozenCols; - /*short nVisibleHSize= std::max(nLastCol == BROWSER_INVALIDID - ? pCols->Count() - nFirstCol -1 - : nLastCol - nFirstCol - 1, 0); - - aHScroll.SetVisibleSize( nVisibleHSize ); - aHScroll.SetRange( Range( 0, Max( std::min(nScrollCols, nVisibleHSize), (short)0 ) ) ); - if ( bNeedsHScroll && !aHScroll.IsVisible() ) - aHScroll.Show();*/ + short nScrollCols = short(pCols->size()) - (short)nFrozenCols; // Sichtbare Columns short nVisibleHSize = nLastCol == BROWSER_INVALIDID - ? (short)( pCols->Count() - nFirstCol ) + ? (short)( pCols->size() - nFirstCol ) : (short)( nLastCol - nFirstCol ); short nRange = Max( nScrollCols, (short)0 ); @@ -1287,7 +1267,7 @@ void BrowseBox::UpdateScrollbars() if ( nTopRow > nRowCount ) { nTopRow = nRowCount - 1; - DBG_ERROR("BrowseBox: nTopRow > nRowCount"); + OSL_FAIL("BrowseBox: nTopRow > nRowCount"); } if ( pVScroll->GetThumbPos() != nTopRow ) @@ -1338,13 +1318,13 @@ void BrowseBox::UpdateScrollbars() if ( getDataWindow()->pHeaderBar ) { long nWidth = 0; - for ( sal_uInt16 nCol = 0; - nCol < pCols->Count() && nCol < nFirstCol; + for ( size_t nCol = 0; + nCol < pCols->size() && nCol < nFirstCol; ++nCol ) { // HandleColumn nicht - if ( pCols->GetObject(nCol)->GetId() ) - nWidth += pCols->GetObject(nCol)->Width(); + if ( (*pCols)[ nCol ]->GetId() ) + nWidth += (*pCols)[ nCol ]->Width(); } getDataWindow()->pHeaderBar->SetOffset( nWidth ); @@ -1406,10 +1386,10 @@ long BrowseBox::GetFrozenWidth() const DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); long nWidth = 0; - for ( sal_uInt16 nCol = 0; - nCol < pCols->Count() && pCols->GetObject(nCol)->IsFrozen(); + for ( size_t nCol = 0; + nCol < pCols->size() && (*pCols)[ nCol ]->IsFrozen(); ++nCol ) - nWidth += pCols->GetObject(nCol)->Width(); + nWidth += (*pCols)[ nCol ]->Width(); return nWidth; } @@ -1431,7 +1411,7 @@ sal_uInt16 BrowseBox::FrozenColCount() const DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); sal_uInt16 nCol; for ( nCol = 0; - nCol < pCols->Count() && pCols->GetObject(nCol)->IsFrozen(); + nCol < pCols->size() && (*pCols)[ nCol ]->IsFrozen(); ++nCol ) /* empty loop */; return nCol; @@ -1469,9 +1449,8 @@ IMPL_LINK( BrowseBox,EndScrollHdl,ScrollBar*, EMPTYARG ) // kein Focus grabben! /// GrabFocus(); - if ( /*pBar->GetDelta() <= 0 &&*/ getDataWindow()->bNoScrollBack ) + if ( getDataWindow()->bNoScrollBack ) { - // UpdateScrollbars(); EndScroll(); return 0; } @@ -1506,10 +1485,10 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt ) long nX = 0; long nWidth = GetOutputSizePixel().Width(); - for ( sal_uInt16 nCol = 0; nCol < pCols->Count() && nX < nWidth; ++nCol ) + for ( size_t nCol = 0; nCol < pCols->size() && nX < nWidth; ++nCol ) { // is this column visible? - BrowserColumn *pCol = pCols->GetObject(nCol); + BrowserColumn *pCol = (*pCols)[ nCol ]; if ( pCol->IsFrozen() || nCol >= nFirstCol ) { // compute right end of column @@ -1539,7 +1518,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 ) ); @@ -1556,20 +1535,20 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt ) void BrowseBox::MouseMove( const MouseEvent& rEvt ) { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - DBG_TRACE( "BrowseBox::MouseMove( MouseEvent )" ); + OSL_TRACE( "BrowseBox::MouseMove( MouseEvent )" ); Pointer aNewPointer; sal_uInt16 nX = 0; - for ( sal_uInt16 nCol = 0; - nCol < sal_uInt16(pCols->Count()) && - ( nX + pCols->GetObject(nCol)->Width() ) < sal_uInt16(GetOutputSizePixel().Width()); + for ( size_t nCol = 0; + nCol < pCols->size() && + ( nX + (*pCols)[ nCol ]->Width() ) < sal_uInt16(GetOutputSizePixel().Width()); ++nCol ) // is this column visible? - if ( pCols->GetObject(nCol)->IsFrozen() || nCol >= nFirstCol ) + if ( (*pCols)[ nCol ]->IsFrozen() || nCol >= nFirstCol ) { // compute right end of column - BrowserColumn *pCol = pCols->GetObject(nCol); + BrowserColumn *pCol = (*pCols)[ nCol ]; sal_uInt16 nR = (sal_uInt16)(nX + pCol->Width() - 1); // show resize-pointer? @@ -1618,7 +1597,7 @@ void BrowseBox::MouseButtonUp( const MouseEvent & rEvt ) // width changed? nDragX = Max( rEvt.GetPosPixel().X(), nMinResizeX ); - if ( (nDragX - nResizeX) != (long)pCols->GetObject(nResizeCol)->Width() ) + if ( (nDragX - nResizeX) != (long)(*pCols)[ nResizeCol ]->Width() ) { // resize column long nMaxX = pDataWin->GetSizePixel().Width(); @@ -1666,7 +1645,7 @@ void BrowseBox::MouseButtonDown( const BrowserMouseEvent& rEvt ) { if ( bColumnCursor && rEvt.GetColumn() != 0 ) { - if ( rEvt.GetColumn() < pCols->Count() ) + if ( rEvt.GetColumn() < pCols->size() ) SelectColumnPos( rEvt.GetColumn(), sal_True, sal_False); } } @@ -2175,3 +2154,4 @@ Rectangle BrowseBox::GetFieldRectPixelAbs( sal_Int32 _nRowId,sal_uInt16 _nColId, // ------------------------------------------------------------------------- EOF +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 966f8e8596fc..929aa3303a77 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -267,7 +268,7 @@ OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType e #endif break; default: - OSL_ENSURE(0,"BrowseBox::GetAccessibleName: invalid enum!"); + OSL_FAIL("BrowseBox::GetAccessibleName: invalid enum!"); } return aRetText; } @@ -374,7 +375,7 @@ void BrowseBox::FillAccessibleStateSet( case ::svt::BBTYPE_ROWHEADERCELL: case ::svt::BBTYPE_COLUMNHEADERCELL: case ::svt::BBTYPE_CHECKBOXCELL: - OSL_ENSURE(0,"Illegal call here!"); + OSL_FAIL("Illegal call here!"); break; } } @@ -566,3 +567,5 @@ Window* BrowseBox::GetWindowInstance() { return this; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/brwhead.cxx b/svtools/source/brwbox/brwhead.cxx index b517f6d931e5..a0a0f01f8251 100644 --- a/svtools/source/brwbox/brwhead.cxx +++ b/svtools/source/brwbox/brwhead.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,6 @@ #include <svtools/brwhead.hxx> #include <svtools/brwbox.hxx> -#ifndef GCC -#endif - //=================================================================== BrowserHeader::BrowserHeader( BrowseBox* pParent, WinBits nWinBits ) @@ -117,3 +115,4 @@ void BrowserHeader::EndDrag() +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/brwimpl.hxx b/svtools/source/brwbox/brwimpl.hxx index 3c9ddb2876f7..d1540550117a 100644 --- a/svtools/source/brwbox/brwimpl.hxx +++ b/svtools/source/brwbox/brwimpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,7 +57,7 @@ namespace svt } catch( const ::com::sun::star::uno::Exception& ) { - OSL_ENSURE( sal_False, "THeaderCellMapFunctorDispose: caught an exception!" ); + OSL_FAIL( "THeaderCellMapFunctorDispose: caught an exception!" ); } } }; @@ -85,3 +86,5 @@ namespace svt } #endif // _SVTOOLS_BRWIMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index 377180653780..f944908c269d 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,24 +31,13 @@ #include "datwin.hxx" -#ifndef GCC -#endif - -#ifndef _APP_HXX //autogen #include <vcl/svapp.hxx> -#endif -#ifndef _HELP_HXX #include <vcl/help.hxx> -#endif -#ifndef _IMAGE_HXX #include <vcl/image.hxx> -#endif #include <tools/debug.hxx> -DECLARE_LIST( BrowserColumns, BrowserColumn* ) - //=================================================================== void ButtonFrame::Draw( OutputDevice& rDev ) { @@ -242,6 +232,10 @@ BrowserDataWin::~BrowserDataWin() { if( pDtorNotify ) *pDtorNotify = sal_True; + + for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i ) + delete aInvalidRegion[ i ]; + aInvalidRegion.clear(); } //------------------------------------------------------------------- @@ -325,7 +319,7 @@ void BrowserDataWin::Paint( const Rectangle& rRect ) { if ( bInPaint ) { - aInvalidRegion.Insert( new Rectangle( rRect ) ); + aInvalidRegion.push_back( new Rectangle( rRect ) ); return; } bInPaint = sal_True; @@ -334,7 +328,7 @@ void BrowserDataWin::Paint( const Rectangle& rRect ) DoOutstandingInvalidations(); } else - aInvalidRegion.Insert( new Rectangle( rRect ) ); + aInvalidRegion.push_back( new Rectangle( rRect ) ); } //------------------------------------------------------------------- @@ -352,28 +346,28 @@ BrowseEvent BrowserDataWin::CreateBrowseEvent( const Point& rPosPixel ) // find column under mouse long nMouseX = rPosPixel.X(); long nColX = 0; - sal_uInt16 nCol; + size_t nCol; for ( nCol = 0; - nCol < pBox->pCols->Count() && nColX < GetSizePixel().Width(); + nCol < pBox->pCols->size() && nColX < GetSizePixel().Width(); ++nCol ) - if ( pBox->pCols->GetObject(nCol)->IsFrozen() || nCol >= pBox->nFirstCol ) + if ( (*pBox->pCols)[ nCol ]->IsFrozen() || nCol >= pBox->nFirstCol ) { - nColX += pBox->pCols->GetObject(nCol)->Width(); + nColX += (*pBox->pCols)[ nCol ]->Width(); if ( nMouseX < nColX ) break; } sal_uInt16 nColId = BROWSER_INVALIDID; - if ( nCol < pBox->pCols->Count() ) - nColId = pBox->pCols->GetObject(nCol)->GetId(); + if ( nCol < pBox->pCols->size() ) + nColId = (*pBox->pCols)[ nCol ]->GetId(); // compute the field rectangle and field relative MouseEvent Rectangle aFieldRect; - if ( nCol < pBox->pCols->Count() ) + if ( nCol < pBox->pCols->size() ) { - nColX -= pBox->pCols->GetObject(nCol)->Width(); + nColX -= (*pBox->pCols)[ nCol ]->Width(); aFieldRect = Rectangle( Point( nColX, nRelRow * pBox->GetDataRowHeight() ), - Size( pBox->pCols->GetObject(nCol)->Width(), + Size( (*pBox->pCols)[ nCol ]->Width(), pBox->GetDataRowHeight() ) ); } @@ -695,8 +689,7 @@ BrowserExecuteDropEvent::BrowserExecuteDropEvent( BrowserDataWin *pWindow, const void BrowserDataWin::SetUpdateMode( sal_Bool bMode ) { - DBG_ASSERT( !bUpdateMode || aInvalidRegion.Count() == 0, - "invalid region not empty" ); + DBG_ASSERT( !bUpdateMode || aInvalidRegion.empty(), "invalid region not empty" ); if ( bMode == bUpdateMode ) return; @@ -708,14 +701,11 @@ void BrowserDataWin::SetUpdateMode( sal_Bool bMode ) //------------------------------------------------------------------- void BrowserDataWin::DoOutstandingInvalidations() { - for ( Rectangle* pRect = aInvalidRegion.First(); - pRect; - pRect = aInvalidRegion.Next() ) - { - Control::Invalidate( *pRect ); - delete pRect; + for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i ) { + Control::Invalidate( *aInvalidRegion[ i ] ); + delete aInvalidRegion[ i ]; } - aInvalidRegion.Clear(); + aInvalidRegion.clear(); } //------------------------------------------------------------------- @@ -724,12 +714,10 @@ void BrowserDataWin::Invalidate( sal_uInt16 nFlags ) { if ( !GetUpdateMode() ) { - for ( Rectangle* pRect = aInvalidRegion.First(); - pRect; - pRect = aInvalidRegion.Next() ) - delete pRect; - aInvalidRegion.Clear(); - aInvalidRegion.Insert( new Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) ); + for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i ) + delete aInvalidRegion[ i ]; + aInvalidRegion.clear(); + aInvalidRegion.push_back( new Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) ); } else Window::Invalidate( nFlags ); @@ -740,7 +728,7 @@ void BrowserDataWin::Invalidate( sal_uInt16 nFlags ) void BrowserDataWin::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags ) { if ( !GetUpdateMode() ) - aInvalidRegion.Insert( new Rectangle( rRect ) ); + aInvalidRegion.push_back( new Rectangle( rRect ) ); else Window::Invalidate( rRect, nFlags ); } @@ -781,3 +769,4 @@ void BrowserScrollBar::EndScroll() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx index 91b22d764bb0..1aeb06b6a085 100644 --- a/svtools/source/brwbox/datwin.hxx +++ b/svtools/source/brwbox/datwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,23 +29,19 @@ #ifndef _SFXDATWIN_HXX #define _SFXDATWIN_HXX -#ifndef _BRWBOX_HXX #include <svtools/brwbox.hxx> -#endif #include <svtools/brwhead.hxx> #include <vcl/timer.hxx> -#ifndef _IMAGE_HXX //autogen #include <vcl/image.hxx> -#endif -#include <tools/list.hxx> #include <svtools/transfer.hxx> +#include <vector> //=================================================================== #define MIN_COLUMNWIDTH 2 #define DRAG_CRITICAL 4 -DECLARE_LIST( RectangleList, Rectangle* ) +typedef ::std::vector< Rectangle* > RectangleList; //=================================================================== @@ -133,21 +130,21 @@ public: String aRealRowCount; // zur Anzeige im VScrollBar RectangleList aInvalidRegion; // invalidated Rectangles during !UpdateMode - FASTBOOL bInPaint; // sal_True while in Paint - FASTBOOL bInCommand; // sal_True while in Command - FASTBOOL bNoScrollBack; // nur vorwaerts scrollen - FASTBOOL bNoHScroll; // kein horizontaler Scrollbar - FASTBOOL bNoVScroll; // no vertical scrollbar - FASTBOOL bAutoHScroll; // autohide horizontaler Scrollbar - FASTBOOL bAutoVScroll; // autohide horizontaler Scrollbar - FASTBOOL bUpdateMode; // nicht SV-UpdateMode wegen Invalidate() - FASTBOOL bAutoSizeLastCol;// last column always fills up window - FASTBOOL bResizeOnPaint; // outstanding resize-event - FASTBOOL bUpdateOnUnlock; // Update() while locked - FASTBOOL bInUpdateScrollbars; // Rekursionsschutz - FASTBOOL bHadRecursion; // Rekursion war aufgetreten - FASTBOOL bOwnDataChangedHdl; // dont change colors in DataChanged - FASTBOOL bCallingDropCallback; // we're in a callback to AcceptDrop or ExecuteDrop curently + bool bInPaint; // TRUE while in Paint + bool bInCommand; // TRUE while in Command + bool bNoScrollBack; // nur vorwaerts scrollen + bool bNoHScroll; // kein horizontaler Scrollbar + bool bNoVScroll; // no vertical scrollbar + bool bAutoHScroll; // autohide horizontaler Scrollbar + bool bAutoVScroll; // autohide horizontaler Scrollbar + bool bUpdateMode; // nicht SV-UpdateMode wegen Invalidate() + bool bAutoSizeLastCol; // last column always fills up window + bool bResizeOnPaint; // outstanding resize-event + bool bUpdateOnUnlock; // Update() while locked + bool bInUpdateScrollbars; // Rekursionsschutz + bool bHadRecursion; // Rekursion war aufgetreten + bool bOwnDataChangedHdl; // dont change colors in DataChanged + bool bCallingDropCallback; // we're in a callback to AcceptDrop or ExecuteDrop curently sal_uInt16 nUpdateLock; // lock count, dont call Control::Update()! short nCursorHidden; // new conuter for DoHide/ShowCursor @@ -185,7 +182,7 @@ public: const String& GetRealRowCount() const { return aRealRowCount; } void SetUpdateMode( sal_Bool bMode ); - FASTBOOL GetUpdateMode() const { return bUpdateMode; } + bool GetUpdateMode() const { return bUpdateMode; } void EnterUpdateLock() { ++nUpdateLock; } void LeaveUpdateLock(); void Update(); @@ -238,17 +235,6 @@ void InitSettings_Impl( Window *pWin, //=================================================================== -#ifdef DBG_MI - -void DoLog_Impl( const BrowseBox *pThis, const char *pWhat, const char *pWho ); -#define LOG(pThis,what,who) DoLog_Impl(pThis,what,who) - -#else - -#define LOG(pThis,what,who) - -#endif - - #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index 9f870a9f0681..7b679aed53b2 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -626,3 +627,4 @@ namespace svt // ....................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 04bb47c2ab3e..dc568cfec7e9 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,26 +30,18 @@ #include "precompiled_svtools.hxx" #include <svtools/editbrowsebox.hxx> -#ifndef _SVTOOLS_EDITBROWSEBOX_HRC_ #include "editbrowsebox.hrc" -#endif -#ifndef _APP_HXX //autogen #include <vcl/svapp.hxx> -#endif #include <tools/debug.hxx> #include <vcl/window.hxx> -#ifndef _EDIT_HXX //autogen #include <vcl/edit.hxx> -#endif #include <tools/resid.hxx> #include <vcl/spinfld.hxx> #include <svtools/svtdata.hxx> -#ifndef _SVTOOLS_HRC #include <svtools/svtools.hrc> -#endif #include <algorithm> #include <tools/multisel.hxx> @@ -64,13 +57,6 @@ namespace svt namespace { //.............................................................. - sal_Bool isHiContrast(Window* _pWindow) - { - OSL_ENSURE(_pWindow,"Window must be not null!"); - return _pWindow && _pWindow->GetSettings().GetStyleSettings().GetHighContrastMode(); - } - - //.............................................................. sal_uInt16 getRealGetFocusFlags( Window* _pWindow ) { sal_uInt16 nFlags = 0; @@ -144,7 +130,6 @@ namespace svt void EditBrowseBox::impl_construct() { m_aImpl = ::std::auto_ptr<EditBrowseBoxImpl>(new EditBrowseBoxImpl()); - m_aImpl->m_bHiContrast = isHiContrast(&GetDataWindow()); SetCompoundControl(sal_True); SetGridLineColor( Color( COL_LIGHTGRAY ) ); @@ -309,11 +294,9 @@ namespace svt //------------------------------------------------------------------------------ Image EditBrowseBox::GetImage(RowStatus eStatus) const { - sal_Bool bHiContrast = isHiContrast(&GetDataWindow()); - if ( !m_aStatusImages.GetImageCount() || (bHiContrast != m_aImpl->m_bHiContrast) ) + if ( !m_aStatusImages.GetImageCount() ) { - m_aImpl->m_bHiContrast = bHiContrast; - const_cast<EditBrowseBox*>(this)->m_aStatusImages = ImageList(SvtResId(bHiContrast ? RID_SVTOOLS_IMAGELIST_EDITBWSEBOX_H : RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX)); + const_cast<EditBrowseBox*>(this)->m_aStatusImages = ImageList( SvtResId( RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX ) ); } Image aImage; @@ -518,7 +501,6 @@ namespace svt // we are about to leave the current cell. If there is a "this cell has been modified" notification // pending (asynchronously), this may be deadly -> do it synchronously - // 95826 - 2002-10-14 - fs@openoffice.org if ( nCellModifiedEvent ) { Application::RemoveUserEvent( nCellModifiedEvent ); @@ -529,7 +511,6 @@ namespace svt if (0 == rEvt.GetColumnId()) { // it was the handle column. save the current cell content if necessary // (clicking on the handle column results in selecting the current row) - // 23.01.2001 - 82797 - FS if (IsEditing() && aController->IsModified()) SaveModified(); } @@ -1435,3 +1416,4 @@ namespace svt } // namespace svt // ....................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/editbrowsebox.src b/svtools/source/brwbox/editbrowsebox.src index 6511d97ea86a..beb2236ab2c8 100644 --- a/svtools/source/brwbox/editbrowsebox.src +++ b/svtools/source/brwbox/editbrowsebox.src @@ -42,25 +42,15 @@ ImageList RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX Blue = 0xFFFF; }; IdList = { - IMG_EBB_CURRENT; IMG_EBB_MODIFIED; - IMG_EBB_NEW;IMG_EBB_DELETED;IMG_EBB_CURRENTNEW; - IMG_EBB_PRIMARYKEY; IMG_EBB_CURRENT_PRIMARYKEY; IMG_EBB_FILTER;IMG_EBB_HEADERFOOTER; - }; - IdCount = { 9; }; -}; - -ImageList RID_SVTOOLS_IMAGELIST_EDITBWSEBOX_H -{ - Prefix = "edh"; - MaskColor = Color { - Red = 0xFFFF; - Green = 0x0000; - Blue = 0xFFFF; - }; - IdList = { - IMG_EBB_CURRENT; IMG_EBB_MODIFIED; - IMG_EBB_NEW;IMG_EBB_DELETED;IMG_EBB_CURRENTNEW; - IMG_EBB_PRIMARYKEY; IMG_EBB_CURRENT_PRIMARYKEY; IMG_EBB_FILTER;IMG_EBB_HEADERFOOTER; + IMG_EBB_CURRENT; + IMG_EBB_MODIFIED; + IMG_EBB_NEW; + IMG_EBB_DELETED; + IMG_EBB_CURRENTNEW; + IMG_EBB_PRIMARYKEY; + IMG_EBB_CURRENT_PRIMARYKEY; + IMG_EBB_FILTER; + IMG_EBB_HEADERFOOTER; }; IdCount = { 9; }; }; diff --git a/svtools/source/brwbox/editbrowsebox2.cxx b/svtools/source/brwbox/editbrowsebox2.cxx index 9f247a580fc9..56f33bac499b 100644 --- a/svtools/source/brwbox/editbrowsebox2.cxx +++ b/svtools/source/brwbox/editbrowsebox2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -132,7 +133,7 @@ void EditBrowseBoxImpl::clearActiveCell() } catch(const Exception&) { - OSL_ENSURE( sal_False, "EditBrowseBoxImpl::clearActiveCell: caught an exception while disposing the AccessibleCell!" ); + OSL_FAIL( "EditBrowseBoxImpl::clearActiveCell: caught an exception while disposing the AccessibleCell!" ); } m_xActiveCell = NULL; @@ -220,3 +221,4 @@ sal_Int32 EditBrowseBox::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumn // ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/editbrowseboximpl.hxx b/svtools/source/brwbox/editbrowseboximpl.hxx index 724da694b9c1..cb7303fcfba6 100644 --- a/svtools/source/brwbox/editbrowseboximpl.hxx +++ b/svtools/source/brwbox/editbrowseboximpl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,10 +37,10 @@ namespace svt { public: ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xActiveCell; - sal_Bool m_bHiContrast; void clearActiveCell(); }; } #endif // SVTOOLS_EDITBROWSEBOX_IMPL_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 1cd368df0f5f..94cfd764a4d4 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,21 +37,11 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> -#endif -#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ #include <comphelper/configurationhelper.hxx> -#endif -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ #include <unotools/processfactory.hxx> -#endif -#ifndef _SVT_LOGHELPER_HXX_ #include <unotools/loghelper.hxx> -#endif #include <svl/smplhint.hxx> @@ -61,8 +52,8 @@ #include <itemholder2.hxx> using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; + namespace css = com::sun::star; #define HELP_TIP_TIMEOUT 0xffff // max. timeout setting to pretend a non-timeout @@ -559,12 +550,12 @@ void SvtAccessibilityOptions::Commit() sal_Bool SvtAccessibilityOptions::GetIsForDrawings() const { - DBG_ERROR( "SvtAccessibilityOptions::GetIsForDrawings: is obsolete!" ); + OSL_FAIL( "SvtAccessibilityOptions::GetIsForDrawings: is obsolete!" ); return sal_False; } sal_Bool SvtAccessibilityOptions::GetIsForBorders() const { - DBG_ERROR( "SvtAccessibilityOptions::GetIsForBorders: is obsolete!" ); + OSL_FAIL( "SvtAccessibilityOptions::GetIsForBorders: is obsolete!" ); return sal_False; } sal_Bool SvtAccessibilityOptions::GetAutoDetectSystemHC() const @@ -647,3 +638,5 @@ void SvtAccessibilityOptions::SetVCLSettings() sm_pSingleImplConfig->SetVCLSettings(); } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/apearcfg.cxx b/svtools/source/config/apearcfg.cxx index 1c581dbf8f53..7dc3ef20cfc8 100644 --- a/svtools/source/config/apearcfg.cxx +++ b/svtools/source/config/apearcfg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,6 +36,7 @@ #include "vcl/settings.hxx" #include "vcl/svapp.hxx" #include <rtl/logfile.hxx> +#include <sal/macros.h> #define DEFAULT_LOOKNFEEL 0 #define DEFAULT_DRAGMODE 2 @@ -47,20 +49,17 @@ using namespace ::com::sun::star::uno; sal_Bool SvtTabAppearanceCfg::bInitialized = sal_False; -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ SvtTabAppearanceCfg::SvtTabAppearanceCfg() - :ConfigItem(OUString::createFromAscii("Office.Common/View")) + :ConfigItem(OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/View"))) ,nDragMode ( DEFAULT_DRAGMODE ) ,nScaleFactor ( DEFAULT_SCALEFACTOR ) ,nSnapMode ( DEFAULT_SNAPMODE ) ,nMiddleMouse ( MOUSE_MIDDLE_AUTOSCROLL ) -#if defined( UNX ) || defined ( FS_PRIV_DEBUG ) +#if defined( UNX ) ,nAAMinPixelHeight ( DEFAULT_AAMINHEIGHT ) #endif ,bMenuMouseFollow(sal_False) -#if defined( UNX ) || defined ( FS_PRIV_DEBUG ) +#if defined( UNX ) ,bFontAntialiasing ( sal_True ) #endif { @@ -84,7 +83,7 @@ SvtTabAppearanceCfg::SvtTabAppearanceCfg() case 2: bMenuMouseFollow = *(sal_Bool*)pValues->getValue(); break; //"Menu/FollowMouse", case 3: *pValues >>= nSnapMode; break; //"Dialog/MousePositioning", case 4: *pValues >>= nMiddleMouse; break; //"Dialog/MiddleMouseButton", -#if defined( UNX ) || defined ( FS_PRIV_DEBUG ) +#if defined( UNX ) case 5: bFontAntialiasing = *(sal_Bool*)pValues->getValue(); break; // "FontAntialising/Enabled", case 6: *pValues >>= nAAMinPixelHeight; break; // "FontAntialising/MinPixelHeight", #endif @@ -93,15 +92,11 @@ SvtTabAppearanceCfg::SvtTabAppearanceCfg() } } } -/* -----------------------------22.05.01 11:53-------------------------------- - ---------------------------------------------------------------------------*/ SvtTabAppearanceCfg::~SvtTabAppearanceCfg( ) { } -/* -----------------------------22.05.01 11:54-------------------------------- - ---------------------------------------------------------------------------*/ const Sequence<OUString>& SvtTabAppearanceCfg::GetPropertyNames() { static Sequence<OUString> aNames; @@ -114,12 +109,12 @@ const Sequence<OUString>& SvtTabAppearanceCfg::GetPropertyNames() ,"Menu/FollowMouse" // 2 ,"Dialog/MousePositioning" // 3 ,"Dialog/MiddleMouseButton" // 4 -#if defined( UNX ) || defined ( FS_PRIV_DEBUG ) +#if defined( UNX ) ,"FontAntiAliasing/Enabled" // 5 ,"FontAntiAliasing/MinPixelHeight" // 6 #endif }; - const int nCount = sizeof( aPropNames ) / sizeof( aPropNames[0] ); + const int nCount = SAL_N_ELEMENTS( aPropNames ); aNames.realloc(nCount); const sal_Char** pAsciiNames = aPropNames; @@ -129,9 +124,7 @@ const Sequence<OUString>& SvtTabAppearanceCfg::GetPropertyNames() } return aNames; } -/* -----------------------------22.05.01 11:54-------------------------------- - ---------------------------------------------------------------------------*/ void SvtTabAppearanceCfg::Commit() { const Sequence<OUString>& rNames = GetPropertyNames(); @@ -148,7 +141,7 @@ void SvtTabAppearanceCfg::Commit() case 2: pValues[nProp].setValue(&bMenuMouseFollow, rType); break; //"Menu/FollowMouse", case 3: pValues[nProp] <<= nSnapMode; break; //"Dialog/MousePositioning", case 4: pValues[nProp] <<= nMiddleMouse; break; //"Dialog/MiddleMouseButton", -#if defined( UNX ) || defined ( FS_PRIV_DEBUG ) +#if defined( UNX ) case 5: pValues[nProp].setValue(&bFontAntialiasing, rType); break; // "FontAntialising/Enabled", case 6: pValues[nProp] <<= nAAMinPixelHeight; break; // "FontAntialising/MinPixelHeight", #endif @@ -161,46 +154,29 @@ void SvtTabAppearanceCfg::Notify( const com::sun::star::uno::Sequence< rtl::OUSt { } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - void SvtTabAppearanceCfg::SetDragMode ( sal_uInt16 nSet ) { nDragMode = nSet; SetModified(); } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - void SvtTabAppearanceCfg::SetScaleFactor ( sal_uInt16 nSet ) { nScaleFactor = nSet; SetModified(); } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - void SvtTabAppearanceCfg::SetSnapMode ( sal_uInt16 nSet ) { nSnapMode = nSet; SetModified(); } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ + void SvtTabAppearanceCfg::SetMiddleMouseButton ( sal_uInt16 nSet ) { nMiddleMouse = nSet; SetModified(); } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ void SvtTabAppearanceCfg::SetApplicationDefaults ( Application* pApp ) { @@ -221,7 +197,7 @@ void SvtTabAppearanceCfg::SetApplicationDefaults ( Application* pApp ) hAppStyle.SetScreenZoom( nScaleFactor ); hAppStyle.SetScreenFontZoom( nScaleFactor ); -#if defined( UNX ) || defined ( FS_PRIV_DEBUG ) +#if defined( UNX ) // font anti aliasing hAppStyle.SetAntialiasingMinPixelHeight( nAAMinPixelHeight ); hAppStyle.SetDisplayOptions( bFontAntialiasing ? 0 : DISPLAY_OPTION_AA_DISABLE ); @@ -270,3 +246,4 @@ void SvtTabAppearanceCfg::SetApplicationDefaults ( Application* pApp ) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 91e93cc65998..ebefe664dd18 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,7 +41,7 @@ #include <com/sun/star/uno/Sequence.h> #include <svl/poolitem.hxx> //Any2Bool #include <svl/smplhint.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <itemholder2.hxx> @@ -53,9 +54,10 @@ //----------------------------------------------------------------------------- using namespace utl; -using namespace rtl; using namespace com::sun::star; +using ::rtl::OUString; + namespace svtools { @@ -71,8 +73,6 @@ namespace ColorConfig_Impl* ColorConfig::m_pImpl = NULL; -/* -----------------------------16.01.01 15:36-------------------------------- - ---------------------------------------------------------------------------*/ class ColorConfig_Impl : public utl::ConfigItem { ColorConfigValue m_aConfigValues[ColorConfigEntryCount]; @@ -113,9 +113,6 @@ public: void ImplUpdateApplicationSettings(); }; -/* -----------------------------16.01.01 15:36-------------------------------- - - ---------------------------------------------------------------------------*/ uno::Sequence< OUString> ColorConfig_Impl::GetPropertyNames(const rtl::OUString& rScheme) { uno::Sequence<OUString> aNames(2 * ColorConfigEntryCount); @@ -140,6 +137,7 @@ uno::Sequence< OUString> ColorConfig_Impl::GetPropertyNames(const rtl::OUString& { RTL_CONSTASCII_USTRINGPARAM("/Anchor") ,sal_False }, { RTL_CONSTASCII_USTRINGPARAM("/Spell") ,sal_False }, { RTL_CONSTASCII_USTRINGPARAM("/SmartTags") ,sal_False }, + { RTL_CONSTASCII_USTRINGPARAM("/Shadow") , sal_True }, { RTL_CONSTASCII_USTRINGPARAM("/WriterTextGrid") ,sal_False }, { RTL_CONSTASCII_USTRINGPARAM("/WriterFieldShadings"),sal_True }, { RTL_CONSTASCII_USTRINGPARAM("/WriterIdxShadings") ,sal_True }, @@ -198,9 +196,7 @@ uno::Sequence< OUString> ColorConfig_Impl::GetPropertyNames(const rtl::OUString& aNames.realloc(nIndex); return aNames; } -/* -----------------------------22.03.2002 14:37------------------------------ - ---------------------------------------------------------------------------*/ ColorConfig_Impl::ColorConfig_Impl(sal_Bool bEditMode) : ConfigItem(C2U("Office.UI/ColorScheme")), m_bEditMode(bEditMode), @@ -220,17 +216,13 @@ ColorConfig_Impl::ColorConfig_Impl(sal_Bool bEditMode) : ::Application::AddEventListener( LINK(this, ColorConfig_Impl, DataChangedEventListener) ); } -/* -----------------------------25.03.2002 12:28------------------------------ - ---------------------------------------------------------------------------*/ ColorConfig_Impl::~ColorConfig_Impl() { // #100822# ::Application::RemoveEventListener( LINK(this, ColorConfig_Impl, DataChangedEventListener) ); } -/* -----------------------------22.03.2002 14:38------------------------------ - ---------------------------------------------------------------------------*/ void ColorConfig_Impl::Load(const rtl::OUString& rScheme) { rtl::OUString sScheme(rScheme); @@ -263,18 +255,14 @@ void ColorConfig_Impl::Load(const rtl::OUString& rScheme) m_aConfigValues[i / 2].bIsVisible = Any2Bool(pColors[nIndex++]); } } -/* -----------------------------22.03.2002 14:38------------------------------ - ---------------------------------------------------------------------------*/ void ColorConfig_Impl::Notify( const uno::Sequence<OUString>& ) { //loading via notification always uses the default setting Load(::rtl::OUString()); NotifyListeners(0); } -/* -----------------------------22.03.2002 14:38------------------------------ - ---------------------------------------------------------------------------*/ void ColorConfig_Impl::Commit() { uno::Sequence < ::rtl::OUString > aColorNames = GetPropertyNames(m_sLoadedScheme); @@ -306,9 +294,7 @@ void ColorConfig_Impl::Commit() CommitCurrentSchemeName(); } -/* -----------------11.12.2002 10:42----------------- - * - * --------------------------------------------------*/ + void ColorConfig_Impl::CommitCurrentSchemeName() { //save current scheme name @@ -318,9 +304,7 @@ void ColorConfig_Impl::CommitCurrentSchemeName() aCurrentVal.getArray()[0] <<= m_sLoadedScheme; PutProperties(aCurrent, aCurrentVal); } -/* -----------------------------25.03.2002 12:19------------------------------ - ---------------------------------------------------------------------------*/ void ColorConfig_Impl::SetColorConfigValue(ColorConfigEntry eValue, const ColorConfigValue& rValue ) { if(rValue != m_aConfigValues[eValue]) @@ -329,16 +313,12 @@ void ColorConfig_Impl::SetColorConfigValue(ColorConfigEntry eValue, const ColorC SetModified(); } } -/* -----------------------------25.03.2002 15:22------------------------------ - ---------------------------------------------------------------------------*/ uno::Sequence< ::rtl::OUString> ColorConfig_Impl::GetSchemeNames() { return GetNodeNames(C2U("ColorSchemes")); } -/* -----------------------------09.04.2002 17:19------------------------------ - ---------------------------------------------------------------------------*/ sal_Bool ColorConfig_Impl::AddScheme(const rtl::OUString& rScheme) { if(ConfigItem::AddNode(C2U("ColorSchemes"), rScheme)) @@ -349,29 +329,23 @@ sal_Bool ColorConfig_Impl::AddScheme(const rtl::OUString& rScheme) } return sal_False; } -/* -----------------------------09.04.2002 17:19------------------------------ - ---------------------------------------------------------------------------*/ sal_Bool ColorConfig_Impl::RemoveScheme(const rtl::OUString& rScheme) { uno::Sequence< rtl::OUString > aElements(1); aElements.getArray()[0] = rScheme; return ClearNodeElements(C2U("ColorSchemes"), aElements); } -/* -----------------------------2002/06/20 13:03------------------------------ - ---------------------------------------------------------------------------*/ void ColorConfig_Impl::SettingsChanged() { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; ImplUpdateApplicationSettings(); NotifyListeners(0); } -/* -----------------------------2002/08/16 12:07 ----------------------------- - #100822# - --------------------------------------------------------------------------- */ + IMPL_LINK( ColorConfig_Impl, DataChangedEventListener, VclWindowEvent*, pEvent ) { if ( pEvent->GetId() == VCLEVENT_APPLICATION_DATACHANGED ) @@ -428,9 +402,7 @@ ColorConfig::ColorConfig() ++nColorRefCount_Impl; m_pImpl->AddListener(this); } -/* -----------------------------16.01.01 15:36-------------------------------- - ---------------------------------------------------------------------------*/ ColorConfig::~ColorConfig() { ::osl::MutexGuard aGuard( ColorMutex_Impl::get() ); @@ -441,9 +413,7 @@ ColorConfig::~ColorConfig() m_pImpl = 0; } } -/* -----------------------------11.04.2002 11:49------------------------------ - ---------------------------------------------------------------------------*/ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry) { static const sal_Int32 aAutoColors[] = @@ -459,6 +429,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry) 0, // ANCHOR 0xff0000, // SPELL COL_LIGHTMAGENTA,// SMARTTAGS + COL_GRAY, // SHADOWCOLOR 0xc0c0c0, // WRITERTEXTGRID 0xc0c0c0, // WRITERFIELDSHADIN 0xc0c0c0, // WRITERIDXSHADINGS @@ -510,17 +481,12 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry) case SPELL : case DRAWDRAWING : case SMARTTAGS : - { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - aRet = rStyleSettings.GetHighContrastMode() ? - rStyleSettings.GetDialogTextColor().GetColor() : aAutoColors[eEntry]; - } - break; + aRet = aAutoColors[eEntry]; + break; case DRAWFILL : - aRet = /*rStyleSettings.GetHighContrastMode() ? - rStyleSettings.OutlineMode??? : */ aAutoColors[eEntry]; - break; + aRet = aAutoColors[eEntry]; + break; case FONTCOLOR : aRet = Application::GetSettings().GetStyleSettings().GetWindowTextColor(); @@ -539,9 +505,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry) } return aRet; } -/* -----------------------------11.04.2002 11:49------------------------------ - ---------------------------------------------------------------------------*/ ColorConfigValue ColorConfig::GetColorValue(ColorConfigEntry eEntry, sal_Bool bSmart)const { ColorConfigValue aRet = m_pImpl->GetColorConfigValue(eEntry); @@ -562,18 +526,14 @@ ColorConfigValue ColorConfig::GetColorValue(ColorConfigEntry eEntry, sal_Bool bS return aRet; } -/* -----------------------------25.03.2002 12:01------------------------------ - ---------------------------------------------------------------------------*/ EditableColorConfig::EditableColorConfig() : m_pImpl(new ColorConfig_Impl), m_bModified(sal_False) { m_pImpl->BlockBroadcasts(sal_True); } -/*-- 25.03.2002 12:03:08--------------------------------------------------- - -----------------------------------------------------------------------*/ EditableColorConfig::~EditableColorConfig() { m_pImpl->BlockBroadcasts(sal_False); @@ -584,30 +544,21 @@ EditableColorConfig::~EditableColorConfig() delete m_pImpl; } -/*-- 25.03.2002 12:03:15--------------------------------------------------- - - -----------------------------------------------------------------------*/ uno::Sequence< ::rtl::OUString > EditableColorConfig::GetSchemeNames() const { return m_pImpl->GetSchemeNames(); } -/*-- 25.03.2002 12:03:16--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditableColorConfig::DeleteScheme(const ::rtl::OUString& rScheme ) { m_pImpl->RemoveScheme(rScheme); } -/*-- 25.03.2002 12:03:16--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditableColorConfig::AddScheme(const ::rtl::OUString& rScheme ) { m_pImpl->AddScheme(rScheme); } -/*-- 25.03.2002 12:03:16--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Bool EditableColorConfig::LoadScheme(const ::rtl::OUString& rScheme ) { if(m_bModified) @@ -620,32 +571,25 @@ sal_Bool EditableColorConfig::LoadScheme(const ::rtl::OUString& rScheme ) m_pImpl->CommitCurrentSchemeName(); return sal_True; } -/*-- 25.03.2002 12:03:16--------------------------------------------------- - -----------------------------------------------------------------------*/ const ::rtl::OUString& EditableColorConfig::GetCurrentSchemeName()const { return m_pImpl->GetLoadedScheme(); } -/* -----------------11.12.2002 10:56----------------- - * changes the name of the current scheme but doesn't load it! - * --------------------------------------------------*/ + +// Changes the name of the current scheme but doesn't load it! void EditableColorConfig::SetCurrentSchemeName(const ::rtl::OUString& rScheme) { m_pImpl->SetCurrentSchemeName(rScheme); m_pImpl->CommitCurrentSchemeName(); } -/*-- 25.03.2002 12:03:17--------------------------------------------------- - -----------------------------------------------------------------------*/ const ColorConfigValue& EditableColorConfig::GetColorValue( ColorConfigEntry eEntry)const { return m_pImpl->GetColorConfigValue(eEntry); } -/*-- 25.03.2002 12:03:17--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditableColorConfig::SetColorValue( ColorConfigEntry eEntry, const ColorConfigValue& rValue) { @@ -653,16 +597,12 @@ void EditableColorConfig::SetColorValue( m_pImpl->ClearModified(); m_bModified = sal_True; } -/* -----------------------------10.04.2002 13:22------------------------------ - ---------------------------------------------------------------------------*/ void EditableColorConfig::SetModified() { m_bModified = sal_True; } -/* -----------------15.10.2002 14:51----------------- - * - * --------------------------------------------------*/ + void EditableColorConfig::Commit() { if(m_bModified) @@ -684,3 +624,5 @@ void EditableColorConfig::EnableBroadcast() // ----------------------------------------------------------------------------- }//namespace svtools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 35d0276144ec..59bb82aa2c56 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,7 +40,7 @@ #include <com/sun/star/uno/Sequence.h> #include <svl/poolitem.hxx> //Any2Bool #include <svl/smplhint.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> /* #100822# ---- #include <vcl/wrkwin.hxx> @@ -53,9 +54,10 @@ //----------------------------------------------------------------------------- using namespace utl; -using namespace rtl; using namespace com::sun::star; +using ::rtl::OUString; + namespace svtools { @@ -69,8 +71,6 @@ namespace ExtendedColorConfig_Impl* ExtendedColorConfig::m_pImpl = NULL; -/* -----------------------------16.01.01 15:36-------------------------------- - ---------------------------------------------------------------------------*/ class ExtendedColorConfig_Impl : public utl::ConfigItem, public SfxBroadcaster { DECLARE_STL_USTRINGACCESS_MAP( ::rtl::OUString, TDisplayNames); @@ -123,7 +123,7 @@ public: aMessage.append( ::rtl::OUStringToOString( _sComponentName, RTL_TEXTENCODING_UTF8 ) ); aMessage.append( "\nname: " ); aMessage.append( ::rtl::OUStringToOString( _sName, RTL_TEXTENCODING_UTF8 ) ); - OSL_ENSURE( 0, aMessage.makeStringAndClear().getStr() ); + OSL_FAIL( aMessage.makeStringAndClear().getStr() ); #endif return ExtendedColorConfigValue(); } @@ -151,9 +151,6 @@ public: DECL_LINK( DataChangedEventListener, VclWindowEvent* ); }; -/* -----------------------------16.01.01 15:36-------------------------------- - - ---------------------------------------------------------------------------*/ uno::Sequence< OUString> ExtendedColorConfig_Impl::GetPropertyNames(const rtl::OUString& rScheme) { uno::Sequence< OUString> aNames(GetNodeNames(rScheme)); @@ -212,10 +209,7 @@ ExtendedColorConfigValue ExtendedColorConfig_Impl::GetComponentColorConfigValue( sRet = m_aConfigValuesPos[_nPos]->first; return sRet; } -// ----------------------------------------------------------------------------- -/* -----------------------------22.03.2002 14:37------------------------------ - ---------------------------------------------------------------------------*/ sal_Bool ExtendedColorConfig_Impl::m_bLockBroadcast = sal_False; sal_Bool ExtendedColorConfig_Impl::m_bBroadcastWhenUnlocked = sal_False; ExtendedColorConfig_Impl::ExtendedColorConfig_Impl(sal_Bool bEditMode) : @@ -235,9 +229,7 @@ ExtendedColorConfig_Impl::ExtendedColorConfig_Impl(sal_Bool bEditMode) : ::Application::AddEventListener( LINK(this, ExtendedColorConfig_Impl, DataChangedEventListener) ); } -/* -----------------------------25.03.2002 12:28------------------------------ - ---------------------------------------------------------------------------*/ ExtendedColorConfig_Impl::~ExtendedColorConfig_Impl() { // #100822# @@ -260,9 +252,7 @@ sal_Bool ExtendedColorConfig_Impl::IsEnableBroadcast() { return ExtendedColorConfig::m_pImpl ? ExtendedColorConfig::m_pImpl->m_bIsBroadcastEnabled : sal_False; } -/* -----------------------------22.03.2002 14:38------------------------------ - ---------------------------------------------------------------------------*/ void lcl_addString(uno::Sequence < ::rtl::OUString >& _rSeq,const ::rtl::OUString& _sAdd) { ::rtl::OUString* pIter = _rSeq.getArray(); @@ -338,12 +328,12 @@ void ExtendedColorConfig_Impl::Load(const rtl::OUString& rScheme) { aComponentNames = GetPropertyNames(sBase); FillComponentColors(aComponentNames,aDisplayNameMap); - } // if ( bFound ) + } if ( !m_sLoadedScheme.getLength() ) m_sLoadedScheme = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default")); - if ( !sScheme.equalsAscii("default") ) + if ( !sScheme.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("default")) ) { ::rtl::OUString sDefault(RTL_CONSTASCII_USTRINGPARAM("default")); if ( ExistsScheme(sDefault) ) @@ -352,7 +342,7 @@ void ExtendedColorConfig_Impl::Load(const rtl::OUString& rScheme) aComponentNames = GetPropertyNames(sBaseDefault); FillComponentColors(aComponentNames,aDisplayNameMap); } - } // if ( !sScheme.equalsAscii("default") ) + } if ( !bFound && sScheme.getLength() ) { AddScheme(sScheme); @@ -424,15 +414,13 @@ void ExtendedColorConfig_Impl::FillComponentColors(uno::Sequence < ::rtl::OUStri } } } -/* -----------------------------22.03.2002 14:38------------------------------ - ---------------------------------------------------------------------------*/ void ExtendedColorConfig_Impl::Notify( const uno::Sequence<OUString>& /*rPropertyNames*/) { //loading via notification always uses the default setting Load(::rtl::OUString()); - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; if(m_bLockBroadcast) { @@ -441,9 +429,7 @@ void ExtendedColorConfig_Impl::Notify( const uno::Sequence<OUString>& /*rProp else Broadcast(SfxSimpleHint(SFX_HINT_COLORS_CHANGED)); } -/* -----------------------------22.03.2002 14:38------------------------------ - ---------------------------------------------------------------------------*/ void ExtendedColorConfig_Impl::Commit() { if ( !m_sLoadedScheme.getLength() ) @@ -490,9 +476,7 @@ void ExtendedColorConfig_Impl::Commit() CommitCurrentSchemeName(); } -/* -----------------11.12.2002 10:42----------------- - * - * --------------------------------------------------*/ + void ExtendedColorConfig_Impl::CommitCurrentSchemeName() { //save current scheme name @@ -515,10 +499,7 @@ sal_Bool ExtendedColorConfig_Impl::ExistsScheme(const ::rtl::OUString& _sSchemeN ; return pCompIter != pCompEnd; } -// ----------------------------------------------------------------------------- -/* -----------------------------25.03.2002 12:19------------------------------ - ---------------------------------------------------------------------------*/ void ExtendedColorConfig_Impl::SetColorConfigValue(const ::rtl::OUString& _sName, const ExtendedColorConfigValue& rValue ) { TComponents::iterator aFind = m_aConfigValues.find(_sName); @@ -530,16 +511,12 @@ void ExtendedColorConfig_Impl::SetColorConfigValue(const ::rtl::OUString& _sName SetModified(); } } -/* -----------------------------25.03.2002 15:22------------------------------ - ---------------------------------------------------------------------------*/ uno::Sequence< ::rtl::OUString> ExtendedColorConfig_Impl::GetSchemeNames() { return GetNodeNames(C2U("ExtendedColorScheme/ColorSchemes")); } -/* -----------------------------09.04.2002 17:19------------------------------ - ---------------------------------------------------------------------------*/ sal_Bool ExtendedColorConfig_Impl::AddScheme(const rtl::OUString& rScheme) { if(ConfigItem::AddNode(C2U("ExtendedColorScheme/ColorSchemes"), rScheme)) @@ -550,34 +527,26 @@ sal_Bool ExtendedColorConfig_Impl::AddScheme(const rtl::OUString& rScheme) } return sal_False; } -/* -----------------------------09.04.2002 17:19------------------------------ - ---------------------------------------------------------------------------*/ sal_Bool ExtendedColorConfig_Impl::RemoveScheme(const rtl::OUString& rScheme) { uno::Sequence< rtl::OUString > aElements(1); aElements.getArray()[0] = rScheme; return ClearNodeElements(C2U("ExtendedColorScheme/ColorSchemes"), aElements); } -/* -----------------------------2002/06/20 13:03------------------------------ - ---------------------------------------------------------------------------*/ void ExtendedColorConfig_Impl::SettingsChanged() { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; Broadcast( SfxSimpleHint( SFX_HINT_COLORS_CHANGED ) ); } -/* -----------------11.12.2002 09:21----------------- - * - * --------------------------------------------------*/ + void ExtendedColorConfig_Impl::LockBroadcast() { m_bLockBroadcast = sal_True; } -/* -----------------11.12.2002 09:21----------------- - * - * --------------------------------------------------*/ + void ExtendedColorConfig_Impl::UnlockBroadcast() { if ( m_bBroadcastWhenUnlocked ) @@ -594,9 +563,7 @@ void ExtendedColorConfig_Impl::UnlockBroadcast() } m_bLockBroadcast = sal_False; } -/* -----------------------------2002/08/16 12:07 ----------------------------- - #100822# - --------------------------------------------------------------------------- */ + IMPL_LINK( ExtendedColorConfig_Impl, DataChangedEventListener, VclWindowEvent*, pEvent ) { if ( pEvent->GetId() == VCLEVENT_APPLICATION_DATACHANGED ) @@ -625,9 +592,7 @@ ExtendedColorConfig::ExtendedColorConfig() ++nExtendedColorRefCount_Impl; StartListening( *m_pImpl); } -/* -----------------------------16.01.01 15:36-------------------------------- - ---------------------------------------------------------------------------*/ ExtendedColorConfig::~ExtendedColorConfig() { ::osl::MutexGuard aGuard( ColorMutex_Impl::get() ); @@ -638,9 +603,7 @@ ExtendedColorConfig::~ExtendedColorConfig() m_pImpl = 0; } } -/* -----------------------------11.04.2002 11:49------------------------------ - ---------------------------------------------------------------------------*/ ExtendedColorConfigValue ExtendedColorConfig::GetColorValue(const ::rtl::OUString& _sComponentName,const ::rtl::OUString& _sName)const { return m_pImpl->GetColorConfigValue(_sComponentName,_sName); @@ -670,28 +633,21 @@ ExtendedColorConfigValue ExtendedColorConfig::GetComponentColorConfigValue(const { return m_pImpl->GetComponentDisplayName(_sComponentName); } -// ----------------------------------------------------------------------------- -/* -----------------------------12.04.2002 09:25------------------------------ - ---------------------------------------------------------------------------*/ void ExtendedColorConfig::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; Broadcast( rHint ); } -/* -----------------------------25.03.2002 12:01------------------------------ - ---------------------------------------------------------------------------*/ EditableExtendedColorConfig::EditableExtendedColorConfig() : m_pImpl(new ExtendedColorConfig_Impl), m_bModified(sal_False) { m_pImpl->LockBroadcast(); } -/*-- 25.03.2002 12:03:08--------------------------------------------------- - -----------------------------------------------------------------------*/ EditableExtendedColorConfig::~EditableExtendedColorConfig() { m_pImpl->UnlockBroadcast(); @@ -702,30 +658,22 @@ EditableExtendedColorConfig::~EditableExtendedColorConfig() delete m_pImpl; } -/*-- 25.03.2002 12:03:15--------------------------------------------------- - -----------------------------------------------------------------------*/ uno::Sequence< ::rtl::OUString > EditableExtendedColorConfig::GetSchemeNames() const { return m_pImpl->GetSchemeNames(); } -/*-- 25.03.2002 12:03:16--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditableExtendedColorConfig::DeleteScheme(const ::rtl::OUString& rScheme ) { m_pImpl->RemoveScheme(rScheme); } -/*-- 25.03.2002 12:03:16--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditableExtendedColorConfig::AddScheme(const ::rtl::OUString& rScheme ) { m_pImpl->AddScheme(rScheme); } -/*-- 25.03.2002 12:03:16--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Bool EditableExtendedColorConfig::LoadScheme(const ::rtl::OUString& rScheme ) { if(m_bModified) @@ -738,32 +686,25 @@ sal_Bool EditableExtendedColorConfig::LoadScheme(const ::rtl::OUString& rScheme m_pImpl->CommitCurrentSchemeName(); return sal_True; } -/*-- 25.03.2002 12:03:16--------------------------------------------------- - -----------------------------------------------------------------------*/ const ::rtl::OUString& EditableExtendedColorConfig::GetCurrentSchemeName()const { return m_pImpl->GetLoadedScheme(); } -/* -----------------11.12.2002 10:56----------------- - * changes the name of the current scheme but doesn't load it! - * --------------------------------------------------*/ + +// Changes the name of the current scheme but doesn't load it! void EditableExtendedColorConfig::SetCurrentSchemeName(const ::rtl::OUString& rScheme) { m_pImpl->SetCurrentSchemeName(rScheme); m_pImpl->CommitCurrentSchemeName(); } -/*-- 25.03.2002 12:03:17--------------------------------------------------- - -----------------------------------------------------------------------*/ ExtendedColorConfigValue EditableExtendedColorConfig::GetColorValue(const ::rtl::OUString& _sComponentName, const ::rtl::OUString& _sName)const { return m_pImpl->GetColorConfigValue(_sComponentName,_sName); } -/*-- 25.03.2002 12:03:17--------------------------------------------------- - -----------------------------------------------------------------------*/ void EditableExtendedColorConfig::SetColorValue( const ::rtl::OUString& _sName, const ExtendedColorConfigValue& rValue) { @@ -771,16 +712,12 @@ void EditableExtendedColorConfig::SetColorValue( m_pImpl->ClearModified(); m_bModified = sal_True; } -/* -----------------------------10.04.2002 13:22------------------------------ - ---------------------------------------------------------------------------*/ void EditableExtendedColorConfig::SetModified() { m_bModified = sal_True; } -/* -----------------15.10.2002 14:51----------------- - * - * --------------------------------------------------*/ + void EditableExtendedColorConfig::Commit() { if(m_bModified) @@ -825,3 +762,5 @@ ExtendedColorConfigValue EditableExtendedColorConfig::GetComponentColorConfigVal return m_pImpl->GetComponentDisplayName(_sComponentName); } }//namespace svtools + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx index bf372902fb6f..95dce21ddd45 100644 --- a/svtools/source/config/fontsubstconfig.cxx +++ b/svtools/source/config/fontsubstconfig.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,11 +40,12 @@ #include <rtl/logfile.hxx> using namespace utl; -using namespace rtl; using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::beans; +using ::rtl::OUString; + #define C2U(cChar) OUString::createFromAscii(cChar) const sal_Char cReplacement[] = "Replacement"; @@ -63,11 +65,9 @@ struct SvtFontSubstConfig_Impl { SubstitutionStructArr aSubstArr; }; -/* -----------------------------18.01.01 12:04-------------------------------- - ---------------------------------------------------------------------------*/ SvtFontSubstConfig::SvtFontSubstConfig() : - ConfigItem(C2U("Office.Common/Font/Substitution")), + ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Font/Substitution"))), bIsEnabled(sal_False), pImpl(new SvtFontSubstConfig_Impl) { @@ -86,13 +86,13 @@ SvtFontSubstConfig::SvtFontSubstConfig() : Sequence<OUString> aPropNames(aNodeNames.getLength() * 4); OUString* pNames = aPropNames.getArray(); sal_Int32 nName = 0; - sPropPrefix += C2U("/"); + sPropPrefix += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); sal_Int32 nNode; for(nNode = 0; nNode < aNodeNames.getLength(); nNode++) { OUString sStart(sPropPrefix); sStart += pNodeNames[nNode]; - sStart += C2U("/"); + sStart += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); pNames[nName] = sStart; pNames[nName++] += C2U(cReplaceFont); pNames[nName] = sStart; pNames[nName++] += C2U(cSubstituteFont); pNames[nName] = sStart; pNames[nName++] += C2U(cAlways); @@ -111,16 +111,12 @@ SvtFontSubstConfig::SvtFontSubstConfig() : pImpl->aSubstArr.Insert(pInsert, pImpl->aSubstArr.Count()); } } -/* -----------------------------18.01.01 12:06-------------------------------- - ---------------------------------------------------------------------------*/ SvtFontSubstConfig::~SvtFontSubstConfig() { delete pImpl; } -/*-- 18.01.01 12:08:00--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtFontSubstConfig::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) { } @@ -168,23 +164,17 @@ void SvtFontSubstConfig::Commit() ReplaceSetProperties(sNode, aSetValues); } } -/*-- 18.01.01 12:08:00--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Int32 SvtFontSubstConfig::SubstitutionCount() const { return pImpl->aSubstArr.Count(); } -/*-- 18.01.01 12:08:00--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtFontSubstConfig::ClearSubstitutions() { pImpl->aSubstArr.DeleteAndDestroy(0, pImpl->aSubstArr.Count()); } -/*-- 18.01.01 12:08:00--------------------------------------------------- - -----------------------------------------------------------------------*/ const SubstitutionStruct* SvtFontSubstConfig::GetSubstitution(sal_Int32 nPos) { DBG_ASSERT(nPos >= 0 && nPos < pImpl->aSubstArr.Count(), "illegal array index"); @@ -192,9 +182,7 @@ const SubstitutionStruct* SvtFontSubstConfig::GetSubstitution(sal_Int32 nPos) return pImpl->aSubstArr[(sal_uInt16)nPos]; return 0; } -/*-- 18.01.01 12:08:01--------------------------------------------------- - -----------------------------------------------------------------------*/ void SvtFontSubstConfig::AddSubstitution(const SubstitutionStruct& rToAdd) { SubstitutionStructPtr pInsert = new SubstitutionStruct(rToAdd); @@ -227,3 +215,5 @@ void SvtFontSubstConfig::Apply() OutputDevice::EndFontSubstitution(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx index 091bf50c4787..6e80db6fcf6c 100644 --- a/svtools/source/config/helpopt.cxx +++ b/svtools/source/config/helpopt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,10 +43,11 @@ #include "itemholder2.hxx" using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; using namespace com::sun::star; +using ::rtl::OUString; + static SvtHelpOptions_Impl* pOptions = NULL; static sal_Int32 nRefCount = 0; @@ -165,7 +167,7 @@ Sequence< OUString > SvtHelpOptions_Impl::GetPropertyNames() // ----------------------------------------------------------------------- SvtHelpOptions_Impl::SvtHelpOptions_Impl() - : ConfigItem( OUString::createFromAscii("Office.Common/Help") ) + : ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Help" )) ) , pList( 0 ) , bExtendedHelp( sal_False ) , bHelpTips( sal_True ) @@ -200,7 +202,9 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< ::rtl::OUString>& rProperty { for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ ) { - DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); +#if OSL_DEBUG_LEVEL > 1 + OSL_ASSERT( pValues[nProp].hasValue(), "property value missing" ); +#endif if ( pValues[nProp].hasValue() ) { sal_Bool bTmp = sal_Bool(); @@ -262,8 +266,8 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< ::rtl::OUString>& rProperty } else { - DBG_ERRORFILE( "Wrong Type!" ); - } + DBG_ERRORFILE( "Wrong Type!" ); + } } } if ( IsHelpTips() != Help::IsQuickHelpEnabled() ) @@ -278,10 +282,10 @@ void SvtHelpOptions_Impl::Load(const uno::Sequence< ::rtl::OUString>& rProperty void SvtHelpOptions_Impl::implGetURLCounters( Sequence< ::rtl::OUString >& _rNodeNames, Sequence< Any >& _rURLs, Sequence< Any >& _rCounters ) { // the ignore counters for the help agent URLs - const ::rtl::OUString sIgnoreListNodePath = ::rtl::OUString::createFromAscii("HelpAgent/IgnoreList"); - const ::rtl::OUString sPathSeparator = ::rtl::OUString::createFromAscii("/"); - const ::rtl::OUString sURLLocalPath = ::rtl::OUString::createFromAscii("/Name"); - const ::rtl::OUString sCounterLocalPath = ::rtl::OUString::createFromAscii("/Counter"); + const ::rtl::OUString sIgnoreListNodePath( RTL_CONSTASCII_USTRINGPARAM( "HelpAgent/IgnoreList" )); + const ::rtl::OUString sPathSeparator( RTL_CONSTASCII_USTRINGPARAM( "/" )); + const ::rtl::OUString sURLLocalPath( RTL_CONSTASCII_USTRINGPARAM( "/Name" )); + const ::rtl::OUString sCounterLocalPath( RTL_CONSTASCII_USTRINGPARAM( "/Counter" )); // get the names of all the nodes containing ignore counters // collect the node names we have to ask @@ -338,10 +342,10 @@ void SvtHelpOptions_Impl::implSaveURLCounters() { ::osl::MutexGuard aGuard(aIgnoreCounterSafety); - const ::rtl::OUString sIgnoreListNodePath = ::rtl::OUString::createFromAscii("HelpAgent/IgnoreList"); - const ::rtl::OUString sPathSeparator = ::rtl::OUString::createFromAscii("/"); - const ::rtl::OUString sURLLocalPath = ::rtl::OUString::createFromAscii("/Name"); - const ::rtl::OUString sCounterLocalPath = ::rtl::OUString::createFromAscii("/Counter"); + const ::rtl::OUString sIgnoreListNodePath( RTL_CONSTASCII_USTRINGPARAM( "HelpAgent/IgnoreList" )); + const ::rtl::OUString sPathSeparator( RTL_CONSTASCII_USTRINGPARAM( "/" )); + const ::rtl::OUString sURLLocalPath( RTL_CONSTASCII_USTRINGPARAM( "/Name" )); + const ::rtl::OUString sCounterLocalPath( RTL_CONSTASCII_USTRINGPARAM( "/Counter" )); // get the current URL/counter pairs (as they're persistent at the moment) Sequence< ::rtl::OUString > aNodeNames; @@ -425,7 +429,7 @@ void SvtHelpOptions_Impl::implSaveURLCounters() ::rtl::OUString sNewNodeName; Sequence< ::rtl::OUString > aNewCounterDataNodeNames(2); Sequence< Any > aNewCounterDataValues(2); - const ::rtl::OUString sNodeNameBase = ::rtl::OUString::createFromAscii("URL"); + const ::rtl::OUString sNodeNameBase( RTL_CONSTASCII_USTRINGPARAM( "URL" )); for ( ConstMapString2IntIterator aCollectNew = aURLIgnoreCounters.begin(); aCollectNew != aURLIgnoreCounters.end(); ++aCollectNew @@ -762,3 +766,4 @@ void SvtHelpOptions::SetHelpStyleSheet(const String& rStyleSheet) pImp->SetHelpStyleSheet(rStyleSheet); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx index 1be097f17ab5..338fd0d6e40c 100644 --- a/svtools/source/config/htmlcfg.cxx +++ b/svtools/source/config/htmlcfg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,8 +33,10 @@ #include <svtools/parhtml.hxx> #include <unotools/syslocale.hxx> #include <tools/debug.hxx> -#include <tools/list.hxx> #include <tools/link.hxx> +#include <sal/macros.h> +#include <rtl/instance.hxx> +#include <list> // ----------------------------------------------------------------------- #define HTMLCFG_UNKNOWN_TAGS 0x01 @@ -47,20 +50,15 @@ #define HTMLCFG_NUMBERS_ENGLISH_US 0x100 using namespace utl; -using namespace rtl; using namespace com::sun::star::uno; -static SvxHtmlOptions* pOptions = 0; - -DECLARE_LIST( LinkList, Link * ) +using ::rtl::OUString; #define C2U(cChar) OUString::createFromAscii(cChar) -/* -----------------------------23.11.00 11:39-------------------------------- - ---------------------------------------------------------------------------*/ struct HtmlOptions_Impl { - LinkList aList; + ::std::list<Link> aList; sal_Int32 nFlags; sal_Int32 nExportMode; sal_Int32 aFontSizeArr[HTML_FONT_COUNT]; @@ -83,9 +81,6 @@ struct HtmlOptions_Impl } }; -/* -----------------------------23.11.00 11:39-------------------------------- - - ---------------------------------------------------------------------------*/ const Sequence<OUString>& SvxHtmlOptions::GetPropertyNames() { static Sequence<OUString> aNames; @@ -110,7 +105,7 @@ const Sequence<OUString>& SvxHtmlOptions::GetPropertyNames() "Export/Encoding", // 14 "Import/NumbersEnglishUS" // 15 }; - const int nCount = sizeof(aPropNames) / sizeof(aPropNames[0]); + const int nCount = SAL_N_ELEMENTS(aPropNames); aNames.realloc(nCount); OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) @@ -164,13 +159,11 @@ void SvxHtmlOptions::Load( const Sequence< OUString >& aNames ) case 9://"Export/Browser", { sal_Int32 nExpMode = 0; -// pValues[nProp] >>= pImp->nExportMode; pValues[nProp] >>= nExpMode; switch( nExpMode ) { case 0: nExpMode = HTML_CFG_HTML32; break; case 1: nExpMode = HTML_CFG_MSIE_40; break; -// case 2: nExpMode = HTML_CFG_NS30; break; depricated case 3: nExpMode = HTML_CFG_WRITER; break; case 4: nExpMode = HTML_CFG_NS40; break; case 5: nExpMode = HTML_CFG_MSIE_40_OLD;break; @@ -216,11 +209,9 @@ void SvxHtmlOptions::Commit() { const Sequence<OUString>& aNames = GetPropertyNames(); -// const OUString* pNames = aNames.getConstArray(); Sequence<Any> aValues(aNames.getLength()); Any* pValues = aValues.getArray(); -// const Type& rType = ::getBooleanCppuType(); for(int nProp = 0; nProp < aNames.getLength(); nProp++) { sal_Bool bSet = sal_False; @@ -243,7 +234,6 @@ void SvxHtmlOptions::Commit() { case HTML_CFG_HTML32: nExpMode = 0; break; case HTML_CFG_MSIE_40: nExpMode = 1; break; -// case HTML_CFG_NS30: nExpMode = 2; break; depricated case HTML_CFG_WRITER: nExpMode = 3; break; case HTML_CFG_NS40: nExpMode = 4; break; case HTML_CFG_MSIE_40_OLD: nExpMode = 5; break; @@ -271,16 +261,16 @@ void SvxHtmlOptions::Commit() void SvxHtmlOptions::AddListenerLink( const Link& rLink ) { - pImp->aList.Insert( new Link( rLink ) ); + pImp->aList.push_back( rLink ); } void SvxHtmlOptions::RemoveListenerLink( const Link& rLink ) { - for ( sal_uInt16 n=0; n<pImp->aList.Count(); n++ ) + for ( ::std::list<Link>::iterator iter = pImp->aList.begin(); iter != pImp->aList.end(); ++iter ) { - if ( (*pImp->aList.GetObject(n) ) == rLink ) + if ( *iter == rLink ) { - delete pImp->aList.Remove(n); + pImp->aList.erase(iter); break; } } @@ -288,8 +278,8 @@ void SvxHtmlOptions::RemoveListenerLink( const Link& rLink ) void SvxHtmlOptions::CallListeners() { - for ( sal_uInt16 n = 0; n < pImp->aList.Count(); ++n ) - pImp->aList.GetObject(n)->Call( this ); + for ( ::std::list<Link>::const_iterator iter = pImp->aList.begin(); iter != pImp->aList.end(); ++iter ) + iter->Call( this ); } @@ -379,17 +369,11 @@ void SvxHtmlOptions::SetStarBasic(sal_Bool bSet) SetModified(); } -/*-----------------14.02.97 08.34------------------- - ---------------------------------------------------*/ - sal_Bool SvxHtmlOptions::IsSaveGraphicsLocal() const { return 0 != (pImp->nFlags & HTMLCFG_LOCAL_GRF) ; } -/*-----------------14.02.97 08.34------------------- ---------------------------------------------------*/ void SvxHtmlOptions::SetSaveGraphicsLocal(sal_Bool bSet) { if(bSet) @@ -399,10 +383,6 @@ void SvxHtmlOptions::SetSaveGraphicsLocal(sal_Bool bSet) SetModified(); } -/*-----------------10/21/97 08:34am----------------- - ---------------------------------------------------*/ - sal_Bool SvxHtmlOptions::IsPrintLayoutExtension() const { sal_Bool bRet = 0 != (pImp->nFlags & HTMLCFG_PRINT_LAYOUT_EXTENSION); @@ -417,9 +397,7 @@ sal_Bool SvxHtmlOptions::IsPrintLayoutExtension() const } return bRet; } -/*-----------------10/21/97 08:34am----------------- ---------------------------------------------------*/ void SvxHtmlOptions::SetPrintLayoutExtension(sal_Bool bSet) { if(bSet) @@ -429,17 +407,11 @@ void SvxHtmlOptions::SetPrintLayoutExtension(sal_Bool bSet) SetModified(); } -/*-----------------10.07.98 10.02------------------- - ---------------------------------------------------*/ - sal_Bool SvxHtmlOptions::IsIgnoreFontFamily() const { return 0 != (pImp->nFlags & HTMLCFG_IGNORE_FONT_FAMILY) ; } -/*-----------------10.07.98 10.02------------------- ---------------------------------------------------*/ void SvxHtmlOptions::SetIgnoreFontFamily(sal_Bool bSet) { if(bSet) @@ -448,16 +420,12 @@ void SvxHtmlOptions::SetIgnoreFontFamily(sal_Bool bSet) pImp->nFlags &= ~HTMLCFG_IGNORE_FONT_FAMILY; SetModified(); } -/* -----------------05.02.99 09:03------------------- - * - * --------------------------------------------------*/ + sal_Bool SvxHtmlOptions::IsStarBasicWarning() const { return 0 != (pImp->nFlags & HTMLCFG_IS_BASIC_WARNING) ; } -/* -----------------05.02.99 09:03------------------- - * - * --------------------------------------------------*/ + void SvxHtmlOptions::SetStarBasicWarning(sal_Bool bSet) { if(bSet) @@ -467,9 +435,6 @@ void SvxHtmlOptions::SetStarBasicWarning(sal_Bool bSet) SetModified(); } -/*-----------------19.02.2001 18:40----------------- - * - * --------------------------------------------------*/ rtl_TextEncoding SvxHtmlOptions::GetTextEncoding() const { rtl_TextEncoding eRet; @@ -480,39 +445,33 @@ rtl_TextEncoding SvxHtmlOptions::GetTextEncoding() const return eRet; } -/*-----------------19.02.2001 18:40----------------- - * - * --------------------------------------------------*/ void SvxHtmlOptions::SetTextEncoding( rtl_TextEncoding eEnc ) { pImp->eEncoding = eEnc; pImp->bIsEncodingDefault = sal_False; SetModified(); } -/* -----------------------------15.08.2001 12:01------------------------------ - ---------------------------------------------------------------------------*/ sal_Bool SvxHtmlOptions::IsDefaultTextEncoding() const { return pImp->bIsEncodingDefault; } -SvxHtmlOptions* SvxHtmlOptions::Get() +namespace { - if ( !pOptions ) - pOptions = new SvxHtmlOptions; - return pOptions; + class theSvxHtmlOptions : public rtl::Static<SvxHtmlOptions, theSvxHtmlOptions> {}; } +SvxHtmlOptions& SvxHtmlOptions::Get() +{ + return theSvxHtmlOptions::get(); +} -/* ---------------------- 2006-06-07T21:02+0200 ---------------------- */ sal_Bool SvxHtmlOptions::IsNumbersEnglishUS() const { return 0 != (pImp->nFlags & HTMLCFG_NUMBERS_ENGLISH_US) ; } - -/* ---------------------- 2006-06-07T21:02+0200 ---------------------- */ void SvxHtmlOptions::SetNumbersEnglishUS(sal_Bool bSet) { if(bSet) @@ -521,3 +480,5 @@ void SvxHtmlOptions::SetNumbersEnglishUS(sal_Bool bSet) pImp->nFlags &= ~HTMLCFG_NUMBERS_ENGLISH_US; SetModified(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index 2382bf3ad7a3..7f57664af5f1 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -64,7 +65,7 @@ ItemHolder2::ItemHolder2() { css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); css::uno::Reference< css::lang::XComponent > xCfg( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ))), css::uno::UNO_QUERY); if (xCfg.is()) xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); @@ -85,7 +86,7 @@ ItemHolder2::ItemHolder2() sMsg += ::rtl::OString(rEx.Message.getStr(), rEx.Message.getLength(), RTL_TEXTENCODING_ASCII_US); - DBG_ERROR(sMsg.getStr()); + OSL_FAIL(sMsg.getStr()); } } #else @@ -207,3 +208,5 @@ void ItemHolder2::impl_deleteItem(TItemInfo& rItem) rItem.pItem = 0; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/itemholder2.hxx b/svtools/source/config/itemholder2.hxx index 9314021b5750..884536d89bb0 100644 --- a/svtools/source/config/itemholder2.hxx +++ b/svtools/source/config/itemholder2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -87,3 +88,5 @@ class ItemHolder2 : private ItemHolderMutexBase #undef css #endif // INCLUDED_SVTOOLS_ITEMHOLDER2_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx index 28f52fe2b23b..a70be005dcca 100644 --- a/svtools/source/config/menuoptions.cxx +++ b/svtools/source/config/menuoptions.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,12 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ #include <svtools/menuoptions.hxx> #include <unotools/configmgr.hxx> @@ -45,6 +40,8 @@ #include <rtl/logfile.hxx> #include "itemholder2.hxx" +#include <list> + //_________________________________________________________________________________________________________________ // namespaces //_________________________________________________________________________________________________________________ @@ -76,8 +73,6 @@ using namespace ::com::sun::star::uno ; #define PROPERTYCOUNT 4 #include <tools/link.hxx> -#include <tools/list.hxx> -DECLARE_LIST( LinkList, Link * ) //_________________________________________________________________________________________________________________ // private declarations! @@ -90,7 +85,7 @@ class SvtMenuOptions_Impl : public ConfigItem //------------------------------------------------------------------------------------------------------------- private: - LinkList aList; + ::std::list<Link> aList; sal_Bool m_bDontHideDisabledEntries ; /// cache "DontHideDisabledEntries" of Menu section sal_Bool m_bFollowMouse ; /// cache "FollowMouse" of Menu section sal_Int16 m_nMenuIcons ; /// cache "MenuIcons" of Menu section @@ -152,8 +147,8 @@ class SvtMenuOptions_Impl : public ConfigItem /*-****************************************************************************************************//** @short access method to get internal values - @descr These method give us a chance to regulate acces to ouer internal values. - It's not used in the moment - but it's possible for the feature! + @descr These methods give us a chance to regulate access to our internal values. + It's not used in the moment - but it's possible for the future! @seealso - @@ -176,8 +171,8 @@ class SvtMenuOptions_Impl : public ConfigItem { m_bDontHideDisabledEntries = bState; SetModified(); - for ( sal_uInt16 n=0; n<aList.Count(); n++ ) - aList.GetObject(n)->Call( this ); + for ( ::std::list<Link>::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); Commit(); } @@ -185,17 +180,17 @@ class SvtMenuOptions_Impl : public ConfigItem { m_bFollowMouse = bState; SetModified(); - for ( sal_uInt16 n=0; n<aList.Count(); n++ ) - aList.GetObject(n)->Call( this ); + for ( ::std::list<Link>::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); Commit(); } - void SetMenuIconsState ( sal_Int16 bState ) + void SetMenuIconsState ( sal_Int16 nState ) { - m_nMenuIcons = bState; + m_nMenuIcons = nState; SetModified(); - for ( sal_uInt16 n=0; n<aList.Count(); n++ ) - aList.GetObject(n)->Call( this ); + for ( ::std::list<Link>::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); Commit(); } @@ -206,7 +201,7 @@ class SvtMenuOptions_Impl : public ConfigItem private: /*-****************************************************************************************************//** - @short return list of fix key names of ouer configuration management which represent oue module tree + @short return list of fix key names of our configuration management which represent our module tree @descr These methods return a static const list of key names. We need it to get needed values from our configuration management. @@ -245,10 +240,17 @@ SvtMenuOptions_Impl::SvtMenuOptions_Impl() // Follow assignment use order of values in relation to our list of key names! DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nI miss some values of configuration keys!\n" ); - sal_Bool bMenuIcons = true; - sal_Bool bSystemMenuIcons = true; + sal_Bool bMenuIcons = sal_True; + sal_Bool bSystemMenuIcons = sal_True; + if (m_nMenuIcons == 2) + bMenuIcons = (sal_Bool)(Application::GetSettings().GetStyleSettings().GetPreferredUseImagesInMenus()); + else + { + bSystemMenuIcons = sal_False; + bMenuIcons = m_nMenuIcons ? sal_True : sal_False; + } - // Copy values from list in right order to ouer internal member. + // Copy values from list in right order to our internal member. sal_Int32 nPropertyCount = seqValues.getLength() ; sal_Int32 nProperty = 0 ; for( nProperty=0; nProperty<nPropertyCount; ++nProperty ) @@ -256,6 +258,10 @@ SvtMenuOptions_Impl::SvtMenuOptions_Impl() // Safe impossible cases. // Check any for valid value. DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nInvalid property value for property detected!\n" ); + + if (!seqValues[nProperty].hasValue()) + continue; + switch( nProperty ) { case PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES : { @@ -298,9 +304,6 @@ SvtMenuOptions_Impl::~SvtMenuOptions_Impl() { Commit(); } - - for ( sal_uInt16 n=0; n<aList.Count(); ) - delete aList.Remove(n); } //***************************************************************************************************************** @@ -342,12 +345,12 @@ void SvtMenuOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) else if( seqPropertyNames[nProperty] == PROPERTYNAME_SHOWICONSINMENUES ) { DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); - bMenuSettingsChanged = seqValues[nProperty] >>= bMenuIcons; + bMenuSettingsChanged |= seqValues[nProperty] >>= bMenuIcons; } else if( seqPropertyNames[nProperty] == PROPERTYNAME_SYSTEMICONSINMENUES ) { DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\IsSystemIconsInMenus\"?" ); - bMenuSettingsChanged = seqValues[nProperty] >>= bSystemMenuIcons; + bMenuSettingsChanged |= seqValues[nProperty] >>= bSystemMenuIcons; } #if OSL_DEBUG_LEVEL > 1 @@ -358,8 +361,8 @@ void SvtMenuOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) if ( bMenuSettingsChanged ) m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; - for ( sal_uInt16 n=0; n<aList.Count(); n++ ) - aList.GetObject(n)->Call( this ); + for ( ::std::list<Link>::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); } //***************************************************************************************************************** @@ -422,16 +425,16 @@ Sequence< OUString > SvtMenuOptions_Impl::impl_GetPropertyNames() void SvtMenuOptions_Impl::AddListenerLink( const Link& rLink ) { - aList.Insert( new Link( rLink ) ); + aList.push_back( rLink ); } void SvtMenuOptions_Impl::RemoveListenerLink( const Link& rLink ) { - for ( sal_uInt16 n=0; n<aList.Count(); n++ ) + for ( ::std::list<Link>::iterator iter = aList.begin(); iter != aList.end(); ++iter ) { - if ( (*aList.GetObject(n) ) == rLink ) + if ( *iter == rLink ) { - delete aList.Remove(n); + aList.erase(iter); break; } } @@ -452,9 +455,9 @@ SvtMenuOptions::SvtMenuOptions() { // Global access, must be guarded (multithreading!). MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... + // Increase our refcount ... ++m_nRefCount; - // ... and initialize ouer data container only if it not already! + // ... and initialize our data container only if it not already! if( m_pDataContainer == NULL ) { RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtMenuOptions_Impl::ctor()"); @@ -471,10 +474,10 @@ SvtMenuOptions::~SvtMenuOptions() { // Global access, must be guarded (multithreading!) MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. + // Decrease our refcount. --m_nRefCount; // If last instance was deleted ... - // we must destroy ouer static data container! + // we must destroy our static data container! if( m_nRefCount <= 0 ) { delete m_pDataContainer; @@ -549,7 +552,7 @@ Mutex& SvtMenuOptions::GetOwnStaticMutex() // ... we must create a new one. Protect follow code with the global mutex - // It must be - we create a static variable! MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! + // We must check our pointer again - because it can be that another instance of our class will be faster than these! if( pMutex == NULL ) { // Create the new mutex and set it for return on static variable. @@ -570,3 +573,5 @@ void SvtMenuOptions::RemoveListenerLink( const Link& rLink ) { m_pDataContainer->RemoveListenerLink( rLink ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 9668a2144ebf..6d10da9cff19 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,16 +39,18 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <tools/link.hxx> -#include <tools/list.hxx> #include <tools/wldcrd.hxx> #include <tools/urlobj.hxx> #include <rtl/logfile.hxx> +#include <rtl/instance.hxx> #include "itemholder2.hxx" #include <svtools/imgdef.hxx> #include <vcl/svapp.hxx> +#include <list> + //_________________________________________________________________________________________________________________ // namespaces //_________________________________________________________________________________________________________________ @@ -78,13 +81,21 @@ using namespace ::com::sun::star; #define PROPERTYHANDLE_SYMBOLSTYLE 4 #define PROPERTYNAME_USESYSTEMPRINTDIALOG ASCII_STR("UseSystemPrintDialog") #define PROPERTYHANDLE_USESYSTEMPRINTDIALOG 5 - -#define PROPERTYCOUNT 6 +#define PROPERTYNAME_TRYODMADIALOG ASCII_STR("TryODMADialog") +#define PROPERTYHANDLE_TRYODMADIALOG 6 +#define PROPERTYNAME_SHOWLINKWARNINGDIALOG ASCII_STR("ShowLinkWarningDialog") +#define PROPERTYHANDLE_SHOWLINKWARNINGDIALOG 7 +#define PROPERTYNAME_DISABLEUICUSTOMIZATION ASCII_STR("DisableUICustomization") +#define PROPERTYHANDLE_DISABLEUICUSTOMIZATION 8 +#define PROPERTYNAME_ALWAYSALLOWSAVE ASCII_STR("AlwaysAllowSave") +#define PROPERTYHANDLE_ALWAYSALLOWSAVE 9 +#define PROPERTYNAME_EXPERIMENTALMODE ASCII_STR("ExperimentalMode") +#define PROPERTYHANDLE_EXPERIMENTALMODE 10 + +#define PROPERTYCOUNT 11 #define VCL_TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004) // from <vcl/toolbox.hxx> -DECLARE_LIST( LinkList, Link * ) - //_________________________________________________________________________________________________________________ // private declarations! //_________________________________________________________________________________________________________________ @@ -96,9 +107,11 @@ class SvtMiscOptions_Impl : public ConfigItem //------------------------------------------------------------------------------------------------------------- private: - LinkList aList; + ::std::list<Link> aList; sal_Bool m_bUseSystemFileDialog; sal_Bool m_bIsUseSystemFileDialogRO; + sal_Bool m_bTryODMADialog; + sal_Bool m_bIsTryODMADialogRO; sal_Bool m_bPluginsEnabled; sal_Bool m_bIsPluginsEnabledRO; sal_Int16 m_nSymbolsSize; @@ -108,6 +121,11 @@ class SvtMiscOptions_Impl : public ConfigItem sal_Bool m_bIsToolboxStyleRO; sal_Bool m_bUseSystemPrintDialog; sal_Bool m_bIsUseSystemPrintDialogRO; + sal_Bool m_bShowLinkWarningDialog; + sal_Bool m_bIsShowLinkWarningDialogRO; + sal_Bool m_bDisableUICustomization; + sal_Bool m_bAlwaysAllowSave; + sal_Bool m_bExperimentalMode; //------------------------------------------------------------------------------------------------------------- // public methods @@ -176,6 +194,30 @@ class SvtMiscOptions_Impl : public ConfigItem inline sal_Bool IsUseSystemFileDialogReadOnly() const { return m_bIsUseSystemFileDialogRO; } + inline sal_Bool TryODMADialog() const + { return m_bTryODMADialog; } + + inline void SetTryODMADialog( sal_Bool bSet ) + { m_bTryODMADialog = bSet; SetModified(); } + + inline sal_Bool IsTryUseODMADialogReadOnly() const + { return m_bIsTryODMADialogRO; } + + inline sal_Bool DisableUICustomization() const + { return m_bDisableUICustomization; } + + inline void SetSaveAlwaysAllowed( sal_Bool bSet ) + { m_bAlwaysAllowSave = bSet; SetModified(); } + + inline sal_Bool IsSaveAlwaysAllowed() const + { return m_bAlwaysAllowSave; } + + inline void SetExperimentalMode( sal_Bool bSet ) + { m_bExperimentalMode = bSet; SetModified(); } + + inline sal_Bool IsExperimentalMode() const + { return m_bExperimentalMode; } + inline sal_Bool IsPluginsEnabled() const { return m_bPluginsEnabled; } @@ -224,6 +266,15 @@ class SvtMiscOptions_Impl : public ConfigItem inline sal_Bool IsUseSystemPrintDialogReadOnly() const { return m_bIsUseSystemPrintDialogRO; } + inline sal_Bool ShowLinkWarningDialog() const + { return m_bShowLinkWarningDialog; } + + void SetShowLinkWarningDialog( sal_Bool bSet ) + { m_bShowLinkWarningDialog = bSet; SetModified(); } + + sal_Bool IsShowLinkWarningDialogReadOnly() const + { return m_bIsShowLinkWarningDialogRO; } + void AddListenerLink( const Link& rLink ); void RemoveListenerLink( const Link& rLink ); void CallListeners(); @@ -262,6 +313,8 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() , m_bUseSystemFileDialog( sal_False ) , m_bIsUseSystemFileDialogRO( sal_False ) + , m_bTryODMADialog( sal_False ) + , m_bIsTryODMADialogRO( sal_False ) , m_bPluginsEnabled( sal_False ) , m_bIsPluginsEnabledRO( sal_False ) , m_nSymbolsSize( 0 ) @@ -271,6 +324,10 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() , m_bIsToolboxStyleRO( sal_False ) , m_bUseSystemPrintDialog( sal_False ) , m_bIsUseSystemPrintDialogRO( sal_False ) + , m_bShowLinkWarningDialog( sal_True ) + , m_bIsShowLinkWarningDialogRO( sal_False ) + , m_bAlwaysAllowSave( sal_False ) + , m_bExperimentalMode( sal_False ) { // Use our static list of configuration keys to get his values. @@ -288,16 +345,15 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() sal_Int32 nPropertyCount = seqValues.getLength(); for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) { - // Safe impossible cases. - // Check any for valid value. - DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nInvalid property value detected!\n" ); + if (seqValues[nProperty].hasValue()==sal_False) + continue; switch( nProperty ) { case PROPERTYHANDLE_PLUGINSENABLED : { if( !(seqValues[nProperty] >>= m_bPluginsEnabled) ) { - DBG_ERROR("Wrong type of \"Misc\\PluginsEnabled\"!" ); + OSL_FAIL("Wrong type of \"Misc\\PluginsEnabled\"!" ); } m_bIsPluginsEnabledRO = seqRO[nProperty]; break; @@ -307,7 +363,7 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() { if( !(seqValues[nProperty] >>= m_nSymbolsSize) ) { - DBG_ERROR("Wrong type of \"Misc\\SymbolSet\"!" ); + OSL_FAIL("Wrong type of \"Misc\\SymbolSet\"!" ); } m_bIsSymbolsSizeRO = seqRO[nProperty]; break; @@ -317,7 +373,7 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() { if( !(seqValues[nProperty] >>= m_nToolboxStyle) ) { - DBG_ERROR("Wrong type of \"Misc\\ToolboxStyle\"!" ); + OSL_FAIL("Wrong type of \"Misc\\ToolboxStyle\"!" ); } m_bIsToolboxStyleRO = seqRO[nProperty]; break; @@ -327,7 +383,7 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() { if( !(seqValues[nProperty] >>= m_bUseSystemFileDialog) ) { - DBG_ERROR("Wrong type of \"Misc\\UseSystemFileDialog\"!" ); + OSL_FAIL("Wrong type of \"Misc\\UseSystemFileDialog\"!" ); } m_bIsUseSystemFileDialogRO = seqRO[nProperty]; break; @@ -337,12 +393,32 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() { if( !(seqValues[nProperty] >>= m_bUseSystemPrintDialog) ) { - DBG_ERROR("Wrong type of \"Misc\\UseSystemPrintDialog\"!" ); + OSL_FAIL("Wrong type of \"Misc\\UseSystemPrintDialog\"!" ); } m_bIsUseSystemPrintDialogRO = seqRO[nProperty]; break; } + case PROPERTYHANDLE_TRYODMADIALOG : + { + if( !(seqValues[nProperty] >>= m_bTryODMADialog) ) + { + OSL_FAIL("Wrong type of \"Misc\\TryODMADialog\"!" ); + } + m_bIsTryODMADialogRO = seqRO[nProperty]; + break; + } + + case PROPERTYHANDLE_SHOWLINKWARNINGDIALOG : + { + if( !(seqValues[nProperty] >>= m_bShowLinkWarningDialog) ) + { + OSL_FAIL("Wrong type of \"Misc\\ShowLinkWarningDialog\"!" ); + } + m_bIsShowLinkWarningDialogRO = seqRO[nProperty]; + break; + } + case PROPERTYHANDLE_SYMBOLSTYLE : { ::rtl::OUString aSymbolsStyle; @@ -350,11 +426,30 @@ SvtMiscOptions_Impl::SvtMiscOptions_Impl() SetSymbolsStyleName( aSymbolsStyle ); else { - DBG_ERROR("Wrong type of \"Misc\\SymbolStyle\"!" ); + OSL_FAIL("Wrong type of \"Misc\\SymbolStyle\"!" ); } m_bIsSymbolsStyleRO = seqRO[nProperty]; break; } + + case PROPERTYHANDLE_DISABLEUICUSTOMIZATION : + { + if( !(seqValues[nProperty] >>= m_bDisableUICustomization) ) + OSL_FAIL("Wrong type of \"Misc\\DisableUICustomization\"!" ); + break; + } + case PROPERTYHANDLE_ALWAYSALLOWSAVE : + { + if( !(seqValues[nProperty] >>= m_bAlwaysAllowSave) ) + OSL_FAIL("Wrong type of \"Misc\\AlwaysAllowSave\"!" ); + break; + } + case PROPERTYHANDLE_EXPERIMENTALMODE : + { + if( !(seqValues[nProperty] >>= m_bExperimentalMode) ) + OSL_FAIL("Wrong type of \"Misc\\ExperimentalMode\"!" ); + break; + } } } @@ -373,14 +468,8 @@ SvtMiscOptions_Impl::~SvtMiscOptions_Impl() { Commit(); } - - for ( sal_uInt16 n=0; n<aList.Count(); ) - delete aList.Remove(n); } -/*-- 25.02.2005 13:22:04--------------------------------------------------- - - -----------------------------------------------------------------------*/ static int lcl_MapPropertyName( const ::rtl::OUString rCompare, const uno::Sequence< ::rtl::OUString>& aInternalPropertyNames) { @@ -406,43 +495,56 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames ) sal_Int32 nPropertyCount = seqValues.getLength(); for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) { - // Safe impossible cases. - // Check any for valid value. - DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nInvalid property value detected!\n" ); + if (seqValues[nProperty].hasValue()==sal_False) + continue; switch( lcl_MapPropertyName(rPropertyNames[nProperty], aInternalPropertyNames) ) { case PROPERTYHANDLE_PLUGINSENABLED : { if( !(seqValues[nProperty] >>= m_bPluginsEnabled) ) { - DBG_ERROR("Wrong type of \"Misc\\PluginsEnabled\"!" ); + OSL_FAIL("Wrong type of \"Misc\\PluginsEnabled\"!" ); } } break; case PROPERTYHANDLE_SYMBOLSET : { if( !(seqValues[nProperty] >>= m_nSymbolsSize) ) { - DBG_ERROR("Wrong type of \"Misc\\SymbolSet\"!" ); + OSL_FAIL("Wrong type of \"Misc\\SymbolSet\"!" ); } } break; case PROPERTYHANDLE_TOOLBOXSTYLE : { if( !(seqValues[nProperty] >>= m_nToolboxStyle) ) { - DBG_ERROR("Wrong type of \"Misc\\ToolboxStyle\"!" ); + OSL_FAIL("Wrong type of \"Misc\\ToolboxStyle\"!" ); } } break; case PROPERTYHANDLE_USESYSTEMFILEDIALOG : { if( !(seqValues[nProperty] >>= m_bUseSystemFileDialog) ) { - DBG_ERROR("Wrong type of \"Misc\\UseSystemFileDialog\"!" ); + OSL_FAIL("Wrong type of \"Misc\\UseSystemFileDialog\"!" ); } } break; case PROPERTYHANDLE_USESYSTEMPRINTDIALOG : { if( !(seqValues[nProperty] >>= m_bUseSystemPrintDialog) ) { - DBG_ERROR("Wrong type of \"Misc\\UseSystemPrintDialog\"!" ); + OSL_FAIL("Wrong type of \"Misc\\UseSystemPrintDialog\"!" ); + } + } + break; + case PROPERTYHANDLE_TRYODMADIALOG : { + if( !(seqValues[nProperty] >>= m_bTryODMADialog) ) + { + OSL_FAIL("Wrong type of \"Misc\\TryODMADialog\"!" ); + } + } + break; + case PROPERTYHANDLE_SHOWLINKWARNINGDIALOG : { + if( !(seqValues[nProperty] >>= m_bShowLinkWarningDialog) ) + { + OSL_FAIL("Wrong type of \"Misc\\ShowLinkWarningDialog\"!" ); } } break; @@ -452,26 +554,37 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames ) SetSymbolsStyleName( aSymbolsStyle ); else { - DBG_ERROR("Wrong type of \"Misc\\SymbolStyle\"!" ); + OSL_FAIL("Wrong type of \"Misc\\SymbolStyle\"!" ); } } break; + case PROPERTYHANDLE_DISABLEUICUSTOMIZATION : { + if( !(seqValues[nProperty] >>= m_bDisableUICustomization) ) + OSL_FAIL("Wrong type of \"Misc\\DisableUICustomization\"!" ); + } + break; + case PROPERTYHANDLE_ALWAYSALLOWSAVE: + { + if( !(seqValues[nProperty] >>= m_bAlwaysAllowSave) ) + OSL_FAIL("Wrong type of \"Misc\\AlwaysAllowSave\"!" ); + } + break; } } } void SvtMiscOptions_Impl::AddListenerLink( const Link& rLink ) { - aList.Insert( new Link( rLink ) ); + aList.push_back( rLink ); } void SvtMiscOptions_Impl::RemoveListenerLink( const Link& rLink ) { - for ( sal_uInt16 n=0; n<aList.Count(); n++ ) + for ( ::std::list<Link>::iterator iter = aList.begin(); iter != aList.end(); ++iter ) { - if ( (*aList.GetObject(n) ) == rLink ) + if ( *iter == rLink ) { - delete aList.Remove(n); + aList.erase(iter); break; } } @@ -479,8 +592,8 @@ void SvtMiscOptions_Impl::RemoveListenerLink( const Link& rLink ) void SvtMiscOptions_Impl::CallListeners() { - for ( sal_uInt16 n = 0; n < aList.Count(); ++n ) - aList.GetObject(n)->Call( this ); + for ( ::std::list<Link>::const_iterator iter = aList.begin(); iter != aList.end(); ++iter ) + iter->Call( this ); } void SvtMiscOptions_Impl::SetToolboxStyle( sal_Int16 nStyle, bool _bSetModified ) @@ -592,6 +705,13 @@ void SvtMiscOptions_Impl::Commit() break; } + case PROPERTYHANDLE_TRYODMADIALOG : + { + if ( !m_bIsTryODMADialogRO ) + seqValues[nProperty] <<= m_bTryODMADialog; + break; + } + case PROPERTYHANDLE_SYMBOLSTYLE : { if ( !m_bIsSymbolsStyleRO ) @@ -605,6 +725,29 @@ void SvtMiscOptions_Impl::Commit() seqValues[nProperty] <<= m_bUseSystemPrintDialog; break; } + + case PROPERTYHANDLE_SHOWLINKWARNINGDIALOG : + { + if ( !m_bIsShowLinkWarningDialogRO ) + seqValues[nProperty] <<= m_bShowLinkWarningDialog; + break; + } + + case PROPERTYHANDLE_DISABLEUICUSTOMIZATION : + { + seqValues[nProperty] <<= m_bDisableUICustomization; + break; + } + case PROPERTYHANDLE_ALWAYSALLOWSAVE : + { + seqValues[nProperty] <<= m_bAlwaysAllowSave; + break; + } + case PROPERTYHANDLE_EXPERIMENTALMODE : + { + seqValues[nProperty] <<= m_bExperimentalMode; + break; + } } } // Set properties in configuration. @@ -616,19 +759,24 @@ void SvtMiscOptions_Impl::Commit() //***************************************************************************************************************** Sequence< OUString > SvtMiscOptions_Impl::GetPropertyNames() { - // Build static list of configuration key names. - static const OUString pProperties[] = + // Build list of configuration key names. + const OUString pProperties[] = { PROPERTYNAME_PLUGINSENABLED, PROPERTYNAME_SYMBOLSET, PROPERTYNAME_TOOLBOXSTYLE, PROPERTYNAME_USESYSTEMFILEDIALOG, PROPERTYNAME_SYMBOLSTYLE, - PROPERTYNAME_USESYSTEMPRINTDIALOG + PROPERTYNAME_USESYSTEMPRINTDIALOG, + PROPERTYNAME_TRYODMADIALOG, + PROPERTYNAME_SHOWLINKWARNINGDIALOG, + PROPERTYNAME_DISABLEUICUSTOMIZATION, + PROPERTYNAME_ALWAYSALLOWSAVE, + PROPERTYNAME_EXPERIMENTALMODE }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, SAL_N_ELEMENTS( pProperties ) ); // ... and return it. return seqPropertyNames; } @@ -692,6 +840,21 @@ sal_Bool SvtMiscOptions::IsUseSystemFileDialogReadOnly() const return m_pDataContainer->IsUseSystemFileDialogReadOnly(); } +sal_Bool SvtMiscOptions::TryODMADialog() const +{ + return m_pDataContainer->TryODMADialog(); +} + +void SvtMiscOptions::SetTryODMADialog( sal_Bool bEnable ) +{ + m_pDataContainer->SetTryODMADialog( bEnable ); +} + +sal_Bool SvtMiscOptions::IsTryUseODMADialogReadOnly() const +{ + return m_pDataContainer->IsTryUseODMADialogReadOnly(); +} + sal_Bool SvtMiscOptions::IsPluginsEnabled() const { return m_pDataContainer->IsPluginsEnabled(); @@ -770,6 +933,11 @@ sal_Bool SvtMiscOptions::IsGetSymbolsStyleReadOnly() const return m_pDataContainer->IsGetSymbolsStyleReadOnly(); } +sal_Bool SvtMiscOptions::DisableUICustomization() const +{ + return m_pDataContainer->DisableUICustomization(); +} + sal_Int16 SvtMiscOptions::GetToolboxStyle() const { return m_pDataContainer->GetToolboxStyle(); @@ -795,29 +963,50 @@ void SvtMiscOptions::SetUseSystemPrintDialog( sal_Bool bEnable ) m_pDataContainer->SetUseSystemPrintDialog( bEnable ); } -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** +sal_Bool SvtMiscOptions::ShowLinkWarningDialog() const +{ + return m_pDataContainer->ShowLinkWarningDialog(); +} + +void SvtMiscOptions::SetShowLinkWarningDialog( sal_Bool bSet ) +{ + m_pDataContainer->SetShowLinkWarningDialog( bSet ); +} + +sal_Bool SvtMiscOptions::IsShowLinkWarningDialogReadOnly() const +{ + return m_pDataContainer->IsShowLinkWarningDialogReadOnly(); +} + +void SvtMiscOptions::SetSaveAlwaysAllowed( sal_Bool bSet ) +{ + m_pDataContainer->SetSaveAlwaysAllowed( bSet ); +} + +sal_Bool SvtMiscOptions::IsSaveAlwaysAllowed() const +{ + return m_pDataContainer->IsSaveAlwaysAllowed(); +} + +void SvtMiscOptions::SetExperimentalMode( sal_Bool bSet ) +{ + m_pDataContainer->SetExperimentalMode( bSet ); +} + +sal_Bool SvtMiscOptions::IsExperimentalMode() const +{ + return m_pDataContainer->IsExperimentalMode(); +} + +namespace +{ + class theSvtMiscOptionsMutex : + public rtl::Static< osl::Mutex, theSvtMiscOptionsMutex > {}; +} + Mutex & SvtMiscOptions::GetInitMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theSvtMiscOptionsMutex::get(); } void SvtMiscOptions::AddListenerLink( const Link& rLink ) @@ -829,3 +1018,5 @@ void SvtMiscOptions::RemoveListenerLink( const Link& rLink ) { m_pDataContainer->RemoveListenerLink( rLink ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 57cf1cd8ad5b..410c430810b2 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,6 +44,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <vcl/svapp.hxx> #include <vcl/outdev.hxx> +#include <rtl/instance.hxx> //_________________________________________________________________________________________________________________ // namespaces @@ -1186,8 +1188,8 @@ sal_uInt16 SvtOptionsDrawinglayer_Impl::GetSelectionMaximumLuminancePercent() co //***************************************************************************************************************** Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames() { - // Build static list of configuration key names. - static const OUString pProperties[] = + // Build list of configuration key names. + const OUString pProperties[] = { PROPERTYNAME_OVERLAYBUFFER , PROPERTYNAME_PAINTBUFFER , @@ -1229,7 +1231,7 @@ Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames() }; // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); // ... and return it. return seqPropertyNames; } @@ -1684,30 +1686,19 @@ void SvtOptionsDrawinglayer::SetSelectionMaximumLuminancePercent( sal_uInt16 nPe m_pDataContainer->SetSelectionMaximumLuminancePercent( nPercent ); } +namespace +{ + class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theOptionsDrawinglayerMutex::get(); } // eof +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index 237d7f79a1c1..7f86d995f278 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,44 +41,30 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ #include <com/sun/star/container/XNameAccess.hpp> -#endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ #include <com/sun/star/container/XNameContainer.hpp> -#endif -#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ #include <com/sun/star/lang/XSingleServiceFactory.hpp> -#endif -#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ #include <comphelper/configurationhelper.hxx> -#endif -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ #include <unotools/processfactory.hxx> -#endif -#ifndef _SVT_LOGHELPER_HXX #include <unotools/loghelper.hxx> -#endif #include <itemholder2.hxx> - +#include <sal/macros.h> // ----------- // - statics - // ----------- static sal_uInt16 aDPIArray[] = { 72, 96, 150, 200, 300, 600 }; -#define DPI_COUNT (sizeof(aDPIArray)/sizeof(aDPIArray[0 ])) +#define DPI_COUNT (SAL_N_ELEMENTS(aDPIArray)) // ----------- // - Defines - @@ -868,3 +855,5 @@ SvtPrintFileOptions::~SvtPrintFileOptions() pPrintFileOptionsDataContainer = NULL; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/config/test/test.cxx b/svtools/source/config/test/test.cxx index ea4e0c0ec942..66fac8540c49 100644 --- a/svtools/source/config/test/test.cxx +++ b/svtools/source/config/test/test.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -53,9 +54,7 @@ // other includes //_________________________________________________________________________________________________________________ -#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ #include <comphelper/regpathhelper.hxx> -#endif #include <cppuhelper/servicefactory.hxx> #include <cppuhelper/bootstrap.hxx> #include <comphelper/processfactory.hxx> @@ -165,7 +164,7 @@ void TestApplication::Main() #endif // Execute(); - OSL_ENSURE( sal_False, "Test was successful!\n" ); + OSL_FAIL( "Test was successful!\n" ); } //***************************************************************************************************************** @@ -250,7 +249,7 @@ void TestApplication::impl_testDynamicMenuOptions() } } - OSL_ENSURE( sal_False, OUStringToOString( sOut.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ).getStr() ); + OSL_FAIL( OUStringToOString( sOut.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ).getStr() ); } //***************************************************************************************************************** @@ -268,3 +267,5 @@ Reference< XMultiServiceFactory > TestApplication::getUNOServiceManager() } return smgr; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx index e3ba48180e9c..6e4f6441140c 100644 --- a/svtools/source/contnr/contentenumeration.cxx +++ b/svtools/source/contnr/contentenumeration.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,7 +45,7 @@ #include <comphelper/processfactory.hxx> #include <tools/debug.hxx> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <memory> @@ -191,18 +192,18 @@ namespace svt Reference< XResultSet > xResultSet; Sequence< OUString > aProps(12); - aProps[0] = OUString::createFromAscii( "Title" ); - aProps[1] = OUString::createFromAscii( "Size" ); - aProps[2] = OUString::createFromAscii( "DateModified" ); - aProps[3] = OUString::createFromAscii( "DateCreated" ); - aProps[4] = OUString::createFromAscii( "IsFolder" ); - aProps[5] = OUString::createFromAscii( "TargetURL" ); - aProps[6] = OUString::createFromAscii( "IsHidden" ); - aProps[7] = OUString::createFromAscii( "IsVolume" ); - aProps[8] = OUString::createFromAscii( "IsRemote" ); - aProps[9] = OUString::createFromAscii( "IsRemoveable" ); - aProps[10] = OUString::createFromAscii( "IsFloppy" ); - aProps[11] = OUString::createFromAscii( "IsCompactDisc" ); + aProps[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" )); + aProps[1] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" )); + aProps[2] = OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" )); + aProps[3] = OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" )); + aProps[4] = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" )); + aProps[5] = OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )); + aProps[6] = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" )); + aProps[7] = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVolume" )); + aProps[8] = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsRemote" )); + aProps[9] = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsRemoveable" )); + aProps[10] = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFloppy" )); + aProps[11] = OUString( RTL_CONSTASCII_USTRINGPARAM( "IsCompactDisc" )); Reference< XCommandEnvironment > xEnvironment; try @@ -298,8 +299,8 @@ namespace svt ::ucbhelper::Content aCnt( aTargetURL, xEnvironment ); try { - aCnt.getPropertyValue( OUString::createFromAscii( "Size" ) ) >>= pData->maSize; - aCnt.getPropertyValue( OUString::createFromAscii( "DateModified" ) ) >>= aDT; + aCnt.getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" )) ) >>= pData->maSize; + aCnt.getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" )) ) >>= aDT; } catch (...) {} } @@ -311,7 +312,7 @@ namespace svt if ( pData->mbIsFolder ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::svtools::VolumeInfo aVolInfo( pData->mbIsVolume, pData->mbIsRemote, pData->mbIsRemoveable, pData->mbIsFloppy, pData->mbIsCompactDisc ); @@ -395,7 +396,7 @@ namespace svt sal_Bool FileViewContentEnumerator::URLOnBlackList ( const ::rtl::OUString& sRealURL ) { - ::rtl::OUString entryName = sRealURL.copy( sRealURL.lastIndexOf( rtl::OUString::createFromAscii("/")) +1 ); + ::rtl::OUString entryName = sRealURL.copy( sRealURL.lastIndexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ))) +1 ); for (int i = 0; i < m_rBlackList.getLength() ; i++) { @@ -430,7 +431,7 @@ namespace svt m_xDocInfo->loadFromURL( _rTargetURL ); Reference< XPropertySet > xPropSet( m_xDocInfo, UNO_QUERY ); - Any aAny = xPropSet->getPropertyValue( OUString::createFromAscii( "Title" ) ); + Any aAny = xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" )) ); OUString sTitle; if ( ( aAny >>= sTitle ) && sTitle.getLength() > 0 ) @@ -462,3 +463,4 @@ namespace svt } // namespace svt //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/contentenumeration.hxx b/svtools/source/contnr/contentenumeration.hxx index 16db279ad547..70e9a2a0fbc9 100644 --- a/svtools/source/contnr/contentenumeration.hxx +++ b/svtools/source/contnr/contentenumeration.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -285,3 +286,4 @@ namespace svt #endif // SVTOOLS_SOURCE_CONTNR_CONTENTENUMERATION_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 4ea086ad7580..6a511bdb4e4b 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -66,13 +67,11 @@ #include <ucbhelper/content.hxx> #include <ucbhelper/commandenvironment.hxx> #include <vcl/msgbox.hxx> -#ifndef INCLUDED_RTL_MATH_H #include <rtl/math.hxx> -#endif #include <tools/config.hxx> #include <osl/mutex.hxx> #include <osl/conditn.hxx> -#include <vos/timer.hxx> +#include <salhelper/timer.hxx> #include <vcl/svapp.hxx> #include <vcl/sound.hxx> #include <unotools/ucbhelper.hxx> @@ -90,7 +89,6 @@ using namespace ::com::sun::star::beans; using namespace ::comphelper; using ::svt::SortingData_Impl; using ::svt::FolderDescriptor; -using ::vos::TTimeValue; using ::rtl::OUString; #define ALL_FILES_FILTER "*.*" @@ -100,7 +98,7 @@ using ::rtl::OUString; #define COLUMN_SIZE 3 #define COLUMN_DATE 4 -DECLARE_LIST( StringList_Impl, OUString* ) +#define aSeparatorStr "----------------------------------" #define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap #define QUICK_SEARCH_TIMEOUT 1500 // time in mSec before the quicksearch string will be reseted @@ -108,25 +106,6 @@ DECLARE_LIST( StringList_Impl, OUString* ) namespace { //==================================================================== - //= ReleaseSolarMutex - //==================================================================== - struct ReleaseSolarMutex - { - private: - sal_uLong m_nCount; - - public: - inline ReleaseSolarMutex() - { - m_nCount = Application::ReleaseSolarMutex(); - } - inline ~ReleaseSolarMutex() - { - Application::AcquireSolarMutex( m_nCount ); - } - }; - - //==================================================================== //= ITimeoutHandler //==================================================================== class CallbackTimer; @@ -139,7 +118,7 @@ namespace //==================================================================== //= CallbackTimer //==================================================================== - class CallbackTimer : public ::vos::OTimer + class CallbackTimer : public ::salhelper::Timer { protected: ITimeoutHandler* m_pTimeoutHandler; @@ -164,13 +143,6 @@ namespace // ----------------------------------------------------------------------- -static sal_Bool isHighContrast( const Window* _pView ) -{ - return _pView->GetSettings().GetStyleSettings().GetHighContrastMode(); -} - -// ----------------------------------------------------------------------- - void FilterMatch::createWildCardFilterList(const String& _rFilterList,::std::vector< WildCard >& _rFilters) { if( _rFilterList.Len() ) @@ -553,7 +525,7 @@ protected: m_pContentEnumerator; Link m_aCurrentAsyncActionHandler; ::osl::Condition m_aAsyncActionFinished; - ::rtl::Reference< ::vos::OTimer > m_pCancelAsyncTimer; + ::rtl::Reference< ::salhelper::Timer > m_pCancelAsyncTimer; ::svt::EnumerationResult m_eAsyncActionResult; bool m_bRunningAsyncAction; bool m_bAsyncActionCancelled; @@ -754,20 +726,25 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin, mbEnableRename ( sal_True ) { + sal_Bool bViewHeader = true; Size aBoxSize = pParentWin->GetSizePixel(); mpHeaderBar = new HeaderBar( pParentWin, WB_BUTTONSTYLE | WB_BOTTOMBORDER ); mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), mpHeaderBar->CalcWindowSizePixel() ); HeaderBarItemBits nBits = ( HIB_LEFT | HIB_VCENTER | HIB_CLICKABLE ); - if ( ( nFlags & FILEVIEW_SHOW_ALL ) == FILEVIEW_SHOW_ALL ) + if ((nFlags & FILEVIEW_SHOW_NONE) == FILEVIEW_SHOW_NONE) + bViewHeader = false; + else { - mpHeaderBar->InsertItem( COLUMN_TITLE, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_TITLE ) ), 180, nBits | HIB_UPARROW ); - mpHeaderBar->InsertItem( COLUMN_TYPE, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_TYPE ) ), 140, nBits ); - mpHeaderBar->InsertItem( COLUMN_SIZE, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_SIZE ) ), 80, nBits ); - mpHeaderBar->InsertItem( COLUMN_DATE, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_DATE ) ), 500, nBits ); + if (nFlags & FILEVIEW_SHOW_TITLE) + mpHeaderBar->InsertItem(COLUMN_TITLE, String(SvtResId(STR_SVT_FILEVIEW_COLUMN_TITLE)), 600, nBits | HIB_UPARROW); + if (nFlags & FILEVIEW_SHOW_ALL) + mpHeaderBar->InsertItem(COLUMN_TYPE, String(SvtResId(STR_SVT_FILEVIEW_COLUMN_TYPE)), 140, nBits); + if (nFlags & FILEVIEW_SHOW_SIZE) + mpHeaderBar->InsertItem(COLUMN_SIZE, String(SvtResId(STR_SVT_FILEVIEW_COLUMN_SIZE)), 80, nBits); + if (nFlags & FILEVIEW_SHOW_DATE) + mpHeaderBar->InsertItem(COLUMN_DATE, String(SvtResId(STR_SVT_FILEVIEW_COLUMN_DATE)), 500, nBits); } - else - mpHeaderBar->InsertItem( COLUMN_TITLE, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_TITLE ) ), 600, nBits ); Size aHeadSize = mpHeaderBar->GetSizePixel(); SetPosSizePixel( Point( 0, aHeadSize.Height() ), @@ -777,7 +754,8 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin, SetEntryHeight( ROW_HEIGHT ); Show(); - mpHeaderBar->Show(); + if( bViewHeader ) + mpHeaderBar->Show(); maResetQuickSearch.SetTimeout( QUICK_SEARCH_TIMEOUT ); maResetQuickSearch.SetTimeoutHdl( LINK( this, ViewTabListBox_Impl, ResetQuickSearch_Impl ) ); @@ -829,7 +807,6 @@ void ViewTabListBox_Impl::Resize() if ( mbAutoResize ) { mbResizeDisabled = sal_True; - Point aPos = GetPosPixel(); SetPosSizePixel( Point( 0, aBarSize.Height() ), Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) ); mbResizeDisabled = sal_False; @@ -912,7 +889,7 @@ PopupMenu* ViewTabListBox_Impl::CreateContextMenu( void ) if ( aCommands.is() ) bEnableDelete = aCommands->hasCommandByName( - OUString::createFromAscii( "delete" ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" )) ); else bEnableDelete = false; } @@ -931,7 +908,7 @@ PopupMenu* ViewTabListBox_Impl::CreateContextMenu( void ) { Property aProp = aProps->getPropertyByName( - OUString::createFromAscii( "Title" ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" )) ); bEnableRename = !( aProp.Attributes & PropertyAttribute::READONLY ); } @@ -1015,7 +992,7 @@ void ViewTabListBox_Impl::DeleteEntries() if ( aCommands.is() ) canDelete = aCommands->hasCommandByName( - OUString::createFromAscii( "delete" ) ); + OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" )) ); else canDelete = false; } @@ -1075,7 +1052,7 @@ sal_Bool ViewTabListBox_Impl::EditedEntry( SvLBoxEntry* pEntry, try { - OUString aPropName = OUString::createFromAscii( "Title" ); + OUString aPropName( RTL_CONSTASCII_USTRINGPARAM( "Title" )); bool canRename = true; ::ucbhelper::Content aContent( aURL, mxCmdEnv ); @@ -1172,7 +1149,6 @@ sal_Bool ViewTabListBox_Impl::DoubleClickHdl() // - which is not what in the case of content replace // (I really doubt that this behaviour of the SvImpLBox does make any sense at all, but // who knows ...) - // 07.12.2001 - 95727 - fs@openoffice.org } ::rtl::OUString ViewTabListBox_Impl::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const @@ -1190,8 +1166,8 @@ sal_Bool ViewTabListBox_Impl::DoubleClickHdl() SvtContentEntry* pData = (SvtContentEntry*)pEntry->GetUserData(); if ( pData ) { - static const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) ); - static const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) ); + const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) ); + const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) ); String aText( msAccessibleDescText ); aText.SearchAndReplace( sVar1, pData->mbIsFolder ? msFolder : msFile ); aText.SearchAndReplace( sVar2, pData->maURL ); @@ -1211,7 +1187,7 @@ sal_Bool ViewTabListBox_Impl::Kill( const OUString& rContent ) try { ::ucbhelper::Content aCnt( rContent, mxCmdEnv ); - aCnt.executeCommand( OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) ); + aCnt.executeCommand( OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" )), makeAny( sal_Bool( sal_True ) ) ); } catch( ::com::sun::star::ucb::CommandAbortedException const & ) { @@ -1251,6 +1227,7 @@ SvtFileView::SvtFileView( Window* pParent, const ResId& rResId, mpImp = new SvtFileView_Impl( this, xCmdEnv, nFlags, bOnlyFolder ); mpImp->mpView->ForbidEmptyText(); + SetSortColumn( true ); long pTabs[] = { 5, 20, 180, 320, 400, 600 }; mpImp->mpView->SetTabs( &pTabs[0], MAP_PIXEL ); @@ -1273,6 +1250,7 @@ SvtFileView::SvtFileView( Window* pParent, const ResId& rResId, sal_Int8 nFlags Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); mpImp = new SvtFileView_Impl( this, xCmdEnv, nFlags, ( nFlags & FILEVIEW_ONLYFOLDER ) == FILEVIEW_ONLYFOLDER ); + SetSortColumn( true ); if ( ( nFlags & FILEVIEW_SHOW_ALL ) == FILEVIEW_SHOW_ALL ) { @@ -1286,7 +1264,8 @@ SvtFileView::SvtFileView( Window* pParent, const ResId& rResId, sal_Int8 nFlags long pTabs[] = { 2, 20, 600 }; mpImp->mpView->SetTabs( &pTabs[0], MAP_PIXEL ); } - + if ( ( nFlags & FILEVIEW_SHOW_NONE ) == FILEVIEW_SHOW_NONE ) + SetSortColumn( false ); if ( ( nFlags & FILEVIEW_MULTISELECTION ) == FILEVIEW_MULTISELECTION ) mpImp->mpView->SetSelectionMode( MULTIPLE_SELECTION ); @@ -1343,7 +1322,7 @@ void SvtFileView::OpenFolder( const Sequence< OUString >& aContents ) // detect image sal_Bool bDoInsert = sal_True; INetURLObject aObj( aImageURL.Len() > 0 ? aImageURL : aURL ); - Image aImage = SvFileInformationManager::GetImage( aObj, sal_False, isHighContrast( this ) ); + Image aImage = SvFileInformationManager::GetImage( aObj, sal_False ); if ( bDoInsert ) { @@ -1519,7 +1498,7 @@ FileViewResult SvtFileView::Initialize( return eResult; } - OSL_ENSURE( sal_False, "SvtFileView::Initialize: unreachable!" ); + OSL_FAIL( "SvtFileView::Initialize: unreachable!" ); return eFailure; } @@ -1544,7 +1523,8 @@ sal_Bool SvtFileView::Initialize( const Sequence< OUString >& aContents ) mpImp->Clear(); mpImp->CreateVector_Impl( aContents ); - mpImp->SortFolderContent_Impl(); + if( GetSortColumn() ) + mpImp->SortFolderContent_Impl(); mpImp->OpenFolder_Impl(); @@ -1936,7 +1916,7 @@ void SvtFileView_Impl::Clear() std::vector< SortingData_Impl* >::iterator aIt; - for ( aIt = maContent.begin(); aIt != maContent.end(); aIt++ ) + for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt ) delete (*aIt); maContent.clear(); @@ -2021,7 +2001,7 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( // also release the SolarMutex. Not all code which is needed during the enumeration // is Solar-Thread-Safe, in particular there is some code which needs to access // string resources (and our resource system relies on the SolarMutex :() - ReleaseSolarMutex aSolarRelease; + SolarMutexReleaser aSolarRelease; // now wait. Note that if we didn't get an pAsyncDescriptor, then this is an infinite wait. eResult = m_aAsyncActionFinished.wait( pTimeout.get() ); @@ -2038,7 +2018,7 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl( "SvtFileView_Impl::GetFolderContent_Impl: invalid maximum timeout!" ); if ( nMaxTimeout <= nMinTimeout ) nMaxTimeout = nMinTimeout + 5000; - m_pCancelAsyncTimer->setRemainingTime( TTimeValue( nMaxTimeout - nMinTimeout ) ); + m_pCancelAsyncTimer->setRemainingTime( salhelper::TTimeValue( nMaxTimeout - nMinTimeout ) ); // we already waited for nMinTimeout milliseconds, so take this into account m_pCancelAsyncTimer->start(); @@ -2197,7 +2177,7 @@ void SvtFileView_Impl::OpenFolder_Impl() std::vector< SortingData_Impl* >::iterator aIt; - for ( aIt = maContent.begin(); aIt != maContent.end(); aIt++ ) + for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt ) { if ( mbOnlyFolder && ! (*aIt)->mbIsFolder ) continue; @@ -2254,7 +2234,7 @@ void SvtFileView_Impl::CancelRunningAsyncAction() //----------------------------------------------------------------------- void SvtFileView_Impl::onTimeout( CallbackTimer* ) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( maMutex ); if ( !m_bRunningAsyncAction ) // there might have been a race condition while we waited for the mutex @@ -2272,7 +2252,7 @@ void SvtFileView_Impl::onTimeout( CallbackTimer* ) //----------------------------------------------------------------------- void SvtFileView_Impl::enumerationDone( ::svt::EnumerationResult _eResult ) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( maMutex ); m_pContentEnumerator = NULL; @@ -2312,8 +2292,8 @@ void SvtFileView_Impl::implEnumerationSuccess() // ----------------------------------------------------------------------- void SvtFileView_Impl::ReplaceTabWithString( OUString& aValue ) { - OUString aTab = OUString::createFromAscii( "\t" ); - OUString aTabString = OUString::createFromAscii( "%09" ); + OUString aTab( RTL_CONSTASCII_USTRINGPARAM( "\t" )); + OUString aTabString( RTL_CONSTASCII_USTRINGPARAM( "%09" )); sal_Int32 iPos; while ( ( iPos = aValue.indexOf( aTab ) ) >= 0 ) @@ -2326,12 +2306,12 @@ void SvtFileView_Impl::CreateDisplayText_Impl() ::osl::MutexGuard aGuard( maMutex ); OUString aValue; - OUString aTab = OUString::createFromAscii( "\t" ); - OUString aDateSep = OUString::createFromAscii( ", " ); + OUString aTab( RTL_CONSTASCII_USTRINGPARAM( "\t" )); + OUString aDateSep( RTL_CONSTASCII_USTRINGPARAM( ", " )); std::vector< SortingData_Impl* >::iterator aIt; - for ( aIt = maContent.begin(); aIt != maContent.end(); aIt++ ) + for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt ) { // title, type, size, date aValue = (*aIt)->GetTitle(); @@ -2361,10 +2341,10 @@ void SvtFileView_Impl::CreateDisplayText_Impl() ::svtools::VolumeInfo aVolInfo( (*aIt)->mbIsVolume, (*aIt)->mbIsRemote, (*aIt)->mbIsRemoveable, (*aIt)->mbIsFloppy, (*aIt)->mbIsCompactDisc ); - (*aIt)->maImage = SvFileInformationManager::GetFolderImage( aVolInfo, sal_False, isHighContrast( mpView ) ); + (*aIt)->maImage = SvFileInformationManager::GetFolderImage( aVolInfo, sal_False ); } else - (*aIt)->maImage = SvFileInformationManager::GetFileImage( INetURLObject( (*aIt)->maTargetURL ), sal_False, isHighContrast( mpView )); + (*aIt)->maImage = SvFileInformationManager::GetFileImage( INetURLObject( (*aIt)->maTargetURL ), sal_False ); } } @@ -2377,7 +2357,7 @@ void SvtFileView_Impl::CreateVector_Impl( const Sequence < OUString > &rList ) { ::osl::MutexGuard aGuard( maMutex ); - OUString aTab = OUString::createFromAscii( "\t" ); + OUString aTab( RTL_CONSTASCII_USTRINGPARAM( "\t" )); sal_uInt32 nCount = (sal_uInt32) rList.getLength(); @@ -2448,9 +2428,11 @@ void SvtFileView_Impl::CreateVector_Impl( const Sequence < OUString > &rList ) pEntry->maDisplayText = aDisplayText; // detect the image - INetURLObject aObj( pEntry->maImageURL.getLength() ? pEntry->maImageURL : pEntry->maTargetURL ); - pEntry->maImage = SvFileInformationManager::GetImage( aObj, sal_False, isHighContrast( mpView ) ); - + if( aValue != rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(aSeparatorStr) ) ) + { + INetURLObject aObj( pEntry->maImageURL.getLength() ? pEntry->maImageURL : pEntry->maTargetURL ); + pEntry->maImage = SvFileInformationManager::GetImage( aObj, sal_False ); + } maContent.push_back( pEntry ); } } @@ -2485,7 +2467,7 @@ void SvtFileView_Impl::Resort_Impl( sal_Int16 nColumn, sal_Bool bAscending ) { pEntry = mpView->GetEntry( nPos ); - ++mnSuspendSelectCallback; // #i15668# - 2004-04-25 - fs@openoffice.org + ++mnSuspendSelectCallback; // #i15668# mpView->SetCurEntry( pEntry ); --mnSuspendSelectCallback; } @@ -2603,7 +2585,7 @@ void SvtFileView_Impl::EntryRemoved( const OUString& rURL ) std::vector< SortingData_Impl* >::iterator aIt; - for ( aIt = maContent.begin(); aIt != maContent.end(); aIt++ ) + for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt ) { if ( (*aIt)->maTargetURL == rURL ) { @@ -2621,7 +2603,7 @@ void SvtFileView_Impl::EntryRenamed( OUString& rURL, std::vector< SortingData_Impl* >::iterator aIt; - for ( aIt = maContent.begin(); aIt != maContent.end(); aIt++ ) + for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt ) { if ( (*aIt)->maTargetURL == rURL ) { @@ -2659,11 +2641,11 @@ String SvtFileView_Impl::FolderInserted( const OUString& rURL, const OUString& r ::svtools::VolumeInfo aVolInfo; pData->maType = SvFileInformationManager::GetFolderDescription( aVolInfo ); - pData->maImage = SvFileInformationManager::GetFolderImage( aVolInfo, sal_False, isHighContrast( mpView ) ); + pData->maImage = SvFileInformationManager::GetFolderImage( aVolInfo, sal_False ); OUString aValue; - OUString aTab = OUString::createFromAscii( "\t" ); - OUString aDateSep = OUString::createFromAscii( ", " ); + OUString aTab( RTL_CONSTASCII_USTRINGPARAM( "\t" )); + OUString aDateSep( RTL_CONSTASCII_USTRINGPARAM( ", " )); // title, type, size, date aValue = pData->GetTitle(); @@ -2695,7 +2677,7 @@ sal_uLong SvtFileView_Impl::GetEntryPos( const OUString& rURL ) std::vector< SortingData_Impl* >::iterator aIt; sal_uLong nPos = 0; - for ( aIt = maContent.begin(); aIt != maContent.end(); aIt++ ) + for ( aIt = maContent.begin(); aIt != maContent.end(); ++aIt ) { if ( (*aIt)->maTargetURL == rURL ) return nPos; @@ -2806,3 +2788,4 @@ IMPL_STATIC_LINK( QueryDeleteDlg_Impl, ClickLink, PushButton*, pBtn ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src index bcb282f44615..a7e82cf15881 100644 --- a/svtools/source/contnr/fileview.src +++ b/svtools/source/contnr/fileview.src @@ -83,7 +83,7 @@ String STR_SVT_GB Image IMG_SVT_FOLDER { - ImageBitmap = Bitmap { File = "folder.bmp" ; }; + ImageBitmap = Bitmap { File = "folder.png" ; }; MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; }; @@ -177,24 +177,3 @@ ModalDialog DLG_SVT_QUERYDELETE TabStop = TRUE ; }; }; - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index a54d578593cd..517f0f6b66f1 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,8 @@ #ifndef _IMPICNVW_HXX #define _IMPICNVW_HXX -#ifndef _VIRDEV_HXX #include <vcl/virdev.hxx> -#endif -#ifndef _SCRBAR_HXX #include <vcl/scrbar.hxx> -#endif #include <vcl/timer.hxx> #include <vcl/seleng.hxx> #include <tools/debug.hxx> @@ -635,3 +632,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 3963ce48c255..640f6c5ae923 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -70,8 +71,6 @@ struct SvxIconChoiceCtrlEntry_Impl static sal_Bool bEndScrollInvalidate = sal_True; -// ---------------------------------------------------------------------------------------------- - class IcnViewEdit_Impl : public MultiLineEdit { Link aCallBackHdl; @@ -104,10 +103,6 @@ public: sal_Bool IsGrabFocus() const { return bGrabFocus; } }; -// ---------------------------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------------------------- - SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pCurView, WinBits nWinStyle ) : aEntries( this ), @@ -535,15 +530,13 @@ void SvxIconChoiceCtrl_Impl::EntrySelected( SvxIconChoiceCtrlEntry* pEntry, sal_ } if( pEntry == pCursor ) ShowCursor( sal_True ); - } // if( bUpdateMode ) + } - // --> OD 2009-05-27 #i101012# - // emit vcl event LISTBOX_SELECT only in case that the given entry is selected. + // #i101012# emit vcl event LISTBOX_SELECT only in case that the given entry is selected. if ( bSelect ) { CallEventListeners( VCLEVENT_LISTBOX_SELECT, pEntry ); } - // <-- } void SvxIconChoiceCtrl_Impl::ResetVirtSize() @@ -551,7 +544,6 @@ void SvxIconChoiceCtrl_Impl::ResetVirtSize() StopEditTimer(); aVirtOutputSize.Width() = 0; aVirtOutputSize.Height() = 0; - sal_Bool bLockedEntryFound = sal_False; const sal_uLong nCount = aEntries.Count(); for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) { @@ -564,7 +556,6 @@ void SvxIconChoiceCtrl_Impl::ResetVirtSize() FindBoundingRect( pCur ); else AdjustVirtSize( pCur->aRect ); - bLockedEntryFound = sal_True; } else InvalidateBoundingRect( pCur->aRect ); @@ -1072,16 +1063,14 @@ sal_Bool SvxIconChoiceCtrl_Impl::MouseButtonUp( const MouseEvent& rMEvt ) pCurHighlightFrame = 0; // Neues painten des Frames erzwingen bHighlightFramePressed = sal_False; SetEntryHighlightFrame( pEntry, sal_True ); -#if 0 - CallSelectHandler( pCurHighlightFrame ); -#else + pHdlEntry = pCurHighlightFrame; pView->ClickIcon(); // set focus on Icon SvxIconChoiceCtrlEntry* pOldCursor = pCursor; SetCursor_Impl( pOldCursor, pHdlEntry, sal_False, sal_False, sal_True ); -#endif + pHdlEntry = 0; } return bHandled; @@ -1221,14 +1210,6 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) if( bMod1 ) nFlags |= F_ADD_MODE; - sal_Bool bDeselectAll = sal_False; - if( eSelectionMode != SINGLE_SELECTION ) - { - if( !bMod1 && !bShift ) - bDeselectAll = sal_True; - if( bShift && !bMod1 && !pAnchor ) - bDeselectAll = sal_True; - } SvxIconChoiceCtrlEntry* pNewCursor; SvxIconChoiceCtrlEntry* pOldCursor = pCursor; @@ -1314,23 +1295,6 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) } break; -// wird vom VCL-Tracking gesteuert -#if 0 - case KEY_ESCAPE: - if( pView->IsTracking() ) - { - HideSelectionRect(); - //SelectAll( sal_False ); - SetNoSelection(); - ClearSelectedRectList(); - nFlags &= ~F_TRACKING; - } - else - bKeyUsed = sal_False; - break; -#endif - - case KEY_F2: if( !bMod1 && !bShift ) EditTimeoutHdl( 0 ); @@ -2257,7 +2221,7 @@ Rectangle SvxIconChoiceCtrl_Impl::CalcBmpRect( SvxIconChoiceCtrlEntry* pEntry, c return Rectangle( aPos, aImageSize ); default: - DBG_ERROR("IconView: Viewmode not set"); + OSL_FAIL("IconView: Viewmode not set"); return aBound; } } @@ -3820,7 +3784,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong pEntry = pEntry->pflink; if( nCount && pEntry == pHead ) { - DBG_ERROR("SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry > Endlosschleife!"); + OSL_FAIL("SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry > Endlosschleife!"); return 0; } } @@ -4671,11 +4635,10 @@ sal_Bool SvxIconChoiceCtrl_Impl::HandleShortCutKey( const KeyEvent& rKEvt ) return bRet; } -// ----------------------------------------------------------------------- - void SvxIconChoiceCtrl_Impl::CallEventListeners( sal_uLong nEvent, void* pData ) { pView->CallImplEventListeners( nEvent, pData ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx index 539477c03599..93e2990d6658 100644 --- a/svtools/source/contnr/imivctl2.cxx +++ b/svtools/source/contnr/imivctl2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -846,3 +847,4 @@ void IcnGridMap_Impl::GetGridCoord( GridId nId, sal_uInt16& rGridX, sal_uInt16& +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index 8a94d3ff086b..f26de38cc1ab 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -45,20 +46,6 @@ SvxIconChoiceCtrlEntry::SvxIconChoiceCtrlEntry( const String& rText, const Image { aText = rText; aImage = rImage; - aImageHC = rImage; - pUserData = NULL; - - nFlags = _nFlags; - eTextMode = IcnShowTextShort; - pblink = 0; - pflink = 0; -} - -SvxIconChoiceCtrlEntry::SvxIconChoiceCtrlEntry( const String& rText, const Image& rImage, const Image& rImageHC, sal_uInt16 _nFlags ) -{ - aText = rText; - aImage = rImage; - aImageHC = rImageHC; pUserData = NULL; nFlags = _nFlags; @@ -93,15 +80,6 @@ void SvxIconChoiceCtrlEntry::LockPos( sal_Bool bLock ) nFlags &= ~ICNVIEW_FLAG_POS_LOCKED; } -/*sal_Unicode SvxIconChoiceCtrlEntry::GetMnemonicChar() const -{ - sal_Unicode cChar = 0; - xub_StrLen nPos = aText.Search( '~' ); - if ( nPos != STRING_NOTFOUND && nPos < ( aText.Len() ) - 1 ) - cChar = aText.GetChar( nPos + 1 ); - return cChar; -}*/ - String SvxIconChoiceCtrlEntry::GetDisplayText() const { return MnemonicGenerator::EraseAllMnemonicChars( aText ); @@ -176,43 +154,41 @@ SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const String& rText, con return pEntry; } -SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const String& rText, const Image& rImage, const Image& rImageHC, sal_uLong nPos, const Point* pPos, sal_uInt16 nFlags ) -{ - SvxIconChoiceCtrlEntry* pEntry = new SvxIconChoiceCtrlEntry( rText, rImage, rImageHC, nFlags); - - _pImp->InsertEntry( pEntry, nPos, pPos ); - - return pEntry; -} - sal_Bool SvtIconChoiceCtrl::EditedEntry( SvxIconChoiceCtrlEntry*, const XubString&, sal_Bool ) { return sal_True; } + sal_Bool SvtIconChoiceCtrl::EditingEntry( SvxIconChoiceCtrlEntry* ) { return sal_True; } + void SvtIconChoiceCtrl::DrawEntryImage( SvxIconChoiceCtrlEntry* pEntry, const Point& rPos, OutputDevice& rDev ) { - rDev.DrawImage( rPos, GetSettings().GetStyleSettings().GetHighContrastMode() ? pEntry->GetImageHC() : pEntry->GetImage() ); + rDev.DrawImage( rPos, pEntry->GetImage() ); } + String SvtIconChoiceCtrl::GetEntryText( SvxIconChoiceCtrlEntry* pEntry, sal_Bool ) { return pEntry->GetText(); } + sal_Bool SvtIconChoiceCtrl::HasBackground() const { return sal_False; } + sal_Bool SvtIconChoiceCtrl::HasFont() const { return sal_False; } + sal_Bool SvtIconChoiceCtrl::HasFontTextColor() const { return sal_True; } + sal_Bool SvtIconChoiceCtrl::HasFontFillColor() const { return sal_True; @@ -637,3 +613,4 @@ void SvtIconChoiceCtrl::CallImplEventListeners(sal_uLong nEvent, void* pData) return xAccessible; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svcontnr.src b/svtools/source/contnr/svcontnr.src index e0449fc3f644..2a4b12a8250c 100644 --- a/svtools/source/contnr/svcontnr.src +++ b/svtools/source/contnr/svcontnr.src @@ -29,25 +29,13 @@ Image RID_IMG_TREENODE_COLLAPSED { - ImageBitmap = Bitmap { File = "plus.bmp"; } ; + ImageBitmap = Bitmap { File = "plus.png"; } ; MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }; }; Image RID_IMG_TREENODE_EXPANDED { - ImageBitmap = Bitmap { File = "minus.bmp"; } ; - MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }; -}; - -Image RID_IMG_TREENODE_COLLAPSED_HC -{ - ImageBitmap = Bitmap { File = "plus_sch.bmp"; } ; - MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }; -}; - -Image RID_IMG_TREENODE_EXPANDED_HC -{ - ImageBitmap = Bitmap { File = "minus_sch.bmp"; } ; + ImageBitmap = Bitmap { File = "minus.png"; } ; MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }; }; @@ -57,20 +45,23 @@ String STR_SVT_ACC_DESC_TABLISTBOX { Text [ en-US ] = "Row: %1, Column: %2"; }; + String STR_SVT_ACC_DESC_FILEVIEW { Text [ en-US ] = ", Type: %1, URL: %2"; }; + String STR_SVT_ACC_DESC_FOLDER { Text [ en-US ] = "Folder"; }; + String STR_SVT_ACC_DESC_FILE { Text [ en-US ] = "File"; }; + String STR_SVT_ACC_EMPTY_FIELD { Text [ en-US ] = "Empty Field"; }; - diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx index 72768dd01746..41d6a100c1f3 100644 --- a/svtools/source/contnr/svicnvw.cxx +++ b/svtools/source/contnr/svicnvw.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,6 @@ #include <svimpicn.hxx> #include <svtools/svlbitm.hxx> -#ifndef GCC -#endif - #define ICNVW_BLOCK_ENTRYINS 0x0001 SvIcnVwDataEntry::SvIcnVwDataEntry() @@ -229,27 +227,27 @@ void SvIconView::RequestingChilds( SvLBoxEntry* pParent ) InsertEntry( String::CreateFromAscii("<dummy>"), pParent, sal_False, LIST_APPEND ); } -void __EXPORT SvIconView::Paint( const Rectangle& rRect ) +void SvIconView::Paint( const Rectangle& rRect ) { pImp->Paint( rRect ); } -void __EXPORT SvIconView::MouseButtonDown( const MouseEvent& rMEvt ) +void SvIconView::MouseButtonDown( const MouseEvent& rMEvt ) { pImp->MouseButtonDown( rMEvt ); } -void __EXPORT SvIconView::MouseButtonUp( const MouseEvent& rMEvt ) +void SvIconView::MouseButtonUp( const MouseEvent& rMEvt ) { pImp->MouseButtonUp( rMEvt ); } -void __EXPORT SvIconView::MouseMove( const MouseEvent& rMEvt ) +void SvIconView::MouseMove( const MouseEvent& rMEvt ) { pImp->MouseMove( rMEvt ); } -void __EXPORT SvIconView::KeyInput( const KeyEvent& rKEvt ) +void SvIconView::KeyInput( const KeyEvent& rKEvt ) { // unter OS/2 bekommen wir auch beim Editieren Key-Up/Down if( IsEditingActive() ) @@ -262,19 +260,19 @@ void __EXPORT SvIconView::KeyInput( const KeyEvent& rKEvt ) nImpFlags &= ~SVLBOX_IS_TRAVELSELECT; } -void __EXPORT SvIconView::Resize() +void SvIconView::Resize() { pImp->Resize(); SvLBox::Resize(); } -void __EXPORT SvIconView::GetFocus() +void SvIconView::GetFocus() { pImp->GetFocus(); SvLBox::GetFocus(); } -void __EXPORT SvIconView::LoseFocus() +void SvIconView::LoseFocus() { pImp->LoseFocus(); SvLBox::LoseFocus(); @@ -301,46 +299,46 @@ void SvIconView::SetModel( SvLBoxTreeList* pNewModel, SvLBoxEntry* pParent ) pImp->SetModel( pNewModel, pParent ); } -void __EXPORT SvIconView::ModelHasCleared() +void SvIconView::ModelHasCleared() { SvLBox::ModelHasCleared(); pImp->Clear(); } -void __EXPORT SvIconView::ModelHasInserted( SvListEntry* pEntry ) +void SvIconView::ModelHasInserted( SvListEntry* pEntry ) { if( !(nIcnVwFlags & ICNVW_BLOCK_ENTRYINS ) ) pImp->EntryInserted( (SvLBoxEntry*)pEntry ); } -void __EXPORT SvIconView::ModelHasInsertedTree( SvListEntry* pEntry ) +void SvIconView::ModelHasInsertedTree( SvListEntry* pEntry ) { pImp->TreeInserted( (SvLBoxEntry*)pEntry ); } -void __EXPORT SvIconView::ModelIsMoving(SvListEntry* pSource, +void SvIconView::ModelIsMoving(SvListEntry* pSource, SvListEntry* /* pTargetParent */ , sal_uLong /* nChildPos */ ) { pImp->MovingEntry( (SvLBoxEntry*)pSource ); } -void __EXPORT SvIconView::ModelHasMoved(SvListEntry* pSource ) +void SvIconView::ModelHasMoved(SvListEntry* pSource ) { pImp->EntryMoved( (SvLBoxEntry*)pSource ); } -void __EXPORT SvIconView::ModelIsRemoving( SvListEntry* pEntry ) +void SvIconView::ModelIsRemoving( SvListEntry* pEntry ) { pImp->RemovingEntry( (SvLBoxEntry*)pEntry ); NotifyRemoving( (SvLBoxEntry*)pEntry ); } -void __EXPORT SvIconView::ModelHasRemoved( SvListEntry* /* pEntry */ ) +void SvIconView::ModelHasRemoved( SvListEntry* /* pEntry */ ) { pImp->EntryRemoved(); } -void __EXPORT SvIconView::ModelHasEntryInvalidated( SvListEntry* pEntry ) +void SvIconView::ModelHasEntryInvalidated( SvListEntry* pEntry ) { // die einzelnen Items des Entries reinitialisieren SvLBox::ModelHasEntryInvalidated( pEntry ); @@ -549,21 +547,6 @@ void SvIconView::EditItemText( SvLBoxEntry* pEntry, SvLBoxItem* pItem, aRect.Bottom() += 2; // sieht huebscher aus -#ifdef OS2 - -#if OS2_SINGLE_LINE_EDIT - aRect.Left() -= 3; - aRect.Right() += 3; - aRect.Top() -= 3; - aRect.Bottom() += 3; -#else - aRect.Left() -= 10; - aRect.Right() += 10; - aRect.Top() -= 5; - aRect.Bottom() += 5; -#endif - -#endif // OS2 EditText( ((SvLBoxString*)pItem)->GetText(), aRect, rSel, sal_True ); } @@ -827,3 +810,4 @@ void SvIconView::ShowFocusRect( const SvLBoxEntry* pEntry ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 7d63304203cd..da5aff817b60 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,6 +44,7 @@ #include <tools/wintypes.hxx> #include <svtools/svtools.hrc> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #define NODE_BMP_TABDIST_NOTVALID -2000000 #define FIRST_ENTRY_TAB 1 @@ -50,8 +52,6 @@ // #i27063# (pl), #i32300# (pb) never access VCL after DeInitVCL - also no destructors Image* SvImpLBox::s_pDefCollapsed = NULL; Image* SvImpLBox::s_pDefExpanded = NULL; -Image* SvImpLBox::s_pDefCollapsedHC = NULL; -Image* SvImpLBox::s_pDefExpandedHC = NULL; sal_Int32 SvImpLBox::s_nImageRefCount = 0; SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvLBoxTreeList* pLBTree, WinBits nWinStyle) : @@ -65,7 +65,7 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvLBoxTreeList* pLBTree, WinBits n aFctSet( this, &aSelEng, pLBView ), nExtendedWinBits( 0 ), bAreChildrenTransient( sal_True ), - pIntlWrapper( NULL ) // #102891# ----------------------- + m_pStringSorter(NULL) { osl_incrementInterlockedCount(&s_nImageRefCount); pView = pLBView; @@ -127,35 +127,37 @@ SvImpLBox::~SvImpLBox() aEditTimer.Stop(); StopUserEvent(); - // #102891# --------------------- - if( pIntlWrapper ) - delete pIntlWrapper; + delete m_pStringSorter; if ( osl_decrementInterlockedCount(&s_nImageRefCount) == 0 ) { DELETEZ(s_pDefCollapsed); DELETEZ(s_pDefExpanded); - DELETEZ(s_pDefCollapsedHC); - DELETEZ(s_pDefExpandedHC); } } -// #102891# -------------------- -void SvImpLBox::UpdateIntlWrapper() +void SvImpLBox::UpdateStringSorter() { - const ::com::sun::star::lang::Locale & aNewLocale = Application::GetSettings().GetLocale(); - if( !pIntlWrapper ) - pIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), aNewLocale ); - else + const ::com::sun::star::lang::Locale& rNewLocale = Application::GetSettings().GetLocale(); + + if( m_pStringSorter ) { - const ::com::sun::star::lang::Locale &aLocale = pIntlWrapper->getLocale(); - if( aLocale.Language != aNewLocale.Language || // different Locale from the older one - aLocale.Country != aNewLocale.Country || - aLocale.Variant != aNewLocale.Variant ) + // different Locale from the older one, drop it and force recreate + const ::com::sun::star::lang::Locale &aLocale = m_pStringSorter->getLocale(); + if( aLocale.Language != rNewLocale.Language || + aLocale.Country != rNewLocale.Country || + aLocale.Variant != rNewLocale.Variant ) { - delete pIntlWrapper; - pIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), aNewLocale ); + delete m_pStringSorter; + m_pStringSorter = NULL; } } + + if( !m_pStringSorter ) + { + m_pStringSorter = new comphelper::string::NaturalStringSorter( + ::comphelper::getProcessComponentContext(), + rNewLocale); + } } // #97680# ---------------------- @@ -912,14 +914,6 @@ void SvImpLBox::Paint( const Rectangle& rRect ) pStartEntry = pView->First(); } -#ifdef XX_OV - sal_uLong nXAbsPos = (sal_uInt16)pTree->GetAbsPos( pStartEntry ); - sal_uLong nXVisPos = pView->GetVisiblePos( pStartEntry ); - SvLBoxString* pXStr = (SvLBoxString*)pStartEntry->GetFirstItem( SV_ITEM_ID_LBOXSTRING); -#endif - - - if( nNodeBmpTabDistance == NODE_BMP_TABDIST_NOTVALID ) SetNodeBmpTabDistance(); @@ -1724,7 +1718,7 @@ void SvImpLBox::RemovingEntry( SvLBoxEntry* pEntry ) SvLBoxEntry* pParent = (SvLBoxEntry*)(pView->GetModel()->GetParent(pEntry)); - if( pParent && pView->GetModel()->GetChildList(pParent)->Count() == 1 ) + if( pParent && pView->GetModel()->GetChildList(pParent)->size() == 1 ) { DBG_ASSERT( pView->IsExpanded( pParent ), "Parent not expanded"); pParent->SetFlags( pParent->GetFlags() | SV_ENTRYFLAG_NO_NODEBMP); @@ -1892,7 +1886,7 @@ void SvImpLBox::EntryInserted( SvLBoxEntry* pEntry ) if( GetUpdateMode() ) { SvLBoxEntry* pParent = (SvLBoxEntry*)pTree->GetParent(pEntry); - if( pParent && pTree->GetChildList(pParent)->Count() == 1 ) + if( pParent && pTree->GetChildList(pParent)->size() == 1 ) // Pluszeichen zeichnen pTree->InvalidateEntry( pParent ); @@ -2105,11 +2099,6 @@ void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt ) if ( !rMEvt.IsLeft() && !rMEvt.IsRight()) return; -#ifdef OS2 - // unter OS/2 kommt zwischen MouseButtonDown und - // MouseButtonUp ein MouseMove - nFlags |= F_IGNORE_NEXT_MOUSEMOVE; -#endif aEditTimer.Stop(); Point aPos( rMEvt.GetPosPixel()); @@ -2185,15 +2174,6 @@ void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt ) if( ButtonDownCheckCtrl(rMEvt, pEntry, nY) == sal_True) return; // Inplace-Editing? -#if 0 - if( rMEvt.IsMod2() && pView->IsInplaceEditingEnabled() ) - { - SvLBoxItem* pItem = pView->GetItem( pEntry, aPos.X() ); - if( pItem ) - pView->EditingRequest( pEntry, pItem, aPos ); - return; - } -#endif } if ( aSelEng.GetSelectionMode() != NO_SELECTION ) aSelEng.SelMouseButtonDown( rMEvt ); @@ -2201,9 +2181,6 @@ void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt ) void SvImpLBox::MouseButtonUp( const MouseEvent& rMEvt) { -#ifdef OS2 - nFlags &= (~F_IGNORE_NEXT_MOUSEMOVE); -#endif if ( !ButtonUpCheckCtrl( rMEvt ) && ( aSelEng.GetSelectionMode() != NO_SELECTION ) ) aSelEng.SelMouseButtonUp( rMEvt ); EndScroll(); @@ -2219,13 +2196,6 @@ void SvImpLBox::MouseButtonUp( const MouseEvent& rMEvt) void SvImpLBox::MouseMove( const MouseEvent& rMEvt) { -#ifdef OS2 - if( nFlags & F_IGNORE_NEXT_MOUSEMOVE ) - { - nFlags &= (~F_IGNORE_NEXT_MOUSEMOVE); - return; - } -#endif SvLBoxEntry* pEntry = GetClickedEntry( rMEvt.GetPosPixel() ); if ( !MouseMoveCheckCtrl( rMEvt, pEntry ) && ( aSelEng.GetSelectionMode() != NO_SELECTION ) ) aSelEng.SelMouseMove( rMEvt ); @@ -2276,7 +2246,6 @@ sal_Bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) // if there is no next entry, take the current one // this ensures that in case of _one_ entry in the list, this entry is selected when pressing // the cursor key - // 06.09.20001 - 83416 - fs@openoffice.org if ( !pNewCursor && pCursor ) pNewCursor = pCursor; @@ -2528,19 +2497,6 @@ sal_Bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) bKeyUsed = sal_False; break; - -#ifdef OV_DEBUG - case KEY_F9: - MakeVisible( pCursor ); - break; - case KEY_F10: - pView->RemoveSelection(); - break; - case KEY_DELETE: - pView->RemoveEntry( pCursor ); - break; -#endif - case KEY_ADD: if( pCursor ) { @@ -2584,7 +2540,7 @@ sal_Bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) // Sonderbehandlung Explorer: Befindet sich auf der // Root nur ein Eintrag,dann den Root-Entry nicht // einklappen - if( pTree->GetChildList(0)->Count() < 2 ) + if( pTree->GetChildList(0)->size() < 2 ) { nRefDepth = 1; pParentToCollapse = pCursor; @@ -2690,7 +2646,7 @@ sal_Bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) return bKeyUsed; } -void __EXPORT SvImpLBox::GetFocus() +void SvImpLBox::GetFocus() { if( pCursor ) { @@ -2726,7 +2682,7 @@ void __EXPORT SvImpLBox::GetFocus() } } -void __EXPORT SvImpLBox::LoseFocus() +void SvImpLBox::LoseFocus() { aEditTimer.Stop(); if( pCursor ) @@ -2756,7 +2712,7 @@ inline void SvImpLBox::SelectEntry( SvLBoxEntry* pEntry, sal_Bool bSelect ) pView->Select( pEntry, bSelect ); } -__EXPORT ImpLBSelEng::ImpLBSelEng( SvImpLBox* pImpl, SelectionEngine* pSEng, +ImpLBSelEng::ImpLBSelEng( SvImpLBox* pImpl, SelectionEngine* pSEng, SvTreeListBox* pV ) { pImp = pImpl; @@ -2764,40 +2720,40 @@ __EXPORT ImpLBSelEng::ImpLBSelEng( SvImpLBox* pImpl, SelectionEngine* pSEng, pView = pV; } -__EXPORT ImpLBSelEng::~ImpLBSelEng() +ImpLBSelEng::~ImpLBSelEng() { } -void __EXPORT ImpLBSelEng::BeginDrag() +void ImpLBSelEng::BeginDrag() { pImp->BeginDrag(); } /* -void __EXPORT ImpLBSelEng::EndDrag( const Point& ) +void ImpLBSelEng::EndDrag( const Point& ) { } */ -void __EXPORT ImpLBSelEng::CreateAnchor() +void ImpLBSelEng::CreateAnchor() { pImp->pAnchor = pImp->pCursor; } -void __EXPORT ImpLBSelEng::DestroyAnchor() +void ImpLBSelEng::DestroyAnchor() { pImp->pAnchor = 0; } /* -void __EXPORT ImpLBSelEng::CreateCursor() +void ImpLBSelEng::CreateCursor() { pImp->pAnchor = 0; } */ -sal_Bool __EXPORT ImpLBSelEng::SetCursorAtPoint(const Point& rPoint, sal_Bool bDontSelectAtCursor) +sal_Bool ImpLBSelEng::SetCursorAtPoint(const Point& rPoint, sal_Bool bDontSelectAtCursor) { SvLBoxEntry* pNewCursor = pImp->MakePointVisible( rPoint ); if( pNewCursor != pImp->pCursor ) @@ -2815,7 +2771,7 @@ sal_Bool __EXPORT ImpLBSelEng::SetCursorAtPoint(const Point& rPoint, sal_Bool bD return sal_False; } -sal_Bool __EXPORT ImpLBSelEng::IsSelectionAtPoint( const Point& rPoint ) +sal_Bool ImpLBSelEng::IsSelectionAtPoint( const Point& rPoint ) { SvLBoxEntry* pEntry = pImp->MakePointVisible( rPoint ); if( pEntry ) @@ -2823,7 +2779,7 @@ sal_Bool __EXPORT ImpLBSelEng::IsSelectionAtPoint( const Point& rPoint ) return sal_False; } -void __EXPORT ImpLBSelEng::DeselectAtPoint( const Point& rPoint ) +void ImpLBSelEng::DeselectAtPoint( const Point& rPoint ) { SvLBoxEntry* pEntry = pImp->MakePointVisible( rPoint ); if( !pEntry ) @@ -2832,7 +2788,7 @@ void __EXPORT ImpLBSelEng::DeselectAtPoint( const Point& rPoint ) } /* -void __EXPORT ImpLBSelEng::SelectAtPoint( const Point& rPoint ) +void ImpLBSelEng::SelectAtPoint( const Point& rPoint ) { SvLBoxEntry* pEntry = pImp->MakePointVisible( rPoint ); if( !pEntry ) @@ -2841,7 +2797,7 @@ void __EXPORT ImpLBSelEng::SelectAtPoint( const Point& rPoint ) } */ -void __EXPORT ImpLBSelEng::DeselectAll() +void ImpLBSelEng::DeselectAll() { pImp->SelAllDestrAnch( sal_False, sal_False ); // SelectionEngine nicht resetten! pImp->nFlags &= (~F_DESEL_ALL); @@ -3093,9 +3049,8 @@ void SvImpLBox::PaintDDCursor( SvLBoxEntry* pInsertionPos ) pView->SetLineColor( aOldLineColor ); pView->SetRasterOp( eOldOp ); } -/* -----------------26.08.2003 12:52----------------- - Delete all sub menues of a PopupMenu, recursively - --------------------------------------------------*/ + +// Delete all submenus of a PopupMenu, recursively void lcl_DeleteSubPopups(PopupMenu* pPopup) { for(sal_uInt16 i = 0; i < pPopup->GetItemCount(); i++) @@ -3483,10 +3438,10 @@ void SvImpLBox::FindMostRight_Impl( SvLBoxEntry* pParent, SvLBoxEntry* pEntryToI if( !pList ) return; - sal_uLong nCount = pList->Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = pList->size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvLBoxEntry* pChild = (SvLBoxEntry*)pList->GetObject( nCur ); + SvLBoxEntry* pChild = (SvLBoxEntry*)(*pList)[ nCur ]; if( pChild != pEntryToIgnore ) { SetMostRight( pChild ); @@ -3570,24 +3525,22 @@ void SvImpLBox::implInitDefaultNodeImages() // assume that all or nothing is initialized return; - s_pDefCollapsed = new Image( SvtResId( RID_IMG_TREENODE_COLLAPSED ) ); - s_pDefCollapsedHC = new Image( SvtResId( RID_IMG_TREENODE_COLLAPSED_HC ) ); - s_pDefExpanded = new Image( SvtResId( RID_IMG_TREENODE_EXPANDED ) ); - s_pDefExpandedHC = new Image( SvtResId( RID_IMG_TREENODE_EXPANDED_HC ) ); + s_pDefCollapsed = new Image( SvtResId( RID_IMG_TREENODE_COLLAPSED ) ); + s_pDefExpanded = new Image( SvtResId( RID_IMG_TREENODE_EXPANDED ) ); } // ----------------------------------------------------------------------- -const Image& SvImpLBox::GetDefaultExpandedNodeImage( BmpColorMode _eMode ) +const Image& SvImpLBox::GetDefaultExpandedNodeImage( ) { implInitDefaultNodeImages(); - return ( BMP_COLOR_NORMAL == _eMode ) ? *s_pDefExpanded : *s_pDefExpandedHC; + return *s_pDefExpanded; } // ----------------------------------------------------------------------- -const Image& SvImpLBox::GetDefaultCollapsedNodeImage( BmpColorMode _eMode ) +const Image& SvImpLBox::GetDefaultCollapsedNodeImage( ) { implInitDefaultNodeImages(); - return ( BMP_COLOR_NORMAL == _eMode ) ? *s_pDefCollapsed : *s_pDefCollapsedHC; + return *s_pDefCollapsed; } // ----------------------------------------------------------------------- @@ -3628,3 +3581,4 @@ bool SvImpLBox::IsSelectable( const SvLBoxEntry* pEntry ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx index 420c0fcd2162..3514c7b6a271 100644 --- a/svtools/source/contnr/svimpicn.cxx +++ b/svtools/source/contnr/svimpicn.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,9 +30,7 @@ #include "precompiled_svtools.hxx" #include <limits.h> -#ifndef _METRIC_HXX #include <vcl/metric.hxx> -#endif #include <vcl/svapp.hxx> #ifdef DBG_UTIL #include <vcl/sound.hxx> @@ -40,9 +39,7 @@ #include <svtools/svlbox.hxx> #include <svtools/svicnvw.hxx> #include <svimpicn.hxx> -#ifndef _SVLBITM_HXX #include <svtools/svlbitm.hxx> -#endif #include <svl/svarray.hxx> @@ -667,7 +664,6 @@ class ImpIcnCursor SvLBoxEntry* SearchRow(sal_uInt16 nRow,sal_uInt16 nRight,sal_uInt16 nLeft,sal_uInt16 nPref, sal_Bool bRight, sal_Bool bSimple ); - void ExpandGrid(); void CreateGridMap(); // Rueckgabe sal_False: Eintrag liegt nicht in der GridMap. rGridx,y werden // dann an nGridCols, nGridRows geclippt @@ -676,10 +672,6 @@ class ImpIcnCursor { pGridMap[ (nDY * nGridCols) + nDX ] = bUsed; } - sal_Bool IsGridUsed( sal_uInt16 nDX, sal_uInt16 nDY ) - { - return pGridMap[ (nDY * nGridCols) + nDX ]; - } public: ImpIcnCursor( SvImpIconView* pOwner ); ~ImpIcnCursor(); @@ -1317,7 +1309,7 @@ void SvImpIconView::PaintResizeRect( const Rectangle& rRect ) void SvImpIconView::RepaintSelectionItems() { - DBG_ERROR("RepaintSelectionItems"); + OSL_FAIL("RepaintSelectionItems"); pView->Invalidate(); // vorlaeufig } @@ -1644,16 +1636,6 @@ sal_Bool SvImpIconView::KeyInput( const KeyEvent& rKEvt ) } break; -#ifdef OS2 - case KEY_F9: - if( rKEvt.GetKeyCode().IsShift() ) - { - if( pCursor && pView->IsInplaceEditingEnabled() ) - pView->EditEntry( pCursor ); - } - break; -#endif - case KEY_SPACE: if( pCursor ) { @@ -1701,9 +1683,6 @@ void SvImpIconView::PositionScrollBars( long nRealWidth, long nRealHeight ) Point aPos( 0, nRealHeight ); aPos.Y() -= nHorSBarHeight; -#ifdef OS2 - aPos.Y()++; -#endif if( aHorSBar.GetPosPixel() != aPos ) aHorSBar.SetPosPixel( aPos ); @@ -1716,11 +1695,6 @@ void SvImpIconView::PositionScrollBars( long nRealWidth, long nRealHeight ) aPos.Y()--; #endif -#ifdef OS2 - aPos.Y()--; - aPos.X()++; -#endif - if( aVerSBar.GetPosPixel() != aPos ) aVerSBar.SetPosPixel( aPos ); } @@ -1806,9 +1780,6 @@ void SvImpIconView::AdjustScrollBars() #if defined(WNT) aSize.Height() += 2; #endif -#ifdef OS2 - aSize.Height() += 3; -#endif if( aSize != aVerSBar.GetSizePixel() ) aVerSBar.SetSizePixel( aSize ); aVerSBar.SetVisibleSize( nVisibleHeight ); @@ -1831,11 +1802,6 @@ void SvImpIconView::AdjustScrollBars() #if defined(WNT) aSize.Width()++; #endif -#ifdef OS2 - aSize.Width() += 3; - if( nResult & 0x0001 ) // vertikale Scrollbar ? - aSize.Width()--; -#endif #if defined(WNT) if( nResult & 0x0001 ) // vertikale Scrollbar ? { @@ -1858,22 +1824,15 @@ void SvImpIconView::AdjustScrollBars() aHorSBar.Hide(); } -#ifdef OS2 - nRealWidth++; -#endif aOutputSize.Width() = nRealWidth; #if defined(WNT) if( nResult & 0x0002 ) // hor scrollbar ? nRealHeight++; // weil unterer Rand geclippt wird #endif -#ifdef OS2 - if( nResult & 0x0002 ) // hor scrollbar ? - nRealHeight++; -#endif aOutputSize.Height() = nRealHeight; } -void __EXPORT SvImpIconView::Resize() +void SvImpIconView::Resize() { StopEditTimer(); Rectangle aRect; @@ -1982,7 +1941,7 @@ void SvImpIconView::CheckScrollBars() } -void __EXPORT SvImpIconView::GetFocus() +void SvImpIconView::GetFocus() { if( pCursor ) { @@ -1991,7 +1950,7 @@ void __EXPORT SvImpIconView::GetFocus() } } -void __EXPORT SvImpIconView::LoseFocus() +void SvImpIconView::LoseFocus() { StopEditTimer(); if( pCursor ) @@ -2033,11 +1992,7 @@ void SvImpIconView::PaintEmphasis( const Rectangle& rRect, sal_Bool bSelected, } else { -#ifndef OS2 aNewColor =rStyleSettings.GetFieldColor(); -#else - aNewColor = pOut->GetBackground().GetColor(); -#endif } if( bCursored ) @@ -3550,20 +3505,6 @@ void ImpIcnCursor::SetDeltas() } } - -void ImpIcnCursor::ExpandGrid() -{ - if( pGridMap ) - { - long nNewGridRows = nGridRows + 20; - unsigned char* pTempMap = new unsigned char[ nNewGridRows * nGridCols ]; - memcpy( pTempMap, pGridMap, nGridRows * nGridCols ); - delete pGridMap; - pGridMap = pTempMap; - nGridRows = nNewGridRows; - } -} - sal_Bool ImpIcnCursor::FindEmptyGridRect( Rectangle& rRect ) { CreateGridMap(); @@ -3582,9 +3523,6 @@ sal_Bool ImpIcnCursor::FindEmptyGridRect( Rectangle& rRect ) rRect.Right() = rRect.Left() + nGridDX; SetGridUsed( nCol, nRow, sal_True ); - //XXX - //if( nRow + 5 > nGridRows ) - // ExpandGrid(); DBG_ASSERT(pGridMap[nCur],"SetGridUsed failed"); return sal_True; } @@ -3595,9 +3533,6 @@ sal_Bool ImpIcnCursor::FindEmptyGridRect( Rectangle& rRect ) rRect.Left() = LROFFS_WINBORDER; rRect.Right() = rRect.Left() + nGridDX; return sal_False; - //XXX - //ExpandGrid(); - //return sal_True; } void ImpIcnCursor::CreateGridAjustData( SvPtrarr& rLists, SvLBoxEntry* pRefEntry) @@ -3740,13 +3675,9 @@ const Size& SvImpIconView::GetItemSize( SvIconView* pIconView, Rectangle SvImpIconView::CalcFocusRect( SvLBoxEntry* pEntry ) { -#if !defined(OS2) SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); DBG_ASSERT(pStringItem,"Text not set"); return CalcTextRect( pEntry, pStringItem ); -#else - return CalcBmpRect( pEntry ); -#endif } @@ -4159,3 +4090,4 @@ void SvImpIconView::CancelUserEvent() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index 89e888de0318..a8b1a62bb4e6 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,7 @@ #include <svtools/svlbox.hxx> #include <svtools/svlbitm.hxx> #include <vcl/svapp.hxx> -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/decoview.hxx> #include <vcl/sound.hxx> #include <vcl/salnativewidgets.hxx> @@ -420,6 +419,7 @@ void SvLBoxButton::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 /* nFlags sal_Bool bNativeOK = sal_False; ControlType eCtrlType = (pData->IsRadio())? CTRL_RADIOBUTTON : CTRL_CHECKBOX; if ( nIndex != SV_BMP_STATICIMAGE && rDev.IsNativeControlSupported( eCtrlType, PART_ENTIRE_CONTROL) ) + { Size aSize(pData->Width(), pData->Height()); ImplAdjustBoxSize( aSize, eCtrlType, &rDev ); @@ -517,9 +517,6 @@ struct SvLBoxContextBmp_Impl Image m_aImage1; Image m_aImage2; - Image m_aImage1_hc; - Image m_aImage2_hc; - sal_uInt16 m_nB2IndicatorFlags; }; @@ -557,47 +554,20 @@ sal_uInt16 SvLBoxContextBmp::IsA() return SV_ITEM_ID_LBOXCONTEXTBMP; } -sal_Bool SvLBoxContextBmp::SetModeImages( const Image& _rBitmap1, const Image& _rBitmap2, BmpColorMode _eMode ) +sal_Bool SvLBoxContextBmp::SetModeImages( const Image& _rBitmap1, const Image& _rBitmap2 ) { DBG_CHKTHIS(SvLBoxContextBmp,0); sal_Bool bSuccess = sal_True; - switch ( _eMode ) - { - case BMP_COLOR_NORMAL: - m_pImpl->m_aImage1 = _rBitmap1; - m_pImpl->m_aImage2 = _rBitmap2; - break; - - case BMP_COLOR_HIGHCONTRAST: - m_pImpl->m_aImage1_hc = _rBitmap1; - m_pImpl->m_aImage2_hc = _rBitmap2; - break; - - default: - DBG_ERROR( "SvLBoxContextBmp::SetModeImages: unexpected mode!"); - bSuccess = sal_False; - break; - } + m_pImpl->m_aImage1 = _rBitmap1; + m_pImpl->m_aImage2 = _rBitmap2; return bSuccess; } -Image& SvLBoxContextBmp::implGetImageStore( sal_Bool _bFirst, BmpColorMode _eMode ) +Image& SvLBoxContextBmp::implGetImageStore( sal_Bool _bFirst ) { DBG_CHKTHIS(SvLBoxContextBmp,0); - switch ( _eMode ) - { - case BMP_COLOR_NORMAL: - return _bFirst ? m_pImpl->m_aImage1 : m_pImpl->m_aImage2; - - case BMP_COLOR_HIGHCONTRAST: - return _bFirst ? m_pImpl->m_aImage1_hc : m_pImpl->m_aImage2_hc; - - default: - DBG_ERROR( "SvLBoxContextBmp::implGetImageStore: unexpected mode!"); - } - // OJ: #i27071# wrong mode so we just return the normal images return _bFirst ? m_pImpl->m_aImage1 : m_pImpl->m_aImage2; } @@ -616,16 +586,8 @@ void SvLBoxContextBmp::Paint( const Point& _rPos, SvLBox& _rDev, { DBG_CHKTHIS(SvLBoxContextBmp,0); - // determine the image set - BmpColorMode eMode( BMP_COLOR_NORMAL ); - if ( !!m_pImpl->m_aImage1_hc ) - { // we really have HC images - if ( _rDev.GetSettings().GetStyleSettings().GetHighContrastMode() ) - eMode = BMP_COLOR_HIGHCONTRAST; - } - // get the image - const Image& rImage = implGetImageStore( 0 == ( _nViewDataEntryFlags & m_pImpl->m_nB2IndicatorFlags ), eMode ); + const Image& rImage = implGetImageStore( 0 == ( _nViewDataEntryFlags & m_pImpl->m_nB2IndicatorFlags ) ); sal_Bool _bSemiTransparent = _pEntry && ( 0 != ( SV_ENTRYFLAG_SEMITRANSPARENT & _pEntry->GetFlags( ) ) ); // draw @@ -649,3 +611,4 @@ void SvLBoxContextBmp::Clone( SvLBoxItem* pSource ) m_pImpl->m_nB2IndicatorFlags = static_cast< SvLBoxContextBmp* >( pSource )->m_pImpl->m_nB2IndicatorFlags; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index e4e4abdc96a2..6ab6184a9aa2 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,14 +45,11 @@ #include <unotools/accessiblestatesethelper.hxx> #include <rtl/instance.hxx> -#define _SVSTDARR_ULONGSSORT -#include <svl/svstdarr.hxx> - -#ifndef _SVEDI_HXX #include <svtools/svmedit.hxx> -#endif #include <svtools/svlbitm.hxx> +#include <set> + using namespace ::com::sun::star::accessibility; // Drag&Drop @@ -738,7 +736,7 @@ SvLBox::SvLBox( Window* pParent, const ResId& rResId ) : SetType(WINDOW_TREELISTBOX); } -__EXPORT SvLBox::~SvLBox() +SvLBox::~SvLBox() { DBG_DTOR(SvLBox,0); delete pEdCtrl; @@ -1027,7 +1025,7 @@ sal_Bool SvLBox::CopySelection( SvLBox* pSource, SvLBoxEntry* pTarget ) { // Childs werden automatisch mitkopiert pSource->SelectChilds( pSourceEntry, sal_False ); - aList.Insert( pSourceEntry, LIST_APPEND ); + aList.push_back( pSourceEntry ); pSourceEntry = pSource->NextSelected( pSourceEntry ); } @@ -1035,7 +1033,7 @@ sal_Bool SvLBox::CopySelection( SvLBox* pSource, SvLBoxEntry* pTarget ) while ( pSourceEntry ) { SvLBoxEntry* pNewParent = 0; - sal_uLong nInsertionPos = LIST_APPEND; + sal_uLong nInsertionPos = ULONG_MAX; sal_Bool bOk=NotifyCopying(pTarget,pSourceEntry,pNewParent,nInsertionPos); if ( bOk ) { @@ -1088,7 +1086,7 @@ sal_Bool SvLBox::MoveSelectionCopyFallbackPossible( SvLBox* pSource, SvLBoxEntry { // Childs werden automatisch mitbewegt pSource->SelectChilds( pSourceEntry, sal_False ); - aList.Insert( pSourceEntry, LIST_APPEND ); + aList.push_back( pSourceEntry ); pSourceEntry = pSource->NextSelected( pSourceEntry ); } @@ -1096,7 +1094,7 @@ sal_Bool SvLBox::MoveSelectionCopyFallbackPossible( SvLBox* pSource, SvLBoxEntry while ( pSourceEntry ) { SvLBoxEntry* pNewParent = 0; - sal_uLong nInsertionPos = LIST_APPEND; + sal_uLong nInsertionPos = ULONG_MAX; sal_Bool bOk = NotifyMoving(pTarget,pSourceEntry,pNewParent,nInsertionPos); sal_Bool bCopyOk = bOk; if ( !bOk && bAllowCopyFallback ) @@ -1146,7 +1144,7 @@ void SvLBox::RemoveSelection() SvLBoxEntry* pEntry = FirstSelected(); while ( pEntry ) { - aList.Insert( pEntry ); + aList.push_back( pEntry ); if ( pEntry->HasChilds() ) // Remove loescht Childs automatisch SelectChilds( pEntry, sal_False ); @@ -1173,7 +1171,7 @@ SvLBox* SvLBox::GetTargetView() const void SvLBox::RequestingChilds( SvLBoxEntry* ) { DBG_CHKTHIS(SvLBox,0); - DBG_ERROR("Child-Request-Hdl not implemented!"); + OSL_FAIL("Child-Request-Hdl not implemented!"); } void SvLBox::RecalcViewData() @@ -1747,7 +1745,7 @@ sal_Int8 SvLBox::AcceptDrop( const AcceptDropEvent& rEvt ) } else { - DBG_ASSERT( pDDSource, "SvLBox::QueryDrop(): SourceBox == 0 (__EXPORT?)" ); + DBG_ASSERT( pDDSource, "SvLBox::QueryDrop(): SourceBox == 0" ); if( !( pEntry && pDDSource->GetModel() == this->GetModel() && DND_ACTION_MOVE == rEvt.mnAction && ( pEntry->nEntryFlags & SV_ENTRYFLAG_DISABLE_DROP ) )) @@ -1934,30 +1932,30 @@ sal_Bool SvLBox::NotifyAcceptDrop( SvLBoxEntry* ) namespace { - struct SortLBoxes : public rtl::Static<SvULongsSort, SortLBoxes> {}; + struct SortLBoxes : public rtl::Static<std::set<sal_uLong>, SortLBoxes> {}; } void SvLBox::AddBoxToDDList_Impl( const SvLBox& rB ) { sal_uLong nVal = (sal_uLong)&rB; - SortLBoxes::get().Insert( nVal ); + SortLBoxes::get().insert( nVal ); } void SvLBox::RemoveBoxFromDDList_Impl( const SvLBox& rB ) { sal_uLong nVal = (sal_uLong)&rB; - SortLBoxes::get().Remove( nVal ); + SortLBoxes::get().erase( nVal ); } IMPL_STATIC_LINK( SvLBox, DragFinishHdl_Impl, sal_Int8*, pAction ) { sal_uLong nVal = (sal_uLong)pThis; - sal_uInt16 nFnd; - SvULongsSort &rSortLBoxes = SortLBoxes::get(); - if( rSortLBoxes.Seek_Entry( nVal, &nFnd ) ) + std::set<sal_uLong> &rSortLBoxes = SortLBoxes::get(); + std::set<sal_uLong>::const_iterator it = rSortLBoxes.find(nVal); + if( it != rSortLBoxes.end() ) { pThis->DragFinished( *pAction ); - rSortLBoxes.Remove( nFnd, 1 ); + rSortLBoxes.erase( it ); } return 0; } @@ -1982,3 +1980,4 @@ Rectangle SvLBox::GetBoundingRect( SvLBoxEntry* ) return Rectangle(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index ed48f9fc6352..ada81843f43d 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,14 +31,10 @@ #include <svtools/svtabbx.hxx> #include <svtools/headbar.hxx> #include <svtools/svtdata.hxx> -#ifndef _SVTOOLS_HRC #include <svtools/svtools.hrc> -#endif #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> -#ifndef SVTOOLS_ACCESSIBLE_FACTORY_HXX #include "svtaccessiblefactory.hxx" -#endif using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; @@ -418,7 +415,7 @@ sal_uLong SvTabListBox::GetEntryPos( const SvLBoxEntry* pEntry ) const return 0xffffffff; } -void __EXPORT SvTabListBox::Resize() +void SvTabListBox::Resize() { SvTreeListBox::Resize(); } @@ -1118,7 +1115,7 @@ sal_Bool SvHeaderTabListBox::ConvertPointToColumnHeader( sal_uInt16&, const Poin break; default: - OSL_ENSURE(0,"BrowseBox::GetAccessibleName: invalid enum!"); + OSL_FAIL("BrowseBox::GetAccessibleName: invalid enum!"); } return aRetText; } @@ -1129,8 +1126,8 @@ sal_Bool SvHeaderTabListBox::ConvertPointToColumnHeader( sal_uInt16&, const Poin if( _eType == ::svt::BBTYPE_TABLECELL && _nPos != -1 ) { - static const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) ); - static const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) ); + const String sVar1( RTL_CONSTASCII_USTRINGPARAM( "%1" ) ); + const String sVar2( RTL_CONSTASCII_USTRINGPARAM( "%2" ) ); sal_uInt16 nColumnCount = GetColumnCount(); if (nColumnCount > 0) @@ -1302,3 +1299,4 @@ sal_Int32 SvHeaderTabListBox::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nC // ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index b48bcb0910ee..d03b956bf571 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,23 +25,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #define _SVTREEBX_CXX #include <vcl/svapp.hxx> -#ifndef GCC -#endif class TabBar; -// #102891# ----------------------- - #include <svtools/svlbox.hxx> #include <svtools/svlbitm.hxx> #include <svtools/svtreebx.hxx> #include <tools/diagnose_ex.h> +#include <comphelper/string.hxx> #include <svimpbox.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -371,22 +368,22 @@ String SvTreeListBox::SearchEntryText( SvLBoxEntry* pEntry ) const return sRet; } -const Image& SvTreeListBox::GetExpandedEntryBmp(SvLBoxEntry* pEntry, BmpColorMode _eMode) const +const Image& SvTreeListBox::GetExpandedEntryBmp(SvLBoxEntry* pEntry) const { DBG_CHKTHIS(SvTreeListBox,0); DBG_ASSERT(pEntry,"Entry?"); SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); DBG_ASSERT(pItem,"GetContextBmp:Item not found"); - return pItem->GetBitmap2( _eMode ); + return pItem->GetBitmap2( ); } -const Image& SvTreeListBox::GetCollapsedEntryBmp( SvLBoxEntry* pEntry, BmpColorMode _eMode ) const +const Image& SvTreeListBox::GetCollapsedEntryBmp( SvLBoxEntry* pEntry ) const { DBG_CHKTHIS(SvTreeListBox,0); DBG_ASSERT(pEntry,"Entry?"); SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); DBG_ASSERT(pItem,"GetContextBmp:Item not found"); - return pItem->GetBitmap1( _eMode ); + return pItem->GetBitmap1( ); } IMPL_LINK_INLINE_START( SvTreeListBox, CheckButtonClick, SvLBoxButtonData *, pData ) @@ -398,9 +395,13 @@ IMPL_LINK_INLINE_START( SvTreeListBox, CheckButtonClick, SvLBoxButtonData *, pDa } IMPL_LINK_INLINE_END( SvTreeListBox, CheckButtonClick, SvLBoxButtonData *, pData ) -SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,SvLBoxEntry* pParent, - sal_Bool bChildsOnDemand, sal_uLong nPos, void* pUser, - SvLBoxButtonKind eButtonKind ) +SvLBoxEntry* SvTreeListBox::InsertEntry( + const XubString& aText, + SvLBoxEntry* pParent, + sal_Bool bChildsOnDemand, sal_uLong nPos, + void* pUser, + SvLBoxButtonKind eButtonKind +) { DBG_CHKTHIS(SvTreeListBox,0); nTreeFlags |= TREEFLAG_MANINS; @@ -416,14 +417,6 @@ SvLBoxEntry* SvTreeListBox::InsertEntry( const XubString& aText,SvLBoxEntry* pPa InitEntry( pEntry, aText, rDefColBmp, rDefExpBmp, eButtonKind ); pEntry->EnableChildsOnDemand( bChildsOnDemand ); - // Add the HC versions of the default images - SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP ) ); - if( pBmpItem ) - { - pBmpItem->SetBitmap1( pImp->GetDefaultEntryColBmp( BMP_COLOR_HIGHCONTRAST ), BMP_COLOR_HIGHCONTRAST ); - pBmpItem->SetBitmap2( pImp->GetDefaultEntryExpBmp( BMP_COLOR_HIGHCONTRAST ), BMP_COLOR_HIGHCONTRAST ); - } - if( !pParent ) SvLBox::Insert( pEntry, nPos ); else @@ -477,18 +470,17 @@ void SvTreeListBox::SetEntryText( SvLBoxEntry* pEntry, const XubString& aStr) GetModel()->InvalidateEntry( pEntry ); } -void SvTreeListBox::SetExpandedEntryBmp( SvLBoxEntry* pEntry, const Image& aBmp, BmpColorMode _eMode ) +void SvTreeListBox::SetExpandedEntryBmp( SvLBoxEntry* pEntry, const Image& aBmp ) { DBG_CHKTHIS(SvTreeListBox,0); SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); DBG_ASSERT(pItem,"SetExpBmp:Item not found"); - pItem->SetBitmap2( aBmp, _eMode ); + pItem->SetBitmap2( aBmp ); GetModel()->InvalidateEntry( pEntry ); SetEntryHeight( pEntry ); Size aSize = aBmp.GetSizePixel(); - // #97680# --------------- short nWidth = pImp->UpdateContextBmpWidthVector( pEntry, (short)aSize.Width() ); if( nWidth > nContextBmpWidthMax ) { @@ -497,18 +489,17 @@ void SvTreeListBox::SetExpandedEntryBmp( SvLBoxEntry* pEntry, const Image& aBmp, } } -void SvTreeListBox::SetCollapsedEntryBmp(SvLBoxEntry* pEntry,const Image& aBmp, BmpColorMode _eMode ) +void SvTreeListBox::SetCollapsedEntryBmp(SvLBoxEntry* pEntry,const Image& aBmp ) { DBG_CHKTHIS(SvTreeListBox,0); SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); DBG_ASSERT(pItem,"SetExpBmp:Item not found"); - pItem->SetBitmap1( aBmp, _eMode ); + pItem->SetBitmap1( aBmp ); GetModel()->InvalidateEntry( pEntry ); SetEntryHeight( pEntry ); Size aSize = aBmp.GetSizePixel(); - // #97680# ----------- short nWidth = pImp->UpdateContextBmpWidthVector( pEntry, (short)aSize.Width() ); if( nWidth > nContextBmpWidthMax ) { @@ -600,9 +591,6 @@ void SvTreeListBox::CheckButtonHdl() pImp->CallEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)pCheckButtonData->GetActEntry() ); } -// ********************************************************************* -// ********************************************************************* - // // TODO: Momentan werden die Daten so geklont, dass sie dem // Standard-TreeView-Format entsprechen. Hier sollte eigentlich @@ -625,8 +613,8 @@ SvLBoxEntry* SvTreeListBox::CloneEntry( SvLBoxEntry* pSource ) SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); if( pBmpItem ) { - aCollEntryBmp = pBmpItem->GetBitmap1( BMP_COLOR_NORMAL ); - aExpEntryBmp = pBmpItem->GetBitmap2( BMP_COLOR_NORMAL ); + aCollEntryBmp = pBmpItem->GetBitmap1( ); + aExpEntryBmp = pBmpItem->GetBitmap2( ); } SvLBoxButton* pButtonItem = (SvLBoxButton*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXBUTTON)); if( pButtonItem ) @@ -637,23 +625,9 @@ SvLBoxEntry* SvTreeListBox::CloneEntry( SvLBoxEntry* pSource ) pClone->EnableChildsOnDemand( pSource->HasChildsOnDemand() ); pClone->SetUserData( pSource->GetUserData() ); - if ( pBmpItem ) - { - SvLBoxContextBmp* pCloneBitmap = static_cast< SvLBoxContextBmp* >( pClone->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP ) ); - if ( pCloneBitmap ) - { - pCloneBitmap->SetBitmap1( pBmpItem->GetBitmap1( BMP_COLOR_HIGHCONTRAST ), BMP_COLOR_HIGHCONTRAST ); - pCloneBitmap->SetBitmap2( pBmpItem->GetBitmap2( BMP_COLOR_HIGHCONTRAST ), BMP_COLOR_HIGHCONTRAST ); - } - } - return pClone; } -// ********************************************************************* -// ********************************************************************* - - void SvTreeListBox::ShowExpandBitmapOnCursor( sal_Bool bYes ) { DBG_CHKTHIS(SvTreeListBox,0); @@ -672,17 +646,17 @@ void SvTreeListBox::SetIndent( short nNewIndent ) Invalidate(); } -const Image& SvTreeListBox::GetDefaultExpandedEntryBmp( BmpColorMode _eMode ) const +const Image& SvTreeListBox::GetDefaultExpandedEntryBmp( ) const { - return pImp->GetDefaultEntryExpBmp( _eMode ); + return pImp->GetDefaultEntryExpBmp( ); } -const Image& SvTreeListBox::GetDefaultCollapsedEntryBmp( BmpColorMode _eMode ) const +const Image& SvTreeListBox::GetDefaultCollapsedEntryBmp( ) const { - return pImp->GetDefaultEntryColBmp( _eMode ); + return pImp->GetDefaultEntryColBmp( ); } -void SvTreeListBox::SetDefaultExpandedEntryBmp( const Image& aBmp, BmpColorMode _eMode ) +void SvTreeListBox::SetDefaultExpandedEntryBmp( const Image& aBmp ) { DBG_CHKTHIS(SvTreeListBox,0); Size aSize = aBmp.GetSizePixel(); @@ -690,10 +664,10 @@ void SvTreeListBox::SetDefaultExpandedEntryBmp( const Image& aBmp, BmpColorMode nContextBmpWidthMax = (short)aSize.Width(); SetTabs(); - pImp->SetDefaultEntryExpBmp( aBmp, _eMode ); + pImp->SetDefaultEntryExpBmp( aBmp ); } -void SvTreeListBox::SetDefaultCollapsedEntryBmp( const Image& aBmp, BmpColorMode _eMode ) +void SvTreeListBox::SetDefaultCollapsedEntryBmp( const Image& aBmp ) { DBG_CHKTHIS(SvTreeListBox,0); Size aSize = aBmp.GetSizePixel(); @@ -701,7 +675,7 @@ void SvTreeListBox::SetDefaultCollapsedEntryBmp( const Image& aBmp, BmpColorMode nContextBmpWidthMax = (short)aSize.Width(); SetTabs(); - pImp->SetDefaultEntryColBmp( aBmp, _eMode ); + pImp->SetDefaultEntryColBmp( aBmp ); } void SvTreeListBox::EnableCheckButton( SvLBoxButtonData* pData ) @@ -729,29 +703,24 @@ void SvTreeListBox::SetCheckButtonData( SvLBoxButtonData* pData ) pCheckButtonData = pData; } -const Image& SvTreeListBox::GetDefaultExpandedNodeImage( BmpColorMode _eMode ) +const Image& SvTreeListBox::GetDefaultExpandedNodeImage( ) { - return SvImpLBox::GetDefaultExpandedNodeImage( _eMode ); + return SvImpLBox::GetDefaultExpandedNodeImage( ); } -const Image& SvTreeListBox::GetDefaultCollapsedNodeImage( BmpColorMode _eMode ) +const Image& SvTreeListBox::GetDefaultCollapsedNodeImage( ) { - return SvImpLBox::GetDefaultCollapsedNodeImage( _eMode ); + return SvImpLBox::GetDefaultCollapsedNodeImage( ); } -void SvTreeListBox::SetNodeBitmaps( const Image& rCollapsedNodeBmp, const Image& rExpandedNodeBmp, BmpColorMode _eMode ) +void SvTreeListBox::SetNodeBitmaps( const Image& rCollapsedNodeBmp, const Image& rExpandedNodeBmp ) { DBG_CHKTHIS(SvTreeListBox,0); - SetExpandedNodeBmp( rExpandedNodeBmp, _eMode ); - SetCollapsedNodeBmp( rCollapsedNodeBmp, _eMode ); + SetExpandedNodeBmp( rExpandedNodeBmp ); + SetCollapsedNodeBmp( rCollapsedNodeBmp ); SetTabs(); } -void SvTreeListBox::SetDontKnowNodeBitmap( const Image& rDontKnowBmp, BmpColorMode _eMode ) -{ - pImp->SetDontKnowNodeBmp( rDontKnowBmp, _eMode ); -} - sal_Bool SvTreeListBox::EditingEntry( SvLBoxEntry*, Selection& ) { DBG_CHKTHIS(SvTreeListBox,0); @@ -846,8 +815,6 @@ void SvTreeListBox::ModelHasCleared() AdjustEntryHeight( GetDefaultCollapsedEntryBmp() ); SvLBox::ModelHasCleared(); -// if( IsUpdateMode() ) -// Invalidate(); } void SvTreeListBox::ShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool /* bShow */ ) @@ -1018,12 +985,11 @@ sal_Bool SvTreeListBox::Expand( SvLBoxEntry* pParent ) GetModel()->InvalidateEntry( pParent ); // neu zeichnen } - // --> OD 2009-04-01 #i92103# + // #i92103# if ( bExpanded ) { pImp->CallEventListeners( VCLEVENT_ITEM_EXPANDED, pParent ); } - // <-- return bExpanded; } @@ -1045,12 +1011,11 @@ sal_Bool SvTreeListBox::Collapse( SvLBoxEntry* pParent ) ExpandedHdl(); } - // --> OD 2009-04-01 #i92103# + // #i92103# if ( bCollapsed ) { pImp->CallEventListeners( VCLEVENT_ITEM_COLLAPSED, pParent ); } - // <-- return bCollapsed; } @@ -1154,18 +1119,18 @@ void SvTreeListBox::ModelHasRemoved( SvListEntry* pEntry ) pImp->EntryRemoved(); } -void SvTreeListBox::SetCollapsedNodeBmp( const Image& rBmp, BmpColorMode _eMode ) +void SvTreeListBox::SetCollapsedNodeBmp( const Image& rBmp) { DBG_CHKTHIS(SvTreeListBox,0); AdjustEntryHeight( rBmp ); - pImp->SetCollapsedNodeBmp( rBmp, _eMode ); + pImp->SetCollapsedNodeBmp( rBmp ); } -void SvTreeListBox::SetExpandedNodeBmp( const Image& rBmp, BmpColorMode _eMode ) +void SvTreeListBox::SetExpandedNodeBmp( const Image& rBmp ) { DBG_CHKTHIS(SvTreeListBox,0); AdjustEntryHeight( rBmp ); - pImp->SetExpandedNodeBmp( rBmp, _eMode ); + pImp->SetExpandedNodeBmp( rBmp ); } @@ -1248,14 +1213,14 @@ void SvTreeListBox::SetCurEntry( SvLBoxEntry* pEntry ) pImp->SetCurEntry( pEntry ); } -Image SvTreeListBox::GetCollapsedNodeBmp( BmpColorMode _eMode ) const +Image SvTreeListBox::GetCollapsedNodeBmp( ) const { - return pImp->GetCollapsedNodeBmp( _eMode ); + return pImp->GetCollapsedNodeBmp( ); } -Image SvTreeListBox::GetExpandedNodeBmp( BmpColorMode _eMode ) const +Image SvTreeListBox::GetExpandedNodeBmp( ) const { - return pImp->GetExpandedNodeBmp( _eMode ); + return pImp->GetExpandedNodeBmp( ); } Point SvTreeListBox::GetEntryPosition( SvLBoxEntry* pEntry ) const @@ -1323,12 +1288,6 @@ void SvTreeListBox::EditItemText( SvLBoxEntry* pEntry, SvLBoxString* pItem, aPos += aOrigin; // in Win-Koord umrechnen aSize.Width() -= aOrigin.X(); Rectangle aRect( aPos, aSize ); -#ifdef OS2 - // Platz lassen fuer WB_BORDER - aRect.Left() -= 2; - aRect.Top() -= 3; - aRect.Bottom() += 3; -#endif EditText( pItem->GetText(), aRect, rSelection ); } @@ -1410,19 +1369,15 @@ void SvTreeListBox::EditedText( const XubString& rStr ) DBG_CHKTHIS(SvTreeListBox,0); if(pEdEntry) // we have to check if this entry is null that means that it is removed while editing { - Point aPos = GetEntryPosition( pEdEntry ); if( EditedEntry( pEdEntry, rStr ) ) { ((SvLBoxString*)pEdItem)->SetText( pEdEntry, rStr ); pModel->InvalidateEntry( pEdEntry ); } - //if( GetSelectionMode() == SINGLE_SELECTION ) - //{ if( GetSelectionCount() == 0 ) Select( pEdEntry ); if( GetSelectionMode() == MULTIPLE_SELECTION && !GetCurEntry() ) SetCurEntry( pEdEntry ); - //} } } @@ -1512,9 +1467,6 @@ void SvTreeListBox::ImplInitStyle() GetModel()->SetSortMode( SortNone ); GetModel()->SetCompareHdl( Link() ); } -#ifdef OS2 - nWindowStyle |= WB_VSCROLL; -#endif pImp->SetStyle( nWindowStyle ); pImp->Resize(); Invalidate(); @@ -1535,7 +1487,6 @@ void SvTreeListBox::InvalidateEntry( SvLBoxEntry* pEntry ) if( pEntry ) { GetModel()->InvalidateEntry( pEntry ); - // pImp->InvalidateEntry( pEntry ); } } @@ -1557,7 +1508,6 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,sal_uInt16 nTabFl sal_Bool bHorSBar = pImp->HasHorScrollBar(); PreparePaint( pEntry ); - // #97680# ------------------ pImp->UpdateContextBmpWidthMax( pEntry ); if( nTreeFlags & TREEFLAG_RECALCTABS ) @@ -1794,20 +1744,17 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,sal_uInt16 nTabFl aPos.X() += pImp->nNodeBmpTabDistance; const Image* pImg = 0; - BmpColorMode eBitmapMode = BMP_COLOR_NORMAL; - if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) - eBitmapMode = BMP_COLOR_HIGHCONTRAST; if( IsExpanded(pEntry) ) - pImg = &pImp->GetExpandedNodeBmp( eBitmapMode ); + pImg = &pImp->GetExpandedNodeBmp( ); else { if( (!pEntry->HasChilds()) && pEntry->HasChildsOnDemand() && (!(pEntry->GetFlags() & SV_ENTRYFLAG_HAD_CHILDREN)) && pImp->GetDontKnowNodeBmp().GetSizePixel().Width() ) - pImg = &pImp->GetDontKnowNodeBmp( eBitmapMode ); + pImg = &pImp->GetDontKnowNodeBmp( ); else - pImg = &pImp->GetCollapsedNodeBmp( eBitmapMode ); + pImg = &pImp->GetCollapsedNodeBmp( ); } aPos.Y() += (nTempEntryHeight - pImg->GetSizePixel().Height()) / 2; @@ -1829,12 +1776,14 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,sal_uInt16 nTabFl aControlValue.setTristateVal( BUTTONVALUE_ON );//expanded node else { - if( (!pEntry->HasChilds()) && pEntry->HasChildsOnDemand() && - (!(pEntry->GetFlags() & SV_ENTRYFLAG_HAD_CHILDREN)) && - pImp->GetDontKnowNodeBmp().GetSizePixel().Width() ) - aControlValue.setTristateVal( BUTTONVALUE_DONTKNOW );//dont know + if( (!pEntry->HasChilds() ) && + pEntry->HasChildsOnDemand() && + (!(pEntry->GetFlags() & SV_ENTRYFLAG_HAD_CHILDREN)) && + pImp->GetDontKnowNodeBmp().GetSizePixel().Width() + ) + aControlValue.setTristateVal( BUTTONVALUE_DONTKNOW ); //dont know else - aControlValue.setTristateVal( BUTTONVALUE_OFF );//collapsed node + aControlValue.setTristateVal( BUTTONVALUE_OFF ); //collapsed node } bNativeOK = DrawNativeControl( CTRL_LISTNODE, PART_ENTIRE_CONTROL, @@ -1842,7 +1791,6 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,sal_uInt16 nTabFl } if( !bNativeOK) { - //non native DrawImage( aPos, *pImg ,nStyle); } } @@ -2318,9 +2266,8 @@ IMPL_LINK( SvTreeListBox, DefaultCompare, SvSortData*, pData ) SvLBoxEntry* pRight = (SvLBoxEntry*)(pData->pRight ); String aLeft( ((SvLBoxString*)(pLeft->GetFirstItem(SV_ITEM_ID_LBOXSTRING)))->GetText()); String aRight( ((SvLBoxString*)(pRight->GetFirstItem(SV_ITEM_ID_LBOXSTRING)))->GetText()); - // #102891# ---------------- - pImp->UpdateIntlWrapper(); - return pImp->pIntlWrapper->getCaseCollator()->compareString( aLeft, aRight ); + pImp->UpdateStringSorter(); + return pImp->m_pStringSorter->compare(aLeft, aRight); } void SvTreeListBox::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1, @@ -2682,3 +2629,5 @@ void SvTreeListBox::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rSt { SvLBox::FillAccessibleStateSet( rStateSet ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 2959d8e0460f..19dcdb26dd87 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,6 +31,7 @@ #include "templwin.hxx" #include <svtools/templdlg.hxx> #include <svtools/svtdata.hxx> +#include <svtools/langhelp.hxx> #include <unotools/pathoptions.hxx> #include <unotools/dynamicmenuoptions.hxx> #include <unotools/extendedsecurityoptions.hxx> @@ -86,7 +88,6 @@ #include <ucbhelper/content.hxx> #include <comphelper/string.hxx> - using namespace ::com::sun::star; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; @@ -99,6 +100,7 @@ using namespace ::com::sun::star::view; using namespace svtools; extern ::rtl::OUString CreateExactSizeText_Impl( sal_Int64 nSize ); // fileview.cxx +#define aSeparatorStr "----------------------------------" #define SPLITSET_ID 0 #define COLSET_ID 1 @@ -127,8 +129,7 @@ struct FolderHistory m_sURL( _rURL ), m_nGroup( _nGroup ) {} }; -DECLARE_LIST( HistoryList_Impl, FolderHistory* ) -DECLARE_LIST( NewDocList_Impl, ::rtl::OUString* ) +typedef ::std::vector< ::rtl::OUString* > NewDocList_Impl; ODocumentInfoPreview::ODocumentInfoPreview( Window* pParent ,WinBits _nBits) : Window(pParent,WB_DIALOGCONTROL) { @@ -171,7 +172,7 @@ void lcl_insertDateTimeEntry(SvtExtendedMultiLineEdit_Impl* i_pEditWin, ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() ); String aDateStr = aLocaleWrapper.getDate( aToolsDT ); - aDateStr += String( RTL_CONSTASCII_STRINGPARAM(", ") ); + aDateStr += String( RTL_CONSTASCII_USTRINGPARAM(", ") ); aDateStr += aLocaleWrapper.getTime( aToolsDT ); i_pEditWin->InsertEntry( i_rName, aDateStr ); } @@ -359,8 +360,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : // insert the categories // "New Document" - sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); - Image aImage( SvtResId( bHiContrast ? IMG_SVT_NEWDOC_HC : IMG_SVT_NEWDOC ) ); + Image aImage( SvtResId( IMG_SVT_NEWDOC ) ); nMaxTextLength = aImage.GetSizePixel().Width(); String aEntryStr = String( SvtResId( STR_SVT_NEWDOC ) ); SvxIconChoiceCtrlEntry* pEntry = @@ -377,7 +377,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : { aEntryStr = String( SvtResId( STR_SVT_TEMPLATES ) ); pEntry = aIconCtrl.InsertEntry( - aEntryStr, Image( SvtResId( bHiContrast ? IMG_SVT_TEMPLATES_HC : IMG_SVT_TEMPLATES ) ), ICON_POS_TEMPLATES ); + aEntryStr, Image( SvtResId( IMG_SVT_TEMPLATES ) ), ICON_POS_TEMPLATES ); pEntry->SetUserData( new String( aTemplateRootURL ) ); pEntry->SetQuickHelpText( String( SvtResId( STR_SVT_TEMPLATES_HELP ) ) ); DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); @@ -389,7 +389,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : // "My Documents" aEntryStr = String( SvtResId( STR_SVT_MYDOCS ) ); pEntry = aIconCtrl.InsertEntry( - aEntryStr, Image( SvtResId( bHiContrast ? IMG_SVT_MYDOCS_HC : IMG_SVT_MYDOCS ) ), ICON_POS_MYDOCS ); + aEntryStr, Image( SvtResId( IMG_SVT_MYDOCS ) ), ICON_POS_MYDOCS ); pEntry->SetUserData( new String( aMyDocumentsRootURL ) ); pEntry->SetQuickHelpText( String( SvtResId( STR_SVT_MYDOCS_HELP ) ) ); DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); @@ -400,7 +400,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : // "Samples" aEntryStr = String( SvtResId( STR_SVT_SAMPLES ) ); pEntry = aIconCtrl.InsertEntry( - aEntryStr, Image( SvtResId( bHiContrast ? IMG_SVT_SAMPLES_HC : IMG_SVT_SAMPLES ) ), ICON_POS_SAMPLES ); + aEntryStr, Image( SvtResId( IMG_SVT_SAMPLES ) ), ICON_POS_SAMPLES ); pEntry->SetUserData( new String( aSamplesFolderRootURL ) ); pEntry->SetQuickHelpText( String( SvtResId( STR_SVT_SAMPLES_HELP ) ) ); DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); @@ -566,20 +566,18 @@ sal_uLong SvtIconWindow_Impl::GetRootPos( const String& rURL ) const return nPos; } -void SvtIconWindow_Impl::UpdateIcons( sal_Bool _bHiContrast ) +void SvtIconWindow_Impl::UpdateIcons() { aIconCtrl.GetEntry( ICON_POS_NEWDOC )->SetImage( - Image( SvtResId( _bHiContrast ? IMG_SVT_NEWDOC_HC : IMG_SVT_NEWDOC ) ) ); + Image( SvtResId( IMG_SVT_NEWDOC ) ) ); aIconCtrl.GetEntry( ICON_POS_TEMPLATES )->SetImage( - Image( SvtResId( _bHiContrast ? IMG_SVT_TEMPLATES_HC : IMG_SVT_TEMPLATES ) ) ); + Image( SvtResId( IMG_SVT_TEMPLATES ) ) ); aIconCtrl.GetEntry( ICON_POS_MYDOCS )->SetImage( - Image( SvtResId( _bHiContrast ? IMG_SVT_MYDOCS_HC : IMG_SVT_MYDOCS ) ) ); + Image( SvtResId( IMG_SVT_MYDOCS ) ) ); aIconCtrl.GetEntry( ICON_POS_SAMPLES )->SetImage( - Image( SvtResId( _bHiContrast ? IMG_SVT_SAMPLES_HC : IMG_SVT_SAMPLES ) ) ); + Image( SvtResId( IMG_SVT_SAMPLES ) ) ); } -/* -----------------27.11.2002 16:58----------------- - * - * --------------------------------------------------*/ + void SvtIconWindow_Impl::SelectFolder(sal_Int32 nFolderPosition) { SvxIconChoiceCtrlEntry* pEntry = aIconCtrl.GetEntry( nFolderPosition ); @@ -597,7 +595,7 @@ SvtFileViewWindow_Impl::SvtFileViewWindow_Impl( SvtTemplateWindow* pParent ) : Window( pParent, WB_DIALOGCONTROL | WB_TABSTOP | WB_BORDER | WB_3DLOOK ), rParent ( *pParent ), - aFileView ( this, SvtResId( CTRL_FILEVIEW ), FILEVIEW_SHOW_TITLE ), + aFileView ( this, SvtResId( CTRL_FILEVIEW ), FILEVIEW_SHOW_NONE ), bIsTemplateFolder ( sal_False ) { @@ -635,6 +633,7 @@ void GetMenuEntry_Impl aDynamicMenuEntry[i].Value >>= rFrame; } } + Sequence< ::rtl::OUString > SvtFileViewWindow_Impl::GetNewDocContents() const { NewDocList_Impl aNewDocs; @@ -653,9 +652,14 @@ Sequence< ::rtl::OUString > SvtFileViewWindow_Impl::GetNewDocContents() const for ( i = 0; i < nCount; ++i ) { GetMenuEntry_Impl( aDynamicMenuEntries[i], aTitle, aURL, aTargetFrame, aImageURL ); - - if ( aURL == sSeparator || aURL == sSlotURL ) + if( aURL == sSlotURL ) continue; + if( aURL == sSeparator ) + { + String aSeparator( ASCII_STR( aSeparatorStr ) ); + ::rtl::OUString* pSeparator = new ::rtl::OUString( aSeparator ); + aNewDocs.push_back( pSeparator ); + } else { // title @@ -680,16 +684,16 @@ Sequence< ::rtl::OUString > SvtFileViewWindow_Impl::GetNewDocContents() const } ::rtl::OUString* pRow = new ::rtl::OUString( aRow ); - aNewDocs.Insert( pRow, LIST_APPEND ); + aNewDocs.push_back( pRow ); } } - nCount = aNewDocs.Count(); + nCount = aNewDocs.size(); Sequence < ::rtl::OUString > aRet( nCount ); ::rtl::OUString* pRet = aRet.getArray(); for ( i = 0; i < nCount; ++i ) { - ::rtl::OUString* pNewDoc = aNewDocs.GetObject(i); + ::rtl::OUString* pNewDoc = aNewDocs[i]; pRet[i] = *( pNewDoc ); delete pNewDoc; } @@ -897,9 +901,9 @@ void SvtFrameWindow_Impl::ShowDocInfo( const String& rURL ) try { uno::Reference < task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.task.InteractionHandler") ), uno::UNO_QUERY ); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" )) ), uno::UNO_QUERY ); uno::Sequence < beans::PropertyValue> aProps(1); - aProps[0].Name = ::rtl::OUString::createFromAscii("InteractionHandler"); + aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); aProps[0].Value <<= xInteractionHandler; m_xDocProps->loadFromMedium( rURL, aProps ); pEditWin->fill( m_xDocProps, rURL ); @@ -947,7 +951,7 @@ void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_B else { // can be removed if the database application change its URL - String sServiceScheme( RTL_CONSTASCII_STRINGPARAM( "service:" ) ); + String sServiceScheme( RTL_CONSTASCII_USTRINGPARAM( "service:" ) ); if ( rURL.Match( sServiceScheme ) != sServiceScheme.Len() ) // service URL has no default target aTarget = ASCII_STR("_default"); @@ -980,8 +984,8 @@ void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_B aArgs[2].Name = ASCII_STR("AsTemplate"); // prevents getting an empty URL with getURL()! uno::Reference < task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.task.InteractionHandler") ), uno::UNO_QUERY ); - aArgs[3].Name = ::rtl::OUString::createFromAscii("InteractionHandler"); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" )) ), uno::UNO_QUERY ); + aArgs[3].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); aArgs[3].Value <<= xInteractionHandler; b = sal_False; @@ -1106,8 +1110,9 @@ SvtTemplateWindow::~SvtTemplateWindow() delete pFrameWin; if ( pHistoryList ) { - for ( sal_uInt32 i = 0; i < pHistoryList->Count(); ++i ) - delete pHistoryList->GetObject(i); + for ( size_t i = 0, n = pHistoryList->size(); i < n; ++i ) + delete (*pHistoryList)[ i ]; + pHistoryList->clear(); delete pHistoryList; } } @@ -1239,17 +1244,17 @@ void SvtTemplateWindow::AppendHistoryURL( const String& rURL, sal_uLong nGroup ) sal_Bool bInsert = sal_True; if ( !pHistoryList ) pHistoryList = new HistoryList_Impl; - else if ( pHistoryList->Count() > 0 ) + else if ( pHistoryList->size() > 0 ) { - FolderHistory* pLastEntry = pHistoryList->GetObject( pHistoryList->Count() - 1 ); + FolderHistory* pLastEntry = pHistoryList->back(); bInsert = ( rURL != pLastEntry->m_sURL); } if ( bInsert ) { FolderHistory* pEntry = new FolderHistory( rURL, nGroup ); - pHistoryList->Insert( pEntry, LIST_APPEND ); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_BACK, pHistoryList->Count() > 1 ); + pHistoryList->push_back( pEntry ); + aFileViewTB.EnableItem( TI_DOCTEMPLATE_BACK, pHistoryList->size() > 1 ); } } @@ -1257,9 +1262,11 @@ void SvtTemplateWindow::AppendHistoryURL( const String& rURL, sal_uLong nGroup ) void SvtTemplateWindow::OpenHistory() { - FolderHistory* pEntry = pHistoryList->Remove( pHistoryList->Count() - 1 ); - pEntry = pHistoryList->Remove( pHistoryList->Count() - 1 ); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_BACK, pHistoryList->Count() > 1 ); + delete pHistoryList->back(); + pHistoryList->pop_back(); + FolderHistory* pEntry = pHistoryList->back(); + pHistoryList->pop_back(); + aFileViewTB.EnableItem( TI_DOCTEMPLATE_BACK, pHistoryList->size() > 1 ); pFileWin->OpenFolder( pEntry->m_sURL ); pIconWin->SetCursorPos( pEntry->m_nGroup ); delete pEntry; @@ -1273,7 +1280,7 @@ void SvtTemplateWindow::DoAction( sal_uInt16 nAction ) { case TI_DOCTEMPLATE_BACK : { - if ( pHistoryList && pHistoryList->Count() > 1 ) + if ( pHistoryList && pHistoryList->size() > 1 ) OpenHistory(); break; } @@ -1338,31 +1345,30 @@ void SvtTemplateWindow::InitToolBoxImages() { SvtMiscOptions aMiscOpt; sal_Bool bLarge = aMiscOpt.AreCurrentSymbolsLarge(); - sal_Bool bHiContrast = aFileViewTB.GetSettings().GetStyleSettings().GetHighContrastMode(); aFileViewTB.SetItemImage( TI_DOCTEMPLATE_BACK, Image( SvtResId( - bLarge ? bHiContrast ? IMG_SVT_DOCTEMPL_HC_BACK_LARGE : IMG_SVT_DOCTEMPLATE_BACK_LARGE - : bHiContrast ? IMG_SVT_DOCTEMPL_HC_BACK_SMALL : IMG_SVT_DOCTEMPLATE_BACK_SMALL ) ) ); + bLarge ? IMG_SVT_DOCTEMPLATE_BACK_LARGE + : IMG_SVT_DOCTEMPLATE_BACK_SMALL ) ) ); aFileViewTB.SetItemImage( TI_DOCTEMPLATE_PREV, Image( SvtResId( - bLarge ? bHiContrast ? IMG_SVT_DOCTEMPL_HC_PREV_LARGE : IMG_SVT_DOCTEMPLATE_PREV_LARGE - : bHiContrast ? IMG_SVT_DOCTEMPL_HC_PREV_SMALL : IMG_SVT_DOCTEMPLATE_PREV_SMALL ) ) ); + bLarge ? IMG_SVT_DOCTEMPLATE_PREV_LARGE + : IMG_SVT_DOCTEMPLATE_PREV_SMALL ) ) ); aFileViewTB.SetItemImage( TI_DOCTEMPLATE_PRINT, Image( SvtResId( - bLarge ? bHiContrast ? IMG_SVT_DOCTEMPL_HC_PRINT_LARGE : IMG_SVT_DOCTEMPLATE_PRINT_LARGE - : bHiContrast ? IMG_SVT_DOCTEMPL_HC_PRINT_SMALL : IMG_SVT_DOCTEMPLATE_PRINT_SMALL ) ) ); + bLarge ? IMG_SVT_DOCTEMPLATE_PRINT_LARGE + : IMG_SVT_DOCTEMPLATE_PRINT_SMALL ) ) ); aFrameWinTB.SetItemImage( TI_DOCTEMPLATE_DOCINFO, Image( SvtResId( - bLarge ? bHiContrast ? IMG_SVT_DOCTEMPL_HC_DOCINFO_LARGE : IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE - : bHiContrast ? IMG_SVT_DOCTEMPL_HC_DOCINFO_SMALL : IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL ) ) ); + bLarge ? IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE + : IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL ) ) ); aFrameWinTB.SetItemImage( TI_DOCTEMPLATE_PREVIEW, Image( SvtResId( - bLarge ? bHiContrast ? IMG_SVT_DOCTEMPL_HC_PREVIEW_LARGE : IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE - : bHiContrast ? IMG_SVT_DOCTEMPL_HC_PREVIEW_SMALL : IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL ) ) ); + bLarge ? IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE + : IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL ) ) ); } // ------------------------------------------------------------------------ void SvtTemplateWindow::UpdateIcons() { - pIconWin->UpdateIcons( aFileViewTB.GetSettings().GetStyleSettings().GetHighContrastMode() ); + pIconWin->UpdateIcons(); } // ------------------------------------------------------------------------ @@ -1523,7 +1529,11 @@ void SvtTemplateWindow::SetPrevLevelButtonState( const String& rURL ) void SvtTemplateWindow::ClearHistory() { if( pHistoryList ) - pHistoryList->Clear(); + { + for ( size_t i = 0, n = pHistoryList->size(); i < n; ++i ) + delete (*pHistoryList)[ i ]; + pHistoryList->clear(); + } } // ------------------------------------------------------------------------ @@ -1624,9 +1634,6 @@ void SvtTemplateWindow::WriteViewSettings() SvtViewOptions aViewSettings( E_DIALOG, VIEWSETTING_NEWFROMTEMPLATE ); aViewSettings.SetUserData( aSettings ); } -/* -----------------27.11.2002 17:20----------------- - * - * --------------------------------------------------*/ void SvtTemplateWindow::SelectFolder(sal_Int32 nFolderPosition) { @@ -1738,7 +1745,7 @@ void SvtDocumentTemplateDialog::InitImpl( ) if ( !bHideLink ) { aMoreTemplatesLink.SetURL( String( - RTL_CONSTASCII_STRINGPARAM( "http://templates.services.openoffice.org/?cid=923508" ) ) ); + RTL_CONSTASCII_USTRINGPARAM( "http://templates.libreoffice.org/" ) ) ); aMoreTemplatesLink.SetClickHdl( LINK( this, SvtDocumentTemplateDialog, OpenLinkHdl_Impl ) ); } else @@ -1987,6 +1994,7 @@ IMPL_LINK ( SvtDocumentTemplateDialog, OpenLinkHdl_Impl, svt::FixedHyperlink*, E ::rtl::OUString sURL( aMoreTemplatesLink.GetURL() ); if ( sURL.getLength() > 0 ) { + localizeWebserviceURI(sURL); try { uno::Reference< lang::XMultiServiceFactory > xSMGR = @@ -2008,11 +2016,9 @@ IMPL_LINK ( SvtDocumentTemplateDialog, OpenLinkHdl_Impl, svt::FixedHyperlink*, E return 0; } -/* -----------------27.11.2002 16:54----------------- - * - * --------------------------------------------------*/ void SvtDocumentTemplateDialog::SelectTemplateFolder() { pImpl->pWin->SelectFolder(ICON_POS_TEMPLATES); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx index c6100ba5bc20..ebc0e393c0de 100644 --- a/svtools/source/contnr/templwin.hxx +++ b/svtools/source/contnr/templwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -101,7 +102,7 @@ public: long CalcHeight() const; sal_Bool IsRootURL( const String& rURL ) const; sal_uLong GetRootPos( const String& rURL ) const; - void UpdateIcons( sal_Bool _bHiContrast ); + void UpdateIcons(); inline sal_Bool ProcessKeyEvent( const KeyEvent& rKEvt ); @@ -233,7 +234,8 @@ public: // class SvtTemplateWindow ----------------------------------------------- -class HistoryList_Impl; +struct FolderHistory; +typedef ::std::vector< FolderHistory* > HistoryList_Impl; class SvtTemplateWindow : public Window { @@ -307,3 +309,4 @@ public: #endif // _SVTOOLS_TEMPLWIN_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src index 113e20c34f28..076963d2e7c3 100644 --- a/svtools/source/contnr/templwin.src +++ b/svtools/source/contnr/templwin.src @@ -48,13 +48,7 @@ String STR_SVT_NEWDOC Image IMG_SVT_NEWDOC { - ImageBitmap = Bitmap { File = "new_doc.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -Image IMG_SVT_NEWDOC_HC -{ - ImageBitmap = Bitmap { File = "new_doc_h.bmp" ; }; + ImageBitmap = Bitmap { File = "new_doc.png" ; }; MaskColor = MASK_COL_MAGENTA }; @@ -65,13 +59,7 @@ String STR_SVT_MYDOCS Image IMG_SVT_MYDOCS { - ImageBitmap = Bitmap { File = "my_docs.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -Image IMG_SVT_MYDOCS_HC -{ - ImageBitmap = Bitmap { File = "my_docs_h.bmp" ; }; + ImageBitmap = Bitmap { File = "my_docs.png" ; }; MaskColor = MASK_COL_MAGENTA }; @@ -82,13 +70,7 @@ String STR_SVT_TEMPLATES Image IMG_SVT_TEMPLATES { - ImageBitmap = Bitmap { File = "template.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -Image IMG_SVT_TEMPLATES_HC -{ - ImageBitmap = Bitmap { File = "template_h.bmp" ; }; + ImageBitmap = Bitmap { File = "template.png" ; }; MaskColor = MASK_COL_MAGENTA }; @@ -99,13 +81,7 @@ String STR_SVT_SAMPLES Image IMG_SVT_SAMPLES { - ImageBitmap = Bitmap { File = "samples.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -Image IMG_SVT_SAMPLES_HC -{ - ImageBitmap = Bitmap { File = "samples_h.bmp" ; }; + ImageBitmap = Bitmap { File = "samples.png" ; }; MaskColor = MASK_COL_MAGENTA }; @@ -142,62 +118,32 @@ ToolBox TB_SVT_FILEVIEW Image IMG_SVT_DOCTEMPLATE_BACK_SMALL { - ImageBitmap = Bitmap { File = "back_small.bmp" ; }; + ImageBitmap = Bitmap { File = "back_small.png" ; }; MaskColor = MASK_COL_MAGENTA }; Image IMG_SVT_DOCTEMPLATE_BACK_LARGE { - ImageBitmap = Bitmap { File = "back_large.bmp" ; }; + ImageBitmap = Bitmap { File = "back_large.png" ; }; MaskColor = MASK_COL_MAGENTA }; Image IMG_SVT_DOCTEMPLATE_PREV_SMALL { - ImageBitmap = Bitmap { File = "up_small.bmp" ; }; + ImageBitmap = Bitmap { File = "up_small.png" ; }; MaskColor = MASK_COL_MAGENTA }; Image IMG_SVT_DOCTEMPLATE_PREV_LARGE { - ImageBitmap = Bitmap { File = "up_large.bmp" ; }; + ImageBitmap = Bitmap { File = "up_large.png" ; }; MaskColor = MASK_COL_MAGENTA }; Image IMG_SVT_DOCTEMPLATE_PRINT_SMALL { - ImageBitmap = Bitmap { File = "sc05509.bmp" ; }; + ImageBitmap = Bitmap { File = "sc05509.png" ; }; MaskColor = MASK_COL_MAGENTA }; Image IMG_SVT_DOCTEMPLATE_PRINT_LARGE { - ImageBitmap = Bitmap { File = "lc05509.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_BACK_SMALL -{ - ImageBitmap = Bitmap { File = "back_small_h.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_BACK_LARGE -{ - ImageBitmap = Bitmap { File = "back_large_h.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_PREV_SMALL -{ - ImageBitmap = Bitmap { File = "up_small_h.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_PREV_LARGE -{ - ImageBitmap = Bitmap { File = "up_large_h.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_PRINT_SMALL -{ - ImageBitmap = Bitmap { File = "sch05509.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_PRINT_LARGE -{ - ImageBitmap = Bitmap { File = "lch05509.bmp" ; }; + ImageBitmap = Bitmap { File = "lc05509.png" ; }; MaskColor = MASK_COL_MAGENTA }; @@ -228,42 +174,22 @@ ToolBox TB_SVT_FRAMEWIN Image IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL { - ImageBitmap = Bitmap { File = "info_small.bmp" ; }; + ImageBitmap = Bitmap { File = "info_small.png" ; }; MaskColor = MASK_COL_MAGENTA }; Image IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE { - ImageBitmap = Bitmap { File = "info_large.bmp" ; }; + ImageBitmap = Bitmap { File = "info_large.png" ; }; MaskColor = MASK_COL_MAGENTA }; Image IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL { - ImageBitmap = Bitmap { File = "preview_small.bmp" ; }; + ImageBitmap = Bitmap { File = "preview_small.png" ; }; MaskColor = MASK_COL_MAGENTA }; Image IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE { - ImageBitmap = Bitmap { File = "preview_large.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_DOCINFO_SMALL -{ - ImageBitmap = Bitmap { File = "info_small_h.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_DOCINFO_LARGE -{ - ImageBitmap = Bitmap { File = "info_large_h.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_PREVIEW_SMALL -{ - ImageBitmap = Bitmap { File = "preview_small_h.bmp" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPL_HC_PREVIEW_LARGE -{ - ImageBitmap = Bitmap { File = "preview_large_h.bmp" ; }; + ImageBitmap = Bitmap { File = "preview_large.png" ; }; MaskColor = MASK_COL_MAGENTA }; @@ -355,24 +281,3 @@ String STR_SVT_SAMPLES_HELP { Text [ en-US ] = "Contains a selection of sample letters, reports and other documents"; }; - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/contnr/tooltiplbox.cxx b/svtools/source/contnr/tooltiplbox.cxx index 69073a0793c5..fb610e826f3a 100644 --- a/svtools/source/contnr/tooltiplbox.cxx +++ b/svtools/source/contnr/tooltiplbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -118,3 +119,4 @@ void ToolTipMultiListBox::RequestHelp( const HelpEvent& rHEvt ) // ============================================================================ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index c4ec516a735b..13b8fb553ee5 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,16 +31,8 @@ #define _TREELIST_CXX -#ifndef GCC -#endif - #include <svtools/treelist.hxx> -#ifdef DBG_UTIL -// Prueft Integritaet der Liste nach jeder Operation -//#define CHECK_INTEGRITY -#endif - DBG_NAME(SvListEntry); @@ -128,6 +121,10 @@ SvViewData::~SvViewData() #endif } +//============================================================================= +// SvTreeEntryList +//============================================================================= + void SvTreeEntryList::DestroyAll() { SvListEntry* pPtr = (SvListEntry*)First(); @@ -138,15 +135,19 @@ void SvTreeEntryList::DestroyAll() } } +SvTreeEntryList::SvTreeEntryList(SvTreeEntryList& rList) +{ + maEntryList.clear(); + maCurrent = 0; + for ( size_t i = 0, n = rList.size(); i < n; ++i ) { + maEntryList.push_back( rList[ i ] ); + } +} /************************************************************************* |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvTreeList::SvTreeList() @@ -163,10 +164,6 @@ SvTreeList::SvTreeList() |* |* SvTreeList::~SvTreeList |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvTreeList::~SvTreeList() @@ -182,41 +179,42 @@ SvTreeList::~SvTreeList() |* |* SvTreeList::Broadcast |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ -void SvTreeList::Broadcast( sal_uInt16 nActionId, SvListEntry* pEntry1, - SvListEntry* pEntry2, sal_uLong nPos ) -{ - sal_uLong nViewCount = aViewList.Count(); +void SvTreeList::Broadcast( + sal_uInt16 nActionId, + SvListEntry* pEntry1, + SvListEntry* pEntry2, + sal_uLong nPos +) { + sal_uLong nViewCount = aViewList.size(); for( sal_uLong nCurView = 0; nCurView < nViewCount; nCurView++ ) { - SvListView* pView = (SvListView*)aViewList.GetObject( nCurView ); + SvListView* pView = aViewList[ nCurView ]; if( pView ) pView->ModelNotification( nActionId, pEntry1, pEntry2, nPos ); } } -void SvTreeList::InsertView( SvListView* pView) +void SvTreeList::InsertView( SvListView* pView ) { - sal_uLong nPos = aViewList.GetPos( pView ); - if ( nPos == LIST_ENTRY_NOTFOUND ) - { - aViewList.Insert( pView, LIST_APPEND ); - nRefCount++; + for ( sal_uLong i = 0, n = aViewList.size(); i < n; ++i ) { + if ( aViewList[ i ] == pView ) { + return; + } } + aViewList.push_back( pView ); + nRefCount++; } void SvTreeList::RemoveView( SvListView* pView ) { - sal_uLong nPos = aViewList.GetPos( pView ); - if ( nPos != LIST_ENTRY_NOTFOUND ) - { - aViewList.Remove( pView ); - nRefCount--; + for ( SvListView_impl::iterator it = aViewList.begin(); it < aViewList.end(); ++it ) { + if ( *it == pView ) { + aViewList.erase( it ); + nRefCount--; + break; + } } } @@ -254,10 +252,6 @@ sal_uInt16 SvTreeList::GetDepth( SvListEntry* pEntry ) const |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ void SvTreeList::Clear() @@ -284,10 +278,6 @@ void SvTreeList::Clear() |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ sal_Bool SvTreeList::IsChild( SvListEntry* pParent, SvListEntry* pChild ) const @@ -336,12 +326,13 @@ sal_uLong SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal // Dummy-Ptr einfuegen, weil nListPos durch das // folgende Remove ungueltig werden koennte - SvListEntry* pDummy = 0; pDstList->Insert( pDummy, nListPos ); + SvListEntry* pDummy = 0; + pDstList->insert( pDummy, nListPos ); // loeschen - pSrcList->Remove( pSrcEntry ); + pSrcList->remove( pSrcEntry ); // Hat Parent noch Childs ? - if ( pSrcList->Count() == 0 ) + if ( pSrcList->empty() ) { // Keine Childs, deshalb Child-List loeschen SvListEntry* pParent = pSrcEntry->pParent; @@ -354,7 +345,7 @@ sal_uLong SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal // der ChildList den alten Parent noch benoetigen!) pSrcEntry->pParent = pTargetParent; - pDstList->Replace( pSrcEntry, pDummy ); + pDstList->replace( pSrcEntry, pDummy ); // Listenpositionen in Zielliste korrigieren SetListPositions( pDstList ); @@ -362,7 +353,7 @@ sal_uLong SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal SetListPositions( pSrcList ); #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif sal_uLong nRetVal = pDstList->GetPos( pSrcEntry ); @@ -388,11 +379,11 @@ sal_uLong SvTreeList::Copy(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,sal SvTreeEntryList* pDstList = pTargetParent->pChilds; pClonedEntry->pParent = pTargetParent; // Parent umsetzen - pDstList->Insert( pClonedEntry, nListPos ); // Einfuegen + pDstList->insert( pClonedEntry, nListPos ); // Einfuegen SetListPositions( pDstList ); // Listenpositionen in Zielliste korrigieren #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif Broadcast( LISTACTION_INSERTED_TREE, pClonedEntry ); sal_uLong nRetVal = pDstList->GetPos( pClonedEntry ); @@ -405,10 +396,6 @@ CheckIntegrity(); |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ void SvTreeList::Move( SvListEntry* pSrcEntry, SvListEntry* pDstEntry ) @@ -434,10 +421,6 @@ void SvTreeList::Move( SvListEntry* pSrcEntry, SvListEntry* pDstEntry ) |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ void SvTreeList::Copy( SvListEntry* pSrcEntry, SvListEntry* pDstEntry ) @@ -462,10 +445,6 @@ void SvTreeList::Copy( SvListEntry* pSrcEntry, SvListEntry* pDstEntry ) |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ void SvTreeList::InsertTree( SvListEntry* pSrcEntry, SvListEntry* pDstEntry) { @@ -505,7 +484,7 @@ void SvTreeList::InsertTree(SvListEntry* pSrcEntry, pSrcEntry->pParent = pTargetParent; // Parent umsetzen SvTreeEntryList* pDstList = pTargetParent->pChilds; - pDstList->Insert( pSrcEntry, nListPos ); // einfuegen + pDstList->insert( pSrcEntry, nListPos ); // einfuegen SetListPositions(pDstList); // Listenpositionen in Zielliste korrigieren nEntryCount += GetChildCount( pSrcEntry ); nEntryCount++; // der Parent ist ja auch neu @@ -534,10 +513,6 @@ SvListEntry* SvTreeList::CreateEntry() const |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::Clone( SvListEntry* pEntry, sal_uLong& nCloneCount ) const @@ -554,17 +529,13 @@ SvListEntry* SvTreeList::Clone( SvListEntry* pEntry, sal_uLong& nCloneCount ) co |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds, SvListEntry* pNewParent, sal_uLong& nCloneCount ) const { - DBG_ASSERT(pChilds->Count(),"Childs?"); + DBG_ASSERT(!pChilds->empty(),"Childs?"); SvTreeEntryList* pClonedChilds = new SvTreeEntryList; SvListEntry* pChild = (SvListEntry*)pChilds->First(); while ( pChild ) @@ -579,7 +550,7 @@ SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds, pNewChild->pChilds = pSubChilds; } - pClonedChilds->Insert( pNewChild, LIST_APPEND ); + pClonedChilds->push_back( pNewChild ); pChild = (SvListEntry*)pChilds->Next(); } return pClonedChilds; @@ -590,10 +561,6 @@ SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds, |* |* SvTreeList::GetChildCount |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ sal_uLong SvTreeList::GetChildCount( SvListEntry* pParent ) const @@ -619,10 +586,6 @@ sal_uLong SvTreeList::GetChildCount( SvListEntry* pParent ) const |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ sal_uLong SvTreeList::GetVisibleChildCount(const SvListView* pView, SvListEntry* pParent) const @@ -669,16 +632,12 @@ sal_uLong SvTreeList::GetChildSelectionCount(const SvListView* pView,SvListEntry |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::First() const { if ( nEntryCount ) - return (SvListEntry*)(pRootItem->pChilds->GetObject(0)); + return (SvListEntry*)(*pRootItem->pChilds)[ 0 ]; else return 0; } @@ -687,10 +646,6 @@ SvListEntry* SvTreeList::First() const |* |* SvTreeList::Next |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) const { @@ -712,15 +667,15 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons if ( pActEntry->pChilds /* && pActEntry->pChilds->Count() */ ) { nDepth++; - pActEntry = (SvListEntry*)(pActEntry->pChilds->GetObject(0)); + pActEntry = (SvListEntry*)(*pActEntry->pChilds)[ 0 ]; if ( bWithDepth ) *pDepth = nDepth; return pActEntry; } - if ( pActualList->Count() > ( nActualPos + 1 ) ) + if ( pActualList->size() > ( nActualPos + 1 ) ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos + 1 )); + pActEntry = (SvListEntry*)(*pActualList)[ nActualPos + 1 ]; if ( bWithDepth ) *pDepth = nDepth; return pActEntry; @@ -734,9 +689,9 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons pActualList = pParent->pParent->pChilds; DBG_ASSERT(pActualList,"TreeData corrupt!"); nActualPos = pParent->GetChildListPos(); - if ( pActualList->Count() > ( nActualPos + 1 ) ) + if ( pActualList->size() > ( nActualPos + 1 ) ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos + 1 )); + pActEntry = (SvListEntry*)(*pActualList)[ nActualPos + 1 ]; if ( bWithDepth ) *pDepth = nDepth; return pActEntry; @@ -751,10 +706,6 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons |* |* SvTreeList::Prev |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, sal_uInt16* pDepth ) const { @@ -773,12 +724,12 @@ SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons if ( nActualPos > 0 ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos - 1 )); - while( pActEntry->pChilds /* && pActEntry->pChilds->Count() */ ) + pActEntry = (SvListEntry*)(*pActualList)[ nActualPos - 1 ]; + while( pActEntry->pChilds ) { pActualList = pActEntry->pChilds; nDepth++; - pActEntry = (SvListEntry*)(pActualList->Last()); + pActEntry = (SvListEntry*)(pActualList->last()); } if ( bWithDepth ) *pDepth = nDepth; @@ -803,13 +754,9 @@ SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, sal_uInt16* pDepth ) cons |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ -SvListEntry* SvTreeList::Last( sal_uInt16* /* nDepth */ ) const +SvListEntry* SvTreeList::Last() const { SvTreeEntryList* pActList = pRootItem->pChilds; // if ( pActList->Count() == 0 ) @@ -817,7 +764,7 @@ SvListEntry* SvTreeList::Last( sal_uInt16* /* nDepth */ ) const SvListEntry* pEntry = 0; while( pActList ) { - pEntry = (SvListEntry*)(pActList->Last()); + pEntry = (SvListEntry*)(pActList->last()); pActList = pEntry->pChilds; // if ( pActList->Count() == 0 ) // pActList = 0; @@ -829,10 +776,6 @@ SvListEntry* SvTreeList::Last( sal_uInt16* /* nDepth */ ) const |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvListEntry* pEntry ) const @@ -853,10 +796,6 @@ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvListEntry* pEntr |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ sal_uLong SvTreeList::GetVisibleCount( const SvListView* pView ) const @@ -879,7 +818,7 @@ sal_uLong SvTreeList::GetVisibleCount( const SvListView* pView ) const #ifdef DBG_UTIL if( nPos > 10000000 ) { - DBG_ERROR("nVisibleCount bad"); + OSL_FAIL("nVisibleCount bad"); } #endif ((SvListView*)pView)->nVisibleCount = nPos; @@ -892,10 +831,6 @@ sal_uLong SvTreeList::GetVisibleCount( const SvListView* pView ) const |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ // Funktion geht aus Geschwindigkeitsgruenden davon aus, @@ -922,16 +857,16 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn { DBG_ASSERT(pActEntry->pChilds,"Childs?"); nDepth++; - pActEntry = (SvListEntry*)(pActEntry->pChilds->GetObject(0)); + pActEntry = (SvListEntry*)(*pActEntry->pChilds)[ 0 ]; if ( bWithDepth ) *pActDepth = nDepth; return pActEntry; } nActualPos++; - if ( pActualList->Count() > nActualPos ) + if ( pActualList->size() > nActualPos ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos )); + pActEntry = (SvListEntry*)(*pActualList)[ nActualPos ]; if ( bWithDepth ) *pActDepth = nDepth; return pActEntry; @@ -944,9 +879,9 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn pActualList = pParent->pParent->pChilds; nActualPos = pParent->GetChildListPos(); nActualPos++; - if ( pActualList->Count() > nActualPos ) + if ( pActualList->size() > nActualPos ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos )); + pActEntry = (SvListEntry*)(*pActualList)[ nActualPos ]; if ( bWithDepth ) *pActDepth = nDepth; return pActEntry; @@ -962,10 +897,6 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ // Funktion geht aus Geschwindigkeitsgruenden davon aus, @@ -988,12 +919,12 @@ SvListEntry* SvTreeList::PrevVisible(const SvListView* pView, SvListEntry* pActE if ( nActualPos > 0 ) { - pActEntry = (SvListEntry*)(pActualList->GetObject( nActualPos - 1 )); + pActEntry = (SvListEntry*)(*pActualList)[ nActualPos - 1 ]; while( pView->IsExpanded(pActEntry) ) { pActualList = pActEntry->pChilds; nDepth++; - pActEntry = (SvListEntry*)(pActualList->Last()); + pActEntry = (SvListEntry*)(pActualList->last()); } if ( bWithDepth ) *pActDepth = nDepth; @@ -1018,10 +949,6 @@ SvListEntry* SvTreeList::PrevVisible(const SvListView* pView, SvListEntry* pActE |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::LastVisible( const SvListView* pView, sal_uInt16* pDepth) const @@ -1039,10 +966,6 @@ SvListEntry* SvTreeList::LastVisible( const SvListView* pView, sal_uInt16* pDept |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pEntry,sal_uInt16& nDelta) const @@ -1072,10 +995,6 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pEntry |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::PrevVisible( const SvListView* pView, SvListEntry* pEntry, sal_uInt16& nDelta ) const @@ -1102,10 +1021,6 @@ SvListEntry* SvTreeList::PrevVisible( const SvListView* pView, SvListEntry* pEnt |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::FirstSelected( const SvListView* pView) const @@ -1126,7 +1041,7 @@ SvListEntry* SvTreeList::FirstChild( SvListEntry* pParent ) const pParent = pRootItem; SvListEntry* pResult; if ( pParent->pChilds ) - pResult = (SvListEntry*)(pParent->pChilds->GetObject( 0 )); + pResult = (SvListEntry*)(*pParent->pChilds)[ 0 ]; else pResult = 0; return pResult; @@ -1138,10 +1053,9 @@ SvListEntry* SvTreeList::NextSibling( SvListEntry* pEntry ) const if( !pEntry ) return 0; SvTreeEntryList* pList = pEntry->pParent->pChilds; -// sal_uLong nPos = pList->GetPos( pEntry ); sal_uLong nPos = pEntry->GetChildListPos(); nPos++; - pEntry = (SvListEntry*)(pList->GetObject( nPos )); + pEntry = (SvListEntry*)(*pList)[ nPos ]; return pEntry; } @@ -1152,12 +1066,11 @@ SvListEntry* SvTreeList::PrevSibling( SvListEntry* pEntry ) const return 0; SvTreeEntryList* pList = pEntry->pParent->pChilds; - // sal_uLong nPos = pList->GetPos( pEntry ); sal_uLong nPos = pEntry->GetChildListPos(); if ( nPos == 0 ) return 0; nPos--; - pEntry = (SvListEntry*)(pList->GetObject( nPos )); + pEntry = (SvListEntry*)(*pList)[ nPos ]; return pEntry; } @@ -1170,20 +1083,15 @@ SvListEntry* SvTreeList::LastSibling( SvListEntry* pEntry ) const SvListEntry* pSib = 0; SvTreeEntryList* pSibs = pEntry->pParent->pChilds; if ( pSibs ) - pSib = (SvListEntry*)(pSibs->Last()); + pSib = (SvListEntry*)(pSibs->last()); return pSib; } - /************************************************************************* |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::NextSelected( const SvListView* pView, SvListEntry* pEntry ) const @@ -1199,10 +1107,6 @@ SvListEntry* SvTreeList::NextSelected( const SvListView* pView, SvListEntry* pEn |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::PrevSelected( const SvListView* pView, SvListEntry* pEntry) const @@ -1219,10 +1123,6 @@ SvListEntry* SvTreeList::PrevSelected( const SvListView* pView, SvListEntry* pEn |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ SvListEntry* SvTreeList::LastSelected( const SvListView* pView ) const @@ -1238,10 +1138,6 @@ SvListEntry* SvTreeList::LastSelected( const SvListView* pView ) const |* |* SvTreeList::Insert |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ sal_uLong SvTreeList::Insert( SvListEntry* pEntry,SvListEntry* pParent,sal_uLong nPos ) { @@ -1265,15 +1161,15 @@ sal_uLong SvTreeList::Insert( SvListEntry* pEntry,SvListEntry* pParent,sal_uLong bAbsPositionsValid = sal_False; pEntry->pParent = pParent; - pList->Insert( pEntry, nPos ); + pList->insert( pEntry, nPos ); nEntryCount++; - if( nPos != LIST_APPEND && (nPos != (pList->Count()-1)) ) + if( nPos != ULONG_MAX && (nPos != (pList->size()-1)) ) SetListPositions( pList ); else - pEntry->nListPos = pList->Count()-1; + pEntry->nListPos = pList->size()-1; #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif Broadcast( LISTACTION_INSERTED, pEntry ); return nPos; // pEntry->nListPos; @@ -1283,10 +1179,6 @@ CheckIntegrity(); |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ sal_uLong SvTreeList::GetAbsPos( SvListEntry* pEntry) const @@ -1300,10 +1192,6 @@ sal_uLong SvTreeList::GetAbsPos( SvListEntry* pEntry) const |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ void SvTreeList::SetAbsolutePositions() @@ -1327,10 +1215,6 @@ CheckIntegrity(); |* |* SvTreeList::Expand |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ void SvTreeList::Expand( SvListView* pView, SvListEntry* pEntry ) @@ -1359,10 +1243,6 @@ CheckIntegrity(); |* |* SvTreeList::Collapse |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ void SvTreeList::Collapse( SvListView* pView, SvListEntry* pEntry ) @@ -1392,10 +1272,6 @@ CheckIntegrity(); |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ sal_Bool SvTreeList::Select( SvListView* pView, SvListEntry* pEntry, sal_Bool bSelect ) @@ -1423,7 +1299,7 @@ sal_Bool SvTreeList::Select( SvListView* pView, SvListEntry* pEntry, sal_Bool bS } } #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif return sal_True; } @@ -1432,10 +1308,6 @@ CheckIntegrity(); |* |* SvTreeList::Remove |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 05.04.01 -|* *************************************************************************/ sal_Bool SvTreeList::Remove( SvListEntry* pEntry ) { @@ -1443,7 +1315,7 @@ sal_Bool SvTreeList::Remove( SvListEntry* pEntry ) if( !pEntry->pParent ) { - DBG_ERROR("Removing entry not in model!"); + OSL_FAIL("Removing entry not in model!"); // unter gewissen Umstaenden (welche?) loescht der // Explorer aus der View Eintraege, die er nicht in die View // eingefuegt hat. Da sich der Kunde fuer ein platzendes @@ -1462,20 +1334,20 @@ sal_Bool SvTreeList::Remove( SvListEntry* pEntry ) if ( pEntry->HasChildListPos() ) { - sal_uLong nListPos = pEntry->GetChildListPos(); - bLastEntry = (nListPos == (pList->Count()-1) ) ? sal_True : sal_False; - pList->Remove( nListPos ); + size_t nListPos = pEntry->GetChildListPos(); + bLastEntry = (nListPos == (pList->size()-1) ) ? sal_True : sal_False; + pList->remove( nListPos ); } else { - pList->Remove( (void*) pEntry ); + pList->remove( pEntry ); } // moved to end of method because it is used later with Broadcast // delete pEntry; // loescht auch alle Childs - if ( pList->Count() == 0 ) + if ( pList->empty() ) { pParent->pChilds = 0; delete pList; @@ -1488,7 +1360,7 @@ sal_Bool SvTreeList::Remove( SvListEntry* pEntry ) nEntryCount -= nRemoved; #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif Broadcast( LISTACTION_REMOVED, pEntry ); @@ -1500,10 +1372,6 @@ CheckIntegrity(); |* |* SvTreeList:: |* -|* Beschreibung -|* Ersterstellung 17.08.94 -|* Letzte Aenderung 17.08.94 -|* *************************************************************************/ sal_uLong SvTreeList::SelectChilds(SvListView* pView, SvListEntry* pParent,sal_Bool bSelect ) @@ -1511,7 +1379,7 @@ sal_uLong SvTreeList::SelectChilds(SvListView* pView, SvListEntry* pParent,sal_B DBG_ASSERT(pView&&pParent,"SelChilds:View/Parent?"); if ( !pParent->pChilds ) return 0; - if ( pParent->pChilds->Count() == 0 ) + if ( pParent->pChilds->empty() ) return 0; sal_uInt16 nRefDepth = GetDepth( pParent ); @@ -1526,7 +1394,7 @@ sal_uLong SvTreeList::SelectChilds(SvListView* pView, SvListEntry* pParent,sal_B } while( pParent && nDepth > nRefDepth ); #ifdef CHECK_INTEGRITY -CheckIntegrity(); + CheckIntegrity(); #endif return nCount; } @@ -1580,22 +1448,12 @@ SvListEntry* SvTreeList::GetEntryAtVisPos( const SvListView* pView, sal_uLong nV void SvTreeList::SetListPositions( SvTreeEntryList* pList ) { - if( pList->Count() ) + if( !pList->empty() ) { - SvListEntry* pEntry = (SvListEntry*)(pList->GetObject(0)); + SvListEntry* pEntry = (SvListEntry*)(*pList)[ 0 ]; if( pEntry->pParent ) pEntry->pParent->InvalidateChildrensListPositions(); } - /* - sal_uLong nListPos = 0; - SvListEntry* pEntry = (SvListEntry*)(pList->First()); - while( pEntry ) - { - pEntry->nListPos = nListPos; - nListPos++; - pEntry = (SvListEntry*)(pList->Next()); - } - */ } @@ -1610,7 +1468,7 @@ sal_Bool SvTreeList::IsInChildList( SvListEntry* pParent, SvListEntry* pChild) c pParent = pRootItem; sal_Bool bIsChild = sal_False; if ( pParent->pChilds ) - bIsChild = (sal_Bool)(pParent->pChilds->GetPos(pChild) != LIST_ENTRY_NOTFOUND); + bIsChild = (sal_Bool)(pParent->pChilds->GetPos(pChild) != ULONG_MAX); return bIsChild; } @@ -1838,7 +1696,7 @@ void SvListView::ActionMoving( SvListEntry* pEntry,SvListEntry*,sal_uLong) DBG_CHKTHIS(SvListView,0); SvListEntry* pParent = pEntry->pParent; DBG_ASSERT(pParent,"Model not consistent"); - if( pParent != pModel->pRootItem && pParent->pChilds->Count() == 1 ) + if( pParent != pModel->pRootItem && pParent->pChilds->size() == 1 ) { SvViewData* pViewData = (SvViewData*)aDataTable.Get( (sal_uLong)pParent ); pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); @@ -1937,7 +1795,7 @@ void SvListView::ActionRemoving( SvListEntry* pEntry ) #ifdef DBG_UTIL if( nVisibleCount < nVisibleRemoved ) { - DBG_ERROR("nVisibleRemoved bad"); + OSL_FAIL("nVisibleRemoved bad"); } #endif nVisibleCount -= nVisibleRemoved; @@ -1951,7 +1809,7 @@ void SvListView::ActionRemoving( SvListEntry* pEntry ) SvListEntry* pCurEntry = pEntry->pParent; if ( pCurEntry && pCurEntry != pModel->pRootItem && - pCurEntry->pChilds->Count() == 1 ) + pCurEntry->pChilds->size() == 1 ) { pViewData = (SvViewData*)aDataTable.Get((sal_uLong)pCurEntry); pViewData->nFlags &= (~SVLISTENTRYFLAG_EXPANDED); @@ -2015,7 +1873,7 @@ void SvListView::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1, case LISTACTION_RESORTING: break; default: - DBG_ERROR("unknown ActionId"); + OSL_FAIL("unknown ActionId"); } } @@ -2046,19 +1904,19 @@ void SvTreeList::Resort() void SvTreeList::ResortChilds( SvListEntry* pParent ) { DBG_ASSERT(pParent,"Parent not set"); - List* pChildList = pParent->pChilds; + SvTreeEntryList* pChildList = pParent->pChilds; if( !pChildList ) return; - List aList( *pChildList ); - pChildList->Clear(); + SvTreeEntryList aList( *pChildList ); + pChildList->clear(); - sal_uLong nCount = aList.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aList.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvListEntry* pCurEntry = (SvListEntry*)aList.GetObject( nCur ); - sal_uLong nListPos = LIST_APPEND; + SvListEntry* pCurEntry = (SvListEntry*)aList[ nCur ]; + sal_uLong nListPos = ULONG_MAX; GetInsertionPos( pCurEntry, pParent, nListPos ); - pChildList->Insert( pCurEntry, nListPos ); + pChildList->insert( pCurEntry, nListPos ); if( pCurEntry->pChilds ) ResortChilds( pCurEntry ); } @@ -2073,20 +1931,20 @@ void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent, if( eSortMode == SortNone ) return; - rPos = LIST_APPEND; + rPos = ULONG_MAX; SvTreeEntryList* pChildList = GetChildList( pParent ); - if( pChildList && pChildList->Count() ) + if( pChildList && !pChildList->empty() ) { long i = 0; - long j = pChildList->Count()-1; + long j = pChildList->size()-1; long k; StringCompare eCompare = COMPARE_GREATER; do { k = (i+j)/2; - SvListEntry* pTempEntry = (SvListEntry*)(pChildList->GetObject(k)); + SvListEntry* pTempEntry = (SvListEntry*)(*pChildList)[ k ]; eCompare = Compare( pEntry, pTempEntry ); if( eSortMode == SortDescending && eCompare != COMPARE_EQUAL ) { @@ -2103,8 +1961,8 @@ void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent, if( eCompare != COMPARE_EQUAL ) { - if(i > ((long)pChildList->Count() - 1)) // nicht gefunden, Ende der Liste - rPos = LIST_APPEND; + if(i > ((long)pChildList->size() - 1)) // nicht gefunden, Ende der Liste + rPos = ULONG_MAX; else rPos = i; // nicht gefunden, Mitte } @@ -2114,3 +1972,4 @@ void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent, } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/asynclink.cxx b/svtools/source/control/asynclink.cxx index 7231470528d5..9a48cf0c73a1 100755..100644 --- a/svtools/source/control/asynclink.cxx +++ b/svtools/source/control/asynclink.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,7 +30,7 @@ #include "precompiled_svtools.hxx" #include <svtools/asynclink.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/debug.hxx> #include <vcl/timer.hxx> #include <vcl/svapp.hxx> @@ -39,7 +40,7 @@ namespace svtools { void AsynchronLink::CreateMutex() { - if( !_pMutex ) _pMutex = new vos::OMutex; + if( !_pMutex ) _pMutex = new osl::Mutex; } void AsynchronLink::Call( void* pObj, sal_Bool @@ -137,3 +138,5 @@ void AsynchronLink::Call_Impl( void* pArg ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 17790d1ad4c8..4a0bc4112264 100755..100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -3033,3 +3034,4 @@ void CalendarField::StateChanged( StateChangedType nStateChange ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src index 4dd31765a5c1..f9d0e676f0cb 100755..100644 --- a/svtools/source/control/calendar.src +++ b/svtools/source/control/calendar.src @@ -42,33 +42,3 @@ String STR_SVT_CALENDAR_NONE { Text [ en-US ] = "None" ; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx index 4514ec918b24..7be2700b45c1 100755..100644 --- a/svtools/source/control/collatorres.cxx +++ b/svtools/source/control/collatorres.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -124,3 +125,4 @@ CollatorRessource::GetTranslation (const String &r_Algorithm) return r_Algorithm; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 219b5428edeb..14dae85f4ee8 100755..100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,8 +31,11 @@ #define _CTRLBOX_CXX #include <tools/debug.hxx> +#include <tools/stream.hxx> #include <vcl/svapp.hxx> #include <vcl/field.hxx> +#include <vcl/helper.hxx> +#include <sal/macros.h> #include <comphelper/processfactory.hxx> #include <unotools/charclass.hxx> @@ -39,14 +43,30 @@ #include <svtools/svtools.hrc> #include <svtools/ctrlbox.hxx> #include <svtools/ctrltool.hxx> +#include <svtools/borderhelper.hxx> #include <vcl/i18nhelp.hxx> +#include <vcl/fontcapabilities.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> -#define IMGTEXTSPACE 2 -#define EXTRAFONTSIZE 5 +#include <rtl/bootstrap.hxx> -static sal_Unicode aImplSymbolFontText[] = {0xF021,0xF032,0xF043,0xF054,0xF065,0xF076,0xF0B7,0xF0C8,0}; -static sal_Unicode aImplStarSymbolText[] = {0x2706,0x2704,0x270D,0xE033,0x2211,0x2288,0}; +#if OSL_DEBUG_LEVEL > 1 +#include <cstdio> +#endif + +#define IMGINNERTEXTSPACE 2 +#define IMGOUTERTEXTSPACE 5 +#define EXTRAFONTSIZE 5 +#define MAXPREVIEWWIDTH 100 + +#define TWIPS_TO_PT100(val) (val * 5) +#define PT100_TO_TWIPS(val) (val / 5) + +#define FONTNAMEBOXMRUENTRIESFILE "/user/config/fontnameboxmruentries" + +using namespace ::com::sun::star; // ======================================================================== // ColorListBox @@ -65,13 +85,11 @@ struct ImplColorListData ImplColorListData( const Color& rColor ) : aColor( rColor ) { bColor = sal_True; } }; -DECLARE_LIST( ImpColorList, ImplColorListData* ) - // ----------------------------------------------------------------------- void ColorListBox::ImplInit() { - pColorList = new ImpColorList( 256, 64 ); + pColorList = new ImpColorList(); aImageSize.Width() = GetTextWidth( XubString( RTL_CONSTASCII_USTRINGPARAM( "xxx" ) ) ); aImageSize.Height() = GetTextHeight(); aImageSize.Height() -= 2; @@ -84,12 +102,9 @@ void ColorListBox::ImplInit() void ColorListBox::ImplDestroyColorEntries() { - for ( sal_uInt16 n = (sal_uInt16) pColorList->Count(); n; ) - { - ImplColorListData* pData = pColorList->GetObject( --n ); - delete pData; - } - pColorList->Clear(); + for ( size_t n = pColorList->size(); n; ) + delete (*pColorList)[ --n ]; + pColorList->clear(); } // ----------------------------------------------------------------------- @@ -124,7 +139,17 @@ sal_uInt16 ColorListBox::InsertEntry( const XubString& rStr, sal_uInt16 nPos ) if ( nPos != LISTBOX_ERROR ) { ImplColorListData* pData = new ImplColorListData; - pColorList->Insert( pData, nPos ); + if ( nPos < pColorList->size() ) + { + ImpColorList::iterator it = pColorList->begin(); + ::std::advance( it, nPos ); + pColorList->insert( it, pData ); + } + else + { + pColorList->push_back( pData ); + nPos = pColorList->size() - 1; + } } return nPos; } @@ -138,7 +163,17 @@ sal_uInt16 ColorListBox::InsertEntry( const Color& rColor, const XubString& rStr if ( nPos != LISTBOX_ERROR ) { ImplColorListData* pData = new ImplColorListData( rColor ); - pColorList->Insert( pData, nPos ); + if ( nPos < pColorList->size() ) + { + ImpColorList::iterator it = pColorList->begin(); + ::std::advance( it, nPos ); + pColorList->insert( it, pData ); + } + else + { + pColorList->push_back( pData ); + nPos = pColorList->size() - 1; + } } return nPos; } @@ -156,7 +191,13 @@ void ColorListBox::InsertAutomaticEntry() void ColorListBox::RemoveEntry( sal_uInt16 nPos ) { ListBox::RemoveEntry( nPos ); - delete pColorList->Remove( nPos ); + if ( nPos < pColorList->size() ) + { + ImpColorList::iterator it = pColorList->begin(); + ::std::advance( it, nPos ); + delete *it; + pColorList->erase( it ); + } } // ----------------------------------------------------------------------- @@ -175,13 +216,24 @@ void ColorListBox::CopyEntries( const ColorListBox& rBox ) ImplDestroyColorEntries(); // Daten kopieren - sal_uInt16 nCount = (sal_uInt16) rBox.pColorList->Count(); - for ( sal_uInt16 n = 0; n < nCount; n++ ) + size_t nCount = rBox.pColorList->size(); + for ( size_t n = 0; n < nCount; n++ ) { - ImplColorListData* pData = rBox.pColorList->GetObject( n ); + ImplColorListData* pData = (*rBox.pColorList)[ n ]; sal_uInt16 nPos = InsertEntry( rBox.GetEntry( n ), LISTBOX_APPEND ); if ( nPos != LISTBOX_ERROR ) - pColorList->Insert( new ImplColorListData( *pData ), nPos ); + { + if ( nPos < pColorList->size() ) + { + ImpColorList::iterator it = pColorList->begin(); + ::std::advance( it, nPos ); + pColorList->insert( it, new ImplColorListData( *pData ) ); + } + else + { + pColorList->push_back( new ImplColorListData( *pData ) ); + } + } } } @@ -189,9 +241,9 @@ void ColorListBox::CopyEntries( const ColorListBox& rBox ) sal_uInt16 ColorListBox::GetEntryPos( const Color& rColor ) const { - for( sal_uInt16 n = (sal_uInt16) pColorList->Count(); n; ) + for( sal_uInt16 n = (sal_uInt16) pColorList->size(); n; ) { - ImplColorListData* pData = pColorList->GetObject( --n ); + ImplColorListData* pData = (*pColorList)[ --n ]; if ( pData->bColor && ( pData->aColor == rColor ) ) return n; } @@ -203,7 +255,7 @@ sal_uInt16 ColorListBox::GetEntryPos( const Color& rColor ) const Color ColorListBox::GetEntryColor( sal_uInt16 nPos ) const { Color aColor; - ImplColorListData* pData = pColorList->GetObject( nPos ); + ImplColorListData* pData = ( nPos < pColorList->size() ) ? (*pColorList)[ nPos ] : NULL; if ( pData && pData->bColor ) aColor = pData->aColor; return aColor; @@ -213,7 +265,8 @@ Color ColorListBox::GetEntryColor( sal_uInt16 nPos ) const void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt ) { - ImplColorListData* pData = pColorList->GetObject( rUDEvt.GetItemId() ); + size_t nPos = rUDEvt.GetItemId(); + ImplColorListData* pData = ( nPos < pColorList->size() ) ? (*pColorList)[ nPos ] : NULL; if ( pData ) { if ( pData->bColor ) @@ -239,30 +292,323 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt ) // LineListBox // ======================================================================= -// ------------------- -// - ImpListListData - -// ------------------- +BorderWidthImpl::BorderWidthImpl( sal_uInt16 nFlags, double nRate1, double nRate2, double nRateGap ): + m_nFlags( nFlags ), + m_nRate1( nRate1 ), + m_nRate2( nRate2 ), + m_nRateGap( nRateGap ) +{ +} + +BorderWidthImpl& BorderWidthImpl::operator= ( const BorderWidthImpl& r ) +{ + m_nFlags = r.m_nFlags; + m_nRate1 = r.m_nRate1; + m_nRate2 = r.m_nRate2; + m_nRateGap = r.m_nRateGap; + return *this; +} + +bool BorderWidthImpl::operator== ( const BorderWidthImpl& r ) const +{ + return ( m_nFlags == r.m_nFlags ) && + ( m_nRate1 == r.m_nRate1 ) && + ( m_nRate2 == r.m_nRate2 ) && + ( m_nRateGap == r.m_nRateGap ); +} -struct ImpLineListData +long BorderWidthImpl::GetLine1( long nWidth ) const { - long nLine1; - long nLine2; - long nDistance; + long result = static_cast<long>(m_nRate1); + if ( ( m_nFlags & CHANGE_LINE1 ) > 0 ) + result = static_cast<long>(m_nRate1 * nWidth); + return result; +} + +long BorderWidthImpl::GetLine2( long nWidth ) const +{ + long result = static_cast<long>(m_nRate2); + if ( ( m_nFlags & CHANGE_LINE2 ) > 0 ) + result = static_cast<long>(m_nRate2 * nWidth); + return result; +} + +long BorderWidthImpl::GetGap( long nWidth ) const +{ + long result = static_cast<long>(m_nRateGap); + if ( ( m_nFlags & CHANGE_DIST ) > 0 ) + result = static_cast<long>(m_nRateGap * nWidth); + + // Avoid having too small distances (less than 1pt) + if ( result < 20 && m_nRate1 > 0 && m_nRate2 > 0 ) + result = 20; + + return result; +} + +double lcl_getGuessedWidth( long nTested, double nRate, bool nChanging ) +{ + double nWidth = -1.0; + if ( nChanging ) + nWidth = double( nTested ) / nRate; + else + { + if ( double( nTested ) == nRate ) + nWidth = nRate; + } + + return nWidth; +} + +long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap ) +{ + std::vector< double > aToCompare; + bool bInvalid = false; + + bool bLine1Change = ( m_nFlags & CHANGE_LINE1 ) > 0; + double nWidth1 = lcl_getGuessedWidth( nLine1, m_nRate1, bLine1Change ); + if ( bLine1Change ) + aToCompare.push_back( nWidth1 ); + else if ( !bLine1Change && nWidth1 < 0 ) + bInvalid = true; + + bool bLine2Change = ( m_nFlags & CHANGE_LINE2 ) > 0; + double nWidth2 = lcl_getGuessedWidth( nLine2, m_nRate2, bLine2Change ); + if ( bLine2Change ) + aToCompare.push_back( nWidth2 ); + else if ( !bLine2Change && nWidth2 < 0 ) + bInvalid = true; + + bool bGapChange = ( m_nFlags & CHANGE_DIST ) > 0; + double nWidthGap = lcl_getGuessedWidth( nGap, m_nRateGap, bGapChange ); + if ( bGapChange && nGap > 20 ) + aToCompare.push_back( nWidthGap ); + else if ( !bGapChange && nWidthGap < 0 ) + bInvalid = true; + + double nWidth = 0.0; + if ( !bInvalid && aToCompare.size() > 0 ) + { + nWidth = *aToCompare.begin(); + std::vector< double >::iterator pIt = aToCompare.begin(); + while ( pIt != aToCompare.end() && !bInvalid ) + { + bInvalid = ( nWidth != *pIt ); + ++pIt; + } + if ( bInvalid ) + nWidth = 0.0; + } + + return long( nWidth ); +} + +/** Utility class storing the border line width, style and colors. The widths + are defined in Twips. + */ +class ImpLineListData +{ +private: + BorderWidthImpl m_aWidthImpl; + + Color ( *m_pColor1Fn )( Color ); + Color ( *m_pColor2Fn )( Color ); + Color ( *m_pColorDistFn )( Color, Color ); + + long m_nMinWidth; + sal_uInt16 m_nStyle; + +public: + ImpLineListData( BorderWidthImpl aWidthImpl, sal_uInt16 nStyle, + long nMinWidth=0, Color ( *pColor1Fn ) ( Color ) = &sameColor, + Color ( *pColor2Fn ) ( Color ) = &sameColor, Color ( *pColorDistFn ) ( Color, Color ) = &sameDistColor ); + + /** Returns the computed width of the line 1 in twips. */ + long GetLine1ForWidth( long nWidth ) { return m_aWidthImpl.GetLine1( nWidth ); } + + /** Returns the computed width of the line 2 in twips. */ + long GetLine2ForWidth( long nWidth ) { return m_aWidthImpl.GetLine2( nWidth ); } + + /** Returns the computed width of the gap in twips. */ + long GetDistForWidth( long nWidth ) { return m_aWidthImpl.GetGap( nWidth ); } + + Color GetColorLine1( const Color& aMain ); + Color GetColorLine2( const Color& aMain ); + Color GetColorDist( const Color& aMain, const Color& rDefault ); + + /** Returns the minimum width in twips */ + long GetMinWidth( ); + sal_uInt16 GetStyle( ); }; -DECLARE_LIST( ImpLineList, ImpLineListData* ) +ImpLineListData::ImpLineListData( BorderWidthImpl aWidthImpl, + sal_uInt16 nStyle, long nMinWidth, Color ( *pColor1Fn )( Color ), + Color ( *pColor2Fn )( Color ), Color ( *pColorDistFn )( Color, Color ) ) : + m_aWidthImpl( aWidthImpl ), + m_pColor1Fn( pColor1Fn ), + m_pColor2Fn( pColor2Fn ), + m_pColorDistFn( pColorDistFn ), + m_nMinWidth( nMinWidth ), + m_nStyle( nStyle ) +{ +} -// ----------------------------------------------------------------------- +long ImpLineListData::GetMinWidth( ) +{ + return m_nMinWidth; +} -inline const Color& LineListBox::GetPaintColor( void ) const +Color ImpLineListData::GetColorLine1( const Color& rMain ) { - return maPaintCol; + return ( *m_pColor1Fn )( rMain ); +} + +Color ImpLineListData::GetColorLine2( const Color& rMain ) +{ + return ( *m_pColor2Fn )( rMain ); +} + +Color ImpLineListData::GetColorDist( const Color& rMain, const Color& rDefault ) +{ + return ( *m_pColorDistFn )( rMain, rDefault ); +} + +sal_uInt16 LineListBox::GetSelectEntryStyle( sal_uInt16 nSelIndex ) const +{ + sal_uInt16 nStyle = STYLE_SOLID; + sal_uInt16 nPos = GetSelectEntryPos( nSelIndex ); + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + { + if ( m_sNone.Len( ) > 0 ) + nPos--; + nStyle = GetEntryStyle( nPos ); + } + + return nStyle; +} + +sal_uInt16 ImpLineListData::GetStyle( ) +{ + return m_nStyle; } // ----------------------------------------------------------------------- +void lclDrawPolygon( OutputDevice& rDev, const basegfx::B2DPolygon& rPolygon, long nWidth, sal_uInt16 nDashing ) +{ + sal_uInt16 nOldAA = rDev.GetAntialiasing(); + rDev.SetAntialiasing( nOldAA & !ANTIALIASING_ENABLE_B2DDRAW ); + + basegfx::B2DPolyPolygon aPolygons = svtools::ApplyLineDashing( rPolygon, nDashing, rDev.GetMapMode().GetMapUnit() ); + for ( sal_uInt32 i = 0; i < aPolygons.count( ); i++ ) + { + basegfx::B2DPolygon aDash = aPolygons.getB2DPolygon( i ); + basegfx::B2DPoint aStart = aDash.getB2DPoint( 0 ); + basegfx::B2DPoint aEnd = aDash.getB2DPoint( aDash.count() - 1 ); + + basegfx::B2DVector aVector( aEnd - aStart ); + aVector.normalize( ); + const basegfx::B2DVector aPerpendicular(basegfx::getPerpendicular(aVector)); + + // Handle problems of width 1px in Pixel mode: 0.5px gives a 1px line + long nPix = rDev.PixelToLogic( Size( 0, 1 ) ).Height(); + if ( rDev.GetMapMode().GetMapUnit() == MAP_PIXEL && nWidth == nPix ) + nWidth = 0; + + const basegfx::B2DVector aWidthOffset( double( nWidth ) / 2 * aPerpendicular); + basegfx::B2DPolygon aDashPolygon; + aDashPolygon.append( aStart + aWidthOffset ); + aDashPolygon.append( aEnd + aWidthOffset ); + aDashPolygon.append( aEnd - aWidthOffset ); + aDashPolygon.append( aStart - aWidthOffset ); + aDashPolygon.setClosed( true ); + + rDev.DrawPolygon( aDashPolygon ); + } + + rDev.SetAntialiasing( nOldAA ); +} + +namespace svtools +{ + std::vector < double > GetDashing( sal_uInt16 nDashing, MapUnit eUnit ) + { + ::std::vector < double >aPattern; + switch ( nDashing ) + { + case STYLE_DOTTED: + if ( eUnit == MAP_TWIP ) + { + aPattern.push_back( 30.0 ); + aPattern.push_back( 110.0 ); + } + else if ( eUnit == MAP_100TH_MM ) + { + aPattern.push_back( 50 ); + aPattern.push_back( 200 ); + } + else if ( eUnit == MAP_PIXEL ) + { + aPattern.push_back( 1.0 ); + aPattern.push_back( 3.0 ); + } + break; + case STYLE_DASHED: + if ( eUnit == MAP_TWIP ) + { + aPattern.push_back( 110 ); + aPattern.push_back( 110 ); + } + else if ( eUnit == MAP_100TH_MM ) + { + aPattern.push_back( 200 ); + aPattern.push_back( 200 ); + } + else if ( eUnit == MAP_PIXEL ) + { + aPattern.push_back( 10 ); + aPattern.push_back( 20 ); + } + break; + default: + break; + } + + return aPattern; + } + + basegfx::B2DPolyPolygon ApplyLineDashing( const basegfx::B2DPolygon& rPolygon, sal_uInt16 nDashing, MapUnit eUnit ) + { + std::vector< double > aPattern = GetDashing( nDashing, eUnit ); + basegfx::B2DPolyPolygon aPolygons; + if ( ! aPattern.empty() ) + basegfx::tools::applyLineDashing( rPolygon, aPattern, &aPolygons ); + else + aPolygons.append( rPolygon ); + + return aPolygons; + } + + void DrawLine( OutputDevice& rDev, const Point& rP1, const Point& rP2, + sal_uInt32 nWidth, sal_uInt16 nDashing ) + { + DrawLine( rDev, basegfx::B2DPoint( rP1.X(), rP1.Y() ), + basegfx::B2DPoint( rP2.X(), rP2.Y( ) ), nWidth, nDashing ); + } + + void DrawLine( OutputDevice& rDev, const basegfx::B2DPoint& rP1, const basegfx::B2DPoint& rP2, + sal_uInt32 nWidth, sal_uInt16 nDashing ) + { + basegfx::B2DPolygon aPolygon; + aPolygon.append( rP1 ); + aPolygon.append( rP2 ); + lclDrawPolygon( rDev, aPolygon, nWidth, nDashing ); + } +} + void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, - Bitmap& rBmp, XubString& rStr ) + Color aColor1, Color aColor2, Color aColorDist, + sal_uInt16 nStyle, Bitmap& rBmp ) { Size aSize = GetOutputSizePixel(); aSize.Width() -= 20; @@ -272,26 +618,17 @@ void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, // SourceUnit nach Twips if ( eSourceUnit == FUNIT_POINT ) { - nLine1 *= 20; - nLine2 *= 20; - nDistance *= 20; - } - else if ( eSourceUnit == FUNIT_MM ) - { - nLine1 *= 14440; - nLine1 /= 254; - nLine2 *= 14440; - nLine2 /= 254; - nDistance *= 14440; - nDistance /= 254; + nLine1 /= 5; + nLine2 /= 5; + nDistance /= 5; } // Linien malen aSize = aVirDev.PixelToLogic( aSize ); long nPix = aVirDev.PixelToLogic( Size( 0, 1 ) ).Height(); - long n1 = nLine1 / 100; - long n2 = nLine2 / 100; - long nDist = nDistance / 100; + sal_uInt32 n1 = nLine1; + sal_uInt32 n2 = nLine2; + long nDist = nDistance; n1 += nPix-1; n1 -= n1%nPix; if ( n2 ) @@ -310,48 +647,31 @@ void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, Size aVirSize = aVirDev.LogicToPixel( aSize ); if ( aVirDev.GetOutputSizePixel() != aVirSize ) aVirDev.SetOutputSizePixel( aVirSize ); - aVirDev.SetFillColor( GetSettings().GetStyleSettings().GetFieldColor() ); + aVirDev.SetFillColor( aColorDist ); aVirDev.DrawRect( Rectangle( Point(), aSize ) ); - aVirDev.SetFillColor( GetPaintColor() ); - aVirDev.DrawRect( Rectangle( 0, 0, aSize.Width(), n1-nPix ) ); + aVirDev.SetFillColor( aColor1 ); + + double y1 = double( n1 ) / 2; + svtools::DrawLine( aVirDev, basegfx::B2DPoint( 0, y1 ), basegfx::B2DPoint( aSize.Width( ), y1 ), n1, nStyle ); + if ( n2 ) { - aVirDev.DrawRect( Rectangle( 0, n1+nDist, - aSize.Width(), n1+nDist+n2-nPix ) ); + double y2 = n1 + nDist + double( n2 ) / 2; + aVirDev.SetFillColor( aColor2 ); + svtools::DrawLine( aVirDev, basegfx::B2DPoint( 0, y2 ), basegfx::B2DPoint( aSize.Width(), y2 ), n2, STYLE_SOLID ); } rBmp = aVirDev.GetBitmap( Point(), Size( aSize.Width(), n1+nDist+n2 ) ); } - // Twips nach Unit - if ( eUnit == FUNIT_POINT ) - { - nLine1 /= 20; - nLine2 /= 20; - nDistance /= 20; - rStr.AssignAscii( " pt" ); - } - else if ( eUnit == FUNIT_MM ) - { - nLine1 *= 254; - nLine1 /= 14400; - nLine2 *= 254; - nLine2 /= 14400; - nDistance *= 254; - nDistance /= 14400; - rStr.AssignAscii( " mm" ); - } - - String aNum( GetSettings().GetLocaleI18nHelper().GetNum( nLine1+nLine2+nDistance, 2 ) ); - rStr.Insert( aNum, 0 ); } // ----------------------------------------------------------------------- void LineListBox::ImplInit() { - aTxtSize.Width() = GetTextWidth( XubString( RTL_CONSTASCII_USTRINGPARAM( "99,99 mm" ) ) ); + aTxtSize.Width() = GetTextWidth( XubString( RTL_CONSTASCII_USTRINGPARAM( " " ) ) ); aTxtSize.Height() = GetTextHeight(); - pLineList = new ImpLineList; + pLineList = new ImpLineList(); eUnit = FUNIT_POINT; eSourceUnit = FUNIT_POINT; @@ -365,6 +685,8 @@ void LineListBox::ImplInit() LineListBox::LineListBox( Window* pParent, WinBits nWinStyle ) : ListBox( pParent, nWinStyle ), + m_nWidth( 5 ), + m_sNone( ), aColor( COL_BLACK ), maPaintCol( COL_BLACK ) { @@ -375,6 +697,8 @@ LineListBox::LineListBox( Window* pParent, WinBits nWinStyle ) : LineListBox::LineListBox( Window* pParent, const ResId& rResId ) : ListBox( pParent, rResId ), + m_nWidth( 5 ), + m_sNone( ), aColor( COL_BLACK ), maPaintCol( COL_BLACK ) { @@ -385,47 +709,76 @@ LineListBox::LineListBox( Window* pParent, const ResId& rResId ) : LineListBox::~LineListBox() { - sal_uLong n = 0; - sal_uLong nCount = pLineList->Count(); - while ( n < nCount ) - { - ImpLineListData* pData = pLineList->GetObject( n ); - if ( pData ) - delete pData; - n++; + for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) { + if ( (*pLineList)[ i ] ) { + delete (*pLineList)[ i ]; + } } + pLineList->clear(); delete pLineList; } +sal_uInt16 LineListBox::GetStylePos( sal_uInt16 nListPos, long nWidth ) +{ + sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; + if ( m_sNone.Len( ) > 0 ) + nListPos--; + + sal_uInt16 i = 0; + sal_uInt16 n = 0; + sal_uInt16 nCount = pLineList->size(); + while ( nPos == LISTBOX_ENTRY_NOTFOUND && i < nCount ) + { + ImpLineListData* pData = (*pLineList)[ i ]; + if ( pData && pData->GetMinWidth() <= nWidth ) + { + if ( nListPos == n ) + nPos = i; + n++; + } + i++; + } + + return nPos; +} + + +void LineListBox::SelectEntry( sal_uInt16 nStyle, sal_Bool bSelect ) +{ + sal_uInt16 nPos = GetEntryPos( nStyle ); + if ( nPos != LISTBOX_ENTRY_NOTFOUND ) + ListBox::SelectEntryPos( nPos, bSelect ); +} + // ----------------------------------------------------------------------- sal_uInt16 LineListBox::InsertEntry( const XubString& rStr, sal_uInt16 nPos ) { nPos = ListBox::InsertEntry( rStr, nPos ); - if ( nPos != LISTBOX_ERROR ) - pLineList->Insert( NULL, nPos ); + if ( nPos != LISTBOX_ERROR ) { + if ( nPos < pLineList->size() ) { + ImpLineList::iterator it = pLineList->begin(); + ::std::advance( it, nPos ); + pLineList->insert( it, NULL ); + } else { + pLineList->push_back( NULL ); + } + } return nPos; } // ----------------------------------------------------------------------- -sal_uInt16 LineListBox::InsertEntry( long nLine1, long nLine2, long nDistance, - sal_uInt16 nPos ) +void LineListBox::InsertEntry( + BorderWidthImpl aWidthImpl, + sal_uInt16 nStyle, long nMinWidth, + Color ( *pColor1Fn )( Color ), Color ( *pColor2Fn )( Color ), + Color ( *pColorDistFn )( Color, Color ) ) { - XubString aStr; - Bitmap aBmp; - ImpGetLine( nLine1, nLine2, nDistance, aBmp, aStr ); - nPos = ListBox::InsertEntry( aStr, aBmp, nPos ); - if ( nPos != LISTBOX_ERROR ) - { - ImpLineListData* pData = new ImpLineListData; - pData->nLine1 = nLine1; - pData->nLine2 = nLine2; - pData->nDistance = nDistance; - pLineList->Insert( pData, nPos ); - } - - return nPos; + ImpLineListData* pData = new ImpLineListData( + aWidthImpl, nStyle, nMinWidth, + pColor1Fn, pColor2Fn, pColorDistFn ); + pLineList->push_back( pData ); } // ----------------------------------------------------------------------- @@ -433,50 +786,46 @@ sal_uInt16 LineListBox::InsertEntry( long nLine1, long nLine2, long nDistance, void LineListBox::RemoveEntry( sal_uInt16 nPos ) { ListBox::RemoveEntry( nPos ); - ImpLineListData* pData = pLineList->Remove( nPos ); - if ( pData ) - delete pData; + + if ( nPos < pLineList->size() ) { + ImpLineList::iterator it = pLineList->begin(); + ::std::advance( it, nPos ); + if ( *it ) delete *it; + pLineList->erase( it ); + } } // ----------------------------------------------------------------------- void LineListBox::Clear() { - sal_uLong n = 0; - sal_uLong nCount = pLineList->Count(); - while ( n < nCount ) - { - ImpLineListData* pData = pLineList->GetObject( n ); - if ( pData ) - delete pData; - n++; + for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) { + if ( (*pLineList)[ i ] ) { + delete (*pLineList)[ i ]; + } } + pLineList->clear(); - pLineList->Clear(); ListBox::Clear(); } // ----------------------------------------------------------------------- -sal_uInt16 LineListBox::GetEntryPos( long nLine1, long nLine2, - long nDistance ) const +sal_uInt16 LineListBox::GetEntryPos( sal_uInt16 nStyle ) const { - sal_uLong n = 0; - sal_uLong nCount = pLineList->Count(); - while ( n < nCount ) - { - ImpLineListData* pData = pLineList->GetObject( n ); + for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) { + ImpLineListData* pData = (*pLineList)[ i ]; if ( pData ) { - if ( (pData->nLine1 == nLine1) && - (pData->nLine2 == nLine2) && - (pData->nDistance == nDistance) ) - return (sal_uInt16)n; + if ( GetEntryStyle( i ) == nStyle ) + { + size_t nPos = i; + if ( m_sNone.Len() > 0 ) + nPos ++; + return (sal_uInt16)nPos; + } } - - n++; } - return LISTBOX_ENTRY_NOTFOUND; } @@ -484,70 +833,32 @@ sal_uInt16 LineListBox::GetEntryPos( long nLine1, long nLine2, long LineListBox::GetEntryLine1( sal_uInt16 nPos ) const { - ImpLineListData* pData = pLineList->GetObject( nPos ); - if ( pData ) - return pData->nLine1; - else - return 0; + ImpLineListData* pData = (nPos < pLineList->size()) ? (*pLineList)[ nPos ] : NULL; + return ( pData ) ? pData->GetLine1ForWidth( m_nWidth ) : 0; } // ----------------------------------------------------------------------- long LineListBox::GetEntryLine2( sal_uInt16 nPos ) const { - ImpLineListData* pData = pLineList->GetObject( nPos ); - if ( pData ) - return pData->nLine2; - else - return 0; + ImpLineListData* pData = (nPos < pLineList->size()) ? (*pLineList)[ nPos ] : NULL; + return ( pData ) ? pData->GetLine2ForWidth( m_nWidth ) : 0; } // ----------------------------------------------------------------------- long LineListBox::GetEntryDistance( sal_uInt16 nPos ) const { - ImpLineListData* pData = pLineList->GetObject( nPos ); - if ( pData ) - return pData->nDistance; - else - return 0; + ImpLineListData* pData = (nPos < pLineList->size()) ? (*pLineList)[ nPos ] : NULL; + return ( pData ) ? pData->GetDistForWidth( m_nWidth ) : 0; } // ----------------------------------------------------------------------- -void LineListBox::UpdateLineColors( void ) +sal_uInt16 LineListBox::GetEntryStyle( sal_uInt16 nPos ) const { - if( UpdatePaintLineColor() ) - { - sal_uLong nCount = pLineList->Count(); - if( !nCount ) - return; - - XubString aStr; - Bitmap aBmp; - - // exchange entries which containing lines - SetUpdateMode( sal_False ); - - sal_uInt16 nSelEntry = GetSelectEntryPos(); - for( sal_uLong n = 0 ; n < nCount ; ++n ) - { - ImpLineListData* pData = pLineList->GetObject( n ); - if( pData ) - { - // exchange listbox data - ListBox::RemoveEntry( sal_uInt16( n ) ); - ImpGetLine( pData->nLine1, pData->nLine2, pData->nDistance, aBmp, aStr ); - ListBox::InsertEntry( aStr, aBmp, sal_uInt16( n ) ); - } - } - - if( nSelEntry != LISTBOX_ENTRY_NOTFOUND ) - SelectEntryPos( nSelEntry ); - - SetUpdateMode( sal_True ); - Invalidate(); - } + ImpLineListData* pData = (nPos < pLineList->size()) ? (*pLineList)[ nPos ] : NULL; + return ( pData ) ? pData->GetStyle() : STYLE_SOLID; } // ----------------------------------------------------------------------- @@ -566,6 +877,89 @@ sal_Bool LineListBox::UpdatePaintLineColor( void ) return bRet; } +void LineListBox::UpdateEntries( long nOldWidth ) +{ + SetUpdateMode( sal_False ); + + UpdatePaintLineColor( ); + + sal_uInt16 nSelEntry = GetSelectEntryPos(); + sal_uInt16 nTypePos = GetStylePos( nSelEntry, nOldWidth ); + + // Remove the old entries + while ( GetEntryCount( ) > 0 ) + ListBox::RemoveEntry( 0 ); + + // Add the new entries based on the defined width + if ( m_sNone.Len( ) > 0 ) + ListBox::InsertEntry( m_sNone, LISTBOX_APPEND ); + + sal_uInt16 n = 0; + sal_uInt16 nCount = pLineList->size( ); + while ( n < nCount ) + { + ImpLineListData* pData = (*pLineList)[ n ]; + if ( pData && pData->GetMinWidth() <= m_nWidth ) + { + Bitmap aBmp; + ImpGetLine( pData->GetLine1ForWidth( m_nWidth ), + pData->GetLine2ForWidth( m_nWidth ), + pData->GetDistForWidth( m_nWidth ), + GetColorLine1( GetEntryCount( ) ), + GetColorLine2( GetEntryCount( ) ), + GetColorDist( GetEntryCount( ) ), + pData->GetStyle(), aBmp ); + ListBox::InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( " " ) ), aBmp, LISTBOX_APPEND ); + if ( n == nTypePos ) + SelectEntryPos( GetEntryCount() - 1 ); + } + else if ( n == nTypePos ) + SetNoSelection(); + n++; + } + + SetUpdateMode( sal_True ); + Invalidate(); +} + +// ----------------------------------------------------------------------- + +Color LineListBox::GetColorLine1( sal_uInt16 nPos ) +{ + Color rResult = GetPaintColor( ); + + sal_uInt16 nStyle = GetStylePos( nPos, m_nWidth ); + ImpLineListData* pData = (*pLineList)[ nStyle ]; + if ( pData ) + rResult = pData->GetColorLine1( GetColor( ) ); + + return rResult; +} + +Color LineListBox::GetColorLine2( sal_uInt16 nPos ) +{ + Color rResult = GetPaintColor( ); + + sal_uInt16 nStyle = GetStylePos( nPos, m_nWidth ); + ImpLineListData* pData = (*pLineList)[ nStyle ]; + if ( pData ) + rResult = pData->GetColorLine2( GetColor( ) ); + + return rResult; +} + +Color LineListBox::GetColorDist( sal_uInt16 nPos ) +{ + Color rResult = GetSettings().GetStyleSettings().GetFieldColor(); + + sal_uInt16 nStyle = GetStylePos( nPos, m_nWidth ); + ImpLineListData* pData = (*pLineList)[ nStyle ]; + if ( pData ) + rResult = pData->GetColorDist( GetColor( ), rResult ); + + return rResult; +} + // ----------------------------------------------------------------------- void LineListBox::DataChanged( const DataChangedEvent& rDCEvt ) @@ -573,9 +967,10 @@ void LineListBox::DataChanged( const DataChangedEvent& rDCEvt ) ListBox::DataChanged( rDCEvt ); if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - UpdateLineColors(); + UpdateEntries( m_nWidth ); } + // =================================================================== // FontNameBox // =================================================================== @@ -592,8 +987,6 @@ struct ImplFontNameListData {} }; -DECLARE_LIST( ImplFontList, ImplFontNameListData* ) - // ------------------------------------------------------------------- FontNameBox::FontNameBox( Window* pParent, WinBits nWinStyle ) : @@ -603,6 +996,7 @@ FontNameBox::FontNameBox( Window* pParent, WinBits nWinStyle ) : mpFontList = NULL; mbWYSIWYG = sal_False; mbSymbols = sal_False; + InitFontMRUEntriesFile(); } // ------------------------------------------------------------------- @@ -614,12 +1008,14 @@ FontNameBox::FontNameBox( Window* pParent, const ResId& rResId ) : mpFontList = NULL; mbWYSIWYG = sal_False; mbSymbols = sal_False; + InitFontMRUEntriesFile(); } // ------------------------------------------------------------------- FontNameBox::~FontNameBox() { + SaveMRUEntries (maFontMRUEntriesFile); ImplDestroyFontList(); } @@ -635,13 +1031,71 @@ void FontNameBox::DataChanged( const DataChangedEvent& rDCEvt ) // ------------------------------------------------------------------- -void FontNameBox::InitBitmaps( void ) +void FontNameBox::SaveMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep ) const +{ + ByteString aEntries = ByteString( GetMRUEntries( cSep ), RTL_TEXTENCODING_UTF8 ); + + if( ! aEntries.Len() || ! aFontMRUEntriesFile.Len() ) + return; + + SvFileStream aStream; + aStream.Open( aFontMRUEntriesFile, STREAM_WRITE | STREAM_TRUNC ); + if( ! (aStream.IsOpen() && aStream.IsWritable()) ) + { +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "FontNameBox::SaveMRUEntries: opening mru entries file %s failed\n", ByteString(aFontMRUEntriesFile , RTL_TEXTENCODING_UTF8 ).GetBuffer() ); +#endif + return; + } + + aStream.SetLineDelimiter( LINEEND_LF ); + aStream.WriteLine( aEntries ); + aStream.WriteLine( ByteString() ); +} + +// ------------------------------------------------------------------- + +void FontNameBox::LoadMRUEntries( const String& aFontMRUEntriesFile, xub_Unicode cSep ) { - sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + if( ! aFontMRUEntriesFile.Len() ) + return; - maImagePrinterFont = Image( SvtResId( bHC? RID_IMG_PRINTERFONT_HC : RID_IMG_PRINTERFONT ) ); - maImageBitmapFont = Image( SvtResId( bHC? RID_IMG_BITMAPFONT_HC : RID_IMG_BITMAPFONT ) ); - maImageScalableFont = Image( SvtResId( bHC? RID_IMG_SCALABLEFONT_HC : RID_IMG_SCALABLEFONT ) ); + SvFileStream aStream( aFontMRUEntriesFile, STREAM_READ ); + if( ! aStream.IsOpen() ) + { +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "FontNameBox::LoadMRUEntries: opening mru entries file %s failed\n", ByteString( aFontMRUEntriesFile, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); +#endif + return; + } + + ByteString aLine; + aStream.ReadLine( aLine ); + XubString aEntries = XubString( aLine, RTL_TEXTENCODING_UTF8 ); + SetMRUEntries( aEntries, cSep ); +} + +// ------------------------------------------------------------------ + +void FontNameBox::InitFontMRUEntriesFile() +{ + rtl::OUString sUserConfigDir(RTL_CONSTASCII_USTRINGPARAM("${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}")); + rtl::Bootstrap::expandMacros(sUserConfigDir); + + maFontMRUEntriesFile = sUserConfigDir; + if( maFontMRUEntriesFile.Len() ) + { + maFontMRUEntriesFile.AppendAscii( FONTNAMEBOXMRUENTRIESFILE ); + } +} + +// ------------------------------------------------------------------- + +void FontNameBox::InitBitmaps( void ) +{ + maImagePrinterFont = Image( SvtResId( RID_IMG_PRINTERFONT ) ); + maImageBitmapFont = Image( SvtResId( RID_IMG_BITMAPFONT ) ); + maImageScalableFont = Image( SvtResId( RID_IMG_SCALABLEFONT ) ); } // ------------------------------------------------------------------- @@ -650,12 +1104,10 @@ void FontNameBox::ImplDestroyFontList() { if ( mpFontList ) { - ImplFontNameListData* pInfo = mpFontList->First(); - while ( pInfo ) - { - delete pInfo; - pInfo = mpFontList->Next(); + for ( size_t i = 0, n = mpFontList->size(); i < n; ++i ) { + delete (*mpFontList)[ i ]; } + mpFontList->clear(); delete mpFontList; } } @@ -666,6 +1118,8 @@ void FontNameBox::Fill( const FontList* pList ) { // store old text and clear box XubString aOldText = GetText(); + XubString rEntries = GetMRUEntries(); + sal_Bool bLoadFromFile = ! rEntries.Len(); Clear(); ImplDestroyFontList(); @@ -681,10 +1135,21 @@ void FontNameBox::Fill( const FontList* pList ) { sal_uInt16 nType = pList->GetFontNameType( i ); ImplFontNameListData* pData = new ImplFontNameListData( rFontInfo, nType ); - mpFontList->Insert( pData, nIndex ); + if ( nIndex < mpFontList->size() ) { + ImplFontList::iterator it = mpFontList->begin(); + ::std::advance( it, nIndex ); + mpFontList->insert( it, pData ); + } else { + mpFontList->push_back( pData ); + } } } + if ( bLoadFromFile ) + LoadMRUEntries (maFontMRUEntriesFile); + else + SetMRUEntries( rEntries ); + ImplCalcUserItemSize(); // restore text @@ -723,57 +1188,869 @@ void FontNameBox::ImplCalcUserItemSize() Size aUserItemSz; if ( mbWYSIWYG && mpFontList ) { - sal_uInt16 nMaxLen = 0; - sal_Bool bSymbolFont = sal_False; - sal_Bool bStarSymbol = sal_False; - for ( sal_uInt16 n = GetEntryCount(); n; ) - { - ImplFontNameListData* pData = mpFontList->GetObject( --n ); - XubString aFontName = pData->maInfo.GetName(); - if ( aFontName.Len() > nMaxLen ) - nMaxLen = aFontName.Len(); - if ( pData->maInfo.GetCharSet() == RTL_TEXTENCODING_SYMBOL ) - bSymbolFont = sal_True; - // starsymbol is a unicode font, but gets WYSIWIG symbols - if( aFontName.EqualsIgnoreCaseAscii( "starsymbol" ) - || aFontName.EqualsIgnoreCaseAscii( "opensymbol" ) ) - bSymbolFont = bStarSymbol = sal_True; - } - - // guess maximimum width - Size aOneCharSz( GetTextWidth( String( 'X' ) ), GetTextHeight() ); - Size aSz( aOneCharSz ); - aSz.Width() *= nMaxLen; - // only XX% of width, because ListBox calculates the normal width... - aSz.Width() *= 1; - aSz.Width() /= 10; - if ( bSymbolFont ) - { - int nLength = sizeof(aImplSymbolFontText)/sizeof(aImplSymbolFontText[0]) - 1; - int nLength2 = sizeof(aImplStarSymbolText)/sizeof(aImplStarSymbolText[0]) - 1; - if( bStarSymbol && (nLength < nLength2) ) - nLength = nLength2; - aSz.Width() += aOneCharSz.Width() * nLength; - } - aSz.Height() *= 14; - aSz.Height() /= 10; - aUserItemSz = aSz; + aUserItemSz = Size(MAXPREVIEWWIDTH, GetTextHeight() ); + aUserItemSz.Height() *= 16; + aUserItemSz.Height() /= 10; } if ( mbSymbols ) { Size aSz = maImageScalableFont.GetSizePixel(); - aUserItemSz.Width() += aSz.Width() + IMGTEXTSPACE; + aUserItemSz.Width() += aSz.Width() + IMGINNERTEXTSPACE; + + if ( mbWYSIWYG && mpFontList ) + aUserItemSz.Width() += IMGOUTERTEXTSPACE; + if ( aSz.Height() > aUserItemSz.Height() ) aUserItemSz.Height() = aSz.Height(); } SetUserItemSize( aUserItemSz ); } +#define MKTAG(s) sal_uInt32((((((s[0]<<8)+s[1])<<8)+s[2])<<8)+s[3]) +#define TRADITIONAL_CHINESE 0x01000000 +#define SIMPLIFIED_CHINESE 0x02000000 +#define JAPANESE 0x04000000 +#define KOREAN 0x08000000 +#define HEBREW_MINIMAL 0x10000000 +#define GREEK_MINIMAL 0x20000000 + +namespace +{ + rtl::OUString getRepresentativeText(size_t nScript) + { + rtl::OUString sSampleText; + switch (nScript) + { + case vcl::UnicodeCoverage::GREEK_AND_COPTIC: + { + const sal_Unicode aGrek[] = { + 0x0391, 0x03BB, 0x03C6, 0x03AC, 0x03B2, 0x03B7, 0x03C4, 0x03BF + }; + sSampleText = rtl::OUString(aGrek, SAL_N_ELEMENTS(aGrek)); + break; + } + case GREEK_MINIMAL: + { + const sal_Unicode aGrek[] = { + 0x0391, 0x0392 + }; + sSampleText = rtl::OUString(aGrek, SAL_N_ELEMENTS(aGrek)); + break; + } + case vcl::UnicodeCoverage::HEBREW: + { + const sal_Unicode aHebr[] = { + 0x05D0, 0x05B8, 0x05DC, 0x05B6, 0x05E3, 0x05D1, 0x05B5, 0x05BC, + 0x05D9, 0x05EA, 0x0020, 0x05E2, 0x05B4, 0x05D1, 0x05B0, 0x05E8, + 0x05B4, 0x05D9 + }; + sSampleText = rtl::OUString(aHebr, SAL_N_ELEMENTS(aHebr)); + break; + } + case HEBREW_MINIMAL: + { + const sal_Unicode aHebr[] = { + 0x05D0, 0x05D1 + }; + sSampleText = rtl::OUString(aHebr, SAL_N_ELEMENTS(aHebr)); + break; + } + case vcl::UnicodeCoverage::ARABIC: + { + const sal_Unicode aArab[] = { + 0x0623, 0x0628, 0x062C, 0x062F, 0x064A, 0x0629, 0x0020, 0x0639, + 0x0631, 0x0628, 0x064A, 0x0629 + }; + sSampleText = rtl::OUString(aArab, SAL_N_ELEMENTS(aArab)); + break; + } + case vcl::UnicodeCoverage::DEVANAGARI: + { + const sal_Unicode aDeva[] = { + 0x0926, 0x0947, 0x0935, 0x0928, 0x093E, 0x0917, 0x0930, 0x0940 + }; + sSampleText = rtl::OUString(aDeva, SAL_N_ELEMENTS(aDeva)); + break; + } + case vcl::UnicodeCoverage::BENGALI: + { + const sal_Unicode aBeng[] = { + 0x09AC, 0x09BE, 0x0982, 0x09B2, 0x09BE, 0x0020, 0x09B2, 0x09BF, + 0x09AA, 0x09BF + }; + sSampleText = rtl::OUString(aBeng, SAL_N_ELEMENTS(aBeng)); + break; + } + case vcl::UnicodeCoverage::GURMUKHI: + { + const sal_Unicode aGuru[] = { + 0x0A17, 0x0A41, 0x0A30, 0x0A2E, 0x0A41, 0x0A16, 0x0A40 + }; + sSampleText = rtl::OUString(aGuru, SAL_N_ELEMENTS(aGuru)); + break; + } + case vcl::UnicodeCoverage::GUJARATI: + { + const sal_Unicode aGujr[] = { + 0x0A97, 0x0AC1, 0x0A9C, 0x0AB0, 0x0ABE, 0x0AA4, 0x0aC0, 0x0020, + 0x0AB2, 0x0ABF, 0x0AAA, 0x0ABF + }; + sSampleText = rtl::OUString(aGujr, SAL_N_ELEMENTS(aGujr)); + break; + } + case vcl::UnicodeCoverage::ORIYA: + { + const sal_Unicode aOrya[] = { + 0x0B09, 0x0B24, 0x0B4D, 0x0B15, 0x0B33, 0x0020, 0x0B32, 0x0B3F, + 0x0B2A, 0x0B3F + }; + sSampleText = rtl::OUString(aOrya, SAL_N_ELEMENTS(aOrya)); + break; + } + case vcl::UnicodeCoverage::TAMIL: + { + const sal_Unicode aTaml[] = { + 0x0B85, 0x0BB0, 0x0BBF, 0x0B9A, 0x0BCD, 0x0B9A, 0x0BC1, 0x0BB5, + 0x0B9F, 0x0BBF + }; + sSampleText = rtl::OUString(aTaml, SAL_N_ELEMENTS(aTaml)); + break; + } + case vcl::UnicodeCoverage::TELUGU: + { + const sal_Unicode aTelu[] = { + 0x0C24, 0x0C46, 0x0C32, 0x0C41, 0x0C17, 0x0C41 + }; + sSampleText = rtl::OUString(aTelu, SAL_N_ELEMENTS(aTelu)); + break; + } + case vcl::UnicodeCoverage::KANNADA: + { + const sal_Unicode aKnda[] = { + 0x0C95, 0x0CA8, 0x0CCD, 0x0CA8, 0x0CA1, 0x0020, 0x0CB2, 0x0CBF, + 0x0CAA, 0x0CBF + }; + sSampleText = rtl::OUString(aKnda, SAL_N_ELEMENTS(aKnda)); + break; + } + case vcl::UnicodeCoverage::MALAYALAM: + { + const sal_Unicode aMlym[] = { + 0x0D2E, 0x0D32, 0x0D2F, 0x0D3E, 0x0D33, 0x0D32, 0x0D3F, 0x0D2A, + 0x0D3F + }; + sSampleText = rtl::OUString(aMlym, SAL_N_ELEMENTS(aMlym)); + break; + } + case vcl::UnicodeCoverage::THAI: + { + const sal_Unicode aThai[] = { + 0x0E2D, 0x0E31, 0x0E01, 0x0E29, 0x0E23, 0x0E44, 0x0E17, 0x0E22 + }; + sSampleText = rtl::OUString(aThai, SAL_N_ELEMENTS(aThai)); + break; + } + case vcl::UnicodeCoverage::LAO: + { + const sal_Unicode aLao[] = { + 0x0EAD, 0x0EB1, 0x0E81, 0x0EAA, 0x0EAD, 0x0E99, 0x0EA5, 0x0EB2, + 0x0EA7 + }; + sSampleText = rtl::OUString(aLao, SAL_N_ELEMENTS(aLao)); + break; + } + case vcl::UnicodeCoverage::GEORGIAN: + { + const sal_Unicode aGeorgian[] = { + 0x10D3, 0x10D0, 0x10DB, 0x10EC, 0x10D4, 0x10E0, 0x10DA, 0x10DD, + 0x10D1, 0x10D0 + }; + sSampleText = rtl::OUString(aGeorgian, SAL_N_ELEMENTS(aGeorgian)); + break; + } + case vcl::UnicodeCoverage::HANGUL_JAMO: + case KOREAN: + { + const sal_Unicode aHang[] = { + 0xD55C, 0xAE00 + }; + sSampleText = rtl::OUString(aHang, SAL_N_ELEMENTS(aHang)); + break; + } + case vcl::UnicodeCoverage::TIBETAN: + { + const sal_Unicode aTibt[] = { + 0x0F51, 0x0F56, 0x0F74, 0x0F0B, 0x0F45, 0x0F53, 0x0F0B + }; + sSampleText = rtl::OUString(aTibt, SAL_N_ELEMENTS(aTibt)); + break; + } + case vcl::UnicodeCoverage::SYRIAC: + { + const sal_Unicode aSyri[] = { + 0x0723, 0x071B, 0x072A, 0x0722, 0x0713, 0x0720, 0x0710 + }; + sSampleText = rtl::OUString(aSyri, SAL_N_ELEMENTS(aSyri)); + break; + } + case vcl::UnicodeCoverage::THAANA: + { + const sal_Unicode aThaa[] = { + 0x078C, 0x07A7, 0x0782, 0x07A6 + }; + sSampleText = rtl::OUString(aThaa, SAL_N_ELEMENTS(aThaa)); + break; + } + case vcl::UnicodeCoverage::SINHALA: + { + const sal_Unicode aSinh[] = { + 0x0DC1, 0x0DD4, 0x0DAF, 0x0DCA, 0x0DB0, 0x0020, 0x0DC3, 0x0DD2, + 0x0D82, 0x0DC4, 0x0DBD + }; + sSampleText = rtl::OUString(aSinh, SAL_N_ELEMENTS(aSinh)); + break; + } + case vcl::UnicodeCoverage::MYANMAR: + { + const sal_Unicode aMymr[] = { + 0x1019, 0x103C, 0x1014, 0x103A, 0x1019, 0x102C, 0x1021, 0x1000, + 0x1039, 0x1001, 0x101B, 0x102C + }; + sSampleText = rtl::OUString(aMymr, SAL_N_ELEMENTS(aMymr)); + break; + } + case vcl::UnicodeCoverage::ETHIOPIC: + { + const sal_Unicode aEthi[] = { + 0x130D, 0x12D5, 0x12DD + }; + sSampleText = rtl::OUString(aEthi, SAL_N_ELEMENTS(aEthi)); + break; + } + case vcl::UnicodeCoverage::CHEROKEE: + { + const sal_Unicode aCher[] = { + 0x13D7, 0x13AA, 0x13EA, 0x13B6, 0x13D9, 0x13D7 + }; + sSampleText = rtl::OUString(aCher, SAL_N_ELEMENTS(aCher)); + break; + } + case vcl::UnicodeCoverage::KHMER: + { + const sal_Unicode aKhmr[] = { + 0x17A2, 0x1780, 0x17D2, 0x1781, 0x179A, 0x1780, 0x17D2, 0x179A, + 0x1798, 0x1781, 0x17C1, 0x1798, 0x179A, 0x1797, 0x17B6, 0x179F, + 0x17B6 + }; + sSampleText = rtl::OUString(aKhmr, SAL_N_ELEMENTS(aKhmr)); + break; + } + case vcl::UnicodeCoverage::MONGOLIAN: + { + const sal_Unicode aMongolian[] = { + 0x182A, 0x1822, 0x1834, 0x1822, 0x182D, 0x180C + }; + sSampleText = rtl::OUString(aMongolian, SAL_N_ELEMENTS(aMongolian)); + break; + } + case vcl::UnicodeCoverage::TAGALOG: + { + const sal_Unicode aTagalog[] = { + 0x170A, 0x170A, 0x170C, 0x1712 + }; + sSampleText = rtl::OUString(aTagalog, SAL_N_ELEMENTS(aTagalog)); + break; + } + case vcl::UnicodeCoverage::NEW_TAI_LUE: + { + const sal_Unicode aTalu[] = { + 0x1991, 0x19BA, 0x199F, 0x19B9, 0x19C9 + }; + sSampleText = rtl::OUString(aTalu, SAL_N_ELEMENTS(aTalu)); + break; + } + case TRADITIONAL_CHINESE: + { + const sal_Unicode aTraditionalChinese[] = { + 0x7E41 + }; + sSampleText = rtl::OUString(aTraditionalChinese, SAL_N_ELEMENTS(aTraditionalChinese)); + break; + } + case SIMPLIFIED_CHINESE: + { + const sal_Unicode aSimplifiedChinese[] = { + 0x7B80 + }; + sSampleText = rtl::OUString(aSimplifiedChinese, SAL_N_ELEMENTS(aSimplifiedChinese)); + break; + } + case TRADITIONAL_CHINESE|SIMPLIFIED_CHINESE: + { + const sal_Unicode aSimplifiedAndTraditionalChinese[] = { + 0x7B80, 0x7E41 + }; + sSampleText = rtl::OUString(aSimplifiedAndTraditionalChinese, SAL_N_ELEMENTS(aSimplifiedAndTraditionalChinese)); + break; + } + case JAPANESE: + { + const sal_Unicode aJapanese[] = { + 0x65E5, 0x672C, 0x8A9E + }; + sSampleText = rtl::OUString(aJapanese, SAL_N_ELEMENTS(aJapanese)); + break; + } + default: + break; + } + return sSampleText; + } + +#if OSL_DEBUG_LEVEL > 2 + void lcl_dump_unicode_coverage(const boost::dynamic_bitset<sal_uInt32> &rIn) + { + if (rIn[vcl::UnicodeCoverage::BASIC_LATIN]) + fprintf(stderr, "BASIC_LATIN\n"); + if (rIn[vcl::UnicodeCoverage::LATIN_1_SUPPLEMENT]) + fprintf(stderr, "LATIN_1_SUPPLEMENT\n"); + if (rIn[vcl::UnicodeCoverage::LATIN_EXTENDED_A]) + fprintf(stderr, "LATIN_EXTENDED_A\n"); + if (rIn[vcl::UnicodeCoverage::LATIN_EXTENDED_B]) + fprintf(stderr, "LATIN_EXTENDED_B\n"); + if (rIn[vcl::UnicodeCoverage::IPA_EXTENSIONS]) + fprintf(stderr, "IPA_EXTENSIONS\n"); + if (rIn[vcl::UnicodeCoverage::SPACING_MODIFIER_LETTERS]) + fprintf(stderr, "SPACING_MODIFIER_LETTERS\n"); + if (rIn[vcl::UnicodeCoverage::COMBINING_DIACRITICAL_MARKS]) + fprintf(stderr, "COMBINING_DIACRITICAL_MARKS\n"); + if (rIn[vcl::UnicodeCoverage::GREEK_AND_COPTIC]) + fprintf(stderr, "GREEK_AND_COPTIC\n"); + if (rIn[vcl::UnicodeCoverage::COPTIC]) + fprintf(stderr, "COPTIC\n"); + if (rIn[vcl::UnicodeCoverage::CYRILLIC]) + fprintf(stderr, "CYRILLIC\n"); + if (rIn[vcl::UnicodeCoverage::ARMENIAN]) + fprintf(stderr, "ARMENIAN\n"); + if (rIn[vcl::UnicodeCoverage::HEBREW]) + fprintf(stderr, "HEBREW\n"); + if (rIn[vcl::UnicodeCoverage::VAI]) + fprintf(stderr, "VAI\n"); + if (rIn[vcl::UnicodeCoverage::ARABIC]) + fprintf(stderr, "ARABIC\n"); + if (rIn[vcl::UnicodeCoverage::NKO]) + fprintf(stderr, "NKO\n"); + if (rIn[vcl::UnicodeCoverage::DEVANAGARI]) + fprintf(stderr, "DEVANAGARI\n"); + if (rIn[vcl::UnicodeCoverage::BENGALI]) + fprintf(stderr, "BENGALI\n"); + if (rIn[vcl::UnicodeCoverage::GURMUKHI]) + fprintf(stderr, "GURMUKHI\n"); + if (rIn[vcl::UnicodeCoverage::GUJARATI]) + fprintf(stderr, "GUJARATI\n"); + if (rIn[vcl::UnicodeCoverage::ORIYA]) + fprintf(stderr, "ORIYA\n"); + if (rIn[vcl::UnicodeCoverage::TAMIL]) + fprintf(stderr, "TAMIL\n"); + if (rIn[vcl::UnicodeCoverage::TELUGU]) + fprintf(stderr, "TELUGU\n"); + if (rIn[vcl::UnicodeCoverage::KANNADA]) + fprintf(stderr, "KANNADA\n"); + if (rIn[vcl::UnicodeCoverage::MALAYALAM]) + fprintf(stderr, "MALAYALAM\n"); + if (rIn[vcl::UnicodeCoverage::THAI]) + fprintf(stderr, "THAI\n"); + if (rIn[vcl::UnicodeCoverage::LAO]) + fprintf(stderr, "LAO\n"); + if (rIn[vcl::UnicodeCoverage::GEORGIAN]) + fprintf(stderr, "GEORGIAN\n"); + if (rIn[vcl::UnicodeCoverage::BALINESE]) + fprintf(stderr, "BALINESE\n"); + if (rIn[vcl::UnicodeCoverage::HANGUL_JAMO]) + fprintf(stderr, "HANGUL_JAMO\n"); + if (rIn[vcl::UnicodeCoverage::LATIN_EXTENDED_ADDITIONAL]) + fprintf(stderr, "LATIN_EXTENDED_ADDITIONAL\n"); + if (rIn[vcl::UnicodeCoverage::GREEK_EXTENDED]) + fprintf(stderr, "GREEK_EXTENDED\n"); + if (rIn[vcl::UnicodeCoverage::GENERAL_PUNCTUATION]) + fprintf(stderr, "GENERAL_PUNCTUATION\n"); + if (rIn[vcl::UnicodeCoverage::SUPERSCRIPTS_AND_SUBSCRIPTS]) + fprintf(stderr, "SUPERSCRIPTS_AND_SUBSCRIPTS\n"); + if (rIn[vcl::UnicodeCoverage::CURRENCY_SYMBOLS]) + fprintf(stderr, "CURRENCY_SYMBOLS\n"); + if (rIn[vcl::UnicodeCoverage::COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS]) + fprintf(stderr, "COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS\n"); + if (rIn[vcl::UnicodeCoverage::LETTERLIKE_SYMBOLS]) + fprintf(stderr, "LETTERLIKE_SYMBOLS\n"); + if (rIn[vcl::UnicodeCoverage::NUMBER_FORMS]) + fprintf(stderr, "NUMBER_FORMS\n"); + if (rIn[vcl::UnicodeCoverage::ARROWS]) + fprintf(stderr, "ARROWS\n"); + if (rIn[vcl::UnicodeCoverage::MATHEMATICAL_OPERATORS]) + fprintf(stderr, "MATHEMATICAL_OPERATORS\n"); + if (rIn[vcl::UnicodeCoverage::MISCELLANEOUS_TECHNICAL]) + fprintf(stderr, "MISCELLANEOUS_TECHNICAL\n"); + if (rIn[vcl::UnicodeCoverage::CONTROL_PICTURES]) + fprintf(stderr, "CONTROL_PICTURES\n"); + if (rIn[vcl::UnicodeCoverage::OPTICAL_CHARACTER_RECOGNITION]) + fprintf(stderr, "OPTICAL_CHARACTER_RECOGNITION\n"); + if (rIn[vcl::UnicodeCoverage::ENCLOSED_ALPHANUMERICS]) + fprintf(stderr, "ENCLOSED_ALPHANUMERICS\n"); + if (rIn[vcl::UnicodeCoverage::BOX_DRAWING]) + fprintf(stderr, "BOX_DRAWING\n"); + if (rIn[vcl::UnicodeCoverage::BLOCK_ELEMENTS]) + fprintf(stderr, "BLOCK_ELEMENTS\n"); + if (rIn[vcl::UnicodeCoverage::GEOMETRIC_SHAPES]) + fprintf(stderr, "GEOMETRIC_SHAPES\n"); + if (rIn[vcl::UnicodeCoverage::MISCELLANEOUS_SYMBOLS]) + fprintf(stderr, "MISCELLANEOUS_SYMBOLS\n"); + if (rIn[vcl::UnicodeCoverage::DINGBATS]) + fprintf(stderr, "DINGBATS\n"); + if (rIn[vcl::UnicodeCoverage::CJK_SYMBOLS_AND_PUNCTUATION]) + fprintf(stderr, "CJK_SYMBOLS_AND_PUNCTUATION\n"); + if (rIn[vcl::UnicodeCoverage::HIRAGANA]) + fprintf(stderr, "HIRAGANA\n"); + if (rIn[vcl::UnicodeCoverage::KATAKANA]) + fprintf(stderr, "KATAKANA\n"); + if (rIn[vcl::UnicodeCoverage::BOPOMOFO]) + fprintf(stderr, "BOPOMOFO\n"); + if (rIn[vcl::UnicodeCoverage::HANGUL_COMPATIBILITY_JAMO]) + fprintf(stderr, "HANGUL_COMPATIBILITY_JAMO\n"); + if (rIn[vcl::UnicodeCoverage::PHAGS_PA]) + fprintf(stderr, "PHAGS_PA\n"); + if (rIn[vcl::UnicodeCoverage::ENCLOSED_CJK_LETTERS_AND_MONTHS]) + fprintf(stderr, "ENCLOSED_CJK_LETTERS_AND_MONTHS\n"); + if (rIn[vcl::UnicodeCoverage::CJK_COMPATIBILITY]) + fprintf(stderr, "CJK_COMPATIBILITY\n"); + if (rIn[vcl::UnicodeCoverage::HANGUL_SYLLABLES]) + fprintf(stderr, "HANGUL_SYLLABLES\n"); + if (rIn[vcl::UnicodeCoverage::NONPLANE_0]) + fprintf(stderr, "NONPLANE_0\n"); + if (rIn[vcl::UnicodeCoverage::PHOENICIAN]) + fprintf(stderr, "PHOENICIAN\n"); + if (rIn[vcl::UnicodeCoverage::CJK_UNIFIED_IDEOGRAPHS]) + fprintf(stderr, "CJK_UNIFIED_IDEOGRAPHS\n"); + if (rIn[vcl::UnicodeCoverage::PRIVATE_USE_AREA_PLANE_0]) + fprintf(stderr, "PRIVATE_USE_AREA_PLANE_0\n"); + if (rIn[vcl::UnicodeCoverage::CJK_STROKES]) + fprintf(stderr, "CJK_STROKES\n"); + if (rIn[vcl::UnicodeCoverage::ALPHABETIC_PRESENTATION_FORMS]) + fprintf(stderr, "ALPHABETIC_PRESENTATION_FORMS\n"); + if (rIn[vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_A]) + fprintf(stderr, "ARABIC_PRESENTATION_FORMS_A\n"); + if (rIn[vcl::UnicodeCoverage::COMBINING_HALF_MARKS]) + fprintf(stderr, "COMBINING_HALF_MARKS\n"); + if (rIn[vcl::UnicodeCoverage::VERTICAL_FORMS]) + fprintf(stderr, "VERTICAL_FORMS\n"); + if (rIn[vcl::UnicodeCoverage::SMALL_FORM_VARIANTS]) + fprintf(stderr, "SMALL_FORM_VARIANTS\n"); + if (rIn[vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_B]) + fprintf(stderr, "ARABIC_PRESENTATION_FORMS_B\n"); + if (rIn[vcl::UnicodeCoverage::HALFWIDTH_AND_FULLWIDTH_FORMS]) + fprintf(stderr, "HALFWIDTH_AND_FULLWIDTH_FORMS\n"); + if (rIn[vcl::UnicodeCoverage::SPECIALS]) + fprintf(stderr, "SPECIALS\n"); + if (rIn[vcl::UnicodeCoverage::TIBETAN]) + fprintf(stderr, "TIBETAN\n"); + if (rIn[vcl::UnicodeCoverage::SYRIAC]) + fprintf(stderr, "SYRIAC\n"); + if (rIn[vcl::UnicodeCoverage::THAANA]) + fprintf(stderr, "THAANA\n"); + if (rIn[vcl::UnicodeCoverage::SINHALA]) + fprintf(stderr, "SINHALA\n"); + if (rIn[vcl::UnicodeCoverage::MYANMAR]) + fprintf(stderr, "MYANMAR\n"); + if (rIn[vcl::UnicodeCoverage::ETHIOPIC]) + fprintf(stderr, "ETHIOPIC\n"); + if (rIn[vcl::UnicodeCoverage::CHEROKEE]) + fprintf(stderr, "CHEROKEE\n"); + if (rIn[vcl::UnicodeCoverage::UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS]) + fprintf(stderr, "UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS\n"); + if (rIn[vcl::UnicodeCoverage::OGHAM]) + fprintf(stderr, "OGHAM\n"); + if (rIn[vcl::UnicodeCoverage::RUNIC]) + fprintf(stderr, "RUNIC\n"); + if (rIn[vcl::UnicodeCoverage::KHMER]) + fprintf(stderr, "KHMER\n"); + if (rIn[vcl::UnicodeCoverage::MONGOLIAN]) + fprintf(stderr, "MONGOLIAN\n"); + if (rIn[vcl::UnicodeCoverage::BRAILLE_PATTERNS]) + fprintf(stderr, "BRAILLE_PATTERNS\n"); + if (rIn[vcl::UnicodeCoverage::YI_SYLLABLES]) + fprintf(stderr, "YI_SYLLABLES\n"); + if (rIn[vcl::UnicodeCoverage::TAGALOG]) + fprintf(stderr, "TAGALOG\n"); + if (rIn[vcl::UnicodeCoverage::OLD_ITALIC]) + fprintf(stderr, "OLD_ITALIC\n"); + if (rIn[vcl::UnicodeCoverage::GOTHIC]) + fprintf(stderr, "GOTHIC\n"); + if (rIn[vcl::UnicodeCoverage::DESERET]) + fprintf(stderr, "DESERET\n"); + if (rIn[vcl::UnicodeCoverage::BYZANTINE_MUSICAL_SYMBOLS]) + fprintf(stderr, "BYZANTINE_MUSICAL_SYMBOLS\n"); + if (rIn[vcl::UnicodeCoverage::MATHEMATICAL_ALPHANUMERIC_SYMBOLS]) + fprintf(stderr, "MATHEMATICAL_ALPHANUMERIC_SYMBOLS\n"); + if (rIn[vcl::UnicodeCoverage::PRIVATE_USE_PLANE_15]) + fprintf(stderr, "PRIVATE_USE_PLANE_15\n"); + if (rIn[vcl::UnicodeCoverage::VARIATION_SELECTORS]) + fprintf(stderr, "VARIATION_SELECTORS\n"); + if (rIn[vcl::UnicodeCoverage::TAGS]) + fprintf(stderr, "TAGS\n"); + if (rIn[vcl::UnicodeCoverage::LIMBU]) + fprintf(stderr, "LIMBU\n"); + if (rIn[vcl::UnicodeCoverage::TAI_LE]) + fprintf(stderr, "TAI_LE\n"); + if (rIn[vcl::UnicodeCoverage::NEW_TAI_LUE]) + fprintf(stderr, "NEW_TAI_LUE\n"); + if (rIn[vcl::UnicodeCoverage::BUGINESE]) + fprintf(stderr, "BUGINESE\n"); + if (rIn[vcl::UnicodeCoverage::GLAGOLITIC]) + fprintf(stderr, "GLAGOLITIC\n"); + if (rIn[vcl::UnicodeCoverage::TIFINAGH]) + fprintf(stderr, "TIFINAGH\n"); + if (rIn[vcl::UnicodeCoverage::YIJING_HEXAGRAM_SYMBOLS]) + fprintf(stderr, "YIJING_HEXAGRAM_SYMBOLS\n"); + if (rIn[vcl::UnicodeCoverage::SYLOTI_NAGRI]) + fprintf(stderr, "SYLOTI_NAGRI\n"); + if (rIn[vcl::UnicodeCoverage::LINEAR_B_SYLLABARY]) + fprintf(stderr, "LINEAR_B_SYLLABARY\n"); + if (rIn[vcl::UnicodeCoverage::ANCIENT_GREEK_NUMBERS]) + fprintf(stderr, "ANCIENT_GREEK_NUMBERS\n"); + if (rIn[vcl::UnicodeCoverage::UGARITIC]) + fprintf(stderr, "UGARITIC\n"); + if (rIn[vcl::UnicodeCoverage::OLD_PERSIAN]) + fprintf(stderr, "OLD_PERSIAN\n"); + if (rIn[vcl::UnicodeCoverage::SHAVIAN]) + fprintf(stderr, "SHAVIAN\n"); + if (rIn[vcl::UnicodeCoverage::OSMANYA]) + fprintf(stderr, "OSMANYA\n"); + if (rIn[vcl::UnicodeCoverage::CYPRIOT_SYLLABARY]) + fprintf(stderr, "CYPRIOT_SYLLABARY\n"); + if (rIn[vcl::UnicodeCoverage::KHAROSHTHI]) + fprintf(stderr, "KHAROSHTHI\n"); + if (rIn[vcl::UnicodeCoverage::TAI_XUAN_JING_SYMBOLS]) + fprintf(stderr, "TAI_XUAN_JING_SYMBOLS\n"); + if (rIn[vcl::UnicodeCoverage::CUNEIFORM]) + fprintf(stderr, "CUNEIFORM\n"); + if (rIn[vcl::UnicodeCoverage::COUNTING_ROD_NUMERALS]) + fprintf(stderr, "COUNTING_ROD_NUMERALS\n"); + if (rIn[vcl::UnicodeCoverage::SUNDANESE]) + fprintf(stderr, "SUNDANESE\n"); + if (rIn[vcl::UnicodeCoverage::LEPCHA]) + fprintf(stderr, "LEPCHA\n"); + if (rIn[vcl::UnicodeCoverage::OL_CHIKI]) + fprintf(stderr, "OL_CHIKI\n"); + if (rIn[vcl::UnicodeCoverage::SAURASHTRA]) + fprintf(stderr, "SAURASHTRA\n"); + if (rIn[vcl::UnicodeCoverage::KAYAH_LI]) + fprintf(stderr, "KAYAH_LI\n"); + if (rIn[vcl::UnicodeCoverage::REJANG]) + fprintf(stderr, "REJANG\n"); + if (rIn[vcl::UnicodeCoverage::CHAM]) + fprintf(stderr, "CHAM\n"); + if (rIn[vcl::UnicodeCoverage::ANCIENT_SYMBOLS]) + fprintf(stderr, "ANCIENT_SYMBOLS\n"); + if (rIn[vcl::UnicodeCoverage::PHAISTOS_DISC]) + fprintf(stderr, "PHAISTOS_DISC\n"); + if (rIn[vcl::UnicodeCoverage::CARIAN]) + fprintf(stderr, "CARIAN\n"); + if (rIn[vcl::UnicodeCoverage::DOMINO_TILES]) + fprintf(stderr, "DOMINO_TILES\n"); + if (rIn[vcl::UnicodeCoverage::RESERVED1]) + fprintf(stderr, "RESERVED1\n"); + if (rIn[vcl::UnicodeCoverage::RESERVED2]) + fprintf(stderr, "RESERVED2\n"); + if (rIn[vcl::UnicodeCoverage::RESERVED3]) + fprintf(stderr, "RESERVED3\n"); + if (rIn[vcl::UnicodeCoverage::RESERVED4]) + fprintf(stderr, "RESERVED4\n"); + if (rIn[vcl::UnicodeCoverage::RESERVED5]) + fprintf(stderr, "RESERVED5\n"); + } + + void lcl_dump_codepage_coverage(const boost::dynamic_bitset<sal_uInt32> &rIn) + { + if (rIn[vcl::CodePageCoverage::CP1252]) + fprintf(stderr, "CP1252\n"); + if (rIn[vcl::CodePageCoverage::CP1250]) + fprintf(stderr, "CP1250\n"); + if (rIn[vcl::CodePageCoverage::CP1251]) + fprintf(stderr, "CP1251\n"); + if (rIn[vcl::CodePageCoverage::CP1253]) + fprintf(stderr, "CP1253\n"); + if (rIn[vcl::CodePageCoverage::CP1254]) + fprintf(stderr, "CP1254\n"); + if (rIn[vcl::CodePageCoverage::CP1255]) + fprintf(stderr, "CP1255\n"); + if (rIn[vcl::CodePageCoverage::CP1256]) + fprintf(stderr, "CP1256\n"); + if (rIn[vcl::CodePageCoverage::CP1257]) + fprintf(stderr, "CP1257\n"); + if (rIn[vcl::CodePageCoverage::CP1258]) + fprintf(stderr, "CP1258\n"); + if (rIn[vcl::CodePageCoverage::CP874]) + fprintf(stderr, "CP874\n"); + if (rIn[vcl::CodePageCoverage::CP932]) + fprintf(stderr, "CP932\n"); + if (rIn[vcl::CodePageCoverage::CP936]) + fprintf(stderr, "CP936\n"); + if (rIn[vcl::CodePageCoverage::CP949]) + fprintf(stderr, "CP949\n"); + if (rIn[vcl::CodePageCoverage::CP950]) + fprintf(stderr, "CP950\n"); + if (rIn[vcl::CodePageCoverage::CP1361]) + fprintf(stderr, "CP1361\n"); + if (rIn[vcl::CodePageCoverage::CP869]) + fprintf(stderr, "CP869\n"); + if (rIn[vcl::CodePageCoverage::CP866]) + fprintf(stderr, "CP866\n"); + if (rIn[vcl::CodePageCoverage::CP865]) + fprintf(stderr, "CP865\n"); + if (rIn[vcl::CodePageCoverage::CP864]) + fprintf(stderr, "CP864\n"); + if (rIn[vcl::CodePageCoverage::CP863]) + fprintf(stderr, "CP863\n"); + if (rIn[vcl::CodePageCoverage::CP862]) + fprintf(stderr, "CP862\n"); + if (rIn[vcl::CodePageCoverage::CP861]) + fprintf(stderr, "CP861\n"); + if (rIn[vcl::CodePageCoverage::CP860]) + fprintf(stderr, "CP860\n"); + if (rIn[vcl::CodePageCoverage::CP857]) + fprintf(stderr, "CP857\n"); + if (rIn[vcl::CodePageCoverage::CP855]) + fprintf(stderr, "CP855\n"); + if (rIn[vcl::CodePageCoverage::CP852]) + fprintf(stderr, "CP852\n"); + if (rIn[vcl::CodePageCoverage::CP775]) + fprintf(stderr, "CP775\n"); + if (rIn[vcl::CodePageCoverage::CP737]) + fprintf(stderr, "CP737\n"); + if (rIn[vcl::CodePageCoverage::CP780]) + fprintf(stderr, "CP780\n"); + if (rIn[vcl::CodePageCoverage::CP850]) + fprintf(stderr, "CP850\n"); + if (rIn[vcl::CodePageCoverage::CP437]) + fprintf(stderr, "CP437\n"); + } +#endif + + size_t getScript(const vcl::FontCapabilities &rFontCapabilities) + { + boost::dynamic_bitset<sal_uInt32> aGenericMask(vcl::UnicodeCoverage::MAX_UC_ENUM); + aGenericMask.set(); + aGenericMask.set(vcl::UnicodeCoverage::BASIC_LATIN, false); + aGenericMask.set(vcl::UnicodeCoverage::LATIN_1_SUPPLEMENT, false); + aGenericMask.set(vcl::UnicodeCoverage::LATIN_EXTENDED_A, false); + aGenericMask.set(vcl::UnicodeCoverage::LATIN_EXTENDED_B, false); + aGenericMask.set(vcl::UnicodeCoverage::IPA_EXTENSIONS, false); + aGenericMask.set(vcl::UnicodeCoverage::SPACING_MODIFIER_LETTERS, false); + aGenericMask.set(vcl::UnicodeCoverage::COMBINING_DIACRITICAL_MARKS, false); + aGenericMask.set(vcl::UnicodeCoverage::COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS, false); + aGenericMask.set(vcl::UnicodeCoverage::LATIN_EXTENDED_ADDITIONAL, false); + aGenericMask.set(vcl::UnicodeCoverage::GENERAL_PUNCTUATION, false); + aGenericMask.set(vcl::UnicodeCoverage::GEOMETRIC_SHAPES, false); + aGenericMask.set(vcl::UnicodeCoverage::SUPERSCRIPTS_AND_SUBSCRIPTS, false); + aGenericMask.set(vcl::UnicodeCoverage::CURRENCY_SYMBOLS, false); + aGenericMask.set(vcl::UnicodeCoverage::LETTERLIKE_SYMBOLS, false); + aGenericMask.set(vcl::UnicodeCoverage::DINGBATS, false); + aGenericMask.set(vcl::UnicodeCoverage::PRIVATE_USE_AREA_PLANE_0, false); + aGenericMask.set(vcl::UnicodeCoverage::ALPHABETIC_PRESENTATION_FORMS, false); + aGenericMask.set(vcl::UnicodeCoverage::NUMBER_FORMS, false); + aGenericMask.set(vcl::UnicodeCoverage::ARROWS, false); + aGenericMask.set(vcl::UnicodeCoverage::MATHEMATICAL_OPERATORS, false); + aGenericMask.set(vcl::UnicodeCoverage::MATHEMATICAL_ALPHANUMERIC_SYMBOLS, false); + aGenericMask.set(vcl::UnicodeCoverage::MISCELLANEOUS_TECHNICAL, false); + aGenericMask.set(vcl::UnicodeCoverage::CONTROL_PICTURES, false); + aGenericMask.set(vcl::UnicodeCoverage::ENCLOSED_ALPHANUMERICS, false); + aGenericMask.set(vcl::UnicodeCoverage::BOX_DRAWING, false); + aGenericMask.set(vcl::UnicodeCoverage::BLOCK_ELEMENTS, false); + aGenericMask.set(vcl::UnicodeCoverage::MISCELLANEOUS_SYMBOLS, false); + aGenericMask.set(vcl::UnicodeCoverage::SPECIALS, false); + aGenericMask.set(vcl::UnicodeCoverage::NONPLANE_0, false); + aGenericMask.set(vcl::UnicodeCoverage::PRIVATE_USE_PLANE_15, false); + aGenericMask.set(vcl::UnicodeCoverage::CJK_SYMBOLS_AND_PUNCTUATION, false); + + boost::dynamic_bitset<sal_uInt32> aMasked = rFontCapabilities.maUnicodeRange & aGenericMask; + + if (aMasked.count() == 1) + return aMasked.find_first(); + + + if (aMasked[vcl::UnicodeCoverage::ARABIC]) + { + aMasked.set(vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_A, false); + aMasked.set(vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_B, false); + aMasked.set(vcl::UnicodeCoverage::NKO, false); + //Probably strongly tuned for Arabic + if (aMasked.count() == 1) + return vcl::UnicodeCoverage::ARABIC; + if (aMasked.count() == 2 && aMasked[vcl::UnicodeCoverage::SYRIAC]) + return vcl::UnicodeCoverage::SYRIAC; + } + + if (aMasked[vcl::UnicodeCoverage::DEVANAGARI]) + { + aMasked.set(vcl::UnicodeCoverage::DEVANAGARI, false); + //Probably strongly tuned for a single Indic script + if (aMasked.count() == 1) + return aMasked.find_first(); + } + + aMasked.set(vcl::UnicodeCoverage::GREEK_EXTENDED, false); + aMasked.set(vcl::UnicodeCoverage::GREEK_AND_COPTIC, false); + if (aMasked.count() == 1) + return aMasked.find_first(); + + if (aMasked[vcl::UnicodeCoverage::CYRILLIC]) + { + //Probably strongly tuned for Georgian + if (aMasked.count() == 2 && aMasked[vcl::UnicodeCoverage::GEORGIAN]) + return vcl::UnicodeCoverage::GEORGIAN; + } + + boost::dynamic_bitset<sal_uInt32> aCJKMask(vcl::UnicodeCoverage::MAX_UC_ENUM); + aCJKMask.set(); + aCJKMask.set(vcl::UnicodeCoverage::CJK_SYMBOLS_AND_PUNCTUATION, false); + aCJKMask.set(vcl::UnicodeCoverage::HIRAGANA, false); + aCJKMask.set(vcl::UnicodeCoverage::KATAKANA, false); + aCJKMask.set(vcl::UnicodeCoverage::HANGUL_JAMO, false); + aCJKMask.set(vcl::UnicodeCoverage::HANGUL_SYLLABLES, false); + aCJKMask.set(vcl::UnicodeCoverage::HANGUL_COMPATIBILITY_JAMO, false); + aCJKMask.set(vcl::UnicodeCoverage::ENCLOSED_CJK_LETTERS_AND_MONTHS, false); + aCJKMask.set(vcl::UnicodeCoverage::CJK_COMPATIBILITY, false); + aCJKMask.set(vcl::UnicodeCoverage::CJK_UNIFIED_IDEOGRAPHS, false); + aCJKMask.set(vcl::UnicodeCoverage::CJK_STROKES, false); + aCJKMask.set(vcl::UnicodeCoverage::HALFWIDTH_AND_FULLWIDTH_FORMS, false); + aCJKMask.set(vcl::UnicodeCoverage::VERTICAL_FORMS, false); + aCJKMask.set(vcl::UnicodeCoverage::BOPOMOFO, false); + aCJKMask.set(vcl::UnicodeCoverage::SMALL_FORM_VARIANTS, false); + aCJKMask.set(vcl::UnicodeCoverage::PHAGS_PA, false); + aCJKMask.set(vcl::UnicodeCoverage::CYRILLIC, false); + aCJKMask.set(vcl::UnicodeCoverage::THAI, false); + aCJKMask.set(vcl::UnicodeCoverage::DESERET, false); + + aMasked = aMasked & aCJKMask; + + //So, apparently a CJK font + if (!aMasked.count()) + { + boost::dynamic_bitset<sal_uInt32> aCJKCodePageMask(vcl::CodePageCoverage::MAX_CP_ENUM); + aCJKCodePageMask.set(vcl::CodePageCoverage::CP932); + aCJKCodePageMask.set(vcl::CodePageCoverage::CP936); + aCJKCodePageMask.set(vcl::CodePageCoverage::CP949); + aCJKCodePageMask.set(vcl::CodePageCoverage::CP950); + aCJKCodePageMask.set(vcl::CodePageCoverage::CP1361); + boost::dynamic_bitset<sal_uInt32> aMaskedCodePage = + rFontCapabilities.maCodePageRange & aCJKCodePageMask; + //fold Korean + if (aMaskedCodePage[vcl::CodePageCoverage::CP1361]) + { + aMaskedCodePage.set(vcl::CodePageCoverage::CP949); + aMaskedCodePage.set(vcl::CodePageCoverage::CP1361, false); + } + + sal_uInt32 nRet = 0; + if (aMaskedCodePage[vcl::CodePageCoverage::CP936]) + nRet |= SIMPLIFIED_CHINESE; + if (aMaskedCodePage[vcl::CodePageCoverage::CP950]) + nRet |= TRADITIONAL_CHINESE; + if (aMaskedCodePage[vcl::CodePageCoverage::CP932]) + nRet |= JAPANESE; + if (aMaskedCodePage[vcl::CodePageCoverage::CP949]) + nRet |= KOREAN; + return nRet; + } + + return 0; + } + + rtl::OUString makeRepresentativeSymbolText(bool bOpenSymbol, OutputDevice &rDevice) + { + rtl::OUString sSampleText; + + FontCharMap aFontCharMap; + bool bHasCharMap = rDevice.GetFontCharMap( aFontCharMap ); + if( bHasCharMap ) + { + // use some sample characters available in the font + sal_Unicode aText[8]; + + // start just above the PUA used by most symbol fonts + sal_uInt32 cNewChar = 0xFF00; +#ifdef QUARTZ + // on MacOSX there are too many non-presentable symbols above the codepoint 0x0192 + if( !bOpenSymbol ) + cNewChar = 0x0192; +#endif + + const int nMaxCount = sizeof(aText)/sizeof(*aText) - 1; + int nSkip = aFontCharMap.GetCharCount() / nMaxCount; + if( nSkip > 10 ) + nSkip = 10; + else if( nSkip <= 0 ) + nSkip = 1; + for( int i = 0; i < nMaxCount; ++i ) + { + sal_uInt32 cOldChar = cNewChar; + for( int j = nSkip; --j >= 0; ) + cNewChar = aFontCharMap.GetPrevChar( cNewChar ); + if( cOldChar == cNewChar ) + break; + aText[ i ] = static_cast<sal_Unicode>(cNewChar); // TODO: support UCS4 samples + aText[ i+1 ] = 0; + } + + sSampleText = rtl::OUString(aText); + } + else + { + static sal_Unicode aImplSymbolFontText[] = { + 0xF021,0xF032,0xF043,0xF054,0xF065,0xF076,0xF0B7,0xF0C8,0}; + const sal_Unicode* pText = aImplSymbolFontText; + if( bOpenSymbol ) + { + static sal_Unicode aImplStarSymbolText[] = { + 0x2706,0x2704,0x270D,0xE033,0x2211,0x2288,0}; + pText = aImplStarSymbolText; + } + sSampleText = rtl::OUString(pText); + } + + return sSampleText; + } + + long shrinkFontToFit(rtl::OUString &rSampleText, long nH, Font &rFont, OutputDevice &rDevice, Rectangle &rTextRect) + { + long nWidth = 0; + + Size aSize( rFont.GetSize() ); + + //Make sure it fits in the available height + while (aSize.Height() > 0) + { + if (!rDevice.GetTextBoundRect(rTextRect, rSampleText, 0, 0)) + break; + if (rTextRect.GetHeight() <= nH) + { + nWidth = rTextRect.GetWidth(); + break; + } + + aSize.Height() -= EXTRAFONTSIZE; + rFont.SetSize(aSize); + rDevice.SetFont(rFont); + } + + return nWidth; + } +} + // ------------------------------------------------------------------- void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt ) { - ImplFontNameListData* pData = mpFontList->GetObject( rUDEvt.GetItemId() ); + ImplFontNameListData* pData = (*mpFontList)[ rUDEvt.GetItemId() ]; const FontInfo& rInfo = pData->maInfo; sal_uInt16 nType = pData->mnType; Point aTopLeft = rUDEvt.GetRect().TopLeft(); @@ -782,7 +2059,7 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt ) if ( mbSymbols ) { - nX += IMGTEXTSPACE; + nX += IMGINNERTEXTSPACE; Image* pImg = NULL; if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_PRINTER ) pImg = &maImagePrinterFont; @@ -803,23 +2080,31 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt ) if ( mbWYSIWYG && mpFontList ) { - nX += IMGTEXTSPACE; + nX += IMGOUTERTEXTSPACE; + + bool bSymbolFont = (rInfo.GetCharSet() == RTL_TEXTENCODING_SYMBOL) + || rInfo.GetName().EqualsIgnoreCaseAscii("cmsy10") + || rInfo.GetName().EqualsIgnoreCaseAscii("cmex10") + || rInfo.GetName().EqualsIgnoreCaseAscii("feta26") + || rInfo.GetName().EqualsIgnoreCaseAscii("jsMath-cmsy10") + || rInfo.GetName().EqualsIgnoreCaseAscii("jsMath-cmex10") + || rInfo.GetName().EqualsIgnoreCaseAscii("msam10") + || rInfo.GetName().EqualsIgnoreCaseAscii("msbm10") + || rInfo.GetName().EqualsIgnoreCaseAscii("wasy10") + || rInfo.GetName().EqualsIgnoreCaseAscii("Denemo") + || rInfo.GetName().EqualsIgnoreCaseAscii("GlyphBasic1") + || rInfo.GetName().EqualsIgnoreCaseAscii("GlyphBasic2") + || rInfo.GetName().EqualsIgnoreCaseAscii("GlyphBasic3") + || rInfo.GetName().EqualsIgnoreCaseAscii("GlyphBasic4") + || rInfo.GetName().EqualsIgnoreCaseAscii("Letters Laughing") + || rInfo.GetName().EqualsIgnoreCaseAscii("MusiQwik") + || rInfo.GetName().EqualsIgnoreCaseAscii("MusiSync"); - bool bSymbolFont = (rInfo.GetCharSet() == RTL_TEXTENCODING_SYMBOL); // starsymbol is a unicode font, but cannot display its own name const bool bOpenSymbol = rInfo.GetName().EqualsIgnoreCaseAscii( "starsymbol" ) || rInfo.GetName().EqualsIgnoreCaseAscii( "opensymbol" ); bSymbolFont |= bOpenSymbol; - if( bSymbolFont ) - { - String aText( rInfo.GetName() ); - aText.AppendAscii( " " ); - Point aPos( nX, aTopLeft.Y() + (nH-rUDEvt.GetDevice()->GetTextHeight())/2 ); - rUDEvt.GetDevice()->DrawText( aPos, aText ); - nX += rUDEvt.GetDevice()->GetTextWidth( aText ); - } - Color aTextColor = rUDEvt.GetDevice()->GetTextColor(); Font aOldFont( rUDEvt.GetDevice()->GetFont() ); Size aSize( aOldFont.GetSize() ); @@ -829,62 +2114,180 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt ) rUDEvt.GetDevice()->SetFont( aFont ); rUDEvt.GetDevice()->SetTextColor( aTextColor ); - FontCharMap aFontCharMap; - bool bHasCharMap = rUDEvt.GetDevice()->GetFontCharMap( aFontCharMap ); + bool bUsingCorrectFont = true; + Rectangle aTextRect; - String aString; - if( !bSymbolFont ) - { - // preview the font name - aString = rInfo.GetName(); + // Preview the font name + rtl::OUString sFontName = rInfo.GetName(); - // reset font if the name cannot be display in the preview font - if( STRING_LEN != rUDEvt.GetDevice()->HasGlyphs( aFont, aString ) ) - rUDEvt.GetDevice()->SetFont( aOldFont ); + //If it shouldn't or can't draw its own name because it doesn't have the glyphs + if (bSymbolFont || (STRING_LEN != rUDEvt.GetDevice()->HasGlyphs(aFont, sFontName))) + bUsingCorrectFont = false; + else + { + //Make sure it fits in the available height, shrinking the font if necessary + bUsingCorrectFont = shrinkFontToFit(sFontName, nH, aFont, *rUDEvt.GetDevice(), aTextRect) != 0; } - else if( bHasCharMap ) + + if (!bUsingCorrectFont) { - // use some sample characters available in the font - sal_Unicode aText[8]; + rUDEvt.GetDevice()->SetFont(aOldFont); + rUDEvt.GetDevice()->GetTextBoundRect(aTextRect, sFontName, 0, 0); + } - // start just above the PUA used by most symbol fonts - sal_uInt32 cNewChar = 0xFF00; -#ifdef QUARTZ - // on MacOSX there are too many non-presentable symbols above the codepoint 0x0192 - if( !bOpenSymbol ) - cNewChar = 0x0192; + long nTextHeight = aTextRect.GetHeight(); + long nDesiredGap = (nH-nTextHeight)/2; + long nVertAdjust = nDesiredGap - aTextRect.Top(); +// long nHortAdjust = 0 - aTextRect.Left(); + Point aPos( nX, aTopLeft.Y() + nVertAdjust ); + rUDEvt.GetDevice()->DrawText( aPos, sFontName ); + Rectangle aHack(aPos.X(), aTopLeft.Y() + nH/2 - 5, aPos.X() + 40, aTopLeft.Y() + nH/2 + 5); + long nTextX = aPos.X() + aTextRect.GetWidth(); + + if (!bUsingCorrectFont) + rUDEvt.GetDevice()->SetFont( aFont ); + + rtl::OUString sSampleText; + bool bHasSampleTextGlyphs=false; + + if (!bSymbolFont) + { + const bool bNameBeginsWithLatinText = rInfo.GetName().GetChar(0) <= 'z'; + vcl::FontCapabilities aFontCapabilities; +#if OSL_DEBUG_LEVEL > 2 + lcl_dump_unicode_coverage(aFontCapabilities.maUnicodeRange); + lcl_dump_codepage_coverage(aFontCapabilities.maCodePageRange); #endif - const int nMaxCount = sizeof(aText)/sizeof(*aText) - 1; - int nSkip = aFontCharMap.GetCharCount() / nMaxCount; - if( nSkip > 10 ) - nSkip = 10; - else if( nSkip <= 0 ) - nSkip = 1; - for( int i = 0; i < nMaxCount; ++i ) + if (bNameBeginsWithLatinText && rUDEvt.GetDevice()->GetFontCapabilities(aFontCapabilities)) { - sal_uInt32 cOldChar = cNewChar; - for( int j = nSkip; --j >= 0; ) - cNewChar = aFontCharMap.GetPrevChar( cNewChar ); - if( cOldChar == cNewChar ) - break; - aText[ i ] = static_cast<sal_Unicode>(cNewChar); // TODO: support UCS4 samples - aText[ i+1 ] = 0; - } + //If this font is probably tuned to display a single non-Latin + //script and the font name is itself in Latin, then show a small + //chunk of representative text for that script + size_t nScript = getScript(aFontCapabilities); + if (nScript) + { + //If we're a CJK font, see if we seem to be tuned + //for C, J or K + if (nScript & JAPANESE && nScript ^ JAPANESE) + { + const sal_Unicode aJapanese[] = { 0x3007, 0x9F9D }; + rtl::OUString sJapanese(aJapanese, SAL_N_ELEMENTS(aJapanese)); + if (STRING_LEN != rUDEvt.GetDevice()->HasGlyphs(aFont, sJapanese)) + nScript ^= JAPANESE; + } - aString = String( aText ); + if (nScript & TRADITIONAL_CHINESE && nScript ^ TRADITIONAL_CHINESE) + { + const sal_Unicode aTraditionalChinese[] = { 0xFA0D }; + rtl::OUString sTraditionalChinese(aTraditionalChinese, SAL_N_ELEMENTS(aTraditionalChinese)); + if (STRING_LEN != rUDEvt.GetDevice()->HasGlyphs(aFont, sTraditionalChinese)) + nScript ^= TRADITIONAL_CHINESE; + } + + if (nScript & SIMPLIFIED_CHINESE && nScript ^ SIMPLIFIED_CHINESE) + { + const sal_Unicode aSimplifiedChinese[] = { 0x9FA0 }; + rtl::OUString sSimplifiedChinese(aSimplifiedChinese, SAL_N_ELEMENTS(aSimplifiedChinese)); + if (STRING_LEN != rUDEvt.GetDevice()->HasGlyphs(aFont, sSimplifiedChinese)) + nScript ^= SIMPLIFIED_CHINESE; + } + + sSampleText = getRepresentativeText(nScript); + bHasSampleTextGlyphs = (STRING_LEN == rUDEvt.GetDevice()->HasGlyphs(aFont, sSampleText)); + } + } } - else + + //If we're not a symbol font, but could neither render our own name and + //we can't determine what script it would like to render, then try a + //few well known scripts + if (!sSampleText.getLength() && !bUsingCorrectFont) { - const sal_Unicode* pText = aImplSymbolFontText; - if( bOpenSymbol ) - pText = aImplStarSymbolText; + static const sal_Int32 aScripts[] = + { + vcl::UnicodeCoverage::ARABIC, + vcl::UnicodeCoverage::HEBREW, + + vcl::UnicodeCoverage::BENGALI, + vcl::UnicodeCoverage::GURMUKHI, + vcl::UnicodeCoverage::GUJARATI, + vcl::UnicodeCoverage::ORIYA, + vcl::UnicodeCoverage::TAMIL, + vcl::UnicodeCoverage::TELUGU, + vcl::UnicodeCoverage::KANNADA, + vcl::UnicodeCoverage::MALAYALAM, + vcl::UnicodeCoverage::SINHALA, + vcl::UnicodeCoverage::DEVANAGARI, + + vcl::UnicodeCoverage::THAI, + vcl::UnicodeCoverage::LAO, + vcl::UnicodeCoverage::GEORGIAN, + vcl::UnicodeCoverage::TIBETAN, + vcl::UnicodeCoverage::SYRIAC, + vcl::UnicodeCoverage::MYANMAR, + vcl::UnicodeCoverage::ETHIOPIC, + vcl::UnicodeCoverage::KHMER, + vcl::UnicodeCoverage::MONGOLIAN, + + KOREAN, + JAPANESE, + TRADITIONAL_CHINESE|SIMPLIFIED_CHINESE, + + vcl::UnicodeCoverage::GREEK_AND_COPTIC, + + HEBREW_MINIMAL, + GREEK_MINIMAL + }; + + for (size_t i = 0; i < SAL_N_ELEMENTS(aScripts); ++i) + { + sSampleText = getRepresentativeText(aScripts[i]); + if (sSampleText.getLength()) + { + bHasSampleTextGlyphs = (STRING_LEN == rUDEvt.GetDevice()->HasGlyphs(aFont, sSampleText)); + if (bHasSampleTextGlyphs) + break; + } + } + } - aString = String( pText ); + //If we're a symbol font, or for some reason the font still couldn't + //render something representative of what it would like to render then + //make up some semi-random text that it *can* display + if (bSymbolFont || (!bUsingCorrectFont && !bHasSampleTextGlyphs)) + { + sSampleText = makeRepresentativeSymbolText(bOpenSymbol, *rUDEvt.GetDevice()); + bHasSampleTextGlyphs = (STRING_LEN == rUDEvt.GetDevice()->HasGlyphs(aFont, sSampleText)); } - long nTextHeight = rUDEvt.GetDevice()->GetTextHeight(); - Point aPos( nX, aTopLeft.Y() + (nH-nTextHeight)/2 ); - rUDEvt.GetDevice()->DrawText( aPos, aString ); + if (sSampleText.getLength() && bHasSampleTextGlyphs) + { + const Size &rItemSize = rUDEvt.GetDevice()->GetOutputSize(); + //leave a little border at the edge + long nSpace = rItemSize.Width() - nTextX - IMGOUTERTEXTSPACE; + if (nSpace >= 0) + { + //Make sure it fits in the available height, and get how wide that would be + long nWidth = shrinkFontToFit(sSampleText, nH, aFont, *rUDEvt.GetDevice(), aTextRect); + //Chop letters off until it fits in the available width + while (nWidth > nSpace || nWidth > MAXPREVIEWWIDTH) + { + sSampleText = sSampleText.copy(0, sSampleText.getLength()-1); + nWidth = rUDEvt.GetDevice()->GetTextBoundRect(aTextRect, sSampleText, 0, 0) ? + aTextRect.GetWidth() : 0; + } + + //center the text on the line + if (sSampleText.getLength() && nWidth) + { + nTextHeight = aTextRect.GetHeight(); + nDesiredGap = (nH-nTextHeight)/2; + nVertAdjust = nDesiredGap - aTextRect.Top(); + aPos = Point(nTextX + nSpace - nWidth, aTopLeft.Y() + nVertAdjust); + rUDEvt.GetDevice()->DrawText( aPos, sSampleText ); + } + } + } rUDEvt.GetDevice()->SetFont( aOldFont ); DrawEntry( rUDEvt, sal_False, sal_False); // draw seperator @@ -1503,3 +2906,4 @@ void FontSizeBox::SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit ) MetricBox::SetUserValue( nNewValue, eInUnit ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src index 95440c905d89..2bb6c8cc4df8 100755..100644 --- a/svtools/source/control/ctrlbox.src +++ b/svtools/source/control/ctrlbox.src @@ -33,37 +33,19 @@ IMAGE RID_IMG_SCALABLEFONT { - ImageBitmap = Bitmap { File = "scalfont.bmp" ; }; - MaskColor = IMAGE_STDBTN_COLOR ; -}; - -IMAGE RID_IMG_SCALABLEFONT_HC -{ - ImageBitmap = Bitmap { File = "scalfont_h.bmp" ; }; + ImageBitmap = Bitmap { File = "scalfont.png" ; }; MaskColor = IMAGE_STDBTN_COLOR ; }; IMAGE RID_IMG_PRINTERFONT { - ImageBitmap = Bitmap { File = "prnfont.bmp" ; }; - MaskColor = IMAGE_STDBTN_COLOR ; -}; - -IMAGE RID_IMG_PRINTERFONT_HC -{ - ImageBitmap = Bitmap { File = "prnfont_h.bmp" ; }; + ImageBitmap = Bitmap { File = "prnfont.png" ; }; MaskColor = IMAGE_STDBTN_COLOR ; }; IMAGE RID_IMG_BITMAPFONT { - ImageBitmap = Bitmap { File = "bmpfont.bmp" ; }; - MaskColor = IMAGE_STDBTN_COLOR ; -}; - -IMAGE RID_IMG_BITMAPFONT_HC -{ - ImageBitmap = Bitmap { File = "bmpfont_h.bmp" ; }; + ImageBitmap = Bitmap { File = "bmpfont.png" ; }; MaskColor = IMAGE_STDBTN_COLOR ; }; @@ -73,7 +55,7 @@ String STR_SVT_AUTOMATIC_COLOR }; /* - * ressources for CollatorRessource / CollatorRessourceData resp. + * resources for CollatorRessource / CollatorRessourceData resp. */ String STR_SVT_COLLATE_ALPHANUMERIC @@ -201,32 +183,3 @@ String STR_SVT_INDEXENTRY_PHONETIC_LC { Text [ en-US ] = "Phonetic (alphanumeric last, grouped by consonants)"; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 1314f416eec6..ff17a99c5069 100755..100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,6 +38,7 @@ #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> +#include <sal/macros.h> #include <svtools/svtools.hrc> #include <svtools/svtdata.hxx> #include <svtools/ctrltool.hxx> @@ -44,7 +46,7 @@ // ======================================================================= // Standard Fontgroessen fuer scalierbare Fonts -static long aStdSizeAry[] = +static const long aStdSizeAry[] = { 60, 70, @@ -120,8 +122,6 @@ private: ImplFontListNameInfo( const XubString& rSearchName ) : maSearchName( rSearchName ) {} - - const XubString& GetSearchName() const { return maSearchName; } }; // ======================================================================= @@ -171,30 +171,30 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon // und somit die Wahrscheinlichkeit das hinten angehaengt werden muss // sehr gross ist. StringCompare eComp; - sal_uLong nCnt = Count(); + sal_uLong nCnt = maEntries.size(); if ( !nCnt ) { if ( pIndex ) - *pIndex = LIST_APPEND; + *pIndex = ULONG_MAX; return NULL; } else { - ImplFontListNameInfo* pCmpData = (ImplFontListNameInfo*)List::GetObject( nCnt-1 ); + const ImplFontListNameInfo* pCmpData = &maEntries[nCnt-1]; eComp = rSearchName.CompareTo( pCmpData->maSearchName ); if ( eComp == COMPARE_GREATER ) { if ( pIndex ) - *pIndex = LIST_APPEND; + *pIndex = ULONG_MAX; return NULL; } else if ( eComp == COMPARE_EQUAL ) - return pCmpData; + return const_cast<ImplFontListNameInfo*>(pCmpData); } // Fonts in der Liste suchen - ImplFontListNameInfo* pCompareData; - ImplFontListNameInfo* pFoundData = NULL; + const ImplFontListNameInfo* pCompareData; + const ImplFontListNameInfo* pFoundData = NULL; sal_uLong nLow = 0; sal_uLong nHigh = nCnt-1; sal_uLong nMid; @@ -202,7 +202,7 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon do { nMid = (nLow + nHigh) / 2; - pCompareData = (ImplFontListNameInfo*)List::GetObject( nMid ); + pCompareData = &maEntries[nMid]; eComp = rSearchName.CompareTo( pCompareData->maSearchName ); if ( eComp == COMPARE_LESS ) { @@ -232,7 +232,7 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon *pIndex = nMid; } - return pFoundData; + return const_cast<ImplFontListNameInfo*>(pFoundData); } // ----------------------------------------------------------------------- @@ -284,7 +284,11 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll, pData->mpFirst = pNewInfo; pNewInfo->mpNext = NULL; pData->mnType = 0; - Insert( (void*)pData, nIndex ); + + if (nIndex < maEntries.size()) + maEntries.insert(maEntries.begin()+nIndex,pData); + else + maEntries.push_back(pData); } } else @@ -344,8 +348,7 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, sal_Bool bAll, // ======================================================================= -FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, sal_Bool bAll ) : - List( 4096, sal::static_int_cast< sal_uInt16 >(pDevice->GetDevFontCount()), 32 ) +FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, sal_Bool bAll ) { // Variablen initialisieren mpDev = pDevice; @@ -387,20 +390,17 @@ FontList::~FontList() delete[] mpSizeAry; // FontInfos loeschen - ImplFontListNameInfo* pData = (ImplFontListNameInfo*)First(); - while ( pData ) + ImplFontListFontInfo *pTemp, *pInfo; + boost::ptr_vector<ImplFontListNameInfo>::iterator it; + for (it = maEntries.begin(); it != maEntries.end(); ++it) { - ImplFontListFontInfo* pTemp; - ImplFontListFontInfo* pInfo = pData->mpFirst; + pInfo = it->mpFirst; while ( pInfo ) { pTemp = pInfo->mpNext; delete pInfo; pInfo = pTemp; } - ImplFontListNameInfo* pNext = (ImplFontListNameInfo*)Next(); - delete pData; - pData = pNext; } } // ----------------------------------------------------------------------- @@ -757,8 +757,7 @@ const FontInfo& FontList::GetFontName( sal_uInt16 nFont ) const { DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontName(): nFont >= Count" ); - ImplFontListNameInfo* pData = (ImplFontListNameInfo*)List::GetObject( nFont ); - return *(pData->mpFirst); + return *(maEntries[nFont].mpFirst); } // ----------------------------------------------------------------------- @@ -767,8 +766,7 @@ sal_uInt16 FontList::GetFontNameType( sal_uInt16 nFont ) const { DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontNameType(): nFont >= Count" ); - ImplFontListNameInfo* pData = (ImplFontListNameInfo*)List::GetObject( nFont ); - return pData->mnType; + return maEntries[nFont].mnType; } // ----------------------------------------------------------------------- @@ -870,7 +868,7 @@ struct ImplFSNameItem //------------------------------------------------------------------------ -static ImplFSNameItem aImplSimplifiedChinese[] = +static const ImplFSNameItem aImplSimplifiedChinese[] = { { 50, "\xe5\x85\xab\xe5\x8f\xb7" }, { 55, "\xe4\xb8\x83\xe5\x8f\xb7" }, @@ -890,30 +888,6 @@ static ImplFSNameItem aImplSimplifiedChinese[] = { 420, "\xe5\x88\x9d\xe5\x8f\xb7" } }; -// ----------------------------------------------------------------------- - -#if 0 // #i89077# disabled by popular request -static ImplFSNameItem aImplTraditionalChinese[] = -{ - { 50, "\xe5\x85\xab\xe8\x99\x9f" }, - { 55, "\xe4\xb8\x83\xe8\x99\x9f" }, - { 65, "\xe5\xb0\x8f\xe5\x85\xad" }, - { 75, "\xe5\x85\xad\xe8\x99\x9f" }, - { 90, "\xe5\xb0\x8f\xe4\xba\x94" }, - { 105, "\xe4\xba\x94\xe8\x99\x9f" }, - { 120, "\xe5\xb0\x8f\xe5\x9b\x9b" }, - { 140, "\xe5\x9b\x9b\xe8\x99\x9f" }, - { 150, "\xe5\xb0\x8f\xe4\xb8\x89" }, - { 160, "\xe4\xb8\x89\xe8\x99\x9f" }, - { 180, "\xe5\xb0\x8f\xe4\xba\x8c" }, - { 220, "\xe4\xba\x8c\xe8\x99\x9f" }, - { 240, "\xe5\xb0\x8f\xe4\xb8\x80" }, - { 260, "\xe4\xb8\x80\xe8\x99\x9f" }, - { 360, "\xe5\xb0\x8f\xe5\x88\x9d" }, - { 420, "\xe5\x88\x9d\xe8\x99\x9f" } -}; -#endif - //------------------------------------------------------------------------ FontSizeNames::FontSizeNames( LanguageType eLanguage ) @@ -928,7 +902,7 @@ FontSizeNames::FontSizeNames( LanguageType eLanguage ) case LANGUAGE_CHINESE: case LANGUAGE_CHINESE_SIMPLIFIED: mpArray = aImplSimplifiedChinese; - mnElem = sizeof(aImplSimplifiedChinese) / sizeof(aImplSimplifiedChinese[0]); + mnElem = SAL_N_ELEMENTS(aImplSimplifiedChinese); break; #if 0 // #i89077# disabled by popular request @@ -937,7 +911,7 @@ FontSizeNames::FontSizeNames( LanguageType eLanguage ) case LANGUAGE_CHINESE_MACAU: case LANGUAGE_CHINESE_TRADITIONAL: mpArray = aImplTraditionalChinese; - mnElem = sizeof(aImplTraditionalChinese) / sizeof(aImplTraditionalChinese[0]); + mnElem = SAL_N_ELEMENTS(aImplTraditionalChinese); break; #endif @@ -1009,3 +983,5 @@ long FontSizeNames::GetIndexSize( sal_uLong nIndex ) const return 0; return mpArray[nIndex].mnSize; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src index 72420af4908e..1cf580bd4309 100755..100644 --- a/svtools/source/control/ctrltool.src +++ b/svtools/source/control/ctrltool.src @@ -66,18 +66,6 @@ String STR_SVT_STYLE_BLACK_ITALIC Text [ en-US ] = "Black Italic" ; }; -/* -Finnische Texte: - "Light", - "Light Kursivoitu", - "Normaali", - "Kursivoitu", - "Lihavoitu", - "Lihavoitu Kursivoitu", - "Black", - "Black Kursivoitu" -*/ - String STR_SVT_FONTMAP_BOTH { Text [ en-US ] = "The same font will be used on both your printer and your screen." ; @@ -107,38 +95,3 @@ String STR_SVT_FONTMAP_NOTAVAILABLE { Text [ en-US ] = "This font has not been installed. The closest available font will be used."; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx index eff46b78b2a2..c8d506ad2a9a 100755..100644 --- a/svtools/source/control/filectrl.cxx +++ b/svtools/source/control/filectrl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -229,3 +230,4 @@ void FileControl::ResetButtonText() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/filectrl.src b/svtools/source/control/filectrl.src index f9d63b65b838..5703004dd946 100755..100644 --- a/svtools/source/control/filectrl.src +++ b/svtools/source/control/filectrl.src @@ -46,5 +46,4 @@ String STR_TABBAR_PUSHBUTTON_MOVERIGHT String STR_TABBAR_PUSHBUTTON_MOVETOEND { Text [ en-US ] = "Move To End" ; -}; - +};
\ No newline at end of file diff --git a/svtools/source/control/filectrl2.cxx b/svtools/source/control/filectrl2.cxx index 904b643d2ae3..805b400599c8 100755..100644 --- a/svtools/source/control/filectrl2.cxx +++ b/svtools/source/control/filectrl2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,7 +49,7 @@ void FileControl::ImplBrowseFile( ) { XubString aNewText; - const ::rtl::OUString sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.FilePicker" ); + const ::rtl::OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" )); Reference< XMultiServiceFactory > xMSF = vcl::unohelper::GetMultiServiceFactory(); Reference < dialogs::XFilePicker > xFilePicker( xMSF->createInstance( sServiceName ), UNO_QUERY ); @@ -88,7 +89,8 @@ void FileControl::ImplBrowseFile( ) } catch( const Exception& ) { - DBG_ERROR( "FileControl::ImplBrowseFile: caught an exception while executing the file picker!" ); + OSL_FAIL( "FileControl::ImplBrowseFile: caught an exception while executing the file picker!" ); } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/fileurlbox.cxx b/svtools/source/control/fileurlbox.cxx index 476b2864a117..f2880feef2d0 100644 --- a/svtools/source/control/fileurlbox.cxx +++ b/svtools/source/control/fileurlbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -122,3 +123,4 @@ namespace svt } // namespace svt //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/fixedhyper.cxx b/svtools/source/control/fixedhyper.cxx index a8877d240d4e..c5500bd691ea 100644 --- a/svtools/source/control/fixedhyper.cxx +++ b/svtools/source/control/fixedhyper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -231,3 +232,4 @@ String FixedHyperlinkImage::GetURL() const } // namespace svt //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index f123af14d510..9c1ba517367c 100755..100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -62,7 +63,7 @@ using namespace ::com::sun::star::util; // regular expression to validate complete numbers, plus every fragment which can occur during the input // of a complete number // [+/-][{digit}*.]*{digit}*[,{digit}*][e[+/-]{digit}*] -const char __FAR_DATA szNumericInput[] = "_[-+]?([0-9]*\\,)*[0-9]*(\\.[0-9]*)?(e[-+]?[0-9]*)?_"; +const char szNumericInput[] = "_[-+]?([0-9]*\\,)*[0-9]*(\\.[0-9]*)?(e[-+]?[0-9]*)?_"; // (the two _ are for normalizing it: With this, we can ensure that a to-be-checked text is always // matched as a _whole_) #else @@ -293,7 +294,7 @@ namespace validation return sal_True; // normalize the string - String sNormalized( RTL_CONSTASCII_STRINGPARAM( "_") ); + String sNormalized( RTL_CONSTASCII_USTRINGPARAM("_") ); sNormalized.Append( _rText ); sNormalized.AppendAscii( "_" ); @@ -812,7 +813,6 @@ void FormattedField::FormatChanged( FORMAT_CHANGE_TYPE _nWhat ) if ( ( 0 != ( _nWhat & FCT_FORMATTER ) ) && m_pFormatter ) m_pFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT ); - // 95845 - 03.04.2002 - fs@openoffice.org ReFormat(); } @@ -1292,7 +1292,7 @@ void DoubleCurrencyField::FormatChanged(FORMAT_CHANGE_TYPE nWhat) UpdateCurrencyFormat(); break; case FCT_KEYONLY: - DBG_ERROR("DoubleCurrencyField::FormatChanged : somebody modified my key !"); + OSL_FAIL("DoubleCurrencyField::FormatChanged : somebody modified my key !"); // We always build our own format from the settings we get via special methods (setCurrencySymbol etc.). // Nobody but ourself should modifiy the format key directly ! break; @@ -1396,3 +1396,4 @@ void DoubleCurrencyField::UpdateCurrencyFormat() m_bChangingFormat = sal_False; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx index 06886339fda5..2b22996c0486 100755..100644 --- a/svtools/source/control/headbar.cxx +++ b/svtools/source/control/headbar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,19 +32,10 @@ #define _SV_HEADBAR_CXX #include <svtools/headbar.hxx> #include <tools/debug.hxx> -#ifndef _TOOLS_LIST_HXX -#include <tools/list.hxx> -#endif -#ifndef _VCL_APP_HXX #include <vcl/svapp.hxx> -#endif -#ifndef _VCL_HELP_HXX #include <vcl/help.hxx> -#endif -#ifndef _VCL_IMAGE_HXX #include <vcl/image.hxx> -#endif #include <com/sun/star/accessibility/XAccessible.hpp> // ======================================================================= @@ -61,8 +53,6 @@ struct ImplHeadItem void* mpUserData; }; -DECLARE_LIST( ImplHeadItemList, ImplHeadItem* ) - // ======================================================================= #define HEAD_ARROWSIZE1 4 @@ -144,13 +134,10 @@ HeaderBar::HeaderBar( Window* pParent, const ResId& rResId ) : HeaderBar::~HeaderBar() { // Alle Items loeschen - ImplHeadItem* pItem = mpItemList->First(); - while ( pItem ) - { - delete pItem; - pItem = mpItemList->Next(); + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + delete (*mpItemList)[ i ]; } - + mpItemList->clear(); delete mpItemList; } @@ -197,8 +184,8 @@ void HeaderBar::ImplInitSettings( sal_Bool bFont, long HeaderBar::ImplGetItemPos( sal_uInt16 nPos ) const { long nX = -mnOffset; - for ( sal_uInt16 i = 0; i < nPos; i++ ) - nX += mpItemList->GetObject( i )->mnSize; + for ( size_t i = 0; i < nPos; i++ ) + nX += (*mpItemList)[ i ]->mnSize; return nX; } @@ -207,7 +194,7 @@ long HeaderBar::ImplGetItemPos( sal_uInt16 nPos ) const Rectangle HeaderBar::ImplGetItemRect( sal_uInt16 nPos ) const { Rectangle aRect( ImplGetItemPos( nPos ), 0, 0, mnDY-1 ); - aRect.Right() = aRect.Left() + mpItemList->GetObject( nPos )->mnSize - 1; + aRect.Right() = aRect.Left() + (*mpItemList)[ nPos ]->mnSize - 1; // Gegen Ueberlauf auf einigen Systemen testen if ( aRect.Right() > 16000 ) aRect.Right() = 16000; @@ -220,13 +207,13 @@ sal_uInt16 HeaderBar::ImplHitTest( const Point& rPos, long& nMouseOff, sal_uInt16& nPos ) const { ImplHeadItem* pItem; - sal_uInt16 nCount = (sal_uInt16)mpItemList->Count(); + size_t nCount = (sal_uInt16)mpItemList->size(); sal_Bool bLastFixed = sal_True; long nX = -mnOffset; - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { - pItem = mpItemList->GetObject( i ); + pItem = (*mpItemList)[ i ]; if ( rPos.X() < (nX+pItem->mnSize) ) { @@ -267,7 +254,7 @@ sal_uInt16 HeaderBar::ImplHitTest( const Point& rPos, if ( !bLastFixed ) { - pItem = mpItemList->GetObject( nCount-1 ); + pItem = (*mpItemList)[ nCount-1 ]; if ( (pItem->mnSize < 4) && (rPos.X() < (nX+HEADERBAR_SPLITOFF)) ) { nPos = nCount-1; @@ -357,7 +344,7 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev, return; } - ImplHeadItem* pItem = mpItemList->GetObject( nPos ); + ImplHeadItem* pItem = (*mpItemList)[ nPos ]; HeaderBarItemBits nBits = pItem->mnBits; const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -659,7 +646,7 @@ void HeaderBar::ImplUpdate( sal_uInt16 nPos, sal_Bool bEnd, sal_Bool bDirect ) if ( !bDirect ) { Rectangle aRect; - sal_uInt16 nItemCount = (sal_uInt16)(mpItemList->Count()); + size_t nItemCount = mpItemList->size(); if ( nPos < nItemCount ) aRect = ImplGetItemRect( nPos ); else @@ -676,11 +663,11 @@ void HeaderBar::ImplUpdate( sal_uInt16 nPos, sal_Bool bEnd, sal_Bool bDirect ) } else { - for ( sal_uInt16 i = nPos; i < mpItemList->Count(); i++ ) + for ( size_t i = nPos; i < mpItemList->size(); i++ ) ImplDrawItem( i ); if ( bEnd ) { - Rectangle aRect = ImplGetItemRect( (sal_uInt16)mpItemList->Count() ); + Rectangle aRect = ImplGetItemRect( (sal_uInt16)mpItemList->size() ); aRect.Left() = aRect.Right(); aRect.Right() = mnDX-1; if ( aRect.Left() < aRect.Right() ) @@ -703,7 +690,7 @@ void HeaderBar::ImplStartDrag( const Point& rMousePos, sal_Bool bCommand ) if ( nHitTest ) { mbDrag = sal_False; - ImplHeadItem* pItem = mpItemList->GetObject( nPos ); + ImplHeadItem* pItem = (*mpItemList)[ nPos ]; if ( nHitTest & HEAD_HITTEST_DIVIDER ) mbDrag = sal_True; else @@ -775,7 +762,7 @@ void HeaderBar::ImplDrag( const Point& rMousePos ) // Evt. ItemDrag anschalten if ( bNewOutDrag && mbDragable && !mbItemDrag && - !(mpItemList->GetObject(nPos)->mnBits & HIB_FIXEDPOS) ) + !((*mpItemList)[ nPos ]->mnBits & HIB_FIXEDPOS) ) { if ( (rMousePos.Y() >= aItemRect.Top()) && (rMousePos.Y() <= aItemRect.Bottom()) ) { @@ -810,13 +797,13 @@ void HeaderBar::ImplDrag( const Point& rMousePos ) // Nicht verschiebbare Items aussparen if ( mnItemDragPos < nPos ) { - while ( (mpItemList->GetObject(mnItemDragPos)->mnBits & HIB_FIXEDPOS) && + while ( ((*mpItemList)[ mnItemDragPos ]->mnBits & HIB_FIXEDPOS) && (mnItemDragPos < nPos) ) mnItemDragPos++; } else if ( mnItemDragPos > nPos ) { - while ( (mpItemList->GetObject(mnItemDragPos)->mnBits & HIB_FIXEDPOS) && + while ( ((*mpItemList)[ mnItemDragPos ]->mnBits & HIB_FIXEDPOS) && (mnItemDragPos > nPos) ) mnItemDragPos--; } @@ -909,7 +896,7 @@ void HeaderBar::ImplEndDrag( sal_Bool bCancel ) long nDelta = mnDragPos - mnStartPos; if ( nDelta ) { - ImplHeadItem* pItem = mpItemList->GetObject( nPos ); + ImplHeadItem* pItem = (*mpItemList)[ nPos ]; pItem->mnSize += nDelta; ImplUpdate( nPos, sal_True ); } @@ -938,7 +925,7 @@ void HeaderBar::MouseButtonDown( const MouseEvent& rMEvt ) sal_uInt16 nHitTest = ImplHitTest( rMEvt.GetPosPixel(), nTemp, nPos ); if ( nHitTest ) { - ImplHeadItem* pItem = mpItemList->GetObject( nPos ); + ImplHeadItem* pItem = (*mpItemList)[ nPos ]; if ( nHitTest & HEAD_HITTEST_DIVIDER ) mbItemMode = sal_False; else @@ -1005,7 +992,7 @@ void HeaderBar::Paint( const Rectangle& rRect ) nCurItemPos = GetItemPos( mnCurItemId ); else nCurItemPos = HEADERBAR_ITEM_NOTFOUND; - sal_uInt16 nItemCount = (sal_uInt16)mpItemList->Count(); + sal_uInt16 nItemCount = (sal_uInt16)mpItemList->size(); for ( sal_uInt16 i = 0; i < nItemCount; i++ ) ImplDrawItem( i, (i == nCurItemPos) ? sal_True : sal_False, sal_False, &rRect ); } @@ -1049,12 +1036,11 @@ void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, } Rectangle aItemRect( aRect ); -// aItemRect.Bottom()--; - sal_uInt16 nItemCount = (sal_uInt16)mpItemList->Count(); - for ( sal_uInt16 i = 0; i < nItemCount; i++ ) + size_t nItemCount = mpItemList->size(); + for ( size_t i = 0; i < nItemCount; i++ ) { aItemRect.Left() = aRect.Left()+ImplGetItemPos( i ); - aItemRect.Right() = aItemRect.Left() + mpItemList->GetObject( i )->mnSize - 1; + aItemRect.Right() = aItemRect.Left() + (*mpItemList)[ i ]->mnSize - 1; // Gegen Ueberlauf auf einigen Systemen testen if ( aItemRect.Right() > 16000 ) aItemRect.Right() = 16000; @@ -1111,7 +1097,7 @@ void HeaderBar::RequestHelp( const HelpEvent& rHEvt ) XubString aStr = GetHelpText( nItemId ); if ( !aStr.Len() || !(rHEvt.GetMode() & HELPMODE_BALLOON) ) { - ImplHeadItem* pItem = mpItemList->GetObject( GetItemPos( nItemId ) ); + ImplHeadItem* pItem = (*mpItemList)[ GetItemPos( nItemId ) ]; // Wir zeigen die Quick-Hilfe nur an, wenn Text nicht // vollstaendig sichtbar, ansonsten zeigen wir den Hilfetext // an, wenn das Item keinen Text besitzt @@ -1246,7 +1232,13 @@ void HeaderBar::InsertItem( sal_uInt16 nItemId, const Image& rImage, pItem->mnSize = nSize; pItem->maImage = rImage; pItem->mpUserData = 0; - mpItemList->Insert( pItem, nPos ); + if ( nPos < mpItemList->size() ) { + ImplHeadItemList::iterator it = mpItemList->begin(); + ::std::advance( it, nPos ); + mpItemList->insert( it, pItem ); + } else { + mpItemList->push_back( pItem ); + } // Ausgabe updaten ImplUpdate( nPos, sal_True ); @@ -1268,7 +1260,13 @@ void HeaderBar::InsertItem( sal_uInt16 nItemId, const XubString& rText, pItem->mnSize = nSize; pItem->maText = rText; pItem->mpUserData = 0; - mpItemList->Insert( pItem, nPos ); + if ( nPos < mpItemList->size() ) { + ImplHeadItemList::iterator it = mpItemList->begin(); + ::std::advance( it, nPos ); + mpItemList->insert( it, pItem ); + } else { + mpItemList->push_back( pItem ); + } // Ausgabe updaten ImplUpdate( nPos, sal_True ); @@ -1293,7 +1291,13 @@ void HeaderBar::InsertItem( sal_uInt16 nItemId, pItem->maImage = rImage; pItem->maText = rText; pItem->mpUserData = 0; - mpItemList->Insert( pItem, nPos ); + if ( nPos < mpItemList->size() ) { + ImplHeadItemList::iterator it = mpItemList->begin(); + ::std::advance( it, nPos ); + mpItemList->insert( it, pItem ); + } else { + mpItemList->push_back( pItem ); + } // Ausgabe updaten ImplUpdate( nPos, sal_True ); @@ -1306,9 +1310,12 @@ void HeaderBar::RemoveItem( sal_uInt16 nItemId ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) { - ImplHeadItem* pItem = mpItemList->Remove( nPos ); - delete pItem; - ImplUpdate( nPos, sal_True ); + if ( nPos < mpItemList->size() ) { + ImplHeadItemList::iterator it = mpItemList->begin(); + ::std::advance( it, nPos ); + delete *it; + mpItemList->erase( it ); + } } } @@ -1321,11 +1328,15 @@ void HeaderBar::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos ) { if ( nPos != nNewPos ) { - ImplHeadItem* pItem = mpItemList->Remove( nPos ); + ImplHeadItemList::iterator it = mpItemList->begin(); + ::std::advance( it, nPos ); + ImplHeadItem* pItem = *it; + mpItemList->erase( it ); if ( nNewPos < nPos ) nPos = nNewPos; - mpItemList->Insert( pItem, nNewPos ); - ImplUpdate( nPos, sal_True ); + it = mpItemList->begin(); + ::std::advance( it, nPos ); + mpItemList->insert( it, pItem ); } } } @@ -1335,13 +1346,10 @@ void HeaderBar::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos ) void HeaderBar::Clear() { // Alle Items loeschen - ImplHeadItem* pItem = mpItemList->First(); - while ( pItem ) - { - delete pItem; - pItem = mpItemList->Next(); + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + delete (*mpItemList)[ i ]; } - mpItemList->Clear(); + mpItemList->clear(); ImplUpdate( 0, sal_True ); } @@ -1350,10 +1358,6 @@ void HeaderBar::Clear() void HeaderBar::SetOffset( long nNewOffset ) { - // Hier erstmal neu zeichnen, damit mit alten Offset noch das - // richtige gemalt wird - //Update(); - // Bereich verschieben Rectangle aRect( 0, mnBorderOff1, mnDX-1, mnDY-mnBorderOff1-mnBorderOff2-1 ); long nDelta = mnOffset-nNewOffset; @@ -1365,21 +1369,18 @@ void HeaderBar::SetOffset( long nNewOffset ) sal_uInt16 HeaderBar::GetItemCount() const { - return (sal_uInt16)mpItemList->Count(); + return (sal_uInt16)mpItemList->size(); } // ----------------------------------------------------------------------- sal_uInt16 HeaderBar::GetItemPos( sal_uInt16 nItemId ) const { - ImplHeadItem* pItem = mpItemList->First(); - while ( pItem ) - { + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + ImplHeadItem* pItem = (*mpItemList)[ i ]; if ( pItem->mnId == nItemId ) - return (sal_uInt16)mpItemList->GetCurPos(); - pItem = mpItemList->Next(); + return (sal_uInt16)i; } - return HEADERBAR_ITEM_NOTFOUND; } @@ -1387,7 +1388,7 @@ sal_uInt16 HeaderBar::GetItemPos( sal_uInt16 nItemId ) const sal_uInt16 HeaderBar::GetItemId( sal_uInt16 nPos ) const { - ImplHeadItem* pItem = mpItemList->GetObject( nPos ); + ImplHeadItem* pItem = (nPos < mpItemList->size() ) ? (*mpItemList)[ nPos ] : NULL; if ( pItem ) return pItem->mnId; else @@ -1398,15 +1399,11 @@ sal_uInt16 HeaderBar::GetItemId( sal_uInt16 nPos ) const sal_uInt16 HeaderBar::GetItemId( const Point& rPos ) const { - sal_uInt16 nPos = 0; - while ( nPos < mpItemList->Count() ) - { - if ( ImplGetItemRect( nPos ).IsInside( rPos ) ) - return GetItemId( nPos ); - - nPos++; + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + if ( ImplGetItemRect( i ).IsInside( rPos ) ) { + return GetItemId( i ); + } } - return 0; } @@ -1428,7 +1425,7 @@ void HeaderBar::SetItemSize( sal_uInt16 nItemId, long nNewSize ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) { - ImplHeadItem* pItem = mpItemList->GetObject( nPos ); + ImplHeadItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->mnSize != nNewSize ) { pItem->mnSize = nNewSize; @@ -1443,7 +1440,7 @@ long HeaderBar::GetItemSize( sal_uInt16 nItemId ) const { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->mnSize; + return (*mpItemList)[ nPos ]->mnSize; else return 0; } @@ -1455,7 +1452,7 @@ void HeaderBar::SetItemBits( sal_uInt16 nItemId, HeaderBarItemBits nNewBits ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) { - ImplHeadItem* pItem = mpItemList->GetObject( nPos ); + ImplHeadItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->mnBits != nNewBits ) { pItem->mnBits = nNewBits; @@ -1470,7 +1467,7 @@ HeaderBarItemBits HeaderBar::GetItemBits( sal_uInt16 nItemId ) const { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->mnBits; + return (*mpItemList)[ nPos ]->mnBits; else return 0; } @@ -1482,7 +1479,7 @@ void HeaderBar::SetItemData( sal_uInt16 nItemId, void* pNewData ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) { - mpItemList->GetObject( nPos )->mpUserData = pNewData; + (*mpItemList)[ nPos ]->mpUserData = pNewData; ImplUpdate( nPos ); } } @@ -1493,7 +1490,7 @@ void* HeaderBar::GetItemData( sal_uInt16 nItemId ) const { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->mpUserData; + return (*mpItemList)[ nPos ]->mpUserData; else return NULL; } @@ -1505,7 +1502,7 @@ void HeaderBar::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) { - mpItemList->GetObject( nPos )->maImage = rImage; + (*mpItemList)[ nPos ]->maImage = rImage; ImplUpdate( nPos ); } } @@ -1516,7 +1513,7 @@ Image HeaderBar::GetItemImage( sal_uInt16 nItemId ) const { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->maImage; + return (*mpItemList)[ nPos ]->maImage; else return Image(); } @@ -1528,7 +1525,7 @@ void HeaderBar::SetItemText( sal_uInt16 nItemId, const XubString& rText ) sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) { - mpItemList->GetObject( nPos )->maText = rText; + (*mpItemList)[ nPos ]->maText = rText; ImplUpdate( nPos ); } } @@ -1539,7 +1536,7 @@ XubString HeaderBar::GetItemText( sal_uInt16 nItemId ) const { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - return mpItemList->GetObject( nPos )->maText; + return (*mpItemList)[ nPos ]->maText; else return String(); } @@ -1550,7 +1547,7 @@ void HeaderBar::SetHelpText( sal_uInt16 nItemId, const XubString& rText ) { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - mpItemList->GetObject( nPos )->maHelpText = rText; + (*mpItemList)[ nPos ]->maHelpText = rText; } // ----------------------------------------------------------------------- @@ -1560,7 +1557,7 @@ XubString HeaderBar::GetHelpText( sal_uInt16 nItemId ) const sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) { - ImplHeadItem* pItem = mpItemList->GetObject( nPos ); + ImplHeadItem* pItem = (*mpItemList)[ nPos ]; if ( !pItem->maHelpText.Len() && pItem->maHelpId.getLength() ) { Help* pHelp = Application::GetHelp(); @@ -1580,7 +1577,7 @@ void HeaderBar::SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId ) { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - mpItemList->GetObject( nPos )->maHelpId = rHelpId; + (*mpItemList)[ nPos ]->maHelpId = rHelpId; } // ----------------------------------------------------------------------- @@ -1590,7 +1587,7 @@ rtl::OString HeaderBar::GetHelpId( sal_uInt16 nItemId ) const sal_uInt16 nPos = GetItemPos( nItemId ); rtl::OString aRet; if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - aRet = mpItemList->GetObject( nPos )->maHelpId; + return (*mpItemList)[ nPos ]->maHelpId; return aRet; } @@ -1601,9 +1598,9 @@ Size HeaderBar::CalcWindowSizePixel() const long nMaxImageSize = 0; Size aSize( 0, GetTextHeight() ); - ImplHeadItem* pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + ImplHeadItem* pItem = (*mpItemList)[ i ]; // Image-Groessen beruecksichtigen long nImageHeight = pItem->maImage.GetSizePixel().Height(); if ( !(pItem->mnBits & (HIB_LEFTIMAGE | HIB_RIGHTIMAGE)) && pItem->maText.Len() ) @@ -1613,8 +1610,6 @@ Size HeaderBar::CalcWindowSizePixel() const // Breite aufaddieren aSize.Width() += pItem->mnSize; - - pItem = mpItemList->Next(); } if ( nMaxImageSize > aSize.Height() ) @@ -1649,3 +1644,4 @@ void HeaderBar::SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::sta mxAccessible = _xAccessible; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx index 10ef8cdcfadf..ab42a891a1ed 100644 --- a/svtools/source/control/hyperlabel.cxx +++ b/svtools/source/control/hyperlabel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,15 +28,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifndef SVTOOLS_ROADMAP_HXX #include <svtools/hyperlabel.hxx> -#endif #include <vcl/bitmap.hxx> #include <tools/color.hxx> -#ifndef _VCL_TABPAGE_HXX #include <vcl/tabpage.hxx> -#endif //......................................................................... @@ -268,3 +265,4 @@ namespace svt } // namespace svt //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx index 23eada244a47..a62320ce99ac 100755..100644 --- a/svtools/source/control/indexentryres.cxx +++ b/svtools/source/control/indexentryres.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -129,3 +130,4 @@ IndexEntryRessource::GetTranslation (const String &r_Algorithm) return r_Algorithm; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 94db99a66194..0dcb4fb4ce23 100755..100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,8 +49,8 @@ #include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp> #include <comphelper/processfactory.hxx> #include <vcl/toolbox.hxx> -#include <vos/thread.hxx> -#include <vos/mutex.hxx> +#include <osl/thread.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <unotools/historyoptions.hxx> #include <svl/eitem.hxx> @@ -105,9 +106,9 @@ public: }; // ----------------------------------------------------------------------- -class SvtMatchContext_Impl : public ::vos::OThread +class SvtMatchContext_Impl : public ::osl::Thread { - static ::vos::OMutex* pDirMutex; + static ::osl::Mutex* pDirMutex; SvStringsDtor aPickList; SvStringsDtor* pCompletions; @@ -130,20 +131,20 @@ class SvtMatchContext_Impl : public ::vos::OThread void FillPicklist( SvStringsDtor& rPickList ); public: - static ::vos::OMutex* GetMutex(); + static ::osl::Mutex* GetMutex(); SvtMatchContext_Impl( SvtURLBox* pBoxP, const String& rText ); ~SvtMatchContext_Impl(); void Stop(); }; -::vos::OMutex* SvtMatchContext_Impl::pDirMutex = 0; +::osl::Mutex* SvtMatchContext_Impl::pDirMutex = 0; -::vos::OMutex* SvtMatchContext_Impl::GetMutex() +::osl::Mutex* SvtMatchContext_Impl::GetMutex() { - ::vos::OGuard aGuard( ::vos::OMutex::getGlobalMutex() ); + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); if( !pDirMutex ) - pDirMutex = new ::vos::OMutex; + pDirMutex = new ::osl::Mutex; return pDirMutex; } @@ -595,7 +596,7 @@ String SvtURLBox::ParseSmart( String aText, String aBaseURL, String aWorkDir ) //------------------------------------------------------------------------- void SvtMatchContext_Impl::run() { - ::vos::OGuard aGuard( GetMutex() ); + ::osl::MutexGuard aGuard( GetMutex() ); if( bStop ) // have we been stopped while we were waiting for the mutex? return; @@ -974,7 +975,7 @@ sal_Bool SvtURLBox::ProcessKey( const KeyCode& rKey ) if ( aCode == KEY_RETURN && GetText().Len() ) { // wait for completion of matching thread - ::vos::OGuard aGuard( SvtMatchContext_Impl::GetMutex() ); + ::osl::MutexGuard aGuard( SvtMatchContext_Impl::GetMutex() ); if ( bAutoCompleteMode ) { @@ -1140,7 +1141,7 @@ void SvtURLBox::SetNoURLSelection( sal_Bool bSet ) String SvtURLBox::GetURL() { // wait for end of autocompletion - ::vos::OGuard aGuard( SvtMatchContext_Impl::GetMutex() ); + ::osl::MutexGuard aGuard( SvtMatchContext_Impl::GetMutex() ); String aText( GetText() ); if ( MatchesPlaceHolder( aText ) ) @@ -1164,7 +1165,7 @@ String SvtURLBox::GetURL() aText.EraseTrailingChars(); if ( !aText.Len() ) return aText; - // #i9739# - 2002-12-03 - fs@openoffice.org + // #i9739# #endif INetURLObject aObj( aText ); @@ -1193,7 +1194,7 @@ String SvtURLBox::GetURL() bool bSlash = aObj.hasFinalSlash(); { static const rtl::OUString aPropName( - rtl::OUString::createFromAscii("CasePreservingURL")); + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CasePreservingURL" ))); rtl::OUString aFileURL; @@ -1236,7 +1237,7 @@ void SvtURLBox::DisableHistory() //------------------------------------------------------------------------- void SvtURLBox::SetBaseURL( const String& rURL ) { - ::vos::OGuard aGuard( SvtMatchContext_Impl::GetMutex() ); + ::osl::MutexGuard aGuard( SvtMatchContext_Impl::GetMutex() ); // Reset match lists if ( pImp->pCompletions ) @@ -1363,3 +1364,4 @@ void SvtURLBox::SetFilter(const String& _sFilter) FilterMatch::createWildCardFilterList(_sFilter,pImp->m_aFilters); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/prgsbar.cxx b/svtools/source/control/prgsbar.cxx index 86b49c782398..b8df51152bbe 100755..100644 --- a/svtools/source/control/prgsbar.cxx +++ b/svtools/source/control/prgsbar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -256,3 +257,4 @@ void ProgressBar::DataChanged( const DataChangedEvent& rDCEvt ) Window::DataChanged( rDCEvt ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index 118c16c3a4dc..14f8446e2ecb 100755..100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,6 +38,7 @@ #include <algorithm> #include <vcl/bitmap.hxx> #include <tools/color.hxx> +#include <rtl/ustring.hxx> #include <memory> #define ROADMAP_INDENT_X 4 @@ -828,7 +830,7 @@ namespace svt if ( mpID ) { - ::rtl::OUString aIDText = ::rtl::OUString::valueOf( (sal_Int32)( _nIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." ); + ::rtl::OUString aIDText = ::rtl::OUString::valueOf( (sal_Int32)( _nIndex + 1 ) ) + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." )); mpID->SetText( aIDText ); } @@ -926,7 +928,7 @@ namespace svt { // calculate widths long nIDWidth = mpID->GetTextWidth( mpID->GetText() ); - long nMaxIDWidth = mpID->GetTextWidth( ::rtl::OUString::createFromAscii( "100." ) ); + long nMaxIDWidth = mpID->GetTextWidth( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "100." )) ); nIDWidth = ::std::min( nIDWidth, nMaxIDWidth ); // check how many space the description would need @@ -1016,3 +1018,5 @@ namespace svt //......................................................................... } // namespace svt //......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 1c5b95460232..b3ae722a4555 100755..100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,7 +81,9 @@ #define RULER_UNIT_MILE 6 #define RULER_UNIT_POINT 7 #define RULER_UNIT_PICA 8 -#define RULER_UNIT_COUNT 9 +#define RULER_UNIT_CHAR 9 +#define RULER_UNIT_LINE 10 +#define RULER_UNIT_COUNT 11 // ----------------- // - ImplRulerData - @@ -144,7 +147,9 @@ static ImplRulerUnitData aImplRulerUnitTab[RULER_UNIT_COUNT] = { MAP_100TH_INCH, 1200, 120, 600, 1200, 30480, 3, "'" }, // FOOT { MAP_10TH_INCH, 633600, 63360, 316800, 633600, 1609344, 4, " miles" }, // MILE { MAP_POINT, 1, 12, 12, 36, 353, 2, " pt" }, // POINT -{ MAP_100TH_MM, 423, 423, 423, 846, 423, 3, " pi" } // PICA +{ MAP_100TH_MM, 423, 423, 423, 846, 423, 3, " pi" }, // PICA +{ MAP_100TH_MM, 371, 371, 371, 743, 371, 3, " ch" }, // CHAR +{ MAP_100TH_MM, 551, 551, 551, 1102, 551, 3, " li" } // LINE }; // ======================================================================= @@ -187,6 +192,9 @@ ImplRulerData::~ImplRulerData() ImplRulerData& ImplRulerData::operator=( const ImplRulerData& rData ) { + if( this == &rData ) + return *this; + delete[] pLines; delete[] pArrows; delete[] pBorders; @@ -263,6 +271,8 @@ void Ruler::ImplInit( WinBits nWinBits ) mnExtraStyle = 0; // Style des Extra-Feldes mnExtraClicks = 0; // Click-Anzahl fuer Extra-Feld mnExtraModifier = 0; // Modifier-Tasten beim Click im Extrafeld + mnCharWidth = 371; + mnLineHeight = 551; mbCalc = sal_True; // Muessen Pagebreiten neu berechnet werden mbFormat = sal_True; // Muss neu ausgegeben werden mbDrag = sal_False; // Sind wir im Drag-Modus @@ -457,16 +467,35 @@ void Ruler::ImplInvertLines( sal_Bool bErase ) void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) { - long n = 0; - long nTick = 0; long nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3; long nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1; Size aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode ); long nTickWidth; - long nX; - long nY; sal_Bool bNoTicks = sal_False; + //Amelia + long nTickUnit = 0; + long nTick2 = 0; + if ( mnUnitIndex == RULER_UNIT_CHAR ) + { + if ( mnCharWidth == 0 ) + mnCharWidth = 371; + nTick3 = mnCharWidth*2; + nTickCount = mnCharWidth; + nTickUnit = mnCharWidth; + nTick2 = mnCharWidth; + } + else if ( mnUnitIndex == RULER_UNIT_LINE ) + { + if ( mnLineHeight == 0 ) + mnLineHeight = 551; + nTick3 = mnLineHeight*2; + nTickCount = mnLineHeight; + nTickUnit = mnLineHeight; + nTick2 = mnLineHeight; + } + aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode ); + // Groessenvorberechnung // Sizes calculation sal_Bool bVertRight = sal_False; @@ -488,10 +517,13 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) long nMaxWidth = maVirDev.PixelToLogic( Size( mpData->nPageWidth, 0 ), maMapMode ).Width(); if ( nMaxWidth < 0 ) nMaxWidth = -nMaxWidth; - nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit; + // Amelia + if (( mnUnitIndex == RULER_UNIT_CHAR ) || ( mnUnitIndex == RULER_UNIT_LINE )) + nMaxWidth /= nTickUnit; + else + nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit; UniString aNumStr( UniString::CreateFromInt32( nMaxWidth ) ); long nTxtWidth = GetTextWidth( aNumStr ); - const long nTextOff = 4; if ( nTickWidth < nTxtWidth+nTextOff ) { @@ -534,8 +566,12 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) if ( !bNoTicks ) { + long nX; + long nY; + long n = 0; long nTxtWidth2; long nTxtHeight2 = GetTextHeight()/2; + long nTick = 0; while ( ((nStart-n) >= nMin) || ((nStart+n) <= nMax) ) { // Null-Punkt @@ -569,7 +605,11 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) // Tick3 - Output (Text) if ( !(nTick % nTick3) ) { - aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit ); + //aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit ); + if ( ( mnUnitIndex == RULER_UNIT_CHAR ) || ( mnUnitIndex == RULER_UNIT_LINE ) ) + aNumStr = UniString::CreateFromInt32( nTick / nTickUnit ); + else + aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit ); nTxtWidth2 = GetTextWidth( aNumStr )/2; nX = nStart+n; @@ -598,7 +638,10 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter ) // Tick/Tick2 - Output (Strokes) else { - if ( !(nTick % aImplRulerUnitTab[mnUnitIndex].nTick2) ) + /// Amelia + if ( ( mnUnitIndex != RULER_UNIT_CHAR ) && ( mnUnitIndex != RULER_UNIT_LINE ) ) + nTick2 = aImplRulerUnitTab[mnUnitIndex].nTick2; + if ( !(nTick % nTick2 ) ) nTickWidth = RULER_TICK2_WIDTH; else nTickWidth = RULER_TICK1_WIDTH; @@ -1262,7 +1305,7 @@ void Ruler::ImplFormat() Size aVirDevSize; sal_Bool b3DLook = !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO); - // VirtualDevice initialize + // initialize VirtualDevice if ( mnWinStyle & WB_HORZ ) { aVirDevSize.Width() = mnVirWidth; @@ -1636,12 +1679,11 @@ sal_Bool Ruler::ImplHitTest( const Point& rPos, ImplRulerHitTest* pHitTest, } nHitBottom = mnVirHeight+(RULER_OFF*2); - // --> FME 2004-08-05 #i32608# + // #i32608# pHitTest->nAryPos = 0; pHitTest->mnDragSize = 0; pHitTest->bSize = sal_False; pHitTest->bSizeBar = sal_False; - // <-- // Damit ueberstehende Tabs und Einzuege mit beruecksichtigt werden long nXExtraOff; @@ -2808,6 +2850,12 @@ void Ruler::SetUnit( FieldUnit eNewUnit ) case FUNIT_PICA: mnUnitIndex = RULER_UNIT_PICA; break; + case FUNIT_CHAR: + mnUnitIndex = RULER_UNIT_CHAR; + break; + case FUNIT_LINE: + mnUnitIndex = RULER_UNIT_LINE; + break; default: #ifdef DBG_UTIL DBG_ERRORFILE( "Ruler::SetUnit() - Wrong Unit" ); @@ -3154,9 +3202,7 @@ void Ruler::DrawTab( OutputDevice* pDevice, const Point& rPos, sal_uInt16 nStyle ImplDrawRulerTab( pDevice, aPos, nTabStyle, nStyle ); pDevice->Pop(); } -/* -----------------16.10.2002 15:17----------------- - * - * --------------------------------------------------*/ + void Ruler::SetTextRTL(sal_Bool bRTL) { if(mpData->bTextRTL != bRTL) @@ -3183,3 +3229,11 @@ const RulerBorder* Ruler::GetBorders() const { return mpData->pBorders; } sal_uInt16 Ruler::GetIndentCount() const { return mpData->nIndents; } const RulerIndent* Ruler::GetIndents() const { return mpData->pIndents; } + +void Ruler::DrawTicks() +{ + mbFormat = sal_True; + ImplDraw(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/scriptedtext.cxx b/svtools/source/control/scriptedtext.cxx index 7e657ba56ce8..98f6c05ac0d7 100755..100644 --- a/svtools/source/control/scriptedtext.cxx +++ b/svtools/source/control/scriptedtext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -390,3 +391,4 @@ void SvtScriptedTextHelper::DrawText( const Point& _rPos ) //_____________________________________________________________________________ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx index ab4946a8400b..4d937981bea9 100755..100644 --- a/svtools/source/control/scrwin.cxx +++ b/svtools/source/control/scrwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -114,7 +115,7 @@ void ScrollableWindow::DataChanged( const DataChangedEvent& rDCEvt ) //------------------------------------------------------------------- -Size __EXPORT ScrollableWindow::GetOutputSizePixel() const +Size ScrollableWindow::GetOutputSizePixel() const { Size aSz( Window::GetOutputSizePixel() ); @@ -182,7 +183,7 @@ IMPL_LINK( ScrollableWindow, ScrollHdl, ScrollBar *, pScroll ) //------------------------------------------------------------------- -void __EXPORT ScrollableWindow::Resize() +void ScrollableWindow::Resize() { // get the new output-size in pixel Size aOutPixSz = Window::GetOutputSizePixel(); @@ -304,13 +305,13 @@ void __EXPORT ScrollableWindow::Resize() //------------------------------------------------------------------- -void __EXPORT ScrollableWindow::StartScroll() +void ScrollableWindow::StartScroll() { } //------------------------------------------------------------------- -void __EXPORT ScrollableWindow::EndScroll( long, long ) +void ScrollableWindow::EndScroll( long, long ) { } @@ -570,3 +571,4 @@ void ScrollableWindow::ScrollPages( long nPagesX, sal_uLong nOverlapX, } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/stdctrl.cxx b/svtools/source/control/stdctrl.cxx index fb42b42dc7f3..d2cd0aa75099 100755..100644 --- a/svtools/source/control/stdctrl.cxx +++ b/svtools/source/control/stdctrl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,3 +95,4 @@ namespace svt } // namespace svt +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx index 94c15a8604d2..539ce156bbb7 100755..100644 --- a/svtools/source/control/stdmenu.cxx +++ b/svtools/source/control/stdmenu.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -508,3 +509,5 @@ void FontSizeMenu::SetCurHeight( long nHeight ) if ( nChecked ) CheckItem( nChecked, sal_False ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/svxbox.cxx b/svtools/source/control/svxbox.cxx index 451837026dbe..23c738df7dac 100755..100644 --- a/svtools/source/control/svxbox.cxx +++ b/svtools/source/control/svxbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -65,10 +66,6 @@ SvxBoxEntry::SvxBoxEntry(const SvxBoxEntry& rOld) : { } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - SvxListBox::SvxListBox(Window* pParent, WinBits nBits) : ListBox(pParent, nBits) { @@ -86,7 +83,7 @@ SvxListBox::SvxListBox(Window* pParent, const ResId& rId): Beschreibung: Basisklasse Dtor --------------------------------------------------------------------*/ -__EXPORT SvxListBox::~SvxListBox() +SvxListBox::~SvxListBox() { aEntryLst.DeleteAndDestroy(0, aEntryLst.Count()); aDelEntryLst.DeleteAndDestroy(0, aDelEntryLst.Count()); @@ -354,7 +351,7 @@ SvxComboBox::SvxComboBox(Window* pParent, const ResId& rId, sal_uInt16 nStyleBit Beschreibung: Basisklasse Dtor --------------------------------------------------------------------*/ -__EXPORT SvxComboBox::~SvxComboBox() +SvxComboBox::~SvxComboBox() { aEntryLst.DeleteAndDestroy(0, aEntryLst.Count()); aDelEntryLst.DeleteAndDestroy(0, aDelEntryLst.Count()); @@ -578,7 +575,7 @@ void SvxComboBox::InsertSorted(SvxBoxEntry* pEntry) Beschreibung: Je nach Option bestimmte Zeichen ausblenden --------------------------------------------------------------------*/ -void __EXPORT SvxComboBox::KeyInput( const KeyEvent& rKEvt ) +void SvxComboBox::KeyInput( const KeyEvent& rKEvt ) { sal_Unicode cChar = rKEvt.GetCharCode(); @@ -615,3 +612,4 @@ String SvxComboBox::GetText() const } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index b7511d24b5c8..bc0ee75a845b 100755..100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,9 +38,11 @@ #include <vcl/decoview.hxx> #include <vcl/button.hxx> #include <vcl/edit.hxx> +#include <vcl/image.hxx> #include "svtaccessiblefactory.hxx" #include <filectrl.hrc> #include <svtools/svtdata.hxx> +#include <svtools/svtools.hrc> #include <limits> // ======================================================================= @@ -66,9 +69,7 @@ struct ImplTabBarItem sal_Bool mbSelect; sal_Bool mbEnable; Color maTabBgColor; - bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? sal_True : sal_False; }; Color maTabTextColor; - bool IsDefaultTabTextColor() const { return maTabTextColor == Color(COL_AUTO) ? sal_True : sal_False; }; ImplTabBarItem( sal_uInt16 nItemId, const XubString& rText, TabBarPageBits nPageBits ) : @@ -83,9 +84,22 @@ struct ImplTabBarItem maTabBgColor = Color( COL_AUTO ); maTabTextColor = Color( COL_AUTO ); } -}; -DECLARE_LIST( ImplTabBarList, ImplTabBarItem* ) + bool IsDefaultTabBgColor() const + { + return maTabBgColor == Color(COL_AUTO); + } + + bool IsDefaultTabTextColor() const + { + return maTabTextColor == Color(COL_AUTO); + } + + bool IsSelected(ImplTabBarItem* pCurItem) const + { + return mbSelect || (pCurItem == this); + } +}; // ======================================================================= @@ -146,8 +160,9 @@ private: // ----------------------------------------------------------------------- -ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle ) : - Window( pParent, nWinStyle & WB_3DLOOK ) +ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle ) + : Window( pParent, nWinStyle & WB_3DLOOK ) + , mnStartWidth(0) { SetPointer( Pointer( POINTER_HSIZEBAR ) ); SetSizePixel( Size( 7, 0 ) ); @@ -358,6 +373,7 @@ struct TabBar_Impl const sal_uInt16 TabBar::APPEND = ::std::numeric_limits<sal_uInt16>::max(); const sal_uInt16 TabBar::PAGE_NOT_FOUND = ::std::numeric_limits<sal_uInt16>::max(); +const sal_uInt16 TabBar::INSERT_TAB_POS = ::std::numeric_limits<sal_uInt16>::max() - 1; void TabBar::ImplInit( WinBits nWinStyle ) { @@ -418,6 +434,7 @@ TabBar::TabBar( Window* pParent, WinBits nWinStyle ) : Window( pParent, (nWinStyle & WB_3DLOOK) | WB_CLIPCHILDREN ) { ImplInit( nWinStyle ); + maCurrentItemList = 0; } // ----------------------------------------------------------------------- @@ -437,16 +454,37 @@ TabBar::~TabBar() delete mpLastBtn; delete mpImpl; - // Alle Items loeschen - ImplTabBarItem* pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + delete (*mpItemList)[ i ]; + } + delete mpItemList; +} + +// ----------------------------------------------------------------------- +ImplTabBarItem* TabBar::seek( size_t i ) +{ + if ( i < mpItemList->size() ) { - delete pItem; - pItem = mpItemList->Next(); + maCurrentItemList = i; + return (*mpItemList)[ maCurrentItemList ]; } + return NULL; +} - // Itemlist loeschen - delete mpItemList; +ImplTabBarItem* TabBar::prev() +{ + if ( maCurrentItemList > 0 ) { + return (*mpItemList)[ --maCurrentItemList ]; + } + return NULL; +} + +ImplTabBarItem* TabBar::next() +{ + if ( maCurrentItemList+1 < mpItemList->size() ) { + return (*mpItemList)[ ++maCurrentItemList ]; + } + return NULL; } // ----------------------------------------------------------------------- @@ -554,9 +592,9 @@ sal_Bool TabBar::ImplCalcWidth() mnCurMaxWidth = 0; sal_Bool bChanged = sal_False; - ImplTabBarItem* pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + ImplTabBarItem* pItem = (*mpItemList)[ i ]; long nNewWidth = GetTextWidth( pItem->maText ); if ( mnCurMaxWidth && (nNewWidth > mnCurMaxWidth) ) { @@ -572,7 +610,6 @@ sal_Bool TabBar::ImplCalcWidth() if ( !pItem->maRect.IsEmpty() ) bChanged = sal_True; } - pItem = mpItemList->Next(); } mbSizeFormat = sal_False; mbFormat = sal_True; @@ -590,9 +627,9 @@ void TabBar::ImplFormat() sal_uInt16 n = 0; long x = mnOffX; - ImplTabBarItem* pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, nL = mpItemList->size(); i < nL; ++i ) { + ImplTabBarItem* pItem = (*mpItemList)[ i ]; // Bei allen nicht sichtbaren Tabs, wird ein leeres Rechteck // gesetzt if ( (n+1 < mnFirstPos) || (x > mnLastOffX) ) @@ -620,7 +657,6 @@ void TabBar::ImplFormat() } n++; - pItem = mpItemList->Next(); } mbFormat = sal_False; @@ -633,19 +669,19 @@ void TabBar::ImplFormat() sal_uInt16 TabBar::ImplGetLastFirstPos() { - sal_uInt16 nCount = (sal_uInt16)(mpItemList->Count()); + sal_uInt16 nCount = (sal_uInt16)(mpItemList->size()); if ( !nCount || mbSizeFormat || mbFormat ) return 0; sal_uInt16 nLastFirstPos = nCount-1; long nWinWidth = mnLastOffX-mnOffX-TABBAR_OFFSET_X-ADDNEWPAGE_AREAWIDTH; - long nWidth = mpItemList->GetObject( nLastFirstPos )->mnWidth; + long nWidth = (*mpItemList)[ nLastFirstPos ]->mnWidth; while ( nLastFirstPos && (nWidth < nWinWidth) ) { nLastFirstPos--; - nWidth += mpItemList->GetObject( nLastFirstPos )->mnWidth; + nWidth += (*mpItemList)[ nLastFirstPos ]->mnWidth; } - if ( (nLastFirstPos != (sal_uInt16)(mpItemList->Count()-1)) && + if ( (nLastFirstPos != (sal_uInt16)(mpItemList->size()-1)) && (nWidth > nWinWidth) ) nLastFirstPos++; return nLastFirstPos; @@ -715,6 +751,8 @@ void TabBar::ImplInitControls() DELETEZ( mpFirstBtn ); DELETEZ( mpLastBtn ); } + + mbHasInsertTab = (mnWinStyle & WB_INSERTTAB); } // ----------------------------------------------------------------------- @@ -746,7 +784,7 @@ void TabBar::ImplShowPage( sal_uInt16 nPos ) long nWidth = GetOutputSizePixel().Width(); if ( nWidth >= TABBAR_OFFSET_X ) nWidth -= TABBAR_OFFSET_X; - ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); + ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; if ( nPos < mnFirstPos ) SetFirstPageId( pItem->mnId ); else if ( pItem->maRect.Right() > nWidth ) @@ -826,7 +864,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt ) if ( (nSelId > 0) && (nSelId != mnCurPageId) ) { sal_uInt16 nPos = GetPagePos( nSelId ); - pItem = mpItemList->GetObject( nPos ); + pItem = (*mpItemList)[ nPos ]; if ( pItem->mbEnable ) { @@ -855,7 +893,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt ) { sal_uInt16 nPos = GetPagePos( nSelId ); sal_Bool bSelectTab = sal_False; - pItem = mpItemList->GetObject( nPos ); + pItem = (*mpItemList)[ nPos ]; if ( pItem->mbEnable ) { @@ -881,7 +919,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt ) n = 0; while ( n < nCurPos ) { - pItem = mpItemList->GetObject( n ); + pItem = (*mpItemList)[ n ]; if ( n < nPos ) bSelect = sal_False; else @@ -903,11 +941,11 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt ) // Alle Tabs von der aktuellen bis zur angeklickten // Tab selektieren und alle Tabs von der angeklickten // Tab bis zur letzten Tab deselektieren - sal_uInt16 nCount = (sal_uInt16)mpItemList->Count(); + sal_uInt16 nCount = (sal_uInt16)mpItemList->size(); n = nCurPos; while ( n < nCount ) { - pItem = mpItemList->GetObject( n ); + pItem = (*mpItemList)[ n ]; if ( n <= nPos ) bSelect = sal_True; @@ -965,7 +1003,7 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt ) if ( nSelId != mnCurPageId ) { sal_uInt16 nPos = GetPagePos( nSelId ); - pItem = mpItemList->GetObject( nPos ); + pItem = (*mpItemList)[ nPos ]; if ( pItem->mbEnable ) { @@ -977,17 +1015,15 @@ void TabBar::MouseButtonDown( const MouseEvent& rMEvt ) bUpdate = sal_True; // Alle selektierten Items deselektieren - pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + pItem = (*mpItemList)[ i ]; if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) { pItem->mbSelect = sal_False; if ( bUpdate ) Invalidate( pItem->maRect ); } - - pItem = mpItemList->Next(); } } @@ -1019,288 +1055,397 @@ void TabBar::MouseButtonUp( const MouseEvent& rMEvt ) Window::MouseButtonUp( rMEvt ); } + // ----------------------------------------------------------------------- -void TabBar::Paint( const Rectangle& ) +namespace { + +class TabBarPaintGuard { - // Items berechnen und ausgeben - sal_uInt16 nItemCount = (sal_uInt16)mpItemList->Count(); - ImplTabBarItem* pItem; +public: + explicit TabBarPaintGuard(TabBar& rParent) : + mrParent(rParent), + maFont(rParent.GetFont()) + { + // #i36013# exclude push buttons from painting area + mrParent.SetClipRegion( Region(mrParent.GetPageArea()) ); + } - // kein Item, dann auch nichts zu tun - if ( nItemCount ) + ~TabBarPaintGuard() { - // TabBar muss formatiert sein - ImplFormat(); + // Restore original font. + mrParent.SetFont(maFont); + // remove clip region + mrParent.SetClipRegion(); + } +private: + TabBar& mrParent; + Font maFont; +}; + +class TabDrawer +{ +public: + + explicit TabDrawer(TabBar& rParent) : + mrParent(rParent), + mpStyleSettings(&mrParent.GetSettings().GetStyleSettings()), + maPoly(4), + mbSelected(false), + mbCustomColored(false), + mbSpecialTab(false), + mbEnabled(false) + { + } + + void drawOutputAreaBorder() + { + WinBits nWinStyle = mrParent.GetStyle(); - // Beim ersten Format auch dafuer sorgen, das aktuelle TabPage - // sichtbar wird - if ( mbFirstFormat ) + // Bei Border oben und unten einen Strich extra malen + if ( (nWinStyle & WB_BORDER) || (nWinStyle & WB_TOPBORDER) ) { - mbFirstFormat = sal_False; + Size aOutputSize = mrParent.GetOutputSizePixel(); + Rectangle aOutRect = mrParent.GetPageArea(); - if ( mnCurPageId && (mnFirstPos == 0) && !mbDropPos ) + // Bei 3D-Tabs wird auch der Border in 3D gemalt + if ( nWinStyle & WB_3DTAB ) { - pItem = mpItemList->GetObject( GetPagePos( mnCurPageId ) ); - if ( pItem->maRect.IsEmpty() ) - { - // mbDropPos setzen (bzw. misbrauchen) um Invalidate() - // zu unterbinden - mbDropPos = sal_True; - SetFirstPageId( mnCurPageId ); - mbDropPos = sal_False; - if ( mnFirstPos != 0 ) - ImplFormat(); - } + mrParent.SetLineColor( mpStyleSettings->GetShadowColor() ); + mrParent.DrawLine( Point( aOutRect.Left(), 0 ), Point( aOutputSize.Width(), 0 ) ); } + + // Border malen (Strich oben und Strich unten) + mrParent.SetLineColor( mpStyleSettings->GetDarkShadowColor() ); + mrParent.DrawLine( aOutRect.TopLeft(), Point( aOutputSize.Width()-1, aOutRect.Top() ) ); } } - // Farben ermitteln - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - Color aFaceColor; - Color aSelectColor; - Color aFaceTextColor; - Color aSelectTextColor; - ImplGetColors( aFaceColor, aFaceTextColor, aSelectColor, aSelectTextColor ); + void drawOuterFrame() + { + mrParent.DrawPolygon(maPoly); + } - // Font selektieren - Font aFont = GetFont(); - Font aLightFont = aFont; - //aLightFont.SetWeight( WEIGHT_LIGHT ); //TODO Make font weight light on custom color only? - aLightFont.SetWeight( WEIGHT_NORMAL ); + void drawLeftShadow() + { + Point p1 = maPoly[0], p2 = maPoly[1]; + p1.X()++; + p2.X()++; + p2.Y()--; + mrParent.DrawLine(p1, p2); + } - // #i36013# exclude push buttons from painting area - Rectangle aClipRect( Point( mnOffX, 0 ), Point( mnLastOffX, GetOutputHeightPixel() - 1 ) ); - SetClipRegion( Region( aClipRect ) ); + void drawRightShadow() + { + Point p1 = maPoly[2]; + Point p2 = maPoly[3]; + p1.X()--; + p2.X()--; + mrParent.DrawLine(p1, p2); + } - // Bei Border oben und unten einen Strich extra malen - if ( (mnWinStyle & WB_BORDER) || (mnWinStyle & WB_TOPBORDER) ) + void drawTopInnerShadow() { - Size aOutputSize = GetOutputSizePixel(); + Point p1 = maPoly[0], p2 = maPoly[3]; + p1.Y()++; + p2.Y()++; + mrParent.DrawLine(p1, p2); + } - // Bei 3D-Tabs wird auch der Border in 3D gemalt - if ( mnWinStyle & WB_3DTAB ) + void drawBottomShadow(bool bColored) + { + Point p1 = maPoly[1], p2 = maPoly[2]; + p1.X() += 1; + p1.Y() -= 1; + p2.X() -= 1; + p2.Y() -= 1; + mrParent.DrawLine(p1, p2); + if (bColored) { - SetLineColor( rStyleSettings.GetShadowColor() ); - DrawLine( Point( mnOffX, 0 ), Point( aOutputSize.Width(), 0 ) ); + p1 += Point(-1, -1); + p2 += Point(1, -1); + mrParent.DrawLine(p1, p2); } + } - // Border malen (Strich oben und Strich unten) - SetLineColor( rStyleSettings.GetDarkShadowColor() ); - DrawLine( Point( mnOffX, mnOffY ), Point( aOutputSize.Width()-1, mnOffY ) ); + void drawText(const String& aText) + { + Rectangle aRect = maRect; + long nTextWidth = mrParent.GetTextWidth(aText); + long nTextHeight = mrParent.GetTextHeight(); + Point aPos = aRect.TopLeft(); + aPos.X() += (aRect.getWidth() - nTextWidth) / 2; + aPos.Y() += (aRect.getHeight() - nTextHeight) / 2; + + if (mbEnabled) + mrParent.DrawText(aPos, aText); + else + mrParent.DrawCtrlText( + aPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC)); } - else - SetLineColor( rStyleSettings.GetDarkShadowColor() ); - // Items ausgeben - if ( nItemCount ) + void drawOverTopBorder(bool b3DTab) { - // letzten sichtbaren Eintrag suchen - sal_uInt16 n = mnFirstPos+1; - if ( n >= nItemCount ) - n = nItemCount-1; - pItem = mpItemList->Seek( n ); - while ( pItem ) + Point p1 = maPoly[0], p2 = maPoly[3]; + p1.X() += 1; + p2.X() -= 1; + Rectangle aDelRect(p1, p2); + mrParent.DrawRect(aDelRect); + if (b3DTab) { - if ( !pItem->maRect.IsEmpty() ) - { - n++; - pItem = mpItemList->Next(); - } - else - break; + aDelRect.Top()--; + mrParent.DrawRect(aDelRect); } + } + + void drawTab() + { + mrParent.SetLineColor(mpStyleSettings->GetDarkShadowColor()); - // Alle Tabs ausgeben (von hinten nach vorn und aktuellen zuletzt) - if ( pItem ) - n--; - else if ( n >= nItemCount ) - n = nItemCount-1; - pItem = mpItemList->Seek( n ); - ImplTabBarItem* pCurItem = NULL; - while ( pItem ) + // Je nach Status die richtige FillInBrush setzen + // Set the correct FillInBrush depending upon status + if ( mbSelected ) { - // CurrentItem als letztes ausgeben, da es alle anderen ueberdeckt - if ( !pCurItem && (pItem->mnId == mnCurPageId) ) - { - pCurItem = pItem; - pItem = mpItemList->Prev(); - if ( !pItem ) - pItem = pCurItem; - continue; - } + // Currently selected Tab + mrParent.SetFillColor( maSelectedColor ); + } + else if ( mbCustomColored ) + { + mrParent.SetFillColor( maCustomColor ); + } + else + { + mrParent.SetFillColor( maUnselectedColor ); + } - if ( !pItem->maRect.IsEmpty() ) - { - Rectangle aRect = pItem->maRect; + drawOuterFrame(); - // Aktuelle Page wird mit einem fetten Font ausgegeben - if ( pItem->mnId == mnCurPageId ) - SetFont( aFont ); - else - SetFont( aLightFont ); + // If this is the current tab, draw the left inner shadow the default color, + // otherwise make it the same as the custom background color + Color aColor = mpStyleSettings->GetLightColor(); + if (mbCustomColored && !mbSelected) + aColor = maCustomColor; - // Je nach Status die richtige FillInBrush setzen - // Set the correct FillInBrush depending upon status - if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) - { - // Currently selected Tab - SetFillColor( aSelectColor ); - SetTextColor( aSelectTextColor ); - } - else - { - if ( !pItem->IsDefaultTabBgColor() && !rStyleSettings.GetHighContrastMode() ) - { - SetFillColor( pItem->maTabBgColor ); - SetTextColor( pItem->maTabTextColor ); - } else { - SetFillColor( aFaceColor ); - SetTextColor( aFaceTextColor ); - } - } + mrParent.SetLineColor(aColor); + drawLeftShadow(); - // Muss Font Kursiv geschaltet werden - if ( pItem->mnBits & TPB_SPECIAL ) - { - SetTextColor( Color( COL_LIGHTBLUE ) ); - } + if ( !mbSelected ) + drawTopInnerShadow(); - // Position der Page berechnen - Point aPos0 = Point( aRect.Left(), mnOffY ); - Point aPos1 = Point( aRect.Left()+TABBAR_OFFSET_X, aRect.Bottom() ); - Point aPos2 = Point( aRect.Right()-TABBAR_OFFSET_X, aRect.Bottom() ); - Point aPos3 = Point( aRect.Right(), mnOffY ); - - // Zuerst geben wir das Polygon gefuellt aus - Polygon aPoly( 4 ); - aPoly[0] = aPos0; - aPoly[1] = aPos1; - aPoly[2] = aPos2; - aPoly[3] = aPos3; - DrawPolygon( aPoly ); - - // Danach den Text zentiert ausgeben - XubString aText = pItem->maText; - if ( pItem->mbShort ) - aText = GetEllipsisString( aText, mnCurMaxWidth, TEXT_DRAW_ENDELLIPSIS ); - Size aRectSize = aRect.GetSize(); - long nTextWidth = GetTextWidth( aText ); - long nTextHeight = GetTextHeight(); - Point aTxtPos( aRect.Left()+(aRectSize.Width()-nTextWidth)/2, - (aRectSize.Height()-nTextHeight)/2 ); - if ( pItem->IsDefaultTabBgColor() || (!pItem->mbSelect) ) - { - if ( !pItem->mbEnable ) - DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) ); - else - DrawText( aTxtPos, aText ); - } - // Jetzt im Inhalt den 3D-Effekt ausgeben - aPos0.X()++; - aPos1.X()++; - aPos2.X()--; - aPos3.X()--; - - // If this is the current tab, draw the left inner shadow the default color, - // otherwise make it the same as the custom background color - if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) { - SetLineColor( rStyleSettings.GetLightColor() ); - } else { - if ( !pItem->IsDefaultTabBgColor() && ! rStyleSettings.GetHighContrastMode() ) - { - SetLineColor( pItem->maTabBgColor ); - } else { - SetLineColor( rStyleSettings.GetLightColor() ); - } - } - // Draw the left side of the tab - DrawLine( aPos0, aPos1 ); + mrParent.SetLineColor( mpStyleSettings->GetShadowColor() ); + drawRightShadow(); + if ( mbCustomColored && mbSelected ) + { + mrParent.SetLineColor(maCustomColor); + drawBottomShadow(true); + } + else + drawBottomShadow(false); - if ( !pItem->mbSelect && (pItem->mnId != mnCurPageId) ) - { - // Draw the top inner shadow - // ToDo: Change from this static color to tab custom bg color - DrawLine( Point( aPos0.X(), aPos0.Y()+1 ), - Point( aPos3.X(), aPos3.Y()+1 ) ); - } + // Draw the outer frame once more. In some environments, the outer frame + // gets overpainted. + mrParent.SetLineColor( mpStyleSettings->GetDarkShadowColor() ); + mrParent.SetFillColor(); + drawOuterFrame(); + } - SetLineColor( rStyleSettings.GetShadowColor() ); - DrawLine( aPos2, aPos3 ); - aPos1.X()--; - aPos1.Y()--; - aPos2.Y()--; - if ( !pItem->IsDefaultTabBgColor() && ( pItem->mbSelect || (pItem->mnId == mnCurPageId) ) ) - { - SetLineColor( pItem->maTabBgColor ); - DrawLine( Point(aPos1.X()-1, aPos1.Y()-1), Point(aPos2.X(), aPos2.Y()-1) ); - } - DrawLine( aPos1, aPos2 ); + void drawPlusImage() + { + SvtResId id( BMP_LIST_ADD ); + Image aPlusImg( id ); + // Center the image within the bounding rectangle. + Size aSize = aPlusImg.GetSizePixel(); + Point pt = maRect.TopLeft(); + long nXOffSet = (maRect.GetWidth() - aSize.Width()) / 2; + long nYOffset = (maRect.GetHeight() - aSize.Height()) / 2; + pt += Point(nXOffSet, nYOffset); + pt.X() += 1; + mrParent.DrawImage(pt, aPlusImg); + } - // draw a small 2px sliver of the original background color at the bottom of the selected tab + void setRect(const Rectangle& rRect) + { + maRect = rRect; - if ( !pItem->IsDefaultTabBgColor() ) - { - if ( pItem->mbSelect || (pItem->mnId == mnCurPageId) || rStyleSettings.GetHighContrastMode() ) { - SetLineColor( pItem->maTabBgColor ); - DrawLine( Point(aPos1.X()-1, aPos1.Y()-1), Point(aPos2.X(), aPos2.Y()-1) ); - if ( !pItem->mbEnable ) - DrawCtrlText( aTxtPos, aText, 0, STRING_LEN, (TEXT_DRAW_DISABLE | TEXT_DRAW_MNEMONIC) ); - else - DrawText( aTxtPos, aText ); - } - } + long nOffY = mrParent.GetPageArea().getY(); - // Da etwas uebermalt werden konnte, muessen wir die Polygon- - // umrandung nocheinmal ausgeben - SetLineColor( rStyleSettings.GetDarkShadowColor() ); - SetFillColor(); - DrawPolygon( aPoly ); + // Zuerst geben wir das Polygon gefuellt aus + maPoly[0] = Point( rRect.Left(), nOffY ); + maPoly[1] = Point( rRect.Left()+TABBAR_OFFSET_X, rRect.Bottom() ); + maPoly[2] = Point( rRect.Right()-TABBAR_OFFSET_X, rRect.Bottom() ); + maPoly[3] = Point( rRect.Right(), nOffY ); + } - // Beim dem aktuellen Tab die restlichten Ausgaben vornehmen und - // die Schleife abbrechen, da die aktuelle Tab als letztes - // ausgegeben wird - if ( pItem == pCurItem ) - { - // Beim aktuellen Item muss der oberstes Strich geloescht - // werden - SetLineColor(); - SetFillColor( aSelectColor ); - Rectangle aDelRect( aPos0, aPos3 ); - DrawRect( aDelRect ); - if ( mnWinStyle & WB_3DTAB ) - { - aDelRect.Top()--; - DrawRect( aDelRect ); - } + void setSelected(bool b) + { + mbSelected = b; + } - break; - } + void setCustomColored(bool b) + { + mbCustomColored = b; + } - pItem = mpItemList->Prev(); - } - else - { - if ( pItem == pCurItem ) - break; + void setSpecialTab(bool b) + { + mbSpecialTab = b; + } - pItem = NULL; - } + void setEnabled(bool b) + { + mbEnabled = b; + } + + void setSelectedFillColor(const Color& rColor) + { + maSelectedColor = rColor; + } + void setUnselectedFillColor(const Color& rColor) + { + maUnselectedColor = rColor; + } + + void setCustomColor(const Color& rColor) + { + maCustomColor = rColor; + } + +private: + TabBar& mrParent; + const StyleSettings* mpStyleSettings; + + Rectangle maRect; + Polygon maPoly; + + Color maSelectedColor; + Color maCustomColor; + Color maUnselectedColor; + + bool mbSelected:1; + bool mbCustomColored:1; + bool mbSpecialTab:1; + bool mbEnabled:1; +}; + +} + +void TabBar::Paint( const Rectangle& ) +{ + // Items berechnen und ausgeben + sal_uInt16 nItemCount = (sal_uInt16)mpItemList->size(); + if (!nItemCount) + return; + + ImplPrePaint(); + + Color aFaceColor, aSelectColor, aFaceTextColor, aSelectTextColor; + ImplGetColors( aFaceColor, aFaceTextColor, aSelectColor, aSelectTextColor ); + + // Font selektieren + Font aFont = GetFont(); + Font aLightFont = aFont; + aLightFont.SetWeight( WEIGHT_NORMAL ); + + TabBarPaintGuard aGuard(*this); + TabDrawer aDrawer(*this); + aDrawer.setSelectedFillColor(aSelectColor); + aDrawer.setUnselectedFillColor(aFaceColor); + aDrawer.drawOutputAreaBorder(); + + // Now, start drawing the tabs. + + ImplTabBarItem* pItem = ImplGetLastTabBarItem(nItemCount); + + if (pItem && mbHasInsertTab) + { + // Draw the insert tab at the right end. + Rectangle aRect = ImplGetInsertTabRect(pItem); + aDrawer.setRect(aRect); + aDrawer.drawTab(); + aDrawer.drawPlusImage(); + } + + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + ImplTabBarItem* pCurItem = NULL; + while ( pItem ) + { + // CurrentItem als letztes ausgeben, da es alle anderen ueberdeckt + if ( !pCurItem && (pItem->mnId == mnCurPageId) ) + { + pCurItem = pItem; + pItem = prev(); if ( !pItem ) pItem = pCurItem; + continue; } - } - // Font wieder herstellen - SetFont( aFont ); - // remove clip region - SetClipRegion(); + bool bCurrent = pItem == pCurItem; + + if ( !pItem->maRect.IsEmpty() ) + { + Rectangle aRect = pItem->maRect; + bool bSelected = pItem->IsSelected(pCurItem); + // We disable custom background color in high contrast mode. + bool bCustomBgColor = !pItem->IsDefaultTabBgColor() && !rStyleSettings.GetHighContrastMode(); + bool bSpecialTab = (pItem->mnBits & TPB_SPECIAL); + bool bEnabled = pItem->mbEnable; + String aText = pItem->mbShort ? + GetEllipsisString(pItem->maText, mnCurMaxWidth, TEXT_DRAW_ENDELLIPSIS) : pItem->maText; + + aDrawer.setRect(aRect); + aDrawer.setSelected(bSelected); + aDrawer.setCustomColored(bCustomBgColor); + aDrawer.setSpecialTab(bSpecialTab); + aDrawer.setEnabled(bEnabled); + aDrawer.setCustomColor(pItem->maTabBgColor); + aDrawer.drawTab(); + + // Aktuelle Page wird mit einem fetten Font ausgegeben + if ( bCurrent ) + SetFont( aFont ); + else + SetFont( aLightFont ); + + // Je nach Status die richtige FillInBrush setzen + // Set the correct FillInBrush depending upon status + if ( bSelected ) + SetTextColor( aSelectTextColor ); + else if ( bCustomBgColor ) + SetTextColor( pItem->maTabTextColor ); + else + SetTextColor( aFaceTextColor ); + + // This tab is "special", and a special tab needs a blue text. + if (bSpecialTab) + SetTextColor(Color(COL_LIGHTBLUE)); + + aDrawer.drawText(aText); + + if ( bCurrent ) + { + SetLineColor(); + SetFillColor(aSelectColor); + aDrawer.drawOverTopBorder(mnWinStyle & WB_3DTAB); + return; + } + + pItem = prev(); + } + else + { + if ( bCurrent ) + return; + + pItem = NULL; + } + + if ( !pItem ) + pItem = pCurItem; + } } // ----------------------------------------------------------------------- - void TabBar::Resize() { Size aNewSize = GetOutputSizePixel(); @@ -1420,7 +1565,7 @@ void TabBar::RequestHelp( const HelpEvent& rHEvt ) if ( rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON) ) { sal_uInt16 nPos = GetPagePos( nItemId ); - ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); + ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->mbShort || (pItem->maRect.Right()-TABBAR_OFFSET_X-5 > mnLastOffX) ) { @@ -1431,7 +1576,7 @@ void TabBar::RequestHelp( const HelpEvent& rHEvt ) aPt = OutputToScreenPixel( aItemRect.BottomRight() ); aItemRect.Right() = aPt.X(); aItemRect.Bottom() = aPt.Y(); - XubString aStr = mpItemList->GetObject( nPos )->maText; + XubString aStr = (*mpItemList)[ nPos ]->maText; if ( aStr.Len() ) { if ( rHEvt.GetMode() & HELPMODE_BALLOON ) @@ -1455,7 +1600,7 @@ void TabBar::StateChanged( StateChangedType nType ) if ( nType == STATE_CHANGE_INITSHOW ) { - if ( (mbSizeFormat || mbFormat) && mpItemList->Count() ) + if ( (mbSizeFormat || mbFormat) && !mpItemList->empty() ) ImplFormat(); } else if ( (nType == STATE_CHANGE_ZOOM) || @@ -1556,6 +1701,80 @@ long TabBar::ImplDeactivatePage() return nRet; } +void TabBar::ImplPrePaint() +{ + sal_uInt16 nItemCount = (sal_uInt16)mpItemList->size(); + if (!nItemCount) + return; + + ImplTabBarItem* pItem; + + // TabBar muss formatiert sein + ImplFormat(); + + // Beim ersten Format auch dafuer sorgen, das aktuelle TabPage + // sichtbar wird + if ( mbFirstFormat ) + { + mbFirstFormat = sal_False; + + if ( mnCurPageId && (mnFirstPos == 0) && !mbDropPos ) + { + pItem = (*mpItemList)[ GetPagePos( mnCurPageId ) ]; + if ( pItem->maRect.IsEmpty() ) + { + // mbDropPos setzen (bzw. misbrauchen) um Invalidate() + // zu unterbinden + mbDropPos = sal_True; + SetFirstPageId( mnCurPageId ); + mbDropPos = sal_False; + if ( mnFirstPos != 0 ) + ImplFormat(); + } + } + } +} + +ImplTabBarItem* TabBar::ImplGetLastTabBarItem( sal_uInt16 nItemCount ) +{ + // letzten sichtbaren Eintrag suchen + sal_uInt16 n = mnFirstPos+1; + if ( n >= nItemCount ) + n = nItemCount-1; + ImplTabBarItem* pItem = seek( n ); + while ( pItem ) + { + if ( !pItem->maRect.IsEmpty() ) + { + n++; + pItem = next(); + } + else + break; + } + + // Alle Tabs ausgeben (von hinten nach vorn und aktuellen zuletzt) + if ( pItem ) + n--; + else if ( n >= nItemCount ) + n = nItemCount-1; + pItem = seek( n ); + return pItem; +} + +Rectangle TabBar::ImplGetInsertTabRect(ImplTabBarItem* pItem) const +{ + if (mbHasInsertTab && pItem) + { + Rectangle aInsTabRect = pItem->maRect; + aInsTabRect.setX( + aInsTabRect.getX() + aInsTabRect.getWidth() - TABBAR_OFFSET_X - TABBAR_OFFSET_X2); + aInsTabRect.setWidth(32); + return aInsTabRect; + } + return Rectangle(); +} + // ----------------------------------------------------------------------- long TabBar::DeactivatePage() @@ -1612,7 +1831,13 @@ void TabBar::InsertPage( sal_uInt16 nPageId, const XubString& rText, // PageItem anlegen und in die Item-Liste eintragen ImplTabBarItem* pItem = new ImplTabBarItem( nPageId, rText, nBits ); - mpItemList->Insert( pItem, nPos ); + if ( nPos < mpItemList->size() ) { + ImplTabBarList::iterator it = mpItemList->begin(); + ::std::advance( it, nPos ); + mpItemList->insert( it, pItem ); + } else { + mpItemList->push_back( pItem ); + } mbSizeFormat = sal_True; // CurPageId gegebenenfalls setzen @@ -1633,7 +1858,7 @@ Color TabBar::GetTabBgColor( sal_uInt16 nPageId ) const sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) - return mpItemList->GetObject( nPos )->maTabBgColor; + return (*mpItemList)[ nPos ]->maTabBgColor; else return Color( COL_AUTO ); } @@ -1644,7 +1869,7 @@ void TabBar::SetTabBgColor( sal_uInt16 nPageId, const Color& aTabBgColor ) ImplTabBarItem* pItem; if ( nPos != PAGE_NOT_FOUND ) { - pItem = mpItemList->GetObject( nPos ); + pItem = (*mpItemList)[ nPos ]; if ( aTabBgColor != Color( COL_AUTO ) ) { pItem->maTabBgColor = aTabBgColor; @@ -1678,8 +1903,10 @@ void TabBar::RemovePage( sal_uInt16 nPageId ) mnFirstPos--; // Item-Daten loeschen - delete mpItemList->Remove( nPos ); - mbFormat = sal_True; + ImplTabBarList::iterator it = mpItemList->begin(); + ::std::advance( it, nPos ); + delete *it; + mpItemList->erase( it ); // Leiste neu ausgeben if ( IsReallyVisible() && IsUpdateMode() ) @@ -1706,9 +1933,17 @@ void TabBar::MovePage( sal_uInt16 nPageId, sal_uInt16 nNewPos ) if ( nPos != PAGE_NOT_FOUND ) { // TabBar-Item in der Liste verschieben - ImplTabBarItem* pItem = mpItemList->Remove( nPos ); - mpItemList->Insert( pItem, nNewPos ); - mbFormat = sal_True; + ImplTabBarList::iterator it = mpItemList->begin(); + ::std::advance( it, nPos ); + ImplTabBarItem* pItem = *it; + mpItemList->erase( it ); + if ( nNewPos < mpItemList->size() ) { + it = mpItemList->begin(); + ::std::advance( it, nNewPos ); + mpItemList->insert( it, pItem ); + } else { + mpItemList->push_back( pItem ); + } // Leiste neu ausgeben if ( IsReallyVisible() && IsUpdateMode() ) @@ -1723,25 +1958,22 @@ void TabBar::MovePage( sal_uInt16 nPageId, sal_uInt16 nNewPos ) void TabBar::Clear() { // Alle Items loeschen - ImplTabBarItem* pItem = mpItemList->First(); - while ( pItem ) - { - // Item-Daten loeschen - delete pItem; - pItem = mpItemList->Next(); + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + delete (*mpItemList)[ i ]; } + mpItemList->clear(); // Items aus der Liste loeschen - mpItemList->Clear(); mbSizeFormat = sal_True; mnCurPageId = 0; mnFirstPos = 0; + maCurrentItemList = 0; // Leiste neu ausgeben if ( IsReallyVisible() && IsUpdateMode() ) Invalidate(); - CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, (void*) PAGE_NOT_FOUND ); + CallEventListeners( VCLEVENT_TABBAR_PAGEREMOVED, reinterpret_cast<void*>(sal::static_int_cast<sal_IntPtr>(PAGE_NOT_FOUND)) ); } // ----------------------------------------------------------------------- @@ -1752,7 +1984,7 @@ void TabBar::EnablePage( sal_uInt16 nPageId, sal_Bool bEnable ) if ( nPos != PAGE_NOT_FOUND ) { - ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); + ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->mbEnable != bEnable ) { @@ -1774,7 +2006,7 @@ sal_Bool TabBar::IsPageEnabled( sal_uInt16 nPageId ) const sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) - return mpItemList->GetObject( nPos )->mbEnable; + return (*mpItemList)[ nPos ]->mbEnable; else return sal_False; } @@ -1787,7 +2019,7 @@ void TabBar::SetPageBits( sal_uInt16 nPageId, TabBarPageBits nBits ) if ( nPos != PAGE_NOT_FOUND ) { - ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); + ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->mnBits != nBits ) { @@ -1807,7 +2039,7 @@ TabBarPageBits TabBar::GetPageBits( sal_uInt16 nPageId ) const sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) - return mpItemList->GetObject( nPos )->mnBits; + return (*mpItemList)[ nPos ]->mnBits; else return sal_False; } @@ -1816,47 +2048,44 @@ TabBarPageBits TabBar::GetPageBits( sal_uInt16 nPageId ) const sal_uInt16 TabBar::GetPageCount() const { - return (sal_uInt16)mpItemList->Count(); + return (sal_uInt16)mpItemList->size(); } // ----------------------------------------------------------------------- sal_uInt16 TabBar::GetPageId( sal_uInt16 nPos ) const { - ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); - if ( pItem ) - return pItem->mnId; - else - return 0; + return ( nPos < mpItemList->size() ) ? (*mpItemList)[ nPos ]->mnId : 0; } // ----------------------------------------------------------------------- sal_uInt16 TabBar::GetPagePos( sal_uInt16 nPageId ) const { - ImplTabBarItem* pItem = mpItemList->First(); - while ( pItem ) - { - if ( pItem->mnId == nPageId ) - return (sal_uInt16)mpItemList->GetCurPos(); - - pItem = mpItemList->Next(); + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + if ( (*mpItemList)[ i ]->mnId == nPageId ) { + return sal_uInt16( i ); + } } - return PAGE_NOT_FOUND; } // ----------------------------------------------------------------------- -sal_uInt16 TabBar::GetPageId( const Point& rPos ) const +sal_uInt16 TabBar::GetPageId( const Point& rPos, bool bCheckInsTab ) const { - ImplTabBarItem* pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + ImplTabBarItem* pItem = (*mpItemList)[ i ]; if ( pItem->maRect.IsInside( rPos ) ) return pItem->mnId; + } - pItem = mpItemList->Next(); + if (bCheckInsTab && mbHasInsertTab && !mpItemList->empty()) + { + ImplTabBarItem* pItem = mpItemList->back(); + if (ImplGetInsertTabRect(pItem).IsInside(rPos)) + return INSERT_TAB_POS; } return 0; @@ -1869,7 +2098,7 @@ Rectangle TabBar::GetPageRect( sal_uInt16 nPageId ) const sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) - return mpItemList->GetObject( nPos )->maRect; + return (*mpItemList)[ nPos ]->maRect; else return Rectangle(); } @@ -1893,11 +2122,11 @@ void TabBar::SetCurPageId( sal_uInt16 nPageId ) if ( IsReallyVisible() && IsUpdateMode() ) bUpdate = sal_True; - ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); + ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; ImplTabBarItem* pOldItem; if ( mnCurPageId ) - pOldItem = mpItemList->GetObject( GetPagePos( mnCurPageId ) ); + pOldItem = (*mpItemList)[ GetPagePos( mnCurPageId ) ]; else pOldItem = NULL; @@ -1979,7 +2208,7 @@ void TabBar::MakeVisible( sal_uInt16 nPageId ) SetFirstPageId( nPageId ); else { - ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); + ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; // sichtbare Breite berechnen long nWidth = mnLastOffX; @@ -2058,7 +2287,7 @@ void TabBar::SelectPage( sal_uInt16 nPageId, sal_Bool bSelect ) if ( nPos != PAGE_NOT_FOUND ) { - ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); + ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; if ( pItem->mbSelect != bSelect ) { @@ -2077,7 +2306,7 @@ void TabBar::SelectPageRange( sal_Bool bSelect, sal_uInt16 nStartPos, sal_uInt16 { Rectangle aPaintRect; sal_uInt16 nPos = nStartPos; - ImplTabBarItem* pItem = mpItemList->Seek( nPos ); + ImplTabBarItem* pItem = seek( nPos ); while ( pItem && (nPos <= nEndPos) ) { if ( (pItem->mbSelect != bSelect) && (pItem->mnId != mnCurPageId) ) @@ -2087,7 +2316,7 @@ void TabBar::SelectPageRange( sal_Bool bSelect, sal_uInt16 nStartPos, sal_uInt16 } nPos++; - pItem = mpItemList->Next(); + pItem = next(); } // Leiste neu ausgeben @@ -2100,16 +2329,14 @@ void TabBar::SelectPageRange( sal_Bool bSelect, sal_uInt16 nStartPos, sal_uInt16 sal_uInt16 TabBar::GetSelectPage( sal_uInt16 nSelIndex ) const { sal_uInt16 nSelected = 0; - ImplTabBarItem* pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + ImplTabBarItem* pItem = (*mpItemList)[ i ]; if ( pItem->mbSelect ) nSelected++; if ( nSelected == nSelIndex ) return pItem->mnId; - - pItem = mpItemList->Next(); } return 0; @@ -2120,13 +2347,11 @@ sal_uInt16 TabBar::GetSelectPage( sal_uInt16 nSelIndex ) const sal_uInt16 TabBar::GetSelectPageCount() const { sal_uInt16 nSelected = 0; - ImplTabBarItem* pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + ImplTabBarItem* pItem = (*mpItemList)[ i ]; if ( pItem->mbSelect ) nSelected++; - - pItem = mpItemList->Next(); } return nSelected; @@ -2138,7 +2363,7 @@ sal_Bool TabBar::IsPageSelected( sal_uInt16 nPageId ) const { sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) - return mpItemList->GetObject( nPos )->mbSelect; + return (*mpItemList)[ nPos ]->mbSelect; else return sal_False; } @@ -2371,7 +2596,7 @@ void TabBar::SetPageText( sal_uInt16 nPageId, const XubString& rText ) sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) { - mpItemList->GetObject( nPos )->maText = rText; + (*mpItemList)[ nPos ]->maText = rText; mbSizeFormat = sal_True; // Leiste neu ausgeben @@ -2388,7 +2613,7 @@ XubString TabBar::GetPageText( sal_uInt16 nPageId ) const { sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) - return mpItemList->GetObject( nPos )->maText; + return (*mpItemList)[ nPos ]->maText; else return XubString(); } @@ -2399,7 +2624,7 @@ void TabBar::SetHelpText( sal_uInt16 nPageId, const XubString& rText ) { sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) - mpItemList->GetObject( nPos )->maHelpText = rText; + (*mpItemList)[ nPos ]->maHelpText = rText; } // ----------------------------------------------------------------------- @@ -2409,7 +2634,7 @@ XubString TabBar::GetHelpText( sal_uInt16 nPageId ) const sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) { - ImplTabBarItem* pItem = mpItemList->GetObject( nPos ); + ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; if ( !pItem->maHelpText.Len() && pItem->maHelpId.getLength() ) { Help* pHelp = Application::GetHelp(); @@ -2429,7 +2654,7 @@ void TabBar::SetHelpId( sal_uInt16 nPageId, const rtl::OString& rHelpId ) { sal_uInt16 nPos = GetPagePos( nPageId ); if ( nPos != PAGE_NOT_FOUND ) - mpItemList->GetObject( nPos )->maHelpId = rHelpId; + (*mpItemList)[ nPos ]->maHelpId = rHelpId; } // ----------------------------------------------------------------------- @@ -2439,7 +2664,7 @@ rtl::OString TabBar::GetHelpId( sal_uInt16 nPageId ) const sal_uInt16 nPos = GetPagePos( nPageId ); rtl::OString aRet; if ( nPos != PAGE_NOT_FOUND ) - aRet = mpItemList->GetObject( nPos )->maHelpId; + return (*mpItemList)[ nPos ]->maHelpId; return aRet; } @@ -2508,14 +2733,14 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos ) ImplTabBarItem* pItem; sal_uInt16 nDropId; sal_uInt16 nNewDropPos; - sal_uInt16 nItemCount = (sal_uInt16)mpItemList->Count(); + sal_uInt16 nItemCount = (sal_uInt16)mpItemList->size(); short nScroll = 0; if ( rPos.X() > mnLastOffX-TABBAR_DRAG_SCROLLOFF ) { - pItem = mpItemList->GetObject( mpItemList->Count()-1 ); + pItem = (*mpItemList)[ mpItemList->size()-1 ]; if ( !pItem->maRect.IsEmpty() && (rPos.X() > pItem->maRect.Right()) ) - nNewDropPos = (sal_uInt16)mpItemList->Count(); + nNewDropPos = (sal_uInt16)mpItemList->size(); else { nNewDropPos = mnFirstPos+1; @@ -2578,7 +2803,7 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos ) SetLineColor( aBlackColor ); if ( mnDropPos < nItemCount ) { - pItem = mpItemList->GetObject( mnDropPos ); + pItem = (*mpItemList)[ mnDropPos ]; nX = pItem->maRect.Left()+TABBAR_OFFSET_X; if ( mnDropPos == nCurPos ) nX--; @@ -2593,7 +2818,7 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos ) } if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) ) { - pItem = mpItemList->GetObject( mnDropPos-1 ); + pItem = (*mpItemList)[ mnDropPos-1 ]; nX = pItem->maRect.Right()-TABBAR_OFFSET_X; if ( mnDropPos == nCurPos ) nX++; @@ -2617,11 +2842,11 @@ void TabBar::HideDropPos() long nX; long nY1 = (maWinSize.Height()/2)-3; long nY2 = nY1 + 5; - sal_uInt16 nItemCount = (sal_uInt16)mpItemList->Count(); + sal_uInt16 nItemCount = (sal_uInt16)mpItemList->size(); if ( mnDropPos < nItemCount ) { - pItem = mpItemList->GetObject( mnDropPos ); + pItem = (*mpItemList)[ mnDropPos ]; nX = pItem->maRect.Left()+TABBAR_OFFSET_X; // Paint direkt aufrufen, da bei Drag and Drop kein Paint // moeglich @@ -2633,7 +2858,7 @@ void TabBar::HideDropPos() } if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) ) { - pItem = mpItemList->GetObject( mnDropPos-1 ); + pItem = (*mpItemList)[ mnDropPos-1 ]; nX = pItem->maRect.Right()-TABBAR_OFFSET_X; // Paint direkt aufrufen, da bei Drag and Drop kein Paint // moeglich @@ -2714,14 +2939,13 @@ Size TabBar::CalcWindowSizePixel() const { long nWidth = 0; - if ( mpItemList->Count() ) + if ( mpItemList->size() ) { ((TabBar*)this)->ImplCalcWidth(); - ImplTabBarItem* pItem = mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + ImplTabBarItem* pItem = (*mpItemList)[ i ]; nWidth += pItem->mnWidth; - pItem = mpItemList->Next(); } nWidth += TABBAR_OFFSET_X+TABBAR_OFFSET_X2; } @@ -2743,3 +2967,5 @@ Rectangle TabBar::GetPageArea() const } // ----------------------------------------------------------------------- + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/taskbar.cxx b/svtools/source/control/taskbar.cxx index 06c90818b13e..8d3a6abce18f 100755..100644 --- a/svtools/source/control/taskbar.cxx +++ b/svtools/source/control/taskbar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #define _TASKBAR_CXX -#include <tools/list.hxx> #include <tools/debug.hxx> #include <vcl/floatwin.hxx> @@ -587,3 +587,5 @@ TaskStatusBar* TaskBar::GetStatusBar() const } return mpStatusBar; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/taskbox.cxx b/svtools/source/control/taskbox.cxx index 798126ae37af..0215c1835f1d 100755..100644 --- a/svtools/source/control/taskbox.cxx +++ b/svtools/source/control/taskbox.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #define _TASKBAR_CXX -#include <tools/list.hxx> #include <tools/debug.hxx> #include <vcl/image.hxx> #include <vcl/help.hxx> @@ -48,8 +48,6 @@ struct ImplTaskItem XubString maText; }; -DECLARE_LIST( ImplTaskItemList, ImplTaskItem* ) - // ======================================================================= TaskToolBox::TaskToolBox( Window* pParent, WinBits nWinStyle ) : @@ -58,7 +56,6 @@ TaskToolBox::TaskToolBox( Window* pParent, WinBits nWinStyle ) : mpItemList = new ImplTaskItemList; mnMaxTextWidth = 0; mnActiveItemId = 0; - mnTaskItem = 0; mnSmallItem = TOOLBOX_ITEM_NOTFOUND; mbMinActivate = sal_False; @@ -70,13 +67,10 @@ TaskToolBox::TaskToolBox( Window* pParent, WinBits nWinStyle ) : TaskToolBox::~TaskToolBox() { - ImplTaskItem* pItem = mpItemList->First(); - while ( pItem ) - { - delete pItem; - pItem = mpItemList->Next(); + for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { + delete (*mpItemList)[ i ]; } - + mpItemList->clear(); delete mpItemList; } @@ -101,9 +95,7 @@ void TaskToolBox::ActivateTaskItem( sal_uInt16 nItemId, sal_Bool bMinActivate ) mbMinActivate = sal_True; } - mnTaskItem = nItemId-1; ActivateTask(); - mnTaskItem = 0; mbMinActivate = sal_False; } } @@ -134,8 +126,8 @@ void TaskToolBox::MouseButtonDown( const MouseEvent& rMEvt ) void TaskToolBox::Resize() { - mnOldItemCount = mpItemList->Count(); - mnUpdatePos = (sal_uInt16)mnOldItemCount; + mnOldItemCount = mpItemList->size(); + mnUpdatePos = mnOldItemCount; mnUpdateNewPos = TOOLBOX_ITEM_NOTFOUND; ImplFormatTaskToolBox(); ToolBox::Resize(); @@ -147,15 +139,9 @@ void TaskToolBox::Command( const CommandEvent& rCEvt ) { if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) { - sal_uInt16 nItemId = GetItemId( rCEvt.GetMousePosPixel() ); -// Dies machen wir nicht mehr, da es von zu vielen als stoerend empfunden wurde -// ActivateTaskItem( nItemId ); - mnTaskItem = nItemId-1; - maContextMenuPos = rCEvt.GetMousePosPixel(); ContextMenu(); maContextMenuPos = Point(); - mnTaskItem = 0; } else ToolBox::Command( rCEvt ); @@ -167,11 +153,11 @@ void TaskToolBox::RequestHelp( const HelpEvent& rHEvt ) { if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) ) { - sal_uInt16 nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ); + size_t nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ); if ( nItemId ) { - ImplTaskItem* pItem = mpItemList->GetObject( nItemId-1 ); + ImplTaskItem* pItem = ( nItemId-1 < mpItemList->size() ) ? (*mpItemList)[ nItemId-1 ] : NULL; if ( pItem ) { if ( pItem->maText != GetItemText( nItemId ) ) @@ -207,21 +193,23 @@ void TaskToolBox::ImplFormatTaskToolBox() if ( mnUpdateNewPos == TOOLBOX_ITEM_NOTFOUND ) { // Eintraege aus der Liste entfernen - while ( mpItemList->Count() > mnUpdatePos ) - delete mpItemList->Remove( (sal_uLong)mnUpdatePos ); + while ( mpItemList->size() > mnUpdatePos ) { + delete mpItemList->back(); + mpItemList->pop_back(); + } mnUpdateNewPos = mnUpdatePos; } // Maximale Itemgroesse berechnen long nOldMaxTextWidth = mnMaxTextWidth; mnMaxTextWidth = 70; - if ( mpItemList->Count() ) + if ( !mpItemList->empty() ) { long nWinSize = GetOutputSizePixel().Width()-8; - long nItemSize = mpItemList->GetObject(0)->maImage.GetSizePixel().Width()+7+TASKBOX_TASKOFF+2; - nWinSize -= mpItemList->Count()*nItemSize; + long nItemSize = (*mpItemList)[ 0 ]->maImage.GetSizePixel().Width()+7+TASKBOX_TASKOFF+2; + nWinSize -= mpItemList->size()*nItemSize; if ( nWinSize > 0 ) - nWinSize /= mpItemList->Count(); + nWinSize /= mpItemList->size(); else nWinSize = 0; if ( nWinSize < mnMaxTextWidth ) @@ -243,10 +231,10 @@ void TaskToolBox::ImplFormatTaskToolBox() mnActiveItemId = 0; // Neue Eintrage einfuegen - sal_uInt16 i = mnUpdateNewPos; - while ( i < mpItemList->Count() ) + size_t i = mnUpdateNewPos; + while ( i < mpItemList->size() ) { - ImplTaskItem* pItem = mpItemList->GetObject( i ); + ImplTaskItem* pItem = (*mpItemList)[ i ]; // Textlaenge berechnen XubString aText = pItem->maText; @@ -292,7 +280,7 @@ void TaskToolBox::ImplFormatTaskToolBox() void TaskToolBox::StartUpdateTask() { - mnOldItemCount = mpItemList->Count(); + mnOldItemCount = mpItemList->size(); mnUpdatePos = 0; mnUpdateNewPos = TOOLBOX_ITEM_NOTFOUND; mnNewActivePos = 0xFFFE; @@ -303,14 +291,16 @@ void TaskToolBox::StartUpdateTask() void TaskToolBox::UpdateTask( const Image& rImage, const String& rText, sal_Bool bActive ) { - ImplTaskItem* pItem = mpItemList->GetObject( mnUpdatePos ); + ImplTaskItem* pItem = ( mnUpdatePos < mpItemList->size() ) ? (*mpItemList)[ mnUpdatePos ] : NULL; if ( pItem ) { if ( (pItem->maText != rText) || (pItem->maImage != rImage) ) { // Eintraege aus der Liste entfernen - while ( mpItemList->Count() > mnUpdatePos ) - delete mpItemList->Remove( (sal_uLong)mnUpdatePos ); + while ( mpItemList->size() > mnUpdatePos ) { + delete mpItemList->back(); + mpItemList->pop_back(); + } pItem = NULL; } } @@ -323,7 +313,7 @@ void TaskToolBox::UpdateTask( const Image& rImage, const String& rText, pItem = new ImplTaskItem; pItem->maImage = rImage; pItem->maText = rText; - mpItemList->Insert( pItem, LIST_APPEND ); + mpItemList->push_back( pItem ); } if ( bActive ) @@ -339,11 +329,14 @@ void TaskToolBox::EndUpdateTask() if ( mnUpdateNewPos == TOOLBOX_ITEM_NOTFOUND ) { // Eintraege aus der Liste entfernen - while ( mpItemList->Count() > mnUpdatePos ) - delete mpItemList->Remove( (sal_uLong)mnUpdatePos ); + while ( mpItemList->size() > mnUpdatePos ) { + delete mpItemList->back(); + mpItemList->pop_back(); + } mnUpdateNewPos = mnUpdatePos; } ImplFormatTaskToolBox(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/taskmisc.cxx b/svtools/source/control/taskmisc.cxx index 35d5d8997624..1476cacb76fb 100755..100644 --- a/svtools/source/control/taskmisc.cxx +++ b/svtools/source/control/taskmisc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #define _TASKBAR_CXX -#include <tools/list.hxx> #include <tools/debug.hxx> #include <vcl/help.hxx> #include <svtools/taskbar.hxx> @@ -375,3 +375,4 @@ void WindowArrange::Arrange( sal_uInt16 nType, const Rectangle& rRect ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx index 7792fe32bff8..b94aae25a88f 100755..100644 --- a/svtools/source/control/taskstat.cxx +++ b/svtools/source/control/taskstat.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #define _TASKBAR_CXX -#include <tools/list.hxx> #include <tools/debug.hxx> #include <tools/date.hxx> #include <vcl/image.hxx> @@ -54,8 +54,6 @@ struct ImplTaskSBFldItem long mnOffX; }; -DECLARE_LIST( ImplTaskSBItemList, ImplTaskSBFldItem* ) - // ======================================================================= sal_Bool ITaskStatusNotify::MouseButtonDown( sal_uInt16, const MouseEvent& ) @@ -168,13 +166,10 @@ TaskStatusBar::~TaskStatusBar() { if ( mpFieldItemList ) { - ImplTaskSBFldItem* pItem = mpFieldItemList->First(); - while ( pItem ) - { - delete pItem; - pItem = mpFieldItemList->Next(); + for ( size_t i = 0, n = mpFieldItemList->size(); i < n; ++i ) { + delete (*mpFieldItemList)[ i ]; } - + mpFieldItemList->clear(); delete mpFieldItemList; } } @@ -199,15 +194,11 @@ ImplTaskSBFldItem* TaskStatusBar::ImplGetFieldItem( sal_uInt16 nItemId ) const if ( !mpFieldItemList ) return NULL; - ImplTaskSBFldItem* pItem = mpFieldItemList->First(); - while ( pItem ) - { - if ( pItem->mnId == nItemId ) - return pItem; - - pItem = mpFieldItemList->Next(); + for ( size_t i = 0, n = mpFieldItemList->size(); i < n; ++i ) { + if ( (*mpFieldItemList)[ i ]->mnId == nItemId ) { + return (*mpFieldItemList)[ i ]; + } } - return NULL; } @@ -222,13 +213,11 @@ ImplTaskSBFldItem* TaskStatusBar::ImplGetFieldItem( const Point& rPos, sal_Bool& if ( mpFieldItemList ) { long nX = rPos.X()-GetItemRect( TASKSTATUSBAR_STATUSFIELDID ).Left(); - ImplTaskSBFldItem* pItem = mpFieldItemList->First(); - while ( pItem ) - { - if ( nX < pItem->mnOffX+pItem->maItem.GetImage().GetSizePixel().Width() ) + for ( size_t i = 0, n = mpFieldItemList->size(); i < n; ++i ) { + ImplTaskSBFldItem* pItem = (*mpFieldItemList)[ i ]; + if ( nX < pItem->mnOffX + pItem->maItem.GetImage().GetSizePixel().Width() ) { return pItem; - - pItem = mpFieldItemList->Next(); + } } } } @@ -289,19 +278,17 @@ void TaskStatusBar::ImplUpdateField( sal_Bool bItems ) if ( bItems ) { - ImplTaskSBFldItem* pItem = mpFieldItemList->First(); mnItemWidth = 0; mbFlashItems = sal_False; mbOutInterval = sal_False; - while ( pItem ) - { + for ( size_t i = 0, n = mpFieldItemList->size(); i < n; ++i ) { + ImplTaskSBFldItem* pItem = (*mpFieldItemList)[ i ]; mnItemWidth += TASKSTATUSBAR_IMAGEOFFX; pItem->mnOffX = mnItemWidth; mnItemWidth += pItem->maItem.GetImage().GetSizePixel().Width(); - if ( pItem->maItem.GetFlags() & TASKSTATUSFIELDITEM_FLASH ) + if ( pItem->maItem.GetFlags() & TASKSTATUSFIELDITEM_FLASH ) { mbFlashItems = sal_True; - - pItem = mpFieldItemList->Next(); + } } } else @@ -541,9 +528,9 @@ void TaskStatusBar::UserDraw( const UserDrawEvent& rUDEvt ) if ( mpFieldItemList ) { - ImplTaskSBFldItem* pItem = mpFieldItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = mpFieldItemList->size(); i < n; ++i ) { + ImplTaskSBFldItem* pItem = (*mpFieldItemList)[ i ]; if ( !mbOutInterval || !(pItem->maItem.GetFlags() & TASKSTATUSFIELDITEM_FLASH) ) { const Image& rImage = pItem->maItem.GetImage(); @@ -552,8 +539,6 @@ void TaskStatusBar::UserDraw( const UserDrawEvent& rUDEvt ) aRect.Top()+((aRect.GetHeight()-aImgSize.Width())/2) ), rImage ); } - - pItem = mpFieldItemList->Next(); } } @@ -604,7 +589,13 @@ void TaskStatusBar::AddStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFiel pItem->maItem = rItem; pItem->mnId = nItemId; pItem->mnOffX = 0; - mpFieldItemList->Insert( pItem, (sal_uLong)nPos ); + if ( nPos < mpFieldItemList->size() ) { + ImplTaskSBItemList::iterator it = mpFieldItemList->begin(); + ::std::advance( it, nPos ); + mpFieldItemList->insert( it, pItem ); + } else { + mpFieldItemList->push_back( pItem ); + } ImplUpdateField( sal_True ); } @@ -631,9 +622,16 @@ void TaskStatusBar::RemoveStatusFieldItem( sal_uInt16 nItemId ) ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId ); if ( pItem ) { - mpFieldItemList->Remove( pItem ); - delete pItem; - ImplUpdateField( sal_True ); + for ( ImplTaskSBItemList::iterator it = mpFieldItemList->begin(); + it < mpFieldItemList->end(); + ++it + ) { + if ( *it == pItem ) { + delete *it; + mpFieldItemList->erase( it ); + break; + } + } } } @@ -651,3 +649,4 @@ sal_Bool TaskStatusBar::GetStatusFieldItem( sal_uInt16 nItemId, TaskStatusFieldI return sal_False; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index c84eb17afecc..d83c578d4650 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -652,6 +653,52 @@ void ToolbarMenu::initWindow() // -------------------------------------------------------------------- +static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) +{ + rMaxWidth = rCheckHeight = rRadioHeight = 0; + + ImplControlValue aVal; + Rectangle aNativeBounds; + Rectangle aNativeContent; + Point tmp( 0, 0 ); + Rectangle aCtrlRegion( tmp, Size( 100, 15 ) ); + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK ) ) + { + if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), + ControlPart(PART_MENU_ITEM_CHECK_MARK), + aCtrlRegion, + ControlState(CTRL_STATE_ENABLED), + aVal, + OUString(), + aNativeBounds, + aNativeContent ) + ) + { + rCheckHeight = aNativeBounds.GetHeight(); + rMaxWidth = aNativeContent.GetWidth(); + } + } + if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) ) + { + if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), + ControlPart(PART_MENU_ITEM_RADIO_MARK), + aCtrlRegion, + ControlState(CTRL_STATE_ENABLED), + aVal, + OUString(), + aNativeBounds, + aNativeContent ) + ) + { + rRadioHeight = aNativeBounds.GetHeight(); + rMaxWidth = Max (rMaxWidth, aNativeContent.GetWidth()); + } + } + return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight; +} + +#define gfxExtra 7 + Size ToolbarMenu::implCalcSize() { const long nFontHeight = GetTextHeight(); @@ -723,6 +770,28 @@ Size ToolbarMenu::implCalcSize() pEntry->maSize.Height() = aControlSize.Height() + 1; } + if( pEntry->HasCheck() && !pEntry->mbHasImage ) + { + if( this->IsNativeControlSupported( CTRL_MENU_POPUP, + (pEntry->mnBits & MIB_RADIOCHECK) + ? PART_MENU_ITEM_CHECK_MARK + : PART_MENU_ITEM_RADIO_MARK ) ) + { + long nCheckHeight = 0, nRadioHeight = 0, nMaxCheckWidth = 0; + ImplGetNativeCheckAndRadioSize( this, nCheckHeight, nRadioHeight, nMaxCheckWidth ); + + long nCtrlHeight = (pEntry->mnBits & MIB_RADIOCHECK) ? nCheckHeight : nRadioHeight; + nMaxTextWidth += nCtrlHeight + gfxExtra; + } + else if( pEntry->mbChecked ) + { + long nSymbolWidth = (nFontHeight*25)/40; + if ( pEntry->mnBits & MIB_RADIOCHECK ) + nSymbolWidth = nFontHeight/2; + + nMaxTextWidth += nSymbolWidth; + } + } } } @@ -1012,12 +1081,12 @@ void ToolbarMenu::MouseMove( const MouseEvent& rMEvt ) void ToolbarMenu::implHighlightEntry( const MouseEvent& rMEvt, bool bMBDown ) { - long nY = 0; long nMouseY = rMEvt.GetPosPixel().Y(); Size aOutSz = GetOutputSizePixel(); if ( ( nMouseY >= 0 ) && ( nMouseY < aOutSz.Height() ) ) { bool bHighlighted = sal_False; + long nY = 0; const int nEntryCount = mpImpl->maEntryVector.size(); int nEntry; @@ -1329,50 +1398,6 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec } } -static long ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) -{ - rMaxWidth = rCheckHeight = rRadioHeight = 0; - - ImplControlValue aVal; - Rectangle aNativeBounds; - Rectangle aNativeContent; - Point tmp( 0, 0 ); - Rectangle aCtrlRegion( tmp, Size( 100, 15 ) ); - if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_CHECK_MARK ) ) - { - if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), - ControlPart(PART_MENU_ITEM_CHECK_MARK), - aCtrlRegion, - ControlState(CTRL_STATE_ENABLED), - aVal, - OUString(), - aNativeBounds, - aNativeContent ) - ) - { - rCheckHeight = aNativeBounds.GetHeight(); - rMaxWidth = aNativeContent.GetWidth(); - } - } - if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) ) - { - if( pWin->GetNativeControlRegion( ControlType(CTRL_MENU_POPUP), - ControlPart(PART_MENU_ITEM_RADIO_MARK), - aCtrlRegion, - ControlState(CTRL_STATE_ENABLED), - aVal, - OUString(), - aNativeBounds, - aNativeContent ) - ) - { - rRadioHeight = aNativeBounds.GetHeight(); - rMaxWidth = Max (rMaxWidth, aNativeContent.GetWidth()); - } - } - return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight; -} - void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) { sal_uInt16 nBorder = 0; long nStartY = 0; // from Menu implementations, needed when we support native menu background & scrollable menu @@ -1492,6 +1517,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); DrawNativeControl( CTRL_MENU_POPUP, nPart, aCheckRect, nState, ImplControlValue(), OUString() ); + aPos.setX( aPos.getX() + nCtrlHeight + gfxExtra ); } else if ( pEntry->mbChecked ) // by default do nothing for unchecked items { @@ -1513,6 +1539,7 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - aSymbolSize.Height())/2; Rectangle aRect( aTmpPos, aSymbolSize ); aDecoView.DrawSymbol( aRect, eSymbol, GetTextColor(), nSymbolStyle ); + aPos.setX( aPos.getX() + aSymbolSize.getWidth( ) + gfxExtra ); } } } @@ -1543,53 +1570,6 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted ) DrawCtrlText( aTmpPos, pEntry->maText, 0, pEntry->maText.Len(), nStyle, NULL, NULL ); // pVector, pDisplayText ); } -/* - // Accel - if ( !bLayout && !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() ) - { - XubString aAccText = pData->aAccelKey.GetName(); - aTmpPos.X() = aOutSz.Width() - this->GetTextWidth( aAccText ); - aTmpPos.X() -= 4*nExtra; - - aTmpPos.X() -= nOuterSpace; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nTextOffsetY; - this->DrawCtrlText( aTmpPos, aAccText, 0, aAccText.Len(), nTextStyle ); - } -*/ - -/* - // SubMenu? - if ( !bLayout && !bIsMenuBar && pData->pSubMenu ) - { - aTmpPos.X() = aOutSz.Width() - nFontHeight + nExtra - nOuterSpace; - aTmpPos.Y() = aPos.Y(); - aTmpPos.Y() += nExtra/2; - aTmpPos.Y() += ( pEntry->maSize.Height() / 2 ) - ( nFontHeight/4 ); - if ( pEntry->mnBits & MIB_POPUPSELECT ) - { - this->SetTextColor( rSettings.GetMenuTextColor() ); - Point aTmpPos2( aPos ); - aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4; - aDecoView.DrawFrame( - Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pEntry->maSize.Height() ) ), FRAME_DRAW_GROUP ); - } - aDecoView.DrawSymbol( - Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ), - SYMBOL_SPIN_RIGHT, this->GetTextColor(), nSymbolStyle ); -// if ( pEntry->mnBits & MIB_POPUPSELECT ) -// { -// aTmpPos.Y() += nFontHeight/2 ; -// this->SetLineColor( rSettings.GetShadowColor() ); -// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); -// this->SetLineColor( rSettings.GetLightColor() ); -// aTmpPos.Y()++; -// this->DrawLine( aTmpPos, Point( aTmpPos.X() + nFontHeight/3, aTmpPos.Y() ) ); -// this->SetLineColor(); -// } - } -*/ - if ( pThisOnly && bHighlighted ) { // This restores the normal menu or menu bar text @@ -1803,3 +1783,4 @@ Reference< XFrame > ToolbarMenu::GetFrame() const } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/toolbarmenuacc.cxx b/svtools/source/control/toolbarmenuacc.cxx index 620002017e6c..340fbeacb008 100644 --- a/svtools/source/control/toolbarmenuacc.cxx +++ b/svtools/source/control/toolbarmenuacc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -171,7 +172,7 @@ Reference< XAccessibleContext > SAL_CALL ToolbarMenuAcc::getAccessibleContext() sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleChildCount() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ThrowIfDisposed(); return mpParent->getAccessibleChildCount(); @@ -181,7 +182,7 @@ sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleChildCount() throw (RuntimeExcep Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ThrowIfDisposed(); return mpParent->getAccessibleChild(i); @@ -192,7 +193,7 @@ Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleChild( sal_Int32 Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleParent() throw (RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; Reference< XAccessible > xRet; @@ -207,7 +208,7 @@ Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleParent() throw (R sal_Int32 SAL_CALL ToolbarMenuAcc::getAccessibleIndexInParent() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ThrowIfDisposed(); Window* pParent = mpParent->mrMenu.GetParent(); @@ -244,7 +245,7 @@ OUString SAL_CALL ToolbarMenuAcc::getAccessibleDescription() throw (RuntimeExcep OUString SAL_CALL ToolbarMenuAcc::getAccessibleName() throw (RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; OUString aRet; if( mpParent ) @@ -293,7 +294,7 @@ Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuAcc::getAccessibleStateSet( Locale SAL_CALL ToolbarMenuAcc::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const ::rtl::OUString aEmptyStr; Reference< XAccessible > xParent( getAccessibleParent() ); Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr ); @@ -326,7 +327,7 @@ void SAL_CALL ToolbarMenuAcc::addEventListener( const Reference< XAccessibleEven if( *aIter == rxListener ) bFound = true; else - aIter++; + ++aIter; } if (!bFound) @@ -354,7 +355,7 @@ void SAL_CALL ToolbarMenuAcc::removeEventListener( const Reference< XAccessibleE bFound = true; } else - aIter++; + ++aIter; } } } @@ -375,7 +376,7 @@ sal_Bool SAL_CALL ToolbarMenuAcc::containsPoint( const awt::Point& aPoint ) thro Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleAtPoint( const awt::Point& aPoint ) throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ThrowIfDisposed(); Reference< XAccessible > xRet; @@ -408,7 +409,7 @@ Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getAccessibleAtPoint( const aw awt::Rectangle SAL_CALL ToolbarMenuAcc::getBounds() throw (RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const Point aOutPos( mpParent->mrMenu.GetPosPixel() ); const Size aOutSize( mpParent->mrMenu.GetOutputSizePixel() ); awt::Rectangle aRet; @@ -426,7 +427,7 @@ awt::Rectangle SAL_CALL ToolbarMenuAcc::getBounds() throw (RuntimeException) awt::Point SAL_CALL ToolbarMenuAcc::getLocation() throw (RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const Point aOutPos( mpParent->mrMenu.GetPosPixel() ); return awt::Point( aOutPos.X(), aOutPos.Y() ); } @@ -436,7 +437,7 @@ awt::Point SAL_CALL ToolbarMenuAcc::getLocation() throw (RuntimeException) awt::Point SAL_CALL ToolbarMenuAcc::getLocationOnScreen() throw (RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const Point aScreenPos( mpParent->mrMenu.OutputToAbsoluteScreenPixel( Point() ) ); return awt::Point( aScreenPos.X(), aScreenPos.Y() ); } @@ -446,7 +447,7 @@ awt::Point SAL_CALL ToolbarMenuAcc::getLocationOnScreen() throw (RuntimeExcepti awt::Size SAL_CALL ToolbarMenuAcc::getSize() throw (RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const Size aOutSize( mpParent->mrMenu.GetOutputSizePixel() ); return awt::Size( aOutSize.Width(), aOutSize.Height() ); } @@ -456,7 +457,7 @@ awt::Size SAL_CALL ToolbarMenuAcc::getSize() throw (RuntimeException) void SAL_CALL ToolbarMenuAcc::grabFocus() throw (RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; mpParent->mrMenu.GrabFocus(); } @@ -490,7 +491,7 @@ sal_Int32 SAL_CALL ToolbarMenuAcc::getBackground() throw (RuntimeException) void SAL_CALL ToolbarMenuAcc::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ThrowIfDisposed(); mpParent->selectAccessibleChild( nChildIndex ); @@ -500,7 +501,7 @@ void SAL_CALL ToolbarMenuAcc::selectAccessibleChild( sal_Int32 nChildIndex ) thr sal_Bool SAL_CALL ToolbarMenuAcc::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ThrowIfDisposed(); return mpParent->isAccessibleChildSelected( nChildIndex ); } @@ -509,7 +510,7 @@ sal_Bool SAL_CALL ToolbarMenuAcc::isAccessibleChildSelected( sal_Int32 nChildInd void SAL_CALL ToolbarMenuAcc::clearAccessibleSelection() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ThrowIfDisposed(); mpParent->clearAccessibleSelection(); } @@ -526,7 +527,7 @@ void SAL_CALL ToolbarMenuAcc::selectAllAccessibleChildren() throw (RuntimeExcept sal_Int32 SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChildCount() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ThrowIfDisposed(); return mpParent->mnHighlightedEntry != -1 ? 1 : 0; @@ -537,7 +538,7 @@ sal_Int32 SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChildCount() throw (Runt Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; if( (mpParent->mnHighlightedEntry != -1) && (nSelectedChildIndex == 0) ) { @@ -562,7 +563,7 @@ Reference< XAccessible > SAL_CALL ToolbarMenuAcc::getSelectedAccessibleChild( sa void SAL_CALL ToolbarMenuAcc::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; // Because of the single selection we can reset the whole selection when // the specified child is currently selected. if (isAccessibleChildSelected(nChildIndex)) @@ -577,7 +578,7 @@ void SAL_CALL ToolbarMenuAcc::disposing (void) { // Make a copy of the list and clear the original. - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard (m_aMutex); aListenerListCopy = mxEventListeners; mxEventListeners.clear(); @@ -661,7 +662,7 @@ void SAL_CALL ToolbarMenuEntryAcc::disposing (void) { // Make a copy of the list and clear the original. - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard (m_aMutex); aListenerListCopy = mxEventListeners; mxEventListeners.clear(); @@ -713,7 +714,7 @@ Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleChild( sal_I Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleParent() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; Reference< XAccessible > xRet; if( mpParent ) @@ -726,7 +727,7 @@ Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleParent() thr sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getAccessibleIndexInParent() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; // The index defaults to -1 to indicate the child does not belong to its // parent. sal_Int32 nIndexInParent = -1; @@ -772,7 +773,7 @@ sal_Int16 SAL_CALL ToolbarMenuEntryAcc::getAccessibleRole() throw (RuntimeExcept ::rtl::OUString SAL_CALL ToolbarMenuEntryAcc::getAccessibleName() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; String aRet; if( mpParent ) @@ -800,7 +801,7 @@ Reference< XAccessibleRelationSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleR Reference< XAccessibleStateSet > SAL_CALL ToolbarMenuEntryAcc::getAccessibleStateSet() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper; if( mpParent ) @@ -846,7 +847,7 @@ Locale SAL_CALL ToolbarMenuEntryAcc::getLocale() throw (IllegalAccessibleCompone void SAL_CALL ToolbarMenuEntryAcc::addEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException) { - const ::vos::OGuard aGuard( maMutex ); + const ::osl::MutexGuard aGuard( maMutex ); if( rxListener.is() ) { @@ -870,7 +871,7 @@ void SAL_CALL ToolbarMenuEntryAcc::addEventListener( const Reference< XAccessibl void SAL_CALL ToolbarMenuEntryAcc::removeEventListener( const Reference< XAccessibleEventListener >& rxListener ) throw (RuntimeException) { - const ::vos::OGuard aGuard( maMutex ); + const ::osl::MutexGuard aGuard( maMutex ); if( rxListener.is() ) { @@ -885,7 +886,7 @@ void SAL_CALL ToolbarMenuEntryAcc::removeEventListener( const Reference< XAccess bFound = true; } else - aIter++; + ++aIter; } } } @@ -913,7 +914,7 @@ Reference< XAccessible > SAL_CALL ToolbarMenuEntryAcc::getAccessibleAtPoint( con awt::Rectangle SAL_CALL ToolbarMenuEntryAcc::getBounds() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; awt::Rectangle aRet; if( mpParent ) @@ -945,7 +946,7 @@ awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocation() throw (RuntimeException) awt::Point SAL_CALL ToolbarMenuEntryAcc::getLocationOnScreen() throw (RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; awt::Point aRet; if( mpParent ) @@ -1001,3 +1002,5 @@ sal_Int32 SAL_CALL ToolbarMenuEntryAcc::getBackground( ) throw (RuntimeExcepti } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx index a190fd9f205d..7674e5f63d0e 100644 --- a/svtools/source/control/toolbarmenuimp.hxx +++ b/svtools/source/control/toolbarmenuimp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,7 +26,7 @@ * ************************************************************************/ -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/image.hxx> #include <vcl/menu.hxx> @@ -114,7 +115,7 @@ public: // - ToolbarMenuAcc - // --------------- -typedef ::cppu::WeakComponentImplHelper5< +typedef ::cppu::PartialWeakComponentImplHelper5< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, ::com::sun::star::accessibility::XAccessibleContext, @@ -135,13 +136,20 @@ public: bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); } public: + + // XComponent + virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::removeEventListener(xListener); } + // XAccessible virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); // XAccessibleEventBroadcaster - using cppu::WeakComponentImplHelper5<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection>::addEventListener; virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - using cppu::WeakComponentImplHelper5<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection>::removeEventListener; virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); // XAccessibleContext @@ -204,7 +212,7 @@ private: // - ToolbarMenuEntryAcc - // ----------------------- -typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::accessibility::XAccessible, +typedef ::cppu::PartialWeakComponentImplHelper4< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, ::com::sun::star::accessibility::XAccessibleContext, ::com::sun::star::accessibility::XAccessibleComponent > ToolbarMenuEntryAccBase; @@ -219,13 +227,18 @@ public: void FireAccessibleEvent( short nEventId, const ::com::sun::star::uno::Any& rOldValue, const ::com::sun::star::uno::Any& rNewValue ); bool HasAccessibleListeners() const { return( mxEventListeners.size() > 0 ); } + virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::removeEventListener(xListener); } + // XAccessible virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); // XAccessibleEventBroadcaster - using ToolbarMenuEntryAccBase::addEventListener; virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - using ToolbarMenuEntryAccBase::removeEventListener; virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); // XAccessibleContext @@ -254,7 +267,7 @@ public: private: EventListenerVector mxEventListeners; - ::vos::OMutex maMutex; + ::osl::Mutex maMutex; ToolbarMenuEntry* mpParent; /** Tell all listeners that the object is dying. This callback is @@ -312,3 +325,5 @@ struct ToolbarMenu_Impl }; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/urlcontrol.cxx b/svtools/source/control/urlcontrol.cxx index 788948355965..eeb562b2a663 100644 --- a/svtools/source/control/urlcontrol.cxx +++ b/svtools/source/control/urlcontrol.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -93,3 +94,4 @@ namespace svt } // namespace svt //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 1b98e3197bd3..137c17a65faf 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,6 +35,7 @@ #include <vcl/svapp.hxx> #include <svtools/valueset.hxx> #include "valueimp.hxx" +#include <comphelper/servicehelper.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -44,12 +46,13 @@ using namespace ::com::sun::star; // - ValueSetItem - // ---------------- -ValueSetItem::ValueSetItem( ValueSet& rParent ) : - mrParent( rParent ), - mnId( 0 ), - mnBits( 0 ), - mpData( NULL ), - mpxAcc( NULL ) +ValueSetItem::ValueSetItem( ValueSet& rParent ) + : mrParent(rParent) + , mnId(0) + , mnBits(0) + , meType(VALUESETITEM_NONE) + , mpData(NULL) + , mpxAcc(NULL) { } @@ -122,7 +125,7 @@ void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue { (*aIter)->notifyEvent( aEvtObject ); } - catch( uno::Exception& ) + catch(const uno::Exception&) { } @@ -131,22 +134,14 @@ void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue } } -// ----------------------------------------------------------------------------- +namespace +{ + class theValueSetAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueSetAccUnoTunnelId > {}; +} const uno::Sequence< sal_Int8 >& ValueSetAcc::getUnoTunnelId() { - static uno::Sequence< sal_Int8 > aSeq; - - if( !aSeq.getLength() ) - { - static osl::Mutex aCreateMutex; - osl::Guard< osl::Mutex > aGuard( aCreateMutex ); - - aSeq.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); - } - - return aSeq; + return theValueSetAccUnoTunnelId::get().getSeq(); } // ----------------------------------------------------------------------------- @@ -159,7 +154,7 @@ ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterfa uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY ); return( xUnoTunnel.is() ? reinterpret_cast<ValueSetAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueSetAcc::getUnoTunnelId() ))) : NULL ); } - catch( const ::com::sun::star::uno::Exception& ) + catch(const ::com::sun::star::uno::Exception&) { return NULL; } @@ -208,7 +203,7 @@ uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAcc sal_Int32 SAL_CALL ValueSetAcc::getAccessibleChildCount() throw (uno::RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ThrowIfDisposed(); sal_Int32 nCount = mpParent->ImplGetVisibleItemCount(); @@ -223,7 +218,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessible throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; uno::Reference< accessibility::XAccessible > xRet; ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i)); @@ -241,7 +236,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessible throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; Window* pParent = mpParent->GetParent(); uno::Reference< accessibility::XAccessible > xRet; @@ -257,7 +252,7 @@ sal_Int32 SAL_CALL ValueSetAcc::getAccessibleIndexInParent() throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; Window* pParent = mpParent->GetParent(); sal_Int32 nRet = 0; @@ -297,7 +292,7 @@ sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole() throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; String aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet" ) ); return aRet; @@ -309,7 +304,7 @@ sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole() throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; String aRet; if ( mpParent ) @@ -362,7 +357,7 @@ lang::Locale SAL_CALL ValueSetAcc::getLocale() throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const ::rtl::OUString aEmptyStr; uno::Reference< accessibility::XAccessible > xParent( getAccessibleParent() ); lang::Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr ); @@ -449,17 +444,17 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessible throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const sal_uInt16 nItemId = mpParent->GetItemId( Point( aPoint.X, aPoint.Y ) ); uno::Reference< accessibility::XAccessible > xRet; - if( VALUESET_ITEM_NOTFOUND != nItemId ) + if( ((sal_uInt16)-1) != nItemId ) { - const sal_uInt16 nItemPos = mpParent->GetItemPos( nItemId ); + const size_t nItemPos = mpParent->GetItemPos( nItemId ); if( VALUESET_ITEM_NONEITEM != nItemPos ) { - ValueSetItem* pItem = mpParent->mpImpl->mpItemList->GetObject( nItemPos ); + ValueSetItem* pItem = (*mpParent->mpImpl->mpItemList)[ nItemPos ]; if( ( pItem->meType != VALUESETITEM_SPACE ) && !pItem->maRect.IsEmpty() ) xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled ); @@ -475,7 +470,7 @@ awt::Rectangle SAL_CALL ValueSetAcc::getBounds() throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const Point aOutPos( mpParent->GetPosPixel() ); const Size aOutSize( mpParent->GetOutputSizePixel() ); awt::Rectangle aRet; @@ -509,7 +504,7 @@ awt::Point SAL_CALL ValueSetAcc::getLocationOnScreen() throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const Point aScreenPos( mpParent->OutputToAbsoluteScreenPixel( Point() ) ); awt::Point aRet; @@ -540,7 +535,7 @@ void SAL_CALL ValueSetAcc::grabFocus() throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; mpParent->GrabFocus(); } @@ -579,7 +574,7 @@ void SAL_CALL ValueSetAcc::selectAccessibleChild( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex)); if(pItem != NULL) @@ -597,7 +592,7 @@ sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex)); sal_Bool bRet = sal_False; @@ -615,7 +610,7 @@ void SAL_CALL ValueSetAcc::clearAccessibleSelection() throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; mpParent->SetNoSelection(); } @@ -634,7 +629,7 @@ sal_Int32 SAL_CALL ValueSetAcc::getSelectedAccessibleChildCount() throw (uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; sal_Int32 nRet = 0; for( sal_uInt16 i = 0, nCount = getItemCount(); i < nCount; i++ ) @@ -654,7 +649,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getSelectedAc throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; uno::Reference< accessibility::XAccessible > xRet; for( sal_uInt16 i = 0, nCount = getItemCount(), nSel = 0; ( i < nCount ) && !xRet.is(); i++ ) @@ -674,7 +669,7 @@ void SAL_CALL ValueSetAcc::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { ThrowIfDisposed(); - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; // Because of the single selection we can reset the whole selection when // the specified child is currently selected. if (isAccessibleChildSelected(nChildIndex)) @@ -704,7 +699,7 @@ void SAL_CALL ValueSetAcc::disposing (void) { // Make a copy of the list and clear the original. - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard (m_aMutex); aListenerListCopy = mxEventListeners; mxEventListeners.clear(); @@ -724,7 +719,7 @@ void SAL_CALL ValueSetAcc::disposing (void) { (*aListenerIterator)->disposing (aEvent); } - catch( uno::Exception& ) + catch(const uno::Exception&) { // Ignore exceptions. } @@ -845,26 +840,18 @@ void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValu void ValueItemAcc::ParentDestroyed() { - const ::vos::OGuard aGuard( maMutex ); + const ::osl::MutexGuard aGuard( maMutex ); mpParent = NULL; } -// ----------------------------------------------------------------------------- +namespace +{ + class theValueItemAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueItemAccUnoTunnelId > {}; +} const uno::Sequence< sal_Int8 >& ValueItemAcc::getUnoTunnelId() { - static uno::Sequence< sal_Int8 > aSeq; - - if( !aSeq.getLength() ) - { - static osl::Mutex aCreateMutex; - osl::Guard< osl::Mutex > aGuard( aCreateMutex ); - - aSeq.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); - } - - return aSeq; + return theValueItemAccUnoTunnelId::get().getSeq(); } // ----------------------------------------------------------------------------- @@ -877,7 +864,7 @@ ValueItemAcc* ValueItemAcc::getImplementation( const uno::Reference< uno::XInter uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY ); return( xUnoTunnel.is() ? reinterpret_cast<ValueItemAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueItemAcc::getUnoTunnelId() ))) : NULL ); } - catch( const ::com::sun::star::uno::Exception& ) + catch(const ::com::sun::star::uno::Exception&) { return NULL; } @@ -912,7 +899,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibl uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleParent() throw (uno::RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; uno::Reference< accessibility::XAccessible > xRet; if( mpParent ) @@ -926,7 +913,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibl sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent() throw (uno::RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; // The index defaults to -1 to indicate the child does not belong to its // parent. sal_Int32 nIndexInParent = -1; @@ -945,7 +932,7 @@ sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent() { pItem = mpParent->mrParent.ImplGetVisibleItem (i); } - catch (lang::IndexOutOfBoundsException aException) + catch (const lang::IndexOutOfBoundsException&) { pItem = NULL; } @@ -984,7 +971,7 @@ sal_Int16 SAL_CALL ValueItemAcc::getAccessibleRole() ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleName() throw (uno::RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; String aRet; if( mpParent ) @@ -1014,7 +1001,7 @@ uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueItemAcc::g uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueItemAcc::getAccessibleStateSet() throw (uno::RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper; if( mpParent ) @@ -1046,7 +1033,7 @@ uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueItemAcc::getA lang::Locale SAL_CALL ValueItemAcc::getLocale() throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; const ::rtl::OUString aEmptyStr; uno::Reference< accessibility::XAccessible > xParent( getAccessibleParent() ); lang::Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr ); @@ -1067,7 +1054,7 @@ lang::Locale SAL_CALL ValueItemAcc::getLocale() void SAL_CALL ValueItemAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) throw (uno::RuntimeException) { - const ::vos::OGuard aGuard( maMutex ); + const ::osl::MutexGuard aGuard( maMutex ); if( rxListener.is() ) { @@ -1092,7 +1079,7 @@ void SAL_CALL ValueItemAcc::addEventListener( const uno::Reference< accessibilit void SAL_CALL ValueItemAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener ) throw (uno::RuntimeException) { - const ::vos::OGuard aGuard( maMutex ); + const ::osl::MutexGuard aGuard( maMutex ); if( rxListener.is() ) { @@ -1138,7 +1125,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibl awt::Rectangle SAL_CALL ValueItemAcc::getBounds() throw (uno::RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; awt::Rectangle aRet; if( mpParent ) @@ -1177,7 +1164,7 @@ awt::Point SAL_CALL ValueItemAcc::getLocation() awt::Point SAL_CALL ValueItemAcc::getLocationOnScreen() throw (uno::RuntimeException) { - const vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aSolarGuard; awt::Point aRet; if( mpParent ) @@ -1256,3 +1243,5 @@ sal_Int64 SAL_CALL ValueItemAcc::getSomething( const uno::Sequence< sal_Int8 >& return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index bc5252372be9..57bb5fae0650 100755..100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,14 +26,10 @@ * ************************************************************************/ -#include <vos/mutex.hxx> -#include <tools/list.hxx> +#include <osl/mutex.hxx> #include <tools/color.hxx> #include <tools/string.hxx> -#ifndef _IMAGE_HXX #include <vcl/image.hxx> -#endif -#include <rtl/uuid.h> #include <cppuhelper/implbase5.hxx> #include <cppuhelper/compbase6.hxx> #include <comphelper/broadcasthelper.hxx> @@ -101,9 +98,7 @@ struct ValueSetItem void ClearAccessible(); }; -// ----------------------------------------------------------------------------- - -DECLARE_LIST( ValueItemList, ValueSetItem* ) +typedef ::std::vector< ValueSetItem* > ValueItemList; // ----------------------------------------------------------------------------- @@ -123,7 +118,7 @@ struct ValueSet_Impl // - ValueSetAcc - // --------------- -typedef ::cppu::WeakComponentImplHelper6< +typedef ::cppu::PartialWeakComponentImplHelper6< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, ::com::sun::star::accessibility::XAccessibleContext, @@ -158,14 +153,19 @@ public: */ void LoseFocus (void); + // XComponent + virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::dispose(); } + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::addEventListener(xListener); } + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException) + { WeakComponentImplHelperBase::removeEventListener(xListener); } // XAccessible virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); // XAccessibleEventBroadcaster - using cppu::WeakComponentImplHelper6<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection, com::sun::star::lang::XUnoTunnel>::addEventListener; virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); - using cppu::WeakComponentImplHelper6<com::sun::star::accessibility::XAccessible, com::sun::star::accessibility::XAccessibleEventBroadcaster, com::sun::star::accessibility::XAccessibleContext, com::sun::star::accessibility::XAccessibleComponent, com::sun::star::accessibility::XAccessibleSelection, com::sun::star::lang::XUnoTunnel>::removeEventListener; virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); // XAccessibleContext @@ -205,7 +205,6 @@ public: virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException ); private: - // ::vos::OMutex maMutex; ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners; ValueSet* mpParent; @@ -274,7 +273,7 @@ private: ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners; - ::vos::OMutex maMutex; + ::osl::Mutex maMutex; ValueSetItem* mpParent; bool mbIsTransientChildrenDisabled; @@ -328,3 +327,5 @@ public: // XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException ); }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 8875ce66354c..c3be233cb917 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,16 +28,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <tools/list.hxx> #include <tools/debug.hxx> #include <vcl/decoview.hxx> #include <vcl/svapp.hxx> -#ifndef _SCRBAR_HXX #include <vcl/scrbar.hxx> -#endif -#ifndef _HELP_HXX #include <vcl/help.hxx> -#endif #include <com/sun/star/accessibility/AccessibleEventObject.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -138,8 +134,9 @@ ValueSet::~ValueSet() void ValueSet::ImplDeleteItems() { - for( ValueSetItem* pItem = mpImpl->mpItemList->First(); pItem; pItem = mpImpl->mpItemList->Next() ) + for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i ) { + ValueSetItem* pItem = (*mpImpl->mpItemList)[ i ]; if( !pItem->maRect.IsEmpty() && ImplHasAccessibleListeners() ) { ::com::sun::star::uno::Any aOldAny, aNewAny; @@ -151,7 +148,7 @@ void ValueSet::ImplDeleteItems() delete pItem; } - mpImpl->mpItemList->Clear(); + mpImpl->mpItemList->clear(); } // ----------------------------------------------------------------------- @@ -345,7 +342,7 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem ) void ValueSet::Format() { Size aWinSize = GetOutputSizePixel(); - sal_uLong nItemCount = mpImpl->mpItemList->Count(); + size_t nItemCount = mpImpl->mpItemList->size(); WinBits nStyle = GetStyle(); long nTxtHeight = GetTextHeight(); long nOff; @@ -437,8 +434,8 @@ void ValueSet::Format() // Zeilenanzahl berechnen mbScroll = sal_False; - mnLines = (long)mpImpl->mpItemList->Count() / mnCols; - if ( mpImpl->mpItemList->Count() % mnCols ) + mnLines = (long)mpImpl->mpItemList->size() / mnCols; + if ( mpImpl->mpItemList->size() % mnCols ) mnLines++; else if ( !mnLines ) mnLines = 1; @@ -509,9 +506,9 @@ void ValueSet::Format() } } - for ( sal_uLong i = 0; i < nItemCount; i++ ) + for ( size_t i = 0; i < nItemCount; i++ ) { - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( i ); + ValueSetItem* pItem = (*mpImpl->mpItemList)[ i ]; pItem->maRect.SetEmpty(); } @@ -598,9 +595,9 @@ void ValueSet::Format() if ( y+(mnVisLines*(nItemHeight+nSpace)) < aWinSize.Height() ) nLastItem += mnCols; } - for ( sal_uLong i = 0; i < nItemCount; i++ ) + for ( size_t i = 0; i < nItemCount; i++ ) { - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( i ); + ValueSetItem* pItem = (*mpImpl->mpItemList)[ i ]; if ( (i >= nFirstItem) && (i < nLastItem) ) { @@ -739,7 +736,7 @@ void ValueSet::ImplDrawSelect() ValueSetItem* pItem; if ( nItemId ) - pItem = mpImpl->mpItemList->GetObject( GetItemPos( nItemId ) ); + pItem = (*mpImpl->mpItemList)[ GetItemPos( nItemId ) ]; else { if ( mpNoneItem ) @@ -904,7 +901,7 @@ void ValueSet::ImplHideSelect( sal_uInt16 nItemId ) sal_uInt16 nItemPos = GetItemPos( nItemId ); if ( nItemPos != sal::static_int_cast<sal_uInt16>(LIST_ENTRY_NOTFOUND) ) - aRect = mpImpl->mpItemList->GetObject( nItemPos )->maRect; + aRect = (*mpImpl->mpItemList)[ nItemPos ]->maRect; else { if ( mpNoneItem ) @@ -945,15 +942,15 @@ void ValueSet::ImplHighlightItem( sal_uInt16 nItemId, sal_Bool bIsSelection ) void ValueSet::ImplDrawDropPos( sal_Bool bShow ) { - if ( (mnDropPos != VALUESET_ITEM_NOTFOUND) && mpImpl->mpItemList->Count() ) + if ( (mnDropPos != VALUESET_ITEM_NOTFOUND) && !mpImpl->mpItemList->empty() ) { - sal_uInt16 nItemPos = mnDropPos; + size_t nItemPos = mnDropPos; sal_uInt16 nItemId1; sal_uInt16 nItemId2 = 0; sal_Bool bRight; - if ( nItemPos >= mpImpl->mpItemList->Count() ) + if ( nItemPos >= mpImpl->mpItemList->size() ) { - nItemPos = (sal_uInt16)(mpImpl->mpItemList->Count()-1); + nItemPos = mpImpl->mpItemList->size() - 1; bRight = sal_True; } else @@ -962,7 +959,7 @@ void ValueSet::ImplDrawDropPos( sal_Bool bShow ) nItemId1 = GetItemId( nItemPos ); if ( (nItemId1 != mnSelItemId) && (nItemId1 != mnHighItemId) ) nItemId1 = 0; - Rectangle aRect2 = mpImpl->mpItemList->GetObject( nItemPos )->maRect; + Rectangle aRect2 = (*mpImpl->mpItemList)[ nItemPos ]->maRect; Rectangle aRect1; if ( bRight ) { @@ -971,7 +968,7 @@ void ValueSet::ImplDrawDropPos( sal_Bool bShow ) } else if ( nItemPos > 0 ) { - aRect1 = mpImpl->mpItemList->GetObject( nItemPos-1 )->maRect; + aRect1 = (*mpImpl->mpItemList)[ nItemPos-1 ]->maRect; nItemId2 = GetItemId( nItemPos-1 ); if ( (nItemId2 != mnSelItemId) && (nItemId2 != mnHighItemId) ) nItemId2 = 0; @@ -1104,7 +1101,7 @@ sal_Bool ValueSet::ImplScroll( const Point& rPos ) long nScrollOffset; sal_uInt16 nOldLine = mnFirstLine; - const Rectangle& rTopRect = mpImpl->mpItemList->GetObject( mnFirstLine*mnCols )->maRect; + const Rectangle& rTopRect = (*mpImpl->mpItemList)[ mnFirstLine * mnCols ]->maRect; if ( rTopRect.GetHeight() <= 16 ) nScrollOffset = VALUESET_SCROLL_OFFSET/2; else @@ -1118,7 +1115,7 @@ sal_Bool ValueSet::ImplScroll( const Point& rPos ) if ( (mnFirstLine == nOldLine) && (mnFirstLine < (sal_uInt16)(mnLines-mnVisLines)) && (rPos.Y() < aOutSize.Height()) ) { - long nBottomPos = mpImpl->mpItemList->GetObject( (mnFirstLine+mnVisLines-1)*mnCols )->maRect.Bottom(); + long nBottomPos = (*mpImpl->mpItemList)[ (mnFirstLine+mnVisLines-1)*mnCols ]->maRect.Bottom(); if ( (rPos.Y() >= nBottomPos-nScrollOffset) && (rPos.Y() <= nBottomPos) ) mnFirstLine++; } @@ -1135,7 +1132,7 @@ sal_Bool ValueSet::ImplScroll( const Point& rPos ) // ----------------------------------------------------------------------- -sal_uInt16 ValueSet::ImplGetItem( const Point& rPos, sal_Bool bMove ) const +size_t ValueSet::ImplGetItem( const Point& rPos, sal_Bool bMove ) const { if ( mpNoneItem ) { @@ -1146,14 +1143,14 @@ sal_uInt16 ValueSet::ImplGetItem( const Point& rPos, sal_Bool bMove ) const Point aDefPos; Rectangle aWinRect( aDefPos, maVirDev.GetOutputSizePixel() ); - sal_uLong nItemCount = mpImpl->mpItemList->Count(); - for ( sal_uLong i = 0; i < nItemCount; i++ ) + size_t nItemCount = mpImpl->mpItemList->size(); + for ( size_t i = 0; i < nItemCount; i++ ) { - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( i ); + ValueSetItem* pItem = (*mpImpl->mpItemList)[ i ]; if ( pItem->maRect.IsInside( rPos ) ) { if ( aWinRect.IsInside( rPos ) ) - return (sal_uInt16)i; + return i; else return VALUESET_ITEM_NOTFOUND; } @@ -1173,27 +1170,23 @@ sal_uInt16 ValueSet::ImplGetItem( const Point& rPos, sal_Bool bMove ) const // ----------------------------------------------------------------------- -ValueSetItem* ValueSet::ImplGetItem( sal_uInt16 nPos ) +ValueSetItem* ValueSet::ImplGetItem( size_t nPos ) { if ( nPos == VALUESET_ITEM_NONEITEM ) return mpNoneItem; else - return mpImpl->mpItemList->GetObject( nPos ); + return ( nPos < mpImpl->mpItemList->size() ) ? (*mpImpl->mpItemList)[ nPos ] : NULL; } // ----------------------------------------------------------------------- ValueSetItem* ValueSet::ImplGetFirstItem() { - sal_uInt16 nItemCount = (sal_uInt16)mpImpl->mpItemList->Count(); - sal_uInt16 i = 0; - - while ( i < nItemCount ) - { - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( i ); - if ( pItem->meType != VALUESETITEM_SPACE ) + for ( size_t i = 0, nItemCount = mpImpl->mpItemList->size(); i < nItemCount; ++i ) { + ValueSetItem* pItem = (*mpImpl->mpItemList)[ i ]; + if ( pItem->meType != VALUESETITEM_SPACE ) { return pItem; - i++; + } } return NULL; @@ -1205,9 +1198,9 @@ sal_uInt16 ValueSet::ImplGetVisibleItemCount() const { sal_uInt16 nRet = 0; - for( sal_Int32 n = 0, nItemCount = mpImpl->mpItemList->Count(); n < nItemCount; n++ ) + for( size_t n = 0, nItemCount = mpImpl->mpItemList->size(); n < nItemCount; n++ ) { - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( n ); + ValueSetItem* pItem = (*mpImpl->mpItemList)[ n ]; if( pItem->meType != VALUESETITEM_SPACE && !pItem->maRect.IsEmpty() ) nRet++; @@ -1223,9 +1216,9 @@ ValueSetItem* ValueSet::ImplGetVisibleItem( sal_uInt16 nVisiblePos ) ValueSetItem* pRet = NULL; sal_uInt16 nFoundPos = 0; - for( sal_Int32 n = 0, nItemCount = mpImpl->mpItemList->Count(); ( n < nItemCount ) && !pRet; n++ ) + for( sal_Int32 n = 0, nItemCount = mpImpl->mpItemList->size(); ( n < nItemCount ) && !pRet; n++ ) { - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( n ); + ValueSetItem* pItem = (*mpImpl->mpItemList)[ n ]; if( ( pItem->meType != VALUESETITEM_SPACE ) && !pItem->maRect.IsEmpty() && ( nVisiblePos == nFoundPos++ ) ) pRet = pItem; @@ -1416,10 +1409,10 @@ void ValueSet::Tracking( const TrackingEvent& rTEvt ) void ValueSet::KeyInput( const KeyEvent& rKEvt ) { - sal_uInt16 nLastItem = (sal_uInt16)mpImpl->mpItemList->Count(); - sal_uInt16 nItemPos = VALUESET_ITEM_NOTFOUND; - sal_uInt16 nCurPos = VALUESET_ITEM_NONEITEM; - sal_uInt16 nCalcPos; + size_t nLastItem = mpImpl->mpItemList->size(); + size_t nItemPos = VALUESET_ITEM_NOTFOUND; + size_t nCurPos = VALUESET_ITEM_NONEITEM; + size_t nCalcPos; if ( !nLastItem || !ImplGetFirstItem() ) { @@ -1507,7 +1500,7 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) if( rKEvt.GetKeyCode().GetCode() != KEY_PAGEUP || ( !rKEvt.GetKeyCode().IsShift() && !rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsMod2() ) ) { - const long nLineCount = ( ( KEY_UP == rKEvt.GetKeyCode().GetCode() ) ? 1 : mnVisLines ); + const size_t nLineCount = ( ( KEY_UP == rKEvt.GetKeyCode().GetCode() ) ? 1 : mnVisLines ); do { if ( nCalcPos == VALUESET_ITEM_NONEITEM ) @@ -1568,16 +1561,6 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) nCalcPos + ( nLineCount * mnCols )); else { -#if 0 - if( (KEY_DOWN == rKEvt.GetKeyCode().GetCode() ) && (GetStyle() & WB_MENUSTYLEVALUESET) ) - { - Window* pParent = GetParent(); - pParent->GrabFocus(); - pParent->KeyInput( rKEvt ); - break; - } - else -#endif { if ( mpNoneItem ) { @@ -1710,7 +1693,7 @@ void ValueSet::RequestHelp( const HelpEvent& rHEvt ) if ( (rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON)) == HELPMODE_QUICK ) { Point aPos = ScreenToOutputPixel( rHEvt.GetMousePosPixel() ); - sal_uInt16 nItemPos = ImplGetItem( aPos ); + size_t nItemPos = ImplGetItem( aPos ); if ( nItemPos != VALUESET_ITEM_NOTFOUND ) { ValueSetItem* pItem = ImplGetItem( nItemPos ); @@ -1817,7 +1800,7 @@ void ValueSet::UserDraw( const UserDrawEvent& ) // ----------------------------------------------------------------------- -void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, sal_uInt16 nPos ) +void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, size_t nPos ) { DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND, @@ -1827,7 +1810,13 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, sal_uInt16 n pItem->mnId = nItemId; pItem->meType = VALUESETITEM_IMAGE; pItem->maImage = rImage; - mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos ); + if ( nPos < mpImpl->mpItemList->size() ) { + ValueItemList::iterator it = mpImpl->mpItemList->begin(); + ::std::advance( it, nPos ); + mpImpl->mpItemList->insert( it, pItem ); + } else { + mpImpl->mpItemList->push_back( pItem ); + } mbFormat = sal_True; if ( IsReallyVisible() && IsUpdateMode() ) @@ -1836,7 +1825,7 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, sal_uInt16 n // ----------------------------------------------------------------------- -void ValueSet::InsertItem( sal_uInt16 nItemId, const Color& rColor, sal_uInt16 nPos ) +void ValueSet::InsertItem( sal_uInt16 nItemId, const Color& rColor, size_t nPos ) { DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND, @@ -1846,7 +1835,13 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const Color& rColor, sal_uInt16 n pItem->mnId = nItemId; pItem->meType = VALUESETITEM_COLOR; pItem->maColor = rColor; - mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos ); + if ( nPos < mpImpl->mpItemList->size() ) { + ValueItemList::iterator it = mpImpl->mpItemList->begin(); + ::std::advance( it, nPos ); + mpImpl->mpItemList->insert( it, pItem ); + } else { + mpImpl->mpItemList->push_back( pItem ); + } mbFormat = sal_True; if ( IsReallyVisible() && IsUpdateMode() ) @@ -1856,7 +1851,7 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const Color& rColor, sal_uInt16 n // ----------------------------------------------------------------------- void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, - const XubString& rText, sal_uInt16 nPos ) + const XubString& rText, size_t nPos ) { DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND, @@ -1867,7 +1862,13 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, pItem->meType = VALUESETITEM_IMAGE; pItem->maImage = rImage; pItem->maText = rText; - mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos ); + if ( nPos < mpImpl->mpItemList->size() ) { + ValueItemList::iterator it = mpImpl->mpItemList->begin(); + ::std::advance( it, nPos ); + mpImpl->mpItemList->insert( it, pItem ); + } else { + mpImpl->mpItemList->push_back( pItem ); + } mbFormat = sal_True; if ( IsReallyVisible() && IsUpdateMode() ) @@ -1877,7 +1878,7 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage, // ----------------------------------------------------------------------- void ValueSet::InsertItem( sal_uInt16 nItemId, const Color& rColor, - const XubString& rText, sal_uInt16 nPos ) + const XubString& rText, size_t nPos ) { DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND, @@ -1888,7 +1889,13 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const Color& rColor, pItem->meType = VALUESETITEM_COLOR; pItem->maColor = rColor; pItem->maText = rText; - mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos ); + if ( nPos < mpImpl->mpItemList->size() ) { + ValueItemList::iterator it = mpImpl->mpItemList->begin(); + ::std::advance( it, nPos ); + mpImpl->mpItemList->insert( it, pItem ); + } else { + mpImpl->mpItemList->push_back( pItem ); + } mbFormat = sal_True; if ( IsReallyVisible() && IsUpdateMode() ) @@ -1897,7 +1904,7 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const Color& rColor, // ----------------------------------------------------------------------- -void ValueSet::InsertItem( sal_uInt16 nItemId, sal_uInt16 nPos ) +void ValueSet::InsertItem( sal_uInt16 nItemId, size_t nPos ) { DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND, @@ -1906,7 +1913,13 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, sal_uInt16 nPos ) ValueSetItem* pItem = new ValueSetItem( *this ); pItem->mnId = nItemId; pItem->meType = VALUESETITEM_USERDRAW; - mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos ); + if ( nPos < mpImpl->mpItemList->size() ) { + ValueItemList::iterator it = mpImpl->mpItemList->begin(); + ::std::advance( it, nPos ); + mpImpl->mpItemList->insert( it, pItem ); + } else { + mpImpl->mpItemList->push_back( pItem ); + } mbFormat = sal_True; if ( IsReallyVisible() && IsUpdateMode() ) @@ -1915,7 +1928,7 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, sal_uInt16 nPos ) // ----------------------------------------------------------------------- -void ValueSet::InsertSpace( sal_uInt16 nItemId, sal_uInt16 nPos ) +void ValueSet::InsertSpace( sal_uInt16 nItemId, size_t nPos ) { DBG_ASSERT( nItemId, "ValueSet::InsertSpace(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND, @@ -1924,7 +1937,13 @@ void ValueSet::InsertSpace( sal_uInt16 nItemId, sal_uInt16 nPos ) ValueSetItem* pItem = new ValueSetItem( *this ); pItem->mnId = nItemId; pItem->meType = VALUESETITEM_SPACE; - mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos ); + if ( nPos < mpImpl->mpItemList->size() ) { + ValueItemList::iterator it = mpImpl->mpItemList->begin(); + ::std::advance( it, nPos ); + mpImpl->mpItemList->insert( it, pItem ); + } else { + mpImpl->mpItemList->push_back( pItem ); + } mbFormat = sal_True; if ( IsReallyVisible() && IsUpdateMode() ) @@ -1935,12 +1954,17 @@ void ValueSet::InsertSpace( sal_uInt16 nItemId, sal_uInt16 nPos ) void ValueSet::RemoveItem( sal_uInt16 nItemId ) { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos == VALUESET_ITEM_NOTFOUND ) return; - delete mpImpl->mpItemList->Remove( nPos ); + if ( nPos < mpImpl->mpItemList->size() ) { + ValueItemList::iterator it = mpImpl->mpItemList->begin(); + ::std::advance( it, nPos ); + delete *it; + mpImpl->mpItemList->erase( it ); + } // Variablen zuruecksetzen if ( (mnHighItemId == nItemId) || (mnSelItemId == nItemId) ) @@ -1963,9 +1987,9 @@ void ValueSet::CopyItems( const ValueSet& rValueSet ) { ImplDeleteItems(); - ValueSetItem* pItem = rValueSet.mpImpl->mpItemList->First(); - while ( pItem ) + for ( size_t i = 0, n = rValueSet.mpImpl->mpItemList->size(); i < n; ++i ) { + ValueSetItem* pItem = (*rValueSet.mpImpl->mpItemList)[ i ]; ValueSetItem* pNewItem = new ValueSetItem( *this ); pNewItem->mnId = pItem->mnId; @@ -1977,9 +2001,7 @@ void ValueSet::CopyItems( const ValueSet& rValueSet ) pNewItem->mpData = pItem->mpData; pNewItem->maRect = pItem->maRect; pNewItem->mpxAcc = NULL; - - mpImpl->mpItemList->Insert( pNewItem ); - pItem = rValueSet.mpImpl->mpItemList->Next(); + mpImpl->mpItemList->push_back( pNewItem ); } // Variablen zuruecksetzen @@ -2016,43 +2038,36 @@ void ValueSet::Clear() // ----------------------------------------------------------------------- -sal_uInt16 ValueSet::GetItemCount() const +size_t ValueSet::GetItemCount() const { - return (sal_uInt16)mpImpl->mpItemList->Count(); + return mpImpl->mpItemList->size(); } // ----------------------------------------------------------------------- -sal_uInt16 ValueSet::GetItemPos( sal_uInt16 nItemId ) const +size_t ValueSet::GetItemPos( sal_uInt16 nItemId ) const { - ValueSetItem* pItem = mpImpl->mpItemList->First(); - while ( pItem ) - { - if ( pItem->mnId == nItemId ) - return (sal_uInt16)mpImpl->mpItemList->GetCurPos(); - pItem = mpImpl->mpItemList->Next(); + for ( size_t i = 0, n = mpImpl->mpItemList->size(); i < n; ++i ) { + ValueSetItem* pItem = (*mpImpl->mpItemList)[ i ]; + if ( pItem->mnId == nItemId ) { + return i; + } } - return VALUESET_ITEM_NOTFOUND; } // ----------------------------------------------------------------------- -sal_uInt16 ValueSet::GetItemId( sal_uInt16 nPos ) const +sal_uInt16 ValueSet::GetItemId( size_t nPos ) const { - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( nPos ); - - if ( pItem ) - return pItem->mnId; - else - return 0; + return ( nPos < mpImpl->mpItemList->size() ) ? (*mpImpl->mpItemList)[ nPos ]->mnId : 0 ; } // ----------------------------------------------------------------------- sal_uInt16 ValueSet::GetItemId( const Point& rPos ) const { - sal_uInt16 nItemPos = ImplGetItem( rPos ); + size_t nItemPos = ImplGetItem( rPos ); if ( nItemPos != VALUESET_ITEM_NOTFOUND ) return GetItemId( nItemPos ); @@ -2063,10 +2078,10 @@ sal_uInt16 ValueSet::GetItemId( const Point& rPos ) const Rectangle ValueSet::GetItemRect( sal_uInt16 nItemId ) const { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos != VALUESET_ITEM_NOTFOUND ) - return mpImpl->mpItemList->GetObject( nPos )->maRect; + return (*mpImpl->mpItemList)[ nPos ]->maRect; else return Rectangle(); } @@ -2147,14 +2162,14 @@ void ValueSet::SetFirstLine( sal_uInt16 nNewLine ) void ValueSet::SelectItem( sal_uInt16 nItemId ) { - sal_uInt16 nItemPos = 0; + size_t nItemPos = 0; if ( nItemId ) { nItemPos = GetItemPos( nItemId ); if ( nItemPos == VALUESET_ITEM_NOTFOUND ) return; - if ( mpImpl->mpItemList->GetObject( nItemPos )->meType == VALUESETITEM_SPACE ) + if ( (*mpImpl->mpItemList)[ nItemPos ]->meType == VALUESETITEM_SPACE ) return; } @@ -2210,12 +2225,12 @@ void ValueSet::SelectItem( sal_uInt16 nItemId ) // focus event (deselect) if( nOldItem ) { - const sal_uInt16 nPos = GetItemPos( nItemId ); + const size_t nPos = GetItemPos( nItemId ); if( nPos != VALUESET_ITEM_NOTFOUND ) { ValueItemAcc* pItemAcc = ValueItemAcc::getImplementation( - mpImpl->mpItemList->GetObject( nPos )->GetAccessible( mpImpl->mbIsTransientChildrenDisabled ) ); + (*mpImpl->mpItemList)[ nPos ]->GetAccessible( mpImpl->mbIsTransientChildrenDisabled ) ); if( pItemAcc ) { @@ -2236,11 +2251,11 @@ void ValueSet::SelectItem( sal_uInt16 nItemId ) } // focus event (select) - const sal_uInt16 nPos = GetItemPos( mnSelItemId ); + const size_t nPos = GetItemPos( mnSelItemId ); ValueSetItem* pItem; if( nPos != VALUESET_ITEM_NOTFOUND ) - pItem = mpImpl->mpItemList->GetObject(nPos); + pItem = (*mpImpl->mpItemList)[ nPos ]; else pItem = mpNoneItem; @@ -2288,20 +2303,20 @@ void ValueSet::SetNoSelection() void ValueSet::SetItemBits( sal_uInt16 nItemId, sal_uInt16 nItemBits ) { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos != VALUESET_ITEM_NOTFOUND ) - mpImpl->mpItemList->GetObject( nPos )->mnBits = nItemBits; + (*mpImpl->mpItemList)[ nPos ]->mnBits = nItemBits; } // ----------------------------------------------------------------------- sal_uInt16 ValueSet::GetItemBits( sal_uInt16 nItemId ) const { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos != VALUESET_ITEM_NOTFOUND ) - return mpImpl->mpItemList->GetObject( nPos )->mnBits; + return (*mpImpl->mpItemList)[ nPos ]->mnBits; else return 0; } @@ -2310,12 +2325,12 @@ sal_uInt16 ValueSet::GetItemBits( sal_uInt16 nItemId ) const void ValueSet::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos == VALUESET_ITEM_NOTFOUND ) return; - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( nPos ); + ValueSetItem* pItem = (*mpImpl->mpItemList)[ nPos ]; pItem->meType = VALUESETITEM_IMAGE; pItem->maImage = rImage; @@ -2332,10 +2347,10 @@ void ValueSet::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) Image ValueSet::GetItemImage( sal_uInt16 nItemId ) const { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos != VALUESET_ITEM_NOTFOUND ) - return mpImpl->mpItemList->GetObject( nPos )->maImage; + return (*mpImpl->mpItemList)[ nPos ]->maImage; else return Image(); } @@ -2344,12 +2359,12 @@ Image ValueSet::GetItemImage( sal_uInt16 nItemId ) const void ValueSet::SetItemColor( sal_uInt16 nItemId, const Color& rColor ) { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos == VALUESET_ITEM_NOTFOUND ) return; - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( nPos ); + ValueSetItem* pItem = (*mpImpl->mpItemList)[ nPos ]; pItem->meType = VALUESETITEM_COLOR; pItem->maColor = rColor; @@ -2366,10 +2381,10 @@ void ValueSet::SetItemColor( sal_uInt16 nItemId, const Color& rColor ) Color ValueSet::GetItemColor( sal_uInt16 nItemId ) const { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos != VALUESET_ITEM_NOTFOUND ) - return mpImpl->mpItemList->GetObject( nPos )->maColor; + return (*mpImpl->mpItemList)[ nPos ]->maColor; else return Color(); } @@ -2378,12 +2393,12 @@ Color ValueSet::GetItemColor( sal_uInt16 nItemId ) const void ValueSet::SetItemData( sal_uInt16 nItemId, void* pData ) { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos == VALUESET_ITEM_NOTFOUND ) return; - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( nPos ); + ValueSetItem* pItem = (*mpImpl->mpItemList)[ nPos ]; pItem->mpData = pData; if ( pItem->meType == VALUESETITEM_USERDRAW ) @@ -2402,10 +2417,10 @@ void ValueSet::SetItemData( sal_uInt16 nItemId, void* pData ) void* ValueSet::GetItemData( sal_uInt16 nItemId ) const { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos != VALUESET_ITEM_NOTFOUND ) - return mpImpl->mpItemList->GetObject( nPos )->mpData; + return (*mpImpl->mpItemList)[ nPos ]->mpData; else return NULL; } @@ -2414,13 +2429,13 @@ void* ValueSet::GetItemData( sal_uInt16 nItemId ) const void ValueSet::SetItemText( sal_uInt16 nItemId, const XubString& rText ) { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos == VALUESET_ITEM_NOTFOUND ) return; - ValueSetItem* pItem = mpImpl->mpItemList->GetObject( nPos ); + ValueSetItem* pItem = (*mpImpl->mpItemList)[ nPos ]; // Remember old and new name for accessibility event. ::com::sun::star::uno::Any aOldName, aNewName; @@ -2457,10 +2472,10 @@ void ValueSet::SetItemText( sal_uInt16 nItemId, const XubString& rText ) XubString ValueSet::GetItemText( sal_uInt16 nItemId ) const { - sal_uInt16 nPos = GetItemPos( nItemId ); + size_t nPos = GetItemPos( nItemId ); if ( nPos != VALUESET_ITEM_NOTFOUND ) - return mpImpl->mpItemList->GetObject( nPos )->maText; + return (*mpImpl->mpItemList)[ nPos ]->maText; else return XubString(); } @@ -2560,13 +2575,13 @@ sal_Bool ValueSet::StartDrag( const CommandEvent& rCEvt, Region& rRegion ) Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesireCols, sal_uInt16 nDesireLines ) { - long nCalcCols = (long)nDesireCols; - long nCalcLines = (long)nDesireLines; + size_t nCalcCols = nDesireCols; + size_t nCalcLines = nDesireLines; if ( !nCalcCols ) { if ( mnUserCols ) - nCalcCols = (long)mnUserCols; + nCalcCols = mnUserCols; else nCalcCols = 1; } @@ -2581,8 +2596,8 @@ Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesireCol nCalcLines = mnUserVisLines; else { - nCalcLines = (long)mpImpl->mpItemList->Count() / nCalcCols; - if ( mpImpl->mpItemList->Count() % nCalcCols ) + nCalcLines = mpImpl->mpItemList->size() / nCalcCols; + if ( mpImpl->mpItemList->size() % nCalcCols ) nCalcLines++; else if ( !nCalcLines ) nCalcLines = 1; @@ -2692,7 +2707,7 @@ sal_uInt16 ValueSet::ShowDropPos( const Point& rPos ) ImplScroll( rPos ); // DropPosition ermitteln - sal_uInt16 nPos = ImplGetItem( rPos, sal_True ); + size_t nPos = ImplGetItem( rPos, sal_True ); if ( nPos == VALUESET_ITEM_NONEITEM ) nPos = 0; else if ( nPos == VALUESET_ITEM_NOTFOUND ) @@ -2702,12 +2717,12 @@ sal_uInt16 ValueSet::ShowDropPos( const Point& rPos ) aOutSize.Height() = mnTextOffset; if ( (rPos.X() >= 0) && (rPos.X() < aOutSize.Width()) && (rPos.Y() >= 0) && (rPos.Y() < aOutSize.Height()) ) - nPos = (sal_uInt16)mpImpl->mpItemList->Count(); + nPos = mpImpl->mpItemList->size(); } else { // Im letzten viertel, dann wird ein Item spaeter eingefuegt - Rectangle aRect = mpImpl->mpItemList->GetObject( nPos )->maRect; + Rectangle aRect = (*mpImpl->mpItemList)[ nPos ]->maRect; if ( rPos.X() > aRect.Left()+aRect.GetWidth()-(aRect.GetWidth()/4) ) nPos++; } @@ -2756,3 +2771,4 @@ const Link& ValueSet::GetHighlightHdl() const // ----------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 27d1d1a6b239..5f3f46aa669d 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -197,7 +198,7 @@ public: } else { - DBG_ERROR ( ( ::rtl::OString("AssigmentTransientData::AssigmentTransientData: unknown programmatic name (") + OSL_FAIL( ( ::rtl::OString("AssigmentTransientData::AssigmentTransientData: unknown programmatic name (") += ::rtl::OString(pFields->ProgrammaticName.getStr(), pFields->ProgrammaticName.getLength(), RTL_TEXTENCODING_ASCII_US) += ::rtl::OString(")!") ).getStr() @@ -260,13 +261,13 @@ public: // ------------------------------------------------------------------- void AssigmentTransientData::setDatasourceName(const ::rtl::OUString&) { - DBG_ERROR( "AssigmentTransientData::setDatasourceName: cannot be implemented for transient data!" ); + OSL_FAIL( "AssigmentTransientData::setDatasourceName: cannot be implemented for transient data!" ); } // ------------------------------------------------------------------- void AssigmentTransientData::setCommand(const ::rtl::OUString&) { - DBG_ERROR( "AssigmentTransientData::setCommand: cannot be implemented for transient data!" ); + OSL_FAIL( "AssigmentTransientData::setCommand: cannot be implemented for transient data!" ); } // =================================================================== @@ -814,7 +815,7 @@ void AssignmentPersistentData::Commit() } catch(Exception&) { - DBG_ERROR("AddressBookSourceDialog::initializeDatasources: caught an exception while asking for the data source names!"); + OSL_FAIL("AddressBookSourceDialog::initializeDatasources: caught an exception while asking for the data source names!"); } const ::rtl::OUString* pDatasourceNames = aDatasourceNames.getConstArray(); const ::rtl::OUString* pEnd = pDatasourceNames + aDatasourceNames.getLength(); @@ -900,7 +901,7 @@ void AssignmentPersistentData::Commit() catch(SQLException& e) { aException <<= e; } catch(Exception&) { - DBG_ERROR("AddressBookSourceDialog::resetTables: could not retrieve the table!"); + OSL_FAIL("AddressBookSourceDialog::resetTables: could not retrieve the table!"); } if (aException.hasValue()) @@ -960,7 +961,7 @@ void AssignmentPersistentData::Commit() } catch(Exception&) { - DBG_ERROR("AddressBookSourceDialog::resetFields: could not retrieve the table columns!"); + OSL_FAIL("AddressBookSourceDialog::resetFields: could not retrieve the table columns!"); } @@ -1259,7 +1260,7 @@ void AssignmentPersistentData::Commit() } catch(Exception&) { - DBG_ERROR("AddressBookSourceDialog::OnAdministrateDatasources: an error occured while executing the administration dialog!"); + OSL_FAIL("AddressBookSourceDialog::OnAdministrateDatasources: an error occurred while executing the administration dialog!"); } // re-fill the data source list @@ -1325,3 +1326,4 @@ void AssignmentPersistentData::Commit() } // namespace svt // ....................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/colctrl.cxx b/svtools/source/dialogs/colctrl.cxx deleted file mode 100644 index 2aa1b5b10675..000000000000 --- a/svtools/source/dialogs/colctrl.cxx +++ /dev/null @@ -1,690 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - - -#include <vcl/salbtype.hxx> -#include <vcl/bmpacc.hxx> - -#include <svtools/colctrl.hxx> - -// ---------------- -// - ColorControl - -// ---------------- - -SvColorControl::SvColorControl( Window* pParent, WinBits nStyle ) : - Control ( pParent, nStyle ), - mpBitmap ( NULL ), - mpReadAccess ( NULL ), - mnLuminance ( 50 ) -{ - Initialize(); -} - -// ----------------------------------------------------------------------- -SvColorControl::SvColorControl( Window* pParent, const ResId& rResId ) : - Control ( pParent, rResId ), - mpBitmap ( NULL ), - mpReadAccess ( NULL ), - mnLuminance ( 50 ) -{ - Initialize(); -} - - -// ----------------------------------------------------------------------- -SvColorControl::~SvColorControl() -{ - delete mpBitmap; -} - -// ----------------------------------------------------------------------- -void SvColorControl::Initialize() -{ - SetLineColor( Color( COL_BLACK ) ); -} - -// ----------------------------------------------------------------------- -void SvColorControl::CreateBitmap() -{ - const Size aSize( GetOutputSizePixel() ); - - if( mpBitmap && mpBitmap->GetSizePixel() != aSize ) - delete mpBitmap, mpBitmap = NULL; - - if( !mpBitmap ) - mpBitmap = new Bitmap( aSize, 24 ); - - BitmapWriteAccess* pWriteAccess = mpBitmap->AcquireWriteAccess(); - - if( pWriteAccess ) - { - sal_uInt16 nX = (sal_uInt16) aSize.Width(); - sal_uInt16 nY = (sal_uInt16) aSize.Height(); - - sal_uInt16 nHue, nSat; - ColorHSB aColHSB( 0, 0, mnLuminance ); - - for( sal_uInt16 i = 0; i < nY; i++ ) - { - nSat = (sal_uInt16) FRound( 100 - ( 100.0 * i + 0.5 ) / nY ); - - for( sal_uInt16 j = 0; j < nX; j++ ) - { - nHue = (sal_uInt16) FRound( ( 360.0 * j + 0.5 ) / nX ); - - aColHSB.SetHue( nHue ); - aColHSB.SetSat( nSat ); - - // mpBitmap always has a bit count of 24 => use of SetPixel(...) is safe - pWriteAccess->SetPixel( i, j, BitmapColor( aColHSB.GetRGB() ) ); - } - } - - mpBitmap->ReleaseAccess( pWriteAccess ); - } - - SetColor( maColor ); -} - -// ----------------------------------------------------------------------- -void SvColorControl::ShowPosition( const Point& rPos ) -{ - // Explizites Abfragen des Bereichs, da schon mal ein Wert < 0 vorhanden ist - if( mpBitmap ) - { - long nX = rPos.X(); - long nY = rPos.Y(); - if( nX < 0L ) - nX = 0L; - else if( nX >= mpBitmap->GetSizePixel().Width() ) - nX = mpBitmap->GetSizePixel().Width() - 1L; - - if( nY < 0L ) - nY= 0L; - else if( nY >= mpBitmap->GetSizePixel().Height() ) - nY = mpBitmap->GetSizePixel().Height() - 1L; - - Point aPos = maPosition; - maPosition.X() = nX - 2; - maPosition.Y() = nY - 2; - Invalidate( Rectangle( aPos, Size( 5, 5) ) ); - Invalidate( Rectangle( maPosition, Size( 5, 5) ) ); - - if( ( mpReadAccess = mpBitmap->AcquireReadAccess() ) != NULL ) - { - // mpBitmap always has a bit count of 24 => use of GetPixel(...) is safe - maColor = mpReadAccess->GetPixel( nY, nX ); - mpBitmap->ReleaseAccess( mpReadAccess ); - mpReadAccess = NULL; - } - } -} -// ----------------------------------------------------------------------- -void SvColorControl::MouseMove( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() ) - { - ShowPosition( rMEvt.GetPosPixel() ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void SvColorControl::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if( rMEvt.IsLeft() && !rMEvt.IsShift() ) - { - //ShowPointer( sal_False ); - CaptureMouse(); - ShowPosition( rMEvt.GetPosPixel() ); - Modify(); - } -} - -// ----------------------------------------------------------------------- -void SvColorControl::MouseButtonUp( const MouseEvent& ) -{ - //ShowPointer( sal_True ); - if( IsMouseCaptured() ) - ReleaseMouse(); -} - -// ----------------------------------------------------------------------- -void SvColorControl::Paint( const Rectangle& rRect ) -{ - if( !mpBitmap ) - CreateBitmap(); - - Bitmap aOutputBitmap( *mpBitmap ); - - if( GetBitCount() <= 8 ) - aOutputBitmap.Dither(); - - DrawBitmap( rRect.TopLeft(), rRect.GetSize(), rRect.TopLeft(), rRect.GetSize(), aOutputBitmap ); - - // Positions-Control (Fadenkreuz oder Aehnliches) - Point aPos1( maPosition ); - Point aPos2( maPosition ); - aPos2.X() += 4; - DrawLine( aPos1, aPos2 ); - aPos2.X() -= 4; - aPos2.Y() += 4; - DrawLine( aPos1, aPos2 ); - aPos1.Y() += 4; - aPos2.X() += 4; - DrawLine( aPos1, aPos2 ); - aPos1.X() += 4; - aPos2.Y() -= 4; - DrawLine( aPos1, aPos2 ); -} - -// ----------------------------------------------------------------------- -void SvColorControl::Resize() -{ - CreateBitmap(); - Control::Resize(); -} - -// ----------------------------------------------------------------------- -void SvColorControl::Modify() -{ - maModifyHdl.Call( this ); -} - -// ----------------------------------------------------------------------- -void SvColorControl::SetColor( const ColorHSB& rCol, sal_Bool bSetColor ) -{ - if( bSetColor ) - maColor = rCol.GetRGB(); - - if( mpBitmap ) - { - sal_uInt16 nX = (sal_uInt16) mpBitmap->GetSizePixel().Width(); - sal_uInt16 nY = (sal_uInt16) mpBitmap->GetSizePixel().Height(); - sal_Int16 nZ = rCol.GetBri(); - - SetLuminance( nZ ); - nX = rCol.GetHue() * nX / 360; // Farbe - nY = nY - rCol.GetSat() * nY / 100; // Saettigung - ShowPosition( Point( nX, nY ) ); - } -} - -// ----------------------------------------------------------------------- -void SvColorControl::SetColor( const Color& rCol ) -{ - maColor = rCol; - - if( mpBitmap ) - { - ColorHSB aColHsb( rCol ); - SetColor( aColHsb, sal_False ); - } -} - -// ----------------------------------------------------------------------- -void SvColorControl::SetLuminance( short nLum ) -{ - if( nLum != mnLuminance && nLum >= 0 && nLum <= 100 ) - { - mnLuminance = nLum; - - if( mnLuminance < 40 ) - SetLineColor( Color( COL_WHITE ) ); - else - SetLineColor( Color( COL_BLACK ) ); - - CreateBitmap(); - - long nX = maPosition.X() + 2; - long nY = maPosition.Y() + 2; - - if( mpBitmap && ( ( mpReadAccess = mpBitmap->AcquireReadAccess() ) != NULL ) ) - { - // mpBitmap always has a bit count of 24 => use of GetPixel(...) is safe - maColor = mpReadAccess->GetPixel( nY, nX ); - mpBitmap->ReleaseAccess( mpReadAccess ); - mpReadAccess = NULL; - } - - Invalidate(); - } -} - - -// ----------------------- -// - ColorPreviewControl - -// ----------------------- - - -// ----------------------------------------------------------------------- -ColorPreviewControl::ColorPreviewControl( Window* pParent, WinBits nStyle ) : - Control ( pParent, nStyle ) -{ - SetFillColor( maColor ); - SetLineColor( maColor ); -} - -// ----------------------------------------------------------------------- -ColorPreviewControl::ColorPreviewControl( Window* pParent, const ResId& rResId ) : - Control ( pParent, rResId ) -{ - SetFillColor( maColor ); - SetLineColor( maColor ); -} - - -// ----------------------------------------------------------------------- -ColorPreviewControl::~ColorPreviewControl() -{ -} - -// ----------------------------------------------------------------------- -void ColorPreviewControl::Paint( const Rectangle& rRect ) -{ - DrawRect( rRect ); -} - -// ----------------------------------------------------------------------- -void ColorPreviewControl::SetColor( const Color& rCol ) -{ - if( rCol != maColor ) - { - maColor = rCol; - SetFillColor( maColor ); - SetLineColor( maColor ); - Invalidate(); - } -} - - -// ----------------------- -// - ColorMixingControl - -// ----------------------- - - -// ----------------------------------------------------------------------- -ColorMixingControl::ColorMixingControl( Window* pParent, WinBits nStyle, - sal_uInt16 nRows, sal_uInt16 nColumns ) : - ValueSet ( pParent, nStyle ), - mnRows ( nRows ), - mnColumns ( nColumns ) -{ - Initialize(); -} - -// ----------------------------------------------------------------------- -ColorMixingControl::ColorMixingControl( Window* pParent, const ResId& rResId, - sal_uInt16 nRows, sal_uInt16 nColumns ) : - ValueSet ( pParent, rResId ), - mnRows ( nRows ), - mnColumns ( nColumns ) -{ - Initialize(); -} - - -// ----------------------------------------------------------------------- -ColorMixingControl::~ColorMixingControl() -{ -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::Initialize() -{ - SetColCount( mnColumns ); - - Color aColor; - String aStr; - for( sal_uInt16 i = 1; i <= mnRows * mnColumns; i++ ) - { - InsertItem( i, aColor, aStr ); - } - - /*maColor[ 0 ] = Color( COL_LIGHTRED ); - maColor[ 1 ] = Color( COL_LIGHTGREEN ); - maColor[ 2 ] = Color( COL_YELLOW ); - maColor[ 3 ] = Color( COL_LIGHTBLUE );*/ - - SetColor( CMC_TOPLEFT, Color( COL_LIGHTRED ) ); - SetColor( CMC_BOTTOMRIGHT, Color( COL_LIGHTBLUE ) ); - - SetColor( CMC_TOPRIGHT, Color( COL_LIGHTGREEN ) ); - SetColor( CMC_BOTTOMLEFT, Color( COL_YELLOW ) ); - - /*FillColumn( 0 ); - FillColumn( mnColumns - 1 ); - for( i = 0; i < mnRows; i++ ) - FillRow( i );*/ -} - -// ----------------------------------------------------------------------- -Color ColorMixingControl::CalcDifferenceColor( sal_uInt16 nCol1, sal_uInt16 nCol2, - sal_uInt16 nSteps ) -{ - // Die Berechnung ist noch etwas ungenau, daher sollte besser mit floats - // gearbeitet werden... (muss !!!) - Color aColor( GetItemColor( nCol1 ) ); - Color aColor2( GetItemColor( nCol2 ) ); - - aColor.SetRed( (sal_uInt8) ( ( aColor2.GetRed() - aColor.GetRed() ) / nSteps ) ); - aColor.SetGreen( (sal_uInt8) ( ( aColor2.GetGreen() - aColor.GetGreen() ) / nSteps ) ); - aColor.SetBlue( (sal_uInt8) ( ( aColor2.GetBlue() - aColor.GetBlue() ) / nSteps ) ); - - return( aColor ); -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::FillRow( sal_uInt16 nRow ) -{ - sal_uInt16 nCol1 = nRow * mnColumns + 1; - sal_uInt16 nCol2 = ( nRow + 1 ) * mnColumns; - Color aColor( GetItemColor( nCol1 ) ); - Color aDiffColor( CalcDifferenceColor( nCol1, nCol2, mnColumns - 1 ) ); - - for( sal_uInt16 i = nCol1 + 1; i < nCol2; i++ ) - { - aColor.SetRed( aColor.GetRed() + aDiffColor.GetRed() ); - aColor.SetGreen( aColor.GetGreen() + aDiffColor.GetGreen() ); - aColor.SetBlue( aColor.GetBlue() + aDiffColor.GetBlue() ); - - SetItemColor( i, aColor ); - SetItemText( i, GetRGBString( aColor ) ); - } -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::FillColumn( sal_uInt16 nColumn ) -{ - sal_uInt16 nCol1 = nColumn + 1; - sal_uInt16 nCol2 = nColumn + ( mnRows - 1 ) * mnColumns + 1; - Color aColor( GetItemColor( nCol1 ) ); - Color aDiffColor( CalcDifferenceColor( nCol1, nCol2, mnRows - 1 ) ); - - for( sal_uInt16 i = nCol1 + mnColumns; i < nCol2; i = i + mnColumns ) - { - aColor.SetRed( aColor.GetRed() + aDiffColor.GetRed() ); - aColor.SetGreen( aColor.GetGreen() + aDiffColor.GetGreen() ); - aColor.SetBlue( aColor.GetBlue() + aDiffColor.GetBlue() ); - - SetItemColor( i, aColor ); - SetItemText( i, GetRGBString( aColor ) ); - } -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::SetRows( sal_uInt16 nRows ) -{ - mnRows = nRows; -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::SetColumns( sal_uInt16 nColumns ) -{ - mnColumns = nColumns; -} - -// ----------------------------------------------------------------------- -void ColorMixingControl::SetColor( CMCPosition ePos, const Color& rCol ) -{ - if( rCol != maColor[ ePos ] ) - { - maColor[ ePos ] = rCol; - sal_uInt16 nPos = 0; - sal_uInt16 nColumn = 0; - String aStr( GetRGBString( rCol ) ); - - switch( ePos ) - { - case CMC_TOPLEFT: - nPos = 1; - nColumn = 0; - break; - - case CMC_TOPRIGHT: - nPos = mnColumns; - nColumn = mnColumns - 1; - break; - - case CMC_BOTTOMLEFT: - nPos = ( mnRows - 1 ) * mnColumns + 1; - nColumn = 0; - break; - - case CMC_BOTTOMRIGHT: - nPos = mnRows * mnColumns; - nColumn = mnColumns - 1; - break; - case CMC_OTHER: - break; // -Wall not handled. - } - SetItemColor( nPos, rCol ); - SetItemText( nPos, aStr ); - FillColumn( nColumn ); - - for( sal_uInt16 i = 0; i < mnRows; i++ ) - FillRow( i ); - } -} - -// ----------------------------------------------------------------------- -String ColorMixingControl::GetRGBString( const Color& rColor ) -{ - String aStr( String::CreateFromInt32(rColor.GetRed()) ); - aStr += ' '; - aStr += String::CreateFromInt32(rColor.GetGreen()); - aStr += ' '; - aStr += String::CreateFromInt32(rColor.GetBlue()); - - return aStr; -} -// ----------------------------------------------------------------------- -CMCPosition ColorMixingControl::GetCMCPosition() const -{ - CMCPosition ePos = CMC_OTHER; - sal_uInt16 nPos = GetSelectItemId(); - - if( nPos == 1 ) - ePos = CMC_TOPLEFT; - else if( nPos == mnColumns ) - ePos = CMC_TOPRIGHT; - else if( nPos == ( mnRows - 1 ) * mnColumns + 1 ) - ePos = CMC_BOTTOMLEFT; - else if( nPos == mnRows * mnColumns ) - ePos = CMC_BOTTOMRIGHT; - - return( ePos ); -} - - -// ------------ -// - ColorHSB - -// ------------ - -// Erste Ansaetze gingen auf die Berechnung von Sven Hannover zurueck -// Der jetzige Algorithmus stammt im weitesten Sinne aus dem Foley/VanDam - - -/************************************************************************** -|* -|* ColorHSB::ColorHSB() -|* -|* Beschreibung RGB nach HSB -|* Ersterstellung SOH 02.10.97 -|* -**************************************************************************/ - -ColorHSB::ColorHSB( const Color& rColor ) -{ - sal_uInt8 c[3]; - sal_uInt8 cMax, cMin; - - c[0] = rColor.GetRed(); - c[1] = rColor.GetGreen(); - c[2] = rColor.GetBlue(); - - cMax = c[0]; - if( c[1] > cMax ) - cMax = c[1]; - if( c[2] > cMax ) - cMax = c[2]; - - // Brightness = max(R, G, B); - mnBri = cMax * 100 / 255; - - cMin = c[0]; - if( c[1] < cMin ) - cMin = c[1]; - if( c[2] < cMin ) - cMin = c[2]; - - sal_uInt8 cDelta = cMax - cMin; - - // Saturation = max - min / max - if( mnBri > 0 ) - mnSat = cDelta * 100 / cMax; - else - mnSat = 0; - - if( mnSat == 0 ) - mnHue = 0; // Default = undefined - else - { - double dHue = 0; - - if( c[0] == cMax ) - { - dHue = (double)( c[1] - c[2] ) / (double)cDelta; - } - else if( c[1] == cMax ) - { - dHue = 2.0 + (double)( c[2] - c[0] ) / (double)cDelta; - } - else if ( c[2] == cMax ) - { - dHue = 4.0 + (double)( c[0] - c[1] ) / (double)cDelta; - } - // else dHue = ??? -Wall FIXME - dHue *= 60.0; - - if( dHue < 0.0 ) - dHue += 360.0; - - mnHue = (sal_uInt16) dHue; - } -} - -/************************************************************************** -|* -|* ColorHSB::GetRGB() -|* -|* Beschreibung HSB nach RGB -|* Ersterstellung SOH 02.10.97 -|* -**************************************************************************/ - -Color ColorHSB::GetRGB() const -{ - sal_uInt8 cR,cG,cB; - sal_uInt8 nB = (sal_uInt8) ( mnBri * 255 / 100 ); - - if( mnSat == 0 ) - { - cR = nB; - cG = nB; - cB = nB; - } - else - { - double dH = mnHue; - double f; - sal_uInt16 n; - if( dH == 360.0 ) - dH = 0.0; - - dH /= 60.0; - n = (sal_uInt16) dH; - f = dH - n; - - // #107375# Doing the calculation completely in floating - // point, the former optimization gave sometimes negative - // results for c and was pointless anyway - sal_uInt8 a = static_cast<sal_uInt8>( nB * ( 100.0 - mnSat ) / 100.0 ); - sal_uInt8 b = static_cast<sal_uInt8>( nB * ( 100.0 - mnSat * f ) / 100.0 ); - sal_uInt8 c = static_cast<sal_uInt8>( nB * ( 100.0 - mnSat * ( 1.0 - f ) ) / 100.0 ); - - switch( n ) - { - case 0: cR = nB; cG = c; cB = a; break; - case 1: cR = b; cG = nB; cB = a; break; - case 2: cR = a; cG = nB; cB = c; break; - case 3: cR = a; cG = b; cB = nB; break; - case 4: cR = c; cG = a; cB = nB; break; - case 5: cR = nB; cG = a; cB = b; break; - default: cR = 0; cG = 0; cB = 0; break; // -Wall ???? - } - } - - return( Color( cR, cG, cB ) ); -} - -// ------------ -// - ColorCMYK - -// ------------ - - -// ----------------------------------------------------------------------- -ColorCMYK::ColorCMYK( const Color& rColor ) -{ - mnCyan = 255 - rColor.GetRed(); - mnMagenta = 255 - rColor.GetGreen(); - mnYellow = 255 - rColor.GetBlue(); - - mnKey = Min( Min( mnCyan, mnMagenta ), mnYellow ); - - mnCyan = mnCyan - mnKey; - mnMagenta = mnMagenta - mnKey; - mnYellow = mnYellow - mnKey; -} - -// ----------------------------------------------------------------------- -Color ColorCMYK::GetRGB() const -{ - int nTmp = Max( 0, 255 - ( mnCyan + mnKey ) ); - sal_uInt8 cR = (sal_uInt8) nTmp; - nTmp = Max( 0, 255 - ( mnMagenta + mnKey ) ); - sal_uInt8 cG = (sal_uInt8) nTmp; - nTmp = Max( 0, 255 - ( mnYellow + mnKey ) ); - sal_uInt8 cB = (sal_uInt8) nTmp; - - return( Color( cR, cG, cB ) ); -} - - diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx index fa494b05b2ab..9ca825e9aab4 100644 --- a/svtools/source/dialogs/colrdlg.cxx +++ b/svtools/source/dialogs/colrdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,302 +28,106 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifndef GCC -#endif -#include <svtools/svtdata.hxx> -#include "colrdlg.hrc" -#include <svtools/colrdlg.hxx> - -// --------------- -// - ColorDialog - -// --------------- +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> -SvColorDialog::SvColorDialog( Window* pWindow ) : - ModalDialog ( pWindow, SvtResId( DLG_COLOR ) ), - maColMixCtrl ( this, SvtResId( VAL_SET_COLOR ), 8, 8 ), - maBtn1 ( this, SvtResId( BTN_1 ) ), - maBtn2 ( this, SvtResId( BTN_2 ) ), - //maBtn3 ( this, SvtResId( BTN_3 ) ), - //maBtn4 ( this, SvtResId( BTN_4 ) ), - //maFtRGB ( this, SvtResId( FT_RGB ) ), - maCtlColor ( this, SvtResId( CTL_COLOR ) ), +#include <comphelper/processfactory.hxx> - maFtCyan ( this, SvtResId( FT_CYAN ) ), - maNumCyan ( this, SvtResId( NUM_CYAN ) ), - maFtMagenta ( this, SvtResId( FT_MAGENTA ) ), - maNumMagenta ( this, SvtResId( NUM_MAGENTA ) ), - maFtYellow ( this, SvtResId( FT_YELLOW ) ), - maNumYellow ( this, SvtResId( NUM_YELLOW ) ), - maFtKey ( this, SvtResId( FT_KEY ) ), - maNumKey ( this, SvtResId( NUM_KEY ) ), +#include <toolkit/helper/vclunohelper.hxx> - maFtRed ( this, SvtResId( FT_RED ) ), - maNumRed ( this, SvtResId( NUM_RED ) ), - maFtGreen ( this, SvtResId( FT_GREEN ) ), - maNumGreen ( this, SvtResId( NUM_GREEN ) ), - maFtBlue ( this, SvtResId( FT_BLUE ) ), - maNumBlue ( this, SvtResId( NUM_BLUE ) ), +#include <svtools/colrdlg.hxx> - maFtHue ( this, SvtResId( FT_HUE ) ), - maNumHue ( this, SvtResId( NUM_HUE ) ), - maFtSaturation ( this, SvtResId( FT_SATURATION ) ), - maNumSaturation ( this, SvtResId( NUM_SATURATION ) ), - maFtLuminance ( this, SvtResId( FT_LUMINANCE ) ), - maNumLuminance ( this, SvtResId( NUM_LUMINANCE ) ), +using rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::ui::dialogs; - maCtlPreview ( this, SvtResId( CTL_PREVIEW ) ), - maCtlPreviewOld ( this, SvtResId( CTL_PREVIEW_OLD ) ), +// --------------- +// - ColorDialog - +// --------------- - maBtnOK ( this, SvtResId( BTN_OK ) ), - maBtnCancel ( this, SvtResId( BTN_CANCEL ) ), - maBtnHelp ( this, SvtResId( BTN_HELP ) ) +SvColorDialog::SvColorDialog( Window* pWindow ) +: mpParent( pWindow ) +, meMode( svtools::ColorPickerMode_SELECT ) { - FreeResource(); - - maColMixCtrl.SetDoubleClickHdl( LINK( this, SvColorDialog, ClickMixCtrlHdl ) ); - maColMixCtrl.SetSelectHdl( LINK( this, SvColorDialog, SelectMixCtrlHdl ) ); - - Link aLink( LINK( this, SvColorDialog, ColorModifyHdl ) ); - maCtlColor.SetModifyHdl( aLink ); - - maNumRed.SetModifyHdl( aLink ); - maNumGreen.SetModifyHdl( aLink ); - maNumBlue.SetModifyHdl( aLink ); - - maNumCyan.SetModifyHdl( aLink ); - maNumMagenta.SetModifyHdl( aLink ); - maNumYellow.SetModifyHdl( aLink ); - maNumKey.SetModifyHdl( aLink ); - - maNumHue.SetModifyHdl( aLink ); - maNumSaturation.SetModifyHdl( aLink ); - maNumLuminance.SetModifyHdl( aLink ); - - aLink = ( LINK( this, SvColorDialog, ClickBtnHdl ) ); - maBtn1.SetClickHdl( aLink ); - maBtn2.SetClickHdl( aLink ); - //maBtn3.SetClickHdl( aLink ); - //maBtn4.SetClickHdl( aLink ); - - maColMixCtrl.SetExtraSpacing( 0 ); } - // ----------------------------------------------------------------------- -SvColorDialog::~SvColorDialog() -{ -} -// ----------------------------------------------------------------------- -void SvColorDialog::Initialize() -{ - maNumRed.SetValue( maColor.GetRed() ); - maNumGreen.SetValue( maColor.GetGreen() ); - maNumBlue.SetValue( maColor.GetBlue() ); - - ColorCMYK aColorCMYK( maColor ); - - long aCyan = (long) ( (double)aColorCMYK.GetCyan() * 100.0 / 255.0 + 0.5 ); - long aMagenta = (long) ( (double)aColorCMYK.GetMagenta() * 100.0 / 255.0 + 0.5 ); - long aYellow = (long) ( (double)aColorCMYK.GetYellow() * 100.0 / 255.0 + 0.5 ); - long aKey = (long) ( (double)aColorCMYK.GetKey() * 100.0 / 255.0 + 0.5 ); - maNumCyan.SetValue( aCyan ); - maNumMagenta.SetValue( aMagenta ); - maNumYellow.SetValue( aYellow ); - maNumKey.SetValue( aKey ); - - ColorHSB aColorHSB( maColor ); - maNumHue.SetValue( aColorHSB.GetHue() ); - maNumSaturation.SetValue( aColorHSB.GetSat() ); - maNumLuminance.SetValue( aColorHSB.GetBri() ); - - maCtlColor.SetColor( aColorHSB ); - - maColMixCtrl.SelectItem( 1 ); - - maCtlPreview.SetColor( maColor ); - maCtlPreviewOld.SetColor( maColor ); -} - -// ----------------------------------------------------------------------- void SvColorDialog::SetColor( const Color& rColor ) { maColor = rColor; } // ----------------------------------------------------------------------- + const Color& SvColorDialog::GetColor() const { - return( maColor ); + return maColor; } // ----------------------------------------------------------------------- -IMPL_LINK( SvColorDialog, ColorModifyHdl, void *, p ) -{ - sal_uInt16 n = 0x00; // 1 == RGB, 2 == CMYK, 4 == HSB - - if( p == &maCtlColor ) - { - maColor = maCtlColor.GetColor(); - maNumRed.SetValue( maColor.GetRed() ); - maNumGreen.SetValue( maColor.GetGreen() ); - maNumBlue.SetValue( maColor.GetBlue() ); - n = 7; - } - else if( p == &maNumRed ) - { - maColor.SetRed( (sal_uInt8)maNumRed.GetValue() ); - maCtlColor.SetColor( maColor ); - n = 6; - } - else if( p == &maNumGreen ) - { - maColor.SetGreen( (sal_uInt8)maNumGreen.GetValue() ); - maCtlColor.SetColor( maColor ); - n = 6; - } - else if( p == &maNumBlue ) - { - maColor.SetBlue( (sal_uInt8)maNumBlue.GetValue() ); - maCtlColor.SetColor( maColor ); - n = 6; - } - else if( p == &maNumHue || - p == &maNumSaturation || - p == &maNumLuminance ) - { - - ColorHSB aColorHSB( (sal_uInt16) maNumHue.GetValue(), - (sal_uInt16) maNumSaturation.GetValue(), - (sal_uInt16) maNumLuminance.GetValue() ); - maCtlColor.SetColor( aColorHSB ); - maColor = maCtlColor.GetColor(); - n = 3; - } - else if( p == &maNumCyan || - p == &maNumMagenta || - p == &maNumYellow || - p == &maNumKey ) - { - long aCyan = (long) ( (double)maNumCyan.GetValue() * 255.0 / 100.0 + 0.5 ); - long aMagenta = (long) ( (double)maNumMagenta.GetValue() * 255.0 / 100.0 + 0.5 ); - long aYellow = (long) ( (double)maNumYellow.GetValue() * 255.0 / 100.0 + 0.5 ); - long aKey = (long) ( (double)maNumKey.GetValue() * 255.0 / 100.0 + 0.5 ); - - ColorCMYK aColorCMYK( (sal_uInt16) aCyan, - (sal_uInt16) aMagenta, - (sal_uInt16) aYellow, - (sal_uInt16) aKey ); - maColor = aColorCMYK.GetRGB(); - maCtlColor.SetColor( maColor ); - n = 5; - } - - if( n & 1 ) // RGB setzen - { - maNumRed.SetValue( maColor.GetRed() ); - maNumGreen.SetValue( maColor.GetGreen() ); - maNumBlue.SetValue( maColor.GetBlue() ); - } - if( n & 2 ) // CMYK setzen - { - ColorCMYK aColorCMYK( maColor ); - long aCyan = (long) ( (double)aColorCMYK.GetCyan() * 100.0 / 255.0 + 0.5 ); - long aMagenta = (long) ( (double)aColorCMYK.GetMagenta() * 100.0 / 255.0 + 0.5 ); - long aYellow = (long) ( (double)aColorCMYK.GetYellow() * 100.0 / 255.0 + 0.5 ); - long aKey = (long) ( (double)aColorCMYK.GetKey() * 100.0 / 255.0 + 0.5 ); - maNumCyan.SetValue( aCyan ); - maNumMagenta.SetValue( aMagenta ); - maNumYellow.SetValue( aYellow ); - maNumKey.SetValue( aKey ); - } - if( n & 4 ) // HSB setzen - { - ColorHSB aColorHSB( maColor ); - maNumHue.SetValue( aColorHSB.GetHue() ); - maNumSaturation.SetValue( aColorHSB.GetSat() ); - maNumLuminance.SetValue( aColorHSB.GetBri() ); - } - - maCtlPreview.SetColor( maColor ); - - return 0; +void SvColorDialog::SetMode( sal_Int16 eMode ) +{ + meMode = eMode; } // ----------------------------------------------------------------------- -IMPL_LINK( SvColorDialog, ClickBtnHdl, void *, p ) -{ - /* - Color aColor = maCtlColor.GetColor(); - if( p == &maBtn1 ) - maColMixCtrl.SetColor( CMC_TOPLEFT, aColor ); - if( p == &maBtn2 ) - maColMixCtrl.SetColor( CMC_TOPRIGHT, aColor ); - if( p == &maBtn3 ) - maColMixCtrl.SetColor( CMC_BOTTOMLEFT, aColor ); - if( p == &maBtn4 ) - maColMixCtrl.SetColor( CMC_BOTTOMRIGHT, aColor ); - */ - if( p == &maBtn1 ) - { - CMCPosition ePos = maColMixCtrl.GetCMCPosition(); - if( ePos != CMC_OTHER ) - maColMixCtrl.SetColor( ePos, maColor ); - } - else if( p == &maBtn2 ) +short SvColorDialog::Execute() +{ + short ret = 0; + try { - sal_uInt16 nPos = maColMixCtrl.GetSelectItemId(); - maColor = maColMixCtrl.GetItemColor( nPos ); - maCtlColor.SetColor( maColor ); - ColorModifyHdl( &maCtlColor ); + const OUString sColor( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ); + Reference< XMultiServiceFactory > xSMGR( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + + Reference< com::sun::star::awt::XWindow > xParent( VCLUnoHelper::GetInterface( mpParent ) ); + + Sequence< Any > args(1); + args[0] = Any( xParent ); + + Reference< XExecutableDialog > xDialog( xSMGR->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.cui.ColorPicker")), args), UNO_QUERY_THROW ); + Reference< XPropertyAccess > xPropertyAccess( xDialog, UNO_QUERY_THROW ); + + Sequence< PropertyValue > props( 2 ); + props[0].Name = sColor; + props[0].Value <<= (sal_Int32) maColor.GetColor(); + props[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Mode" ) ); + props[1].Value <<= (sal_Int16) meMode; + + xPropertyAccess->setPropertyValues( props ); + + ret = xDialog->execute(); + + if( ret ) + { + props = xPropertyAccess->getPropertyValues(); + for( sal_Int32 n = 0; n < props.getLength(); n++ ) + { + if( props[n].Name.equals( sColor ) ) + { + sal_Int32 nColor = 0; + if( props[n].Value >>= nColor ) + { + maColor.SetColor( nColor ); + } + + } + } + } } - - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( SvColorDialog, ClickMixCtrlHdl, void *, EMPTYARG ) -{ - sal_uInt16 nPos = maColMixCtrl.GetSelectItemId(); - CMCPosition ePos = maColMixCtrl.GetCMCPosition(); - - if( ePos != CMC_OTHER ) - maColMixCtrl.SetColor( ePos, maColor ); - else + catch(Exception&) { - maColor = maColMixCtrl.GetItemColor( nPos ); - maCtlColor.SetColor( maColor ); - ColorModifyHdl( &maCtlColor ); + OSL_ASSERT(false); } - return 0; -} - -// ----------------------------------------------------------------------- -IMPL_LINK( SvColorDialog, SelectMixCtrlHdl, void *, EMPTYARG ) -{ - //sal_uInt16 nPos = maColMixCtrl.GetSelectItemId(); - //maFtRGB.SetText( maColMixCtrl.GetItemText( nPos ) ); - - CMCPosition ePos = maColMixCtrl.GetCMCPosition(); - if( ePos == CMC_OTHER ) - maBtn1.Enable( sal_False ); - else - maBtn1.Enable(); - - return 0; -} - -// ----------------------------------------------------------------------- -short SvColorDialog::Execute() -{ - Initialize(); - - short nRet = ModalDialog::Execute(); - - return( nRet ); + return ret; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/colrdlg.hrc b/svtools/source/dialogs/colrdlg.hrc deleted file mode 100644 index b1e785bd2f17..000000000000 --- a/svtools/source/dialogs/colrdlg.hrc +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define DLG_COLOR 996 - -#define VAL_SET_COLOR 2 -#define BTN_1 1 -#define BTN_2 2 -#define BTN_3 3 -#define BTN_4 4 -#define FT_RGB 12 - -#define CTL_COLOR 1 - -#define FT_RED 1 -#define NUM_RED 1 -#define FT_GREEN 2 -#define NUM_GREEN 2 -#define FT_BLUE 3 -#define NUM_BLUE 3 - -#define FT_CYAN 7 -#define NUM_CYAN 7 -#define FT_MAGENTA 8 -#define NUM_MAGENTA 8 -#define FT_YELLOW 9 -#define NUM_YELLOW 9 -#define FT_KEY 10 -#define NUM_KEY 10 - -#define FT_HUE 4 -#define NUM_HUE 4 -#define FT_SATURATION 5 -#define NUM_SATURATION 5 -#define FT_LUMINANCE 6 -#define NUM_LUMINANCE 6 - -#define CTL_PREVIEW 3 -#define CTL_PREVIEW_OLD 4 - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 - -//IAccessibility2 Implementation 2009----- -#define STR_COLORDES 3001 diff --git a/svtools/source/dialogs/colrdlg.src b/svtools/source/dialogs/colrdlg.src deleted file mode 100644 index fee6314b28cc..000000000000 --- a/svtools/source/dialogs/colrdlg.src +++ /dev/null @@ -1,295 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "colrdlg.hrc" -#define DIFF 3 -ModalDialog DLG_COLOR -{ - HelpID = "svtools:ModalDialog:DLG_COLOR"; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 260 , 165 + DIFF ) ; - Moveable = TRUE ; - Text [ en-US ] = "Color" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 205 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 205 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 205 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Control VAL_SET_COLOR - { - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 91 , 100 ) ; - TabStop = TRUE ; - }; - Control CTL_COLOR - { - Border = TRUE ; - Pos = MAP_APPFONT ( 100 , 6 ) ; - Size = MAP_APPFONT ( 100 , 100 ) ; - TabStop = TRUE ; - }; - FixedText FT_CYAN - { - Pos = MAP_APPFONT ( 6 , 110 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Cyan" ; - }; - FixedText FT_MAGENTA - { - Pos = MAP_APPFONT ( 6 , 123 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Magenta" ; - }; - FixedText FT_YELLOW - { - Pos = MAP_APPFONT ( 6 , 136 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Yellow" ; - }; - FixedText FT_KEY - { - Pos = MAP_APPFONT ( 6 , 149 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Key" ; - }; - MetricField NUM_CYAN - { - HelpID = "svtools:MetricField:DLG_COLOR:NUM_CYAN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 109 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - MetricField NUM_MAGENTA - { - HelpID = "svtools:MetricField:DLG_COLOR:NUM_MAGENTA"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 122 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - MetricField NUM_YELLOW - { - HelpID = "svtools:MetricField:DLG_COLOR:NUM_YELLOW"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 135 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - MetricField NUM_KEY - { - HelpID = "svtools:MetricField:DLG_COLOR:NUM_KEY"; - Border = TRUE ; - Pos = MAP_APPFONT ( 42 , 148 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - Unit = FUNIT_CUSTOM ; - CustomUnitText = " %" ; - }; - FixedText FT_RED - { - Pos = MAP_APPFONT ( 72 , 123 + DIFF ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "~Red" ; - }; - FixedText FT_GREEN - { - Pos = MAP_APPFONT ( 72 , 136 + DIFF ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "~Green" ; - }; - FixedText FT_BLUE - { - Pos = MAP_APPFONT ( 72 , 149 + DIFF ) ; - Size = MAP_APPFONT ( 33 , 10 ) ; - Text [ en-US ] = "~Blue" ; - }; - NumericField NUM_RED - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_RED"; - Border = TRUE ; - Pos = MAP_APPFONT ( 106 , 122 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - NumericField NUM_GREEN - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_GREEN"; - Border = TRUE ; - Pos = MAP_APPFONT ( 106 , 135 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - NumericField NUM_BLUE - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_BLUE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 106 , 148 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 255 ; - Last = 255 ; - }; - FixedText FT_HUE - { - Pos = MAP_APPFONT ( 135 , 123 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "H~ue" ; - }; - NumericField NUM_HUE - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_HUE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 171 , 122 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 359 ; - Last = 359 ; - }; - FixedText FT_SATURATION - { - Pos = MAP_APPFONT ( 135 , 136 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "~Saturation" ; - }; - NumericField NUM_SATURATION - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_SATURATION"; - Border = TRUE ; - Pos = MAP_APPFONT ( 171 , 135 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - }; - FixedText FT_LUMINANCE - { - Pos = MAP_APPFONT ( 135 , 149 + DIFF ) ; - Size = MAP_APPFONT ( 34 , 10 ) ; - Text [ en-US ] = "Bright~ness" ; - }; - NumericField NUM_LUMINANCE - { - HelpID = "svtools:NumericField:DLG_COLOR:NUM_LUMINANCE"; - Border = TRUE ; - Pos = MAP_APPFONT ( 171 , 148 + DIFF ) ; - Size = MAP_APPFONT ( 26 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Maximum = 100 ; - Last = 100 ; - }; - PushButton BTN_1 - { - HelpID = "svtools:PushButton:DLG_COLOR:BTN_1"; - Pos = MAP_APPFONT ( 80 , 109 ) ; - Size = MAP_APPFONT ( 17 , 12 ) ; - Text = "~<--" ; - TabStop = TRUE ; - }; - PushButton BTN_2 - { - HelpID = "svtools:PushButton:DLG_COLOR:BTN_2"; - Pos = MAP_APPFONT ( 100 , 109 ) ; - Size = MAP_APPFONT ( 17 , 12 ) ; - Text = "--~>" ; - TabStop = TRUE ; - }; - Control CTL_PREVIEW_OLD - { - Border = TRUE ; - Pos = MAP_APPFONT ( 200 , 109 ) ; - Size = MAP_APPFONT ( 26 , 51 + DIFF ) ; - TabStop = FALSE ; - }; - Control CTL_PREVIEW - { - Border = TRUE ; - Pos = MAP_APPFONT ( 229 , 109 ) ; - Size = MAP_APPFONT ( 26 , 51 + DIFF ) ; - TabStop = FALSE ; - }; -}; - -String STR_COLORDES -{ - Text [ en-US ] = "RGB(%1, %2, %3) Hue:%4 Saturation:%5 Brightness:%6"; -}; - diff --git a/svtools/source/dialogs/filedlg.cxx b/svtools/source/dialogs/filedlg.cxx index d0f86867686a..e1a7548ba170 100644 --- a/svtools/source/dialogs/filedlg.cxx +++ b/svtools/source/dialogs/filedlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -146,3 +147,5 @@ void FileDialog::SetCancelButtonText( const UniString& rText ) { pImpFileDlg->SetCancelButtonText( rText ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx index 6e6fd4fd2e84..e7bf845a03ea 100644 --- a/svtools/source/dialogs/filedlg2.cxx +++ b/svtools/source/dialogs/filedlg2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,8 +38,8 @@ #include <svtools/filedlg.hxx> #include <svtools/filedlg2.hrc> #include <vcl/msgbox.hxx> -#include <vos/security.hxx> -#include <com/sun/star/i18n/XCollator.hpp> +#include <osl/security.hxx> +#include <comphelper/string.hxx> #include <svtools/stdctrl.hxx> @@ -51,8 +52,7 @@ using namespace com::sun::star; using namespace com::sun::star::uno; - -DECLARE_LIST( UniStringList, UniString* ) +typedef ::std::vector< UniString* > UniStringList; #define STD_BTN_WIDTH 80 #define STD_BTN_HEIGHT 26 @@ -130,12 +130,6 @@ ImpPathDialog::ImpPathDialog( PathDialog* pDlg, RESOURCE_TYPE nType, sal_Bool bC } pDlg->SetHelpId( HID_FILEDLG_PATHDLG ); - - lang::Locale aLocale = Application::GetSettings().GetLocale(); - xCollator = ::vcl::unohelper::CreateCollator(); - if( xCollator.is() ) - xCollator->loadDefaultCollator( aLocale, 1 ); - DBG_ASSERT( xCollator.is(), "not collator service for path dialog" ); } ImpPathDialog::~ImpPathDialog() @@ -150,7 +144,7 @@ ImpPathDialog::~ImpPathDialog() delete pOkBtn; delete pCancelBtn; delete pNewDirBtn; -# if defined(UNX) || defined(OS2) +# if defined(UNX) delete pHomeBtn; # endif } @@ -213,7 +207,7 @@ void ImpPathDialog::InitControls() nTextWidth = pDlg->GetTextWidth( aNewDirStr )+nExtraWidth; if( nTextWidth > aBtnSiz.Width() ) aBtnSiz.Width() = nTextWidth; -#if defined(UNX) || defined(OS2) +#if defined(UNX) String aHomeDirStr( SvtResId( STR_FILEDLG_HOME ) ); nTextWidth = pDlg->GetTextWidth( aHomeDirStr )+nExtraWidth; if( nTextWidth > aBtnSiz.Width() ) @@ -230,7 +224,7 @@ void ImpPathDialog::InitControls() aPnt.Y() += aBtnSiz.Height() + a3Siz.Height(); INITCONTROL( pNewDirBtn, PushButton, WB_DEFBUTTON, aPnt, aBtnSiz, aNewDirStr, HID_FILEDLG_NEWDIR ); -#if defined(UNX) || defined(OS2) +#if defined(UNX) aPnt.Y() += aBtnSiz.Height() + a3Siz.Height(); INITCONTROL( pHomeBtn, PushButton, WB_DEFBUTTON, aPnt, aBtnSiz, aHomeDirStr, HID_FILEDLG_HOME ); @@ -344,7 +338,7 @@ IMPL_LINK( ImpPathDialog, ClickHdl, Button*, pBtn ) if ( pBtn == pHomeBtn ) { ::rtl::OUString aHomeDir; - vos:: OSecurity aSecurity; + osl::Security aSecurity; if ( aSecurity.getHomeDir( aHomeDir ) ) { DirEntry aFile ( aHomeDir ); @@ -453,6 +447,8 @@ void ImpPathDialog::UpdateEntries( const sal_Bool ) if( nEntries ) { UniStringList aSortDirList; + const comphelper::string::NaturalStringSorter& rSorter = + ::vcl::unohelper::getNaturalStringSorterForAppLocale(); for ( sal_uInt16 n = 0; n < nEntries; n++ ) { DirEntry& rEntry = aDir[n]; @@ -461,24 +457,27 @@ void ImpPathDialog::UpdateEntries( const sal_Bool ) { if( FileStat( rEntry ).GetKind() & FSYS_KIND_DIR ) { - sal_uLong l = 0; - if( xCollator.is() ) - { - for( l = 0; l < aSortDirList.Count(); l++ ) - if( xCollator->compareString( *aSortDirList.GetObject(l), aName ) > 0 ) - break; + size_t l = 0; + for( l = 0; l < aSortDirList.size(); l++ ) + if( rSorter.compare( *aSortDirList[ l ], aName ) > 0 ) + break; + if ( l < aSortDirList.size() ) { + UniStringList::iterator it = aSortDirList.begin(); + ::std::advance( it, l ); + aSortDirList.insert( it, new UniString( aName ) ); + } else { + aSortDirList.push_back( new UniString( aName ) ); } - aSortDirList.Insert( new UniString( aName ), l ); } } } - for( sal_uLong l = 0; l < aSortDirList.Count(); l++ ) + for( size_t l = 0; l < aSortDirList.size(); l++ ) { UniString aEntryStr( aTabString ); - aEntryStr += *aSortDirList.GetObject(l); + aEntryStr += *aSortDirList[ l ]; pDirList->InsertEntry( aEntryStr ); - delete aSortDirList.GetObject(l); + delete aSortDirList[ l ]; } } @@ -717,12 +716,10 @@ ImpFileDialog::ImpFileDialog( PathDialog* pDlg, WinBits nWinBits, RESOURCE_TYPE ImpFileDialog::~ImpFileDialog() { - ImpFilterItem* pItem = aFilterList.First(); - while( pItem ) - { - delete pItem; - pItem = aFilterList.Next(); + for ( size_t i = 0, n = aFilterList.size(); i < n; ++i ) { + delete aFilterList[ i ]; } + aFilterList.clear(); delete pFileTitel; if (pFileList && ( pFileList != pDirList ) ) @@ -905,16 +902,13 @@ IMPL_LINK( ImpFileDialog, DblClickHdl, ListBox *, pBox ) if( pBox == pTypeList ) { // Neue Maske setzen, und Listboxen updaten - sal_uInt16 nCurPos = pTypeList->GetSelectEntryPos(); - if( nCurPos+1 > (sal_uInt16)aFilterList.Count() ) + size_t nCurPos = pTypeList->GetSelectEntryPos(); + if( nCurPos+1 > aFilterList.size() ) aMask = UniString::CreateFromAscii( ALLFILES ); else { - UniString aFilterListMask = aFilterList.GetObject( nCurPos )->aMask; -// if( aFilterListMask.Search( ';' ) == STRING_NOTFOUND ) // kein ; in der Maske -// aMask = WildCard( aFilterListMask, '\0' ); -// else // ; muss beruecksichtigt werden - aMask = WildCard( aFilterListMask, ';' ); + UniString aFilterListMask = aFilterList[ nCurPos ]->aMask; + aMask = WildCard( aFilterListMask, ';' ); } pEdit->SetText( aMask() ); @@ -1015,7 +1009,9 @@ void ImpFileDialog::UpdateEntries( const sal_Bool bWithDirs ) WildCard aTmpMask( aWildCard, ';' ); if ( nEntries ) { - UniStringList aSortDirList; + UniStringList aSortDirList; + const comphelper::string::NaturalStringSorter& rSorter = + ::vcl::unohelper::getNaturalStringSorterForAppLocale(); for ( sal_uInt16 n = 0; n < nEntries; n++ ) { DirEntry& rEntry = aDir[n]; @@ -1045,25 +1041,28 @@ void ImpFileDialog::UpdateEntries( const sal_Bool bWithDirs ) } else { - sal_uLong l = 0; - if( xCollator.is() ) - { - for( l = 0; l < aSortDirList.Count(); l++ ) - if( xCollator->compareString( *aSortDirList.GetObject(l), aName ) > 0 ) - break; + size_t l = 0; + for( l = 0; l < aSortDirList.size(); l++ ) + if( rSorter.compare( *aSortDirList[ l ], aName ) > 0 ) + break; + if ( l < aSortDirList.size() ) { + UniStringList::iterator it = aSortDirList.begin(); + ::std::advance( it, l ); + aSortDirList.insert( it, new UniString( aName ) ); + } else { + aSortDirList.push_back( new UniString( aName ) ); } - aSortDirList.Insert( new UniString( aName ), l ); + } + } } } - } - } - for( sal_uLong l = 0; l < aSortDirList.Count(); l++ ) + for( size_t l = 0; l < aSortDirList.size(); l++ ) { UniString aEntryStr( aTabString ); - aEntryStr += *aSortDirList.GetObject(l); - pDirList->InsertEntry( aEntryStr ); - delete aSortDirList.GetObject(l); - } + aEntryStr += *aSortDirList[ l ]; + pDirList->InsertEntry( aEntryStr ); + delete aSortDirList[ l ]; + } } if( bWithDirs ) @@ -1177,7 +1176,7 @@ void ImpFileDialog::SetPath( Edit const& rEdit ) void ImpFileDialog::AddFilter( const UniString& rFilter, const UniString& rMask ) { - aFilterList.Insert( new ImpFilterItem( rFilter, rMask ), LIST_APPEND ); + aFilterList.push_back( new ImpFilterItem( rFilter, rMask ) ); if( pTypeList ) pTypeList->InsertEntry( rFilter, LISTBOX_APPEND ); @@ -1187,27 +1186,24 @@ void ImpFileDialog::AddFilter( const UniString& rFilter, const UniString& rMask void ImpFileDialog::RemoveFilter( const UniString& rFilter ) { - ImpFilterItem* pItem = aFilterList.First(); - while( pItem && pItem->aName != rFilter ) - pItem = aFilterList.Next(); - - if( pItem ) - { - delete aFilterList.Remove(); - if( pTypeList ) - pTypeList->RemoveEntry( rFilter ); + for ( ImpFilterList::iterator it = aFilterList.begin(); it < aFilterList.end(); ++it ) { + if ( (*it)->aName == rFilter ) { + delete *it; + aFilterList.erase( it ); + if ( pTypeList ) { + pTypeList->RemoveEntry( rFilter ); + } + break; + } } } void ImpFileDialog::RemoveAllFilter() { - ImpFilterItem* pItem = aFilterList.First(); - while( pItem ) - { - delete pItem; - pItem = aFilterList.Next(); + for ( size_t i = 0, n = aFilterList.size(); i < n ; ++i ) { + delete aFilterList[ i ]; } - aFilterList.Clear(); + aFilterList.clear(); if( pTypeList ) pTypeList->Clear(); @@ -1218,14 +1214,14 @@ void ImpFileDialog::SetCurFilter( const UniString& rFilter ) if( !pTypeList ) return; - ImpFilterItem* pItem = aFilterList.First(); - while( pItem && pItem->aName != rFilter ) - pItem = aFilterList.Next(); + for ( size_t i = 0, n = aFilterList.size(); i < n; ++i ) { + if ( aFilterList[ i ]->aName == rFilter ) { + pTypeList->SelectEntryPos( sal_uInt16( i ) ); + return; + } + } - if( pItem ) - pTypeList->SelectEntryPos( (sal_uInt16)aFilterList.GetCurPos() ); - else - pTypeList->SetNoSelection(); + pTypeList->SetNoSelection(); } UniString ImpFileDialog::GetCurFilter() const @@ -1255,9 +1251,9 @@ void ImpFileDialog::PreExecute() if( pTypeList ) { sal_uInt16 nCurType = pTypeList->GetSelectEntryPos(); - if( nCurType < aFilterList.Count() ) + if( nCurType < aFilterList.size() ) { - UniString aFilterListMask = aFilterList.GetObject( nCurType )->aMask; + UniString aFilterListMask = aFilterList[ nCurType ]->aMask; if( aFilterListMask.Search( ';' ) == STRING_NOTFOUND ) // kein ; in der Maske aMask = WildCard( aFilterListMask, '\0' ); else // ; in der Maske, muss in der Wildcard beruecksichtigt werden @@ -1357,3 +1353,4 @@ void ImpSvFileDlg::CreateDialog( PathDialog* pSvDlg, WinBits nStyle, RESOURCE_TY } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/filedlg2.hxx b/svtools/source/dialogs/filedlg2.hxx index 36214db27d33..e65bebe6f155 100644 --- a/svtools/source/dialogs/filedlg2.hxx +++ b/svtools/source/dialogs/filedlg2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,10 +31,9 @@ #include <tools/debug.hxx> #include <tools/fsys.hxx> -#ifndef _SV_BUTTON_HXX //autogen wg. PushButton #include <vcl/button.hxx> -#endif #include <vcl/unohelp.hxx> +#include <vector> class FixedText; class Edit; @@ -57,7 +57,7 @@ struct ImpFilterItem } }; -DECLARE_LIST( ImpFilterList, ImpFilterItem* ) +typedef ::std::vector< ImpFilterItem* > ImpFilterList; #include <vcl/lstbox.hxx> class KbdListBox : public ListBox @@ -96,10 +96,6 @@ private: DirEntry aPath; // aktuell angewaehlter Pfad sal_uInt16 nDirCount; // Anzahl der Verzeichnis- // Verschachtelungen - - ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > - xCollator; - protected: virtual void UpdateEntries( const sal_Bool bWithDirs ); @@ -168,9 +164,9 @@ public: void SetCurFilter( const String& rFilter ); String GetCurFilter() const; - sal_uInt16 GetFilterCount() const { return (sal_uInt16)aFilterList.Count(); } - inline String GetFilterName( sal_uInt16 nPos ) const; - inline String GetFilterType( sal_uInt16 nPos ) const; + size_t GetFilterCount() const { return aFilterList.size(); } + inline String GetFilterName( size_t nPos ) const; + inline String GetFilterType( size_t nPos ) const; virtual void SetPath( const String& rPath ); virtual void SetPath( const Edit& rEdit ); @@ -181,21 +177,21 @@ public: FileDialog* GetFileDialog() const { return (FileDialog*)GetPathDialog(); } }; -inline String ImpFileDialog::GetFilterName( sal_uInt16 nPos ) const +inline String ImpFileDialog::GetFilterName( size_t nPos ) const { String aName; - ImpFilterItem* pItem = aFilterList.GetObject( nPos ); - if ( pItem ) - aName = pItem->aName; + if ( nPos < aFilterList.size() ) { + aName = aFilterList[ nPos ]->aName; + } return aName; } -inline String ImpFileDialog::GetFilterType( sal_uInt16 nPos ) const +inline String ImpFileDialog::GetFilterType( size_t nPos ) const { String aFilterMask; - ImpFilterItem* pItem = aFilterList.GetObject( nPos ); - if ( pItem ) - aFilterMask = pItem->aMask; + if ( nPos < aFilterList.size() ) { + aFilterMask = aFilterList[ nPos ]->aMask; + } return aFilterMask; } @@ -217,3 +213,5 @@ public: }; #endif // _FILEDLG2_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/filedlg2.src b/svtools/source/dialogs/filedlg2.src index acef462c04cb..629d4699b309 100644 --- a/svtools/source/dialogs/filedlg2.src +++ b/svtools/source/dialogs/filedlg2.src @@ -87,41 +87,3 @@ String STR_FILEDLG_ASKNEWDIR { Text [ en-US ] = "Do you want the directory %s to be created ?" ; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/dialogs/formats.src b/svtools/source/dialogs/formats.src index d91700afac8f..3ab9488fbbc5 100644 --- a/svtools/source/dialogs/formats.src +++ b/svtools/source/dialogs/formats.src @@ -189,7 +189,7 @@ String STR_FORMAT_ID_BIFF_5 }; String STR_FORMAT_ID_BIFF_8 { - Text [ en-US ] = "Biff8 (Microsoft Excel 97/2000/XP)"; + Text [ en-US ] = "Biff8 (Microsoft Excel 97/2000/XP/2003)"; }; String STR_FORMAT_ID_SYLK { @@ -291,4 +291,3 @@ String STR_FORMAT_ID_HTML_NO_COMMENT { Text [ en-US ] = "HTML format without comments"; }; - diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index 605f9ed5db07..7d6bcb9187cf 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,6 +41,7 @@ #include <unotools/configmgr.hxx> #include <sot/clsids.hxx> #include <sot/stg.hxx> +#include <sal/macros.h> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -68,7 +70,6 @@ struct OleObjectDescriptor /********************** SvObjectServerList ******************************** **************************************************************************/ -PRV_SV_IMPL_OWNER_LIST( SvObjectServerList, SvObjectServer ) /************************************************************************* |* SvObjectServerList::SvObjectServerList() @@ -77,10 +78,10 @@ PRV_SV_IMPL_OWNER_LIST( SvObjectServerList, SvObjectServer ) *************************************************************************/ const SvObjectServer * SvObjectServerList::Get( const String & rHumanName ) const { - for( sal_uLong i = 0; i < Count(); i++ ) + for( size_t i = 0; i < aObjectServerList.size(); i++ ) { - if( rHumanName == GetObject( i ).GetHumanName() ) - return &GetObject( i ); + if( rHumanName == aObjectServerList[ i ].GetHumanName() ) + return &aObjectServerList[ i ]; } return NULL; } @@ -92,26 +93,27 @@ const SvObjectServer * SvObjectServerList::Get( const String & rHumanName ) cons *************************************************************************/ const SvObjectServer * SvObjectServerList::Get( const SvGlobalName & rName ) const { - for( sal_uLong i = 0; i < Count(); i++ ) + for( size_t i = 0; i < aObjectServerList.size(); i++ ) { - if( rName == GetObject( i ).GetClassName() ) - return &GetObject( i ); + if( rName == aObjectServerList[ i ].GetClassName() ) + return &aObjectServerList[ i ]; } return NULL; } void SvObjectServerList::Remove( const SvGlobalName & rName ) { - SvObjectServer * pS = (SvObjectServer *)aTypes.First(); - while( pS ) + for( size_t i = 0; i < aObjectServerList.size(); ) { - if( rName == pS->GetClassName() ) + if( aObjectServerList[ i ].GetClassName() == rName ) { - Remove(); - pS = (SvObjectServer *)aTypes.GetCurObject(); + SvObjectServerList_impl::iterator it = aObjectServerList.begin() + i; + aObjectServerList.erase( it ); } else - pS = (SvObjectServer *)aTypes.Next(); + { + ++i; + } } } @@ -127,19 +129,17 @@ void SvObjectServerList::FillInsertObjects() uno::Reference< lang::XMultiServiceFactory > _globalMSFactory= comphelper::getProcessServiceFactory(); if( _globalMSFactory.is()) { - ::rtl::OUString sProviderService = - ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ); + ::rtl::OUString sProviderService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" )); uno::Reference< lang::XMultiServiceFactory > sProviderMSFactory( _globalMSFactory->createInstance( sProviderService ), uno::UNO_QUERY ); if( sProviderMSFactory.is()) { - ::rtl::OUString sReaderService = - ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ); + ::rtl::OUString sReaderService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )); uno::Sequence< uno::Any > aArguments( 1 ); beans::PropertyValue aPathProp; - aPathProp.Name = ::rtl::OUString::createFromAscii( "nodepath" ); - aPathProp.Value <<= ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Embedding/ObjectNames"); + aPathProp.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" )); + aPathProp.Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Embedding/ObjectNames" )); aArguments[0] <<= aPathProp; uno::Reference< container::XNameAccess > xNameAccess( @@ -164,13 +164,13 @@ void SvObjectServerList::FillInsertObjects() ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); if ( !( aProperty >>= aProductName ) ) { - OSL_ENSURE( sal_False, "Coudn't get PRODUCTNAME variable!\n" ); + OSL_FAIL( "Coudn't get PRODUCTNAME variable!\n" ); aProductName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice" ) ); } aProperty = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); if ( !( aProperty >>= aProductVersion ) ) { - OSL_ENSURE( sal_False, "Coudn't get PRODUCTVERSION variable!\n" ); + OSL_FAIL( "Coudn't get PRODUCTVERSION variable!\n" ); } for( nInd = 0; nInd < seqNames.getLength(); nInd++ ) @@ -181,8 +181,8 @@ void SvObjectServerList::FillInsertObjects() { ::rtl::OUString aUIName; ::rtl::OUString aClassID; - xEntry->getByName( ::rtl::OUString::createFromAscii("ObjectUIName") ) >>= aUIName; - xEntry->getByName( ::rtl::OUString::createFromAscii("ClassID") ) >>= aClassID; + xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectUIName" )) ) >>= aUIName; + xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassID" )) ) >>= aClassID; if ( aUIName.getLength() ) { @@ -208,7 +208,7 @@ void SvObjectServerList::FillInsertObjects() { if( !Get( aClassName ) ) // noch nicht eingetragen - Append( SvObjectServer( aClassName, String( aUIName.getStr() ) ) ); + aObjectServerList.push_back( SvObjectServer( aClassName, String( aUIName.getStr() ) ) ); } } } @@ -220,12 +220,12 @@ void SvObjectServerList::FillInsertObjects() #ifdef WNT SvGlobalName aOleFact( SO3_OUT_CLASSID ); String aOleObj( SvtResId( STR_FURTHER_OBJECT ) ); - Append( SvObjectServer( aOleFact, aOleObj ) ); + aObjectServerList.push_back( SvObjectServer( aOleFact, aOleObj ) ); #endif - }catch( container::NoSuchElementException) + }catch(const container::NoSuchElementException&) { - }catch( uno::Exception) + }catch(const uno::Exception&) { } catch(...) @@ -314,7 +314,7 @@ String SvPasteObjectHelper::GetSotFormatUIName( SotFormatStringId nId ) String aUIName; sal_uInt16 nResId = 0; - for( sal_uInt32 i = 0, nCount = sizeof( aSotResourcePairs ) / sizeof( aSotResourcePairs[ 0 ] ); ( i < nCount ) && !nResId; i++ ) + for( sal_uInt32 i = 0, nCount = SAL_N_ELEMENTS( aSotResourcePairs ); ( i < nCount ) && !nResId; i++ ) { if( aSotResourcePairs[ i ].mnSotId == nId ) nResId = aSotResourcePairs[ i ].mnResId; @@ -387,3 +387,4 @@ sal_Bool SvPasteObjectHelper::GetEmbeddedName(const TransferableDataHelper& rDat } // ----------------------------------------------------------------------------- +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index d98493114fd3..5d5ad14c82c2 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,8 +57,6 @@ static const short SinTab[16]= |* ImpMultBig2() |* |* Beschreibung Multiplikation fuer FixPoint-Berechnungen -|* Ersterstellung SH 01.07.93 -|* Letzte Aenderung SH 01.07.93 |* **************************************************************************/ @@ -75,8 +74,6 @@ Fix ImpMultBig2( const Fix& a, const Fix& b ) |* ImpMultBig2() |* |* Beschreibung Multiplikation fuer FixPoint-Berechnungen -|* Ersterstellung SH 01.07.93 -|* Letzte Aenderung SH 01.07.93 |* **************************************************************************/ @@ -94,8 +91,6 @@ FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb ) |* ImpSqrt() |* |* Beschreibung Wurzelfunktion fuer FixPoint-Berechnungen -|* Ersterstellung SH 01.07.93 -|* Letzte Aenderung SH 01.07.93 |* **************************************************************************/ @@ -126,8 +121,6 @@ sal_uInt16 ImpSqrt( sal_uLong nRadi ) |* ImpExPI() |* |* Beschreibung EXPI-Funktion fuer FixPoint-Berechnungen -|* Ersterstellung SH 01.07.93 -|* Letzte Aenderung SH 01.07.93 |* **************************************************************************/ @@ -158,8 +151,6 @@ FixCpx ImpExPI( sal_uInt16 nPhi ) |* ImpATanx2() |* |* Beschreibung ATANX2-Funktion fuer FixPoint-Berechnungen -|* Ersterstellung SH 01.07.93 -|* Letzte Aenderung SH 01.07.93 |* **************************************************************************/ @@ -238,8 +229,6 @@ static sal_uInt16 ImpATanx2( const Fix& rX, const Fix& rY ) |* ImpATan2() |* |* Beschreibung ATAN-Funktion fuer FixPoint-Berechnungen -|* Ersterstellung SH 01.07.93 -|* Letzte Aenderung SH 01.07.93 |* **************************************************************************/ @@ -262,8 +251,6 @@ sal_uInt16 ImpATan2( const short x, const short y ) |* ImpCartToPolar() |* |* Beschreibung Koordinaaten-Wandlung -|* Ersterstellung SH 01.07.93 -|* Letzte Aenderung SH 01.07.93 |* **************************************************************************/ @@ -289,8 +276,6 @@ void ImpCartToPolar( const short x, const short y, Fix& rRad, sal_uInt16& rPhi ) |* ImpPolarToCart() |* |* Beschreibung Koordinaaten-Wandlung -|* Ersterstellung SH 01.07.93 -|* Letzte Aenderung SH 01.07.93 |* **************************************************************************/ @@ -303,3 +288,4 @@ void ImpPolarToCart( const Fix& rR, const sal_uInt16 Phi, short& rX, short& rY ) rY = sal::static_int_cast< short >(long( fc.GetImag() )); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/mcvmath.hxx b/svtools/source/dialogs/mcvmath.hxx index 7708a8f1c89a..5e0d47e655ef 100644 --- a/svtools/source/dialogs/mcvmath.hxx +++ b/svtools/source/dialogs/mcvmath.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -226,3 +227,5 @@ sal_uInt16 ImpATan2( const short x, const short y ); FixCpx ImpExPI( sal_uInt16 nPhi ); #endif // _MCVMATH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx index 12a71a706b60..728d0e6ea5c7 100644 --- a/svtools/source/dialogs/prnsetup.cxx +++ b/svtools/source/dialogs/prnsetup.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include <tools/debug.hxx> -#ifndef _VCL_PRINT_HXX #include <vcl/print.hxx> -#endif - -#ifndef GCC -#endif #include <svtools/svtdata.hxx> #include "prnsetup.hrc" @@ -401,3 +397,5 @@ short PrinterSetupDialog::Execute() return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/prnsetup.src b/svtools/source/dialogs/prnsetup.src index afdf7d56864e..b0ef9638d974 100644 --- a/svtools/source/dialogs/prnsetup.src +++ b/svtools/source/dialogs/prnsetup.src @@ -245,38 +245,3 @@ ModalDialog DLG_SVT_PRNDLG_PRNSETUPDLG Size = MAP_APPFONT ( 50 , 14 ) ; }; }; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/dialogs/property.cxx b/svtools/source/dialogs/property.cxx index 140d00d39bb1..7bc07c88a6e6 100644 --- a/svtools/source/dialogs/property.cxx +++ b/svtools/source/dialogs/property.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,19 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" - -#ifndef GCC -#endif - -//------------------------------------------------------------------ - -//#include "Svitems.hxx" - #include "property.hxx" -/* -#include "property.hrc" -#include "Scresid.hxx" -*/ + #define FRAME_OFFSET 4 @@ -1416,145 +1406,4 @@ void SvBasicPropertyDataControl::SetIsCorrect(sal_Bool nFlag) bCorrectness=nFlag; } - - -//======================================================================== -// Property-Dialog: -/* zum TESTEN im CALC*/ -//======================================================================== -/* -ScPropertyDlg::ScPropertyDlg( Window* pParent) : - ModalDialog ( pParent, ScResId( RID_SCDLG_PROPERTIES) ), - aPropListBox ( this, ResId( CTR_PROPLINE) ), - aKindOfListBox (this,ResId( LB_KIND_OF_PROP)), - aModAnswer (this,ResId(FT_ANSMOD )), - aClickAnswer (this,ResId(FT_ANSCLICK )), - aCommitAnswer (this,ResId(FT_ANSCOMMIT)), - aSelectAnswer (this,ResId(FT_ANSSELECT)), - anOk(this,ResId( BTN_OK)), - aCancel(this,ResId( BTN_CANCEL)) -{ - FreeResource(); - - aKindOfListBox.SelectEntryPos(0); - aKindOfListBox.SetSelectHdl( - LINK( this, ScPropertyDlg, ModifiedHdl )); - nCount=0; - nClickCount=0; - - String aString("Don't know "); - - aBaProDatCtr.SetModifyHdl (LINK( this, ScPropertyDlg, RowModifiedHdl )); - aBaProDatCtr.SetClickedHdl(LINK( this, ScPropertyDlg, ClickHdl )); - aBaProDatCtr.SetCommitHdl (LINK( this, ScPropertyDlg, SelectHdl )); - aBaProDatCtr.SetSelectHdl (LINK( this, ScPropertyDlg, CommitHdl )); - - aPropListBox.SetController(&aBaProDatCtr); - - sal_uInt16 nPageId=aPropListBox.AppendPage("YabbaDabbaDo"); - aPropListBox.SetPage(nPageId); - aProperty.eKind=KOC_EDIT; - aProperty.aName=aString; - aProperty.aName+=String((sal_uInt16)++nCount); - aProperty.aValue=sizeof ComboBox; - aProperty.bHasVisibleXButton=sal_False; - aProperty.bIsHyperLink=sal_False; - aProperty.bIsLocked=sal_False; - aProperty.pDataPtr=NULL; - aProperty.pControl=NULL; - aProperty.theValues.Insert(new String("1"),aProperty.theValues.Count()); - aProperty.theValues.Insert(new String("2"),aProperty.theValues.Count()); - aProperty.theValues.Insert(new String("3"),aProperty.theValues.Count()); - aProperty.theValues.Insert(new String("4"),aProperty.theValues.Count()); - aPropListBox.InsertEntry(aProperty); - aProperty.bHasVisibleXButton=sal_True; - aProperty.aName=aString; - aProperty.aName+=String((sal_uInt16)++nCount); - aProperty.aValue="42"; - aProperty.eKind=KOC_LISTBOX; - aPropListBox.InsertEntry(aProperty); - aProperty.aName=aString; - aProperty.aName+=String((sal_uInt16)++nCount); - aProperty.eKind=KOC_COMBOBOX; - aProperty.bHasVisibleXButton=sal_False; - aPropListBox.InsertEntry(aProperty); -} - -ScPropertyDlg::~ScPropertyDlg() -{ - delete aProperty.theValues[0]; - delete aProperty.theValues[1]; - delete aProperty.theValues[2]; - delete aProperty.theValues[3]; -} - -IMPL_LINK( ScPropertyDlg, ModifiedHdl, ListBox*, pLB ) -{ - if(pLB!=NULL) - { - String aString("Don't know "); - aProperty.aName=aString; - aProperty.aName+=String((sal_uInt16)++nCount); - if(nCount>20) - { - String aStr("Yabba "); - aStr+=aPropListBox.GetCurPage(); - sal_uInt16 nPageId=aPropListBox.AppendPage(aStr); - aPropListBox.SetPage(nPageId); - nCount=0; - } - - aProperty.eKind=(eKindOfControl)(aKindOfListBox.GetSelectEntryPos()+1); - aProperty.bHasVisibleXButton=sal_False; - if((nCount % 5)==0) aProperty.bHasVisibleXButton=sal_True; - aPropListBox.InsertEntry(aProperty); - } - return 0; -} - -IMPL_LINK( ScPropertyDlg, RowModifiedHdl, SvBasicPropertyDataControl* ,pProCtr) -{ - if(pProCtr!=NULL) - { - aModAnswer.SetText(aBaProDatCtr.GetProperty()); - aModAnswer.Invalidate(); - aBaProDatCtr.SetIsCorrect(sal_True); - } - return 0; -} - -IMPL_LINK( ScPropertyDlg, CommitHdl, SvBasicPropertyDataControl*,pProCtr) -{ - if(pProCtr!=NULL) - { - aCommitAnswer.SetText(aBaProDatCtr.GetProperty()); - aCommitAnswer.Invalidate(); - aBaProDatCtr.SetIsCorrect(sal_True); - } - return 0; -} - -IMPL_LINK( ScPropertyDlg, ClickHdl, SvBasicPropertyDataControl*,pProCtr) -{ - if(pProCtr!=NULL) - { - aClickAnswer.SetText(aBaProDatCtr.GetName()); - aClickAnswer.Invalidate(); - aBaProDatCtr.SetIsCorrect(sal_True); - } - return 0; -} - -IMPL_LINK( ScPropertyDlg, SelectHdl, SvBasicPropertyDataControl*,pProCtr) -{ - if(pProCtr!=NULL) - { - aSelectAnswer.SetText(aBaProDatCtr.GetName()); - aSelectAnswer.Invalidate(); - aBaProDatCtr.SetIsCorrect(sal_True); - } - return 0; -} -*/ - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index cdf2eef32fdc..a80641fa05f9 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -135,7 +136,7 @@ namespace svt //==================================================================== DBG_NAME( RoadmapWizard ) //-------------------------------------------------------------------- -#if OSL_DEBUG_LEVEL > 0 +#ifdef DBG_UTIL const char* CheckInvariants( const void* pVoid ) { return static_cast< const RoadmapWizard* >( pVoid )->checkInvariants(); @@ -348,7 +349,7 @@ namespace svt { if ( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) <= nCurrentStatePathIndex ) { - OSL_ENSURE( false, "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" ); + OSL_FAIL( "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" ); return; } } @@ -746,3 +747,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/so3res.src b/svtools/source/dialogs/so3res.src index 0d1aa1756267..3b2aab346584 100644 --- a/svtools/source/dialogs/so3res.src +++ b/svtools/source/dialogs/so3res.src @@ -38,7 +38,6 @@ Resource RID_SO_ERROR_HANDLER }; String ERRCODE_SO_CANT_BINDTOSOURCE&S_MAX { - // ### ACHTUNG: Neuer Text in Resource? Die Verbindung zum Objekt kann nicht hergestellt werden : Die Verbindung zum Objekt kann nicht hergestellt werden. Text [ en-US ] = "The connection to the object cannot be established." ; }; String ERRCODE_SO_NOCACHE_UPDATED&S_MAX @@ -111,7 +110,6 @@ Resource RID_SO_ERROR_HANDLER }; String ERRCODE_SO_MK_NOT_BINDABLE&S_MAX { - // ### ACHTUNG: Neuer Text in Resource? Der Verbindungsname kann nicht verbunden werden Es handelt sich um einen relativen Namen : Der Verbindungsname kann nicht verbunden werden. Es handelt sich um einen relativen Namen Text [ en-US ] = "The connection name cannot be connected. This is a relative name." ; }; String ERRCODE_SO_NOT_IMPLEMENTED&S_MAX @@ -136,42 +134,34 @@ Resource RID_SO_ERROR_HANDLER }; String ERRCODE_SO_NOT_INPLACEACTIVE & S_MAX { - /* ### ACHTUNG: Neuer Text in Resource? Objekt wurde nicht InPlace aktiviert : Objetkt wurde nicht InPlace aktiviert */ Text [ en-US ] = "Object could not be activated InPlace." ; }; String ERRCODE_SO_LINDEX & S_MAX { - /* ### ACHTUNG: Neuer Text in Resource? Ungültiger Index : Ung³ltiger Index */ Text [ en-US ] = "Invalid index." ; }; String ERRCODE_SO_CANNOT_DOVERB_NOW & S_MAX { - /* ### ACHTUNG: Neuer Text in Resource? Das Objekt kann die Aktion im momentanen Zustand nicht ausführen : Das Objekt kann die Aktion im momentanen Zustand nicht ausf³hren */ Text [ en-US ] = "The action cannot be executed in the object's current state." ; }; String ERRCODE_SO_OLEOBJ_INVALIDHWND & S_MAX { - /* ### ACHTUNG: Neuer Text in Resource? Bei der Aktivierung wurde ein ungültiges Fenster ist übergeben : Bei der Aktivierung wurde ein ung³ltiges Fenster ist ³bergeben */ Text [ en-US ] = "An invalid window was passed when activated." ; }; String ERRCODE_SO_NOVERBS & S_MAX { - /* ### ACHTUNG: Neuer Text in Resource? Das Objekt unterstützt keine Aktionen : Das Objekt unterst³tzt keine Aktionen */ Text [ en-US ] = "The object does not support any actions." ; }; String ERRCODE_SO_INVALIDVERB & S_MAX { - /* ### ACHTUNG: Neuer Text in Resource? Die Aktion ist nicht definiert. Es wird die Default Aktion ausgelöst : Die Aktion ist nicht definiert. Es wird die Default Aktion ausgel÷st */ Text [ en-US ] = "The action is not defined. The default action will be executed." ; }; String ERRCODE_SO_MK_CONNECT & S_MAX { - /* ### ACHTUNG: Neuer Text in Resource? Eine Verknüpfung auf das Netzwerk konnte nicht wieder hergestellt werden : Eine Verkn³pfung auf das Netzwerk, die nicht wieder hergestellt werden konnte */ Text [ en-US ] = "A link to the network could not be re-established." ; }; String ERRCODE_SO_NOTIMPL & S_MAX { - /* ### ACHTUNG: Neuer Text in Resource? Das Objekt unterstützt diese Aktion nicht : Das Objekt unterst³tzt diese Aktion nicht */ Text [ en-US ] = "Object does not support this action." ; }; String ERRCODE_SO_MK_CANTOPENFILE & S_MAX diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index 41e759eda43b..f4e024b65cc1 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,9 +34,7 @@ #include <tools/diagnose_ex.h> #include <vcl/msgbox.hxx> #include <svtools/svtdata.hxx> -#ifndef _SVTOOLS_HRC #include <svtools/svtools.hrc> -#endif //......................................................................... namespace svt @@ -523,7 +522,7 @@ namespace svt WizardState nNextState = determineNextState( nCurrentState ); if ( WZS_INVALID_STATE == nNextState ) { - DBG_ERROR( "OWizardMachine::skipUntil: the given target state does not exist!" ); + OSL_FAIL( "OWizardMachine::skipUntil: the given target state does not exist!" ); return sal_False; } @@ -539,7 +538,7 @@ namespace svt { // argh! prepareLeaveCurrentPage succeeded, determineNextState succeeded, // but ShowPage doesn't? Somebody behaves very strange here .... - DBG_ERROR( "OWizardMachine::skipUntil: very unpolite ...." ); + OSL_FAIL( "OWizardMachine::skipUntil: very unpolite ...." ); m_pImpl->aStateHistory = aOldStateHistory; return sal_False; } @@ -575,7 +574,7 @@ namespace svt { // TODO: this leaves us in a state where we have no current page and an inconsistent state history. // Perhaps we should rollback the skipping here .... - DBG_ERROR("OWizardMachine::skip: very unpolite ...."); + OSL_FAIL("OWizardMachine::skip: very unpolite ...."); // if somebody does a skip and then does not allow to leave ... // (can't be a commit error, as we've already committed the current page. So if ShowPage fails here, // somebody behaves really strange ...) @@ -748,3 +747,5 @@ namespace svt //......................................................................... } // namespace svt //......................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/wizardmachine.src b/svtools/source/dialogs/wizardmachine.src index 9c82ea30071f..8f6956684350 100644 --- a/svtools/source/dialogs/wizardmachine.src +++ b/svtools/source/dialogs/wizardmachine.src @@ -25,9 +25,7 @@ * ************************************************************************/ -#ifndef _SVTOOLS_HRC #include <svtools/svtools.hrc> -#endif String STR_WIZDLG_FINISH { diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx index 8787e39b1284..e7bb12989e4a 100644 --- a/svtools/source/dialogs/wizdlg.cxx +++ b/svtools/source/dialogs/wizdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,15 +31,9 @@ #define _SVT_WIZDLG_CXX #include <tools/debug.hxx> -#ifndef _VCL_FIXED_HXX #include <vcl/fixed.hxx> -#endif -#ifndef _VCL_BUTTON_HXX #include <vcl/button.hxx> -#endif -#ifndef _VCL_TABPAGE_HXX #include <vcl/tabpage.hxx> -#endif #include <svtools/wizdlg.hxx> // ======================================================================= @@ -595,7 +590,7 @@ void WizardDialog::RemovePage( TabPage* pPage ) pPageData = pPageData->mpNext; } - DBG_ERROR( "WizardDialog::RemovePage() - Page not in list" ); + OSL_FAIL( "WizardDialog::RemovePage() - Page not in list" ); } // ----------------------------------------------------------------------- @@ -681,7 +676,7 @@ void WizardDialog::RemoveButton( Button* pButton ) pBtnData = pBtnData->mpNext; } - DBG_ERROR( "WizardDialog::RemoveButton() - Button not in list" ); + OSL_FAIL( "WizardDialog::RemoveButton() - Button not in list" ); } // ----------------------------------------------------------------------- @@ -705,3 +700,5 @@ sal_Bool WizardDialog::IsButtonFixedLineVisible() { return (mpFixedLine && mpFixedLine->IsVisible()); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index a62df6d64700..bc81a96ea142 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -188,7 +189,7 @@ void MultiLineEditSyntaxHighlight::UpdateData() for (unsigned int nLine=0; nLine < GetTextEngine()->GetParagraphCount(); nLine++) { String aLine( GetTextEngine()->GetText( nLine ) ); - Range aChanges = aHighlighter.notifyChange( nLine, 0, &aLine, 1 ); + aHighlighter.notifyChange( nLine, 0, &aLine, 1 ); GetTextEngine()->RemoveAttribs( nLine, sal_True ); HighlightPortions aPortions; @@ -202,3 +203,5 @@ void MultiLineEditSyntaxHighlight::UpdateData() GetTextView()->ShowCursor( false, true ); GetTextEngine()->SetModified(bTempModified); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index 1e9e7b7cd48b..6c720acff89b 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -858,9 +859,6 @@ void TextWindow::Command( const CommandEvent& rCEvt ) if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) { PopupMenu* pPopup = Edit::CreatePopupMenu(); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - if ( rStyleSettings.GetOptions() & STYLE_OPTION_HIDEDISABLED ) - pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES ); if ( !mpExtTextView->HasSelection() ) { pPopup->EnableItem( SV_MENU_EDIT_CUT, sal_False ); @@ -1647,10 +1645,10 @@ MultiLineEdit::GetComponentInterface(sal_Bool bCreate) } return xPeer; } -/*-- 11.08.2004 11:29:23--------------------------------------------------- - -----------------------------------------------------------------------*/ void MultiLineEdit::DisableSelectionOnFocus() { pImpSvMEdit->GetTextWindow()->DisableSelectionOnFocus(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/svmedit2.cxx b/svtools/source/edit/svmedit2.cxx index 2a4c0134005a..bb496e47a7ef 100644 --- a/svtools/source/edit/svmedit2.cxx +++ b/svtools/source/edit/svmedit2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -79,3 +80,4 @@ sal_uLong ExtMultiLineEdit::GetParagraphCount() const return GetTextEngine()->GetParagraphCount(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/sychconv.cxx b/svtools/source/edit/sychconv.cxx index 5e723815eb37..c20ebd962acd 100644 --- a/svtools/source/edit/sychconv.cxx +++ b/svtools/source/edit/sychconv.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,7 @@ sal_Bool SymCharConverter::Convert( Font& rFont, UniString& rString, OutputDevic // 2 = the converted character does not look like the original but got the same meaning // 3 = the destination does not match looking and meaning of the original - static sal_uInt16 __READONLY_DATA aWingdingsToStarBatsTable[ 256 - 32 ] = + static sal_uInt16 const aWingdingsToStarBatsTable[ 256 - 32 ] = { 0x0020, 0x0238, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0174, 0x02BA, 0x017B, 0x017C, 0x037C, 0x037C, 0x037C, 0x037C, 0x0000, 0x0000, 0x0372, 0x0272, 0x0372, 0x0000, 0x0000, 0x0374, 0x0279, 0x0000, 0x027A, 0x0000, 0x0178, 0x0278, 0x0000, 0x0137, @@ -55,7 +56,7 @@ sal_Bool SymCharConverter::Convert( Font& rFont, UniString& rString, OutputDevic 0x01AF, 0x01B2, 0x01B0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0150, 0x0032, 0x0033, 0x0034, 0x01C8 }; - static sal_uInt16 __READONLY_DATA aMonotypeSortsToStarBatsTable[ 256 - 32 ]= + static sal_uInt16 const aMonotypeSortsToStarBatsTable[ 256 - 32 ]= { 0x0020, 0x00cb, 0x00cb, 0x00cb, 0x00cb, 0x0074, 0x00ba, 0x0021, 0x00cc, 0x007b, 0x0036, 0x007d, 0x007e, 0x0037, 0x0038, 0x0038, 0x0039, 0x0038, 0x0038, 0x0039, 0x003a, 0x004f, 0x0050, 0x004f, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0086, 0x0086, 0x0086, @@ -101,3 +102,5 @@ sal_Bool SymCharConverter::Convert( Font& rFont, UniString& rString, OutputDevic } else return sal_False; }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index 8e26c58d57ae..f859e9930cf9 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -904,3 +905,5 @@ void SyntaxHighlighter::getHighlightPortions( sal_uInt32 nLine, const String& rL { m_pSimpleTokenizer->getHighlightPortions( nLine, rLine, portions ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textdat2.hxx b/svtools/source/edit/textdat2.hxx index 17b4454a109f..579810ce37ab 100644 --- a/svtools/source/edit/textdat2.hxx +++ b/svtools/source/edit/textdat2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,6 @@ #define _TEXTDAT2_HXX #include <svl/svarray.hxx> -#include <tools/list.hxx> #include <vcl/seleng.hxx> #include <vcl/virdev.hxx> #include <vcl/cursor.hxx> @@ -304,3 +304,5 @@ struct TextDDInfo }; #endif // _TEXTDAT2_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textdata.cxx b/svtools/source/edit/textdata.cxx index 1cefb30700df..d1586de4352a 100644 --- a/svtools/source/edit/textdata.cxx +++ b/svtools/source/edit/textdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -111,7 +112,7 @@ sal_uInt16 TETextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPor } } } - DBG_ERROR( "FindPortion: Nicht gefunden!" ); + OSL_FAIL( "FindPortion: Nicht gefunden!" ); return ( Count() - 1 ); } @@ -359,3 +360,4 @@ void TEIMEInfos::DestroyAttribs() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index 2dfb014117b1..fa7536035288 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,22 +38,8 @@ SV_IMPL_PTRARR( TextCharAttribs, TextCharAttribPtr ); // Vergleichmethode wird von QuickSort gerufen... -EXTERN_C -#if defined( PM2 ) && (!defined( CSET ) && !defined ( MTW ) && !defined( WTC )) -int _stdcall -#else -#ifdef WNT -#if _MSC_VER >= 1200 -int __cdecl -#else -int _cdecl -#endif -#else -int -#endif -#endif - -CompareStart( const void* pFirst, const void* pSecond ) +extern "C" { +int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) { if ( (*((TextCharAttrib**)pFirst))->GetStart() < (*((TextCharAttrib**)pSecond))->GetStart() ) return (-1); @@ -60,7 +47,7 @@ CompareStart( const void* pFirst, const void* pSecond ) return (1); return 0; } - +} // ------------------------------------------------------------------------- // (+) class TextCharAttrib @@ -239,7 +226,7 @@ sal_Bool TextCharAttribList::DbgCheckAttribs() if ( pAttr->GetStart() > pAttr->GetEnd() ) { bOK = sal_False; - DBG_ERROR( "Attr verdreht" ); + OSL_FAIL( "Attr verdreht" ); } } return bOK; @@ -551,7 +538,7 @@ String TextDoc::GetText( const sal_Unicode* pSep ) const if ( nLen > STRING_MAXLEN ) { - DBG_ERROR( "Text zu gross fuer String" ); + OSL_FAIL( "Text zu gross fuer String" ); return String(); } @@ -677,370 +664,16 @@ sal_Bool TextDoc::IsValidPaM( const TextPaM& rPaM ) { if ( rPaM.GetPara() >= maTextNodes.Count() ) { - DBG_ERROR( "PaM: Para out of range" ); + OSL_FAIL( "PaM: Para out of range" ); return sal_False; } TextNode * pNode = maTextNodes.GetObject( rPaM.GetPara() ); if ( rPaM.GetIndex() > pNode->GetText().Len() ) { - DBG_ERROR( "PaM: Index out of range" ); + OSL_FAIL( "PaM: Index out of range" ); return sal_False; } return sal_True; } -/* - -void TextDoc::InsertAttribInSelection( TextNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ) -{ - DBG_ASSERT( pNode, "Wohin mit dem Attribut?" ); - DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribut zu gross!" ); - - // fuer Optimierung: - // dieses endet am Anfang der Selektion => kann erweitert werden - TextCharAttrib* pEndingAttrib = 0; - // dieses startet am Ende der Selektion => kann erweitert werden - TextCharAttrib* pStartingAttrib = 0; - - DBG_ASSERT( nStart <= nEnd, "Kleiner Rechenfehler in InsertAttribInSelection" ); - - RemoveAttribs( pNode, nStart, nEnd, pStartingAttrib, pEndingAttrib, rPoolItem.Which() ); - - if ( pStartingAttrib && pEndingAttrib && - ( *(pStartingAttrib->GetItem()) == rPoolItem ) && - ( *(pEndingAttrib->GetItem()) == rPoolItem ) ) - { - // wird ein groesses Attribut. - pEndingAttrib->GetEnd() = pStartingAttrib->GetEnd(); - pCurPool->Remove( *(pStartingAttrib->GetItem()) ); - pNode->GetCharAttribs().GetAttribs().Remove( pNode->GetCharAttribs().GetAttribs().GetPos( pStartingAttrib ) ); - delete pStartingAttrib; - } - else if ( pStartingAttrib && ( *(pStartingAttrib->GetItem()) == rPoolItem ) ) - pStartingAttrib->GetStart() = nStart; - else if ( pEndingAttrib && ( *(pEndingAttrib->GetItem()) == rPoolItem ) ) - pEndingAttrib->GetEnd() = nEnd; - else - InsertAttrib( rPoolItem, pNode, nStart, nEnd ); - - if ( pStartingAttrib ) - pNode->GetCharAttribs().ResortAttribs(); -} - -sal_Bool TextDoc::RemoveAttribs( TextNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt16 nWhich ) -{ - TextCharAttrib* pStarting; - TextCharAttrib* pEnding; - return RemoveAttribs( pNode, nStart, nEnd, pStarting, pEnding, nWhich ); -} - -sal_Bool TextDoc::RemoveAttribs( TextNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, TextCharAttrib*& rpStarting, TextCharAttrib*& rpEnding, sal_uInt16 nWhich ) -{ - DBG_ASSERT( pNode, "Wohin mit dem Attribut?" ); - DBG_ASSERT( nEnd <= pNode->Len(), "InsertAttrib: Attribut zu gross!" ); - - // dieses endet am Anfang der Selektion => kann erweitert werden - rpEnding = 0; - // dieses startet am Ende der Selektion => kann erweitert werden - rpStarting = 0; - - sal_Bool bChanged = sal_False; - - DBG_ASSERT( nStart <= nEnd, "Kleiner Rechenfehler in InsertAttribInSelection" ); - - // ueber die Attribute iterieren... - sal_uInt16 nAttr = 0; - TextCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); - while ( pAttr ) - { - sal_Bool bRemoveAttrib = sal_False; - if ( !nWhich || ( pAttr->Which() == nWhich ) ) - { - // Attribut beginnt in Selection - if ( ( pAttr->GetStart() >= nStart ) && ( pAttr->GetStart() <= nEnd ) ) - { - bChanged = sal_True; - if ( pAttr->GetEnd() > nEnd ) - { - pAttr->GetStart() = nEnd; // dann faengt es dahinter an - rpStarting = pAttr; - break; // es kann kein weiteres Attrib hier liegen - } - else if ( !pAttr->IsFeature() || ( pAttr->GetStart() == nStart ) ) - { - // Feature nur loeschen, wenn genau an der Stelle - bRemoveAttrib = sal_True; - } - } - - // Attribut endet in Selection - else if ( ( pAttr->GetEnd() >= nStart ) && ( pAttr->GetEnd() <= nEnd ) ) - { - bChanged = sal_True; - if ( ( pAttr->GetStart() < nStart ) && !pAttr->IsFeature() ) - { - pAttr->GetEnd() = nStart; // dann hoert es hier auf - rpEnding = pAttr; - } - else if ( !pAttr->IsFeature() || ( pAttr->GetStart() == nStart ) ) - { - // Feature nur loeschen, wenn genau an der Stelle - bRemoveAttrib = sal_True; - } - } - // Attribut ueberlappt die Selektion - else if ( ( pAttr->GetStart() <= nStart ) && ( pAttr->GetEnd() >= nEnd ) ) - { - bChanged = sal_True; - if ( pAttr->GetStart() == nStart ) - { - pAttr->GetStart() = nEnd; - rpStarting = pAttr; - break; // es kann weitere Attribute geben! - } - else if ( pAttr->GetEnd() == nEnd ) - { - pAttr->GetEnd() = nStart; - rpEnding = pAttr; - break; // es kann weitere Attribute geben! - } - else // Attribut muss gesplittet werden... - { - sal_uInt16 nOldEnd = pAttr->GetEnd(); - pAttr->GetEnd() = nStart; - rpEnding = pAttr; -// sal_uLong nSavePos = pNode->GetCharAttribs().GetStartList().GetCurPos(); - InsertAttrib( *pAttr->GetItem(), pNode, nEnd, nOldEnd ); -// pNode->GetCharAttribs().GetStartList().Seek( nSavePos ); - break; // es kann weitere Attribute geben! - } - } - } - if ( bRemoveAttrib ) - { - DBG_ASSERT( ( pAttr != rpStarting ) && ( pAttr != rpEnding ), "Loeschen und behalten des gleichen Attributs ?" ); - pNode->GetCharAttribs().GetAttribs().Remove(nAttr); - pCurPool->Remove( *pAttr->GetItem() ); - delete pAttr; - nAttr--; - } - nAttr++; - pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); - } - return bChanged; -} - -#pragma SEG_FUNCDEF(editdoc_3f) - -void TextDoc::InsertAttrib( const SfxPoolItem& rPoolItem, TextNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd ) -{ - // Diese Methode prueft nicht mehr, ob ein entspr. Attribut - // schon an der Stelle existiert! - - // pruefen, ob neues Attrib oder einfach nur Ende eines Attribs... -// const SfxPoolItem& rDefItem = pNode->GetContentAttribs().GetItem( rPoolItem.Which() ); -// sal_Bool bCreateAttrib = ( rDefItem != rPoolItem ); - - // Durch den Verlust der Exclude-Liste geht es nicht mehr, dass ich - // kein neues Attribut benoetige und nur das alte nicht expandiere... -// if ( !bCreateAttrib ) - { - // => Wenn schon Default-Item, dann wenigstens nur dann einstellen, - // wenn davor wirklich ein entsprechendes Attribut. -// if ( pNode->GetCharAttribs().FindAttrib( rPoolItem.Which(), nStart ) ) -// bCreateAttrib = sal_True; - // Aber kleiner Trost: - // Die wenigsten schreiben, aendern das Attr, schreiben, und - // stellen dann wieder das Default-Attr ein. - } - - // 22.9.95: - // Die Uberlegung, einfach das andere Attribut nicht zu expandieren, war - // sowieso falsch, da das DefAttr aus einer Vorlage kommen kann, - // die irgendwann verschwindet! -// if ( bCreateAttrib ) -// { - TextCharAttrib* pAttrib = MakeCharAttrib( *pCurPool, rPoolItem, nStart, nEnd ); - DBG_ASSERT( pAttrib, "MakeCharAttrib fehlgeschlagen!" ); - pNode->GetCharAttribs().InsertAttrib( pAttrib ); -// } -// else -// { -// TextCharAttrib* pTmpAttrib = -// pNode->GetCharAttribs().FindAnyAttrib( rPoolItem.Which() ); -// if ( pTmpAttrib ) // sonst benoetige ich es sowieso nicht.... -// { -// aExcludeList.Insert( pTmpAttrib->GetItem() ); -// } -// } -} - -#pragma SEG_FUNCDEF(editdoc_40) - -void TextDoc::InsertAttrib( TextNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, const SfxPoolItem& rPoolItem ) -{ - if ( nStart != nEnd ) - { - InsertAttribInSelection( pNode, nStart, nEnd, rPoolItem ); - } - else - { - // Pruefen, ob schon ein neues Attribut mit der WhichId an der Stelle: - TextCharAttrib* pAttr = pNode->GetCharAttribs().FindEmptyAttrib( rPoolItem.Which(), nStart ); - if ( pAttr ) - { - // Attribut entfernen.... - pNode->GetCharAttribs().GetAttribs().Remove( - pNode->GetCharAttribs().GetAttribs().GetPos( pAttr ) ); - } - - // pruefen, ob ein 'gleiches' Attribut an der Stelle liegt. - pAttr = pNode->GetCharAttribs().FindAttrib( rPoolItem.Which(), nStart ); - if ( pAttr ) - { - if ( pAttr->IsInside( nStart ) ) // splitten - { - // ??????????????????????????????? - // eigentlich noch pruefen, ob wirklich splittet, oder return ! - // ??????????????????????????????? - sal_uInt16 nOldEnd = pAttr->GetEnd(); - pAttr->GetEnd() = nStart; - pAttr = MakeCharAttrib( *pCurPool, *(pAttr->GetItem()), nStart, nOldEnd ); - pNode->GetCharAttribs().InsertAttrib( pAttr ); - } - else if ( pAttr->GetEnd() == nStart ) - { - DBG_ASSERT( !pAttr->IsEmpty(), "Doch noch ein leeres Attribut?" ); - // pruefen, ob genau das gleiche Attribut - if ( *(pAttr->GetItem()) == rPoolItem ) - return; - } - } - InsertAttrib( rPoolItem, pNode, nStart, nStart ); - } -} - -#pragma SEG_FUNCDEF(editdoc_41) - -void TextDoc::FindAttribs( TextNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, SfxItemSet& rCurSet ) -{ - DBG_ASSERT( pNode, "Wo soll ich suchen ?" ); - DBG_ASSERT( nStartPos <= nEndPos, "Ungueltiger Bereich!" ); - - sal_uInt16 nAttr = 0; - TextCharAttrib* pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); - // keine Selection... - if ( nStartPos == nEndPos ) - { - while ( pAttr && ( pAttr->GetStart() <= nEndPos) ) - { - const SfxPoolItem* pItem = 0; - // Attribut liegt dadrueber... - if ( ( pAttr->GetStart() < nStartPos ) && ( pAttr->GetEnd() > nStartPos ) ) - pItem = pAttr->GetItem(); - // Attribut endet hier, ist nicht leer - else if ( ( pAttr->GetStart() < nStartPos ) && ( pAttr->GetEnd() == nStartPos ) ) - { - if ( !pNode->GetCharAttribs().FindEmptyAttrib( pAttr->GetItem()->Which(), nStartPos ) ) - pItem = pAttr->GetItem(); - } - // Attribut endet hier, ist leer - else if ( ( pAttr->GetStart() == nStartPos ) && ( pAttr->GetEnd() == nStartPos ) ) - { -// if ( aExcludeList.FindAttrib( pAttr->GetItem()->Which() ) ) - pItem = pAttr->GetItem(); -// else if ( pNode->Len() == 0 ) // Sonderfall -// pItem = pAttr->GetItem(); - } - // Attribut beginnt hier - else if ( ( pAttr->GetStart() == nStartPos ) && ( pAttr->GetEnd() > nStartPos ) ) - { - if ( nStartPos == 0 ) // Sonderfall - pItem = pAttr->GetItem(); - } - - if ( pItem ) - { - sal_uInt16 nWhich = pItem->Which(); - if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF ) - { - rCurSet.Put( *pItem ); - } - else if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_ON ) - { - const SfxPoolItem& rItem = rCurSet.Get( nWhich ); - if ( rItem != *pItem ) - { - rCurSet.InvalidateItem( nWhich ); - } - } - } - nAttr++; - pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); - } - } - else // Selektion - { - while ( pAttr && ( pAttr->GetStart() < nEndPos) ) - { - const SfxPoolItem* pItem = 0; - // Attribut liegt dadrueber... - if ( ( pAttr->GetStart() <= nStartPos ) && ( pAttr->GetEnd() >= nEndPos ) ) - pItem = pAttr->GetItem(); - // Attribut startet mitten drin... - else if ( pAttr->GetStart() >= nStartPos ) - { - // !!! pItem = pAttr->GetItem(); - // einfach nur pItem reicht nicht, da ich z.B. bei Shadow - // niemals ein ungleiches Item finden wuerde, da ein solche - // seine Anwesenheit durch Abwesenheit repraesentiert! - // if ( ... ) - // Es muesste geprueft werden, on genau das gleiche Attribut - // an der Bruchstelle aufsetzt, was recht aufwendig ist. - // Da ich beim Einfuegen von Attributen aber etwas optimiere - // tritt der Fall nicht so schnell auf... - // Also aus Geschwindigkeitsgruenden: - rCurSet.InvalidateItem( pAttr->GetItem()->Which() ); - - } - // Attribut endet mitten drin... - else if ( pAttr->GetEnd() > nStartPos ) - { - // pItem = pAttr->GetItem(); - // s.o. - - // -----------------31.05.95 16:01------------------- - // Ist falsch, wenn das gleiche Attribut sofort wieder - // eingestellt wird! - // => Sollte am besten nicht vorkommen, also gleich beim - // Setzen von Attributen richtig machen! - // -------------------------------------------------- - rCurSet.InvalidateItem( pAttr->GetItem()->Which() ); - } - - if ( pItem ) - { - sal_uInt16 nWhich = pItem->Which(); - if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_OFF ) - { - rCurSet.Put( *pItem ); - } - else if ( rCurSet.GetItemState( nWhich ) == SFX_ITEM_ON ) - { - const SfxPoolItem& rItem = rCurSet.Get( nWhich ); - if ( rItem != *pItem ) - { - rCurSet.InvalidateItem( nWhich ); - } - } - } - nAttr++; - pAttr = GetAttrib( pNode->GetCharAttribs().GetAttribs(), nAttr ); - } - } -} - - -*/ - - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textdoc.hxx b/svtools/source/edit/textdoc.hxx index 44ae2371a181..c52190ca4d63 100644 --- a/svtools/source/edit/textdoc.hxx +++ b/svtools/source/edit/textdoc.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,6 @@ #include <tools/debug.hxx> #include <tools/string.hxx> -#include <tools/list.hxx> typedef TextCharAttrib* TextCharAttribPtr; SV_DECL_PTRARR_DEL( TextCharAttribs, TextCharAttribPtr, 0, 4 ) @@ -146,3 +146,5 @@ public: }; #endif // _TEXTDOC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index 38ff8852c777..15412276e587 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,21 +45,13 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValues.hpp> -#ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_ #include <com/sun/star/i18n/XBreakIterator.hpp> -#endif -#ifndef _COM_SUN_STAR_TEXT_CHARACTERITERATORMODE_HPP_ #include <com/sun/star/i18n/CharacterIteratorMode.hpp> -#endif -#ifndef _COM_SUN_STAR_TEXT_WORDTYPE_HPP_ #include <com/sun/star/i18n/WordType.hpp> -#endif -#ifndef _COM_SUN_STAR_I18N_XEXTENDEDINPUTSEQUENCECHECKER_HDL_ #include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp> -#endif #include <com/sun/star/i18n/InputSequenceCheckMode.hpp> #include <com/sun/star/i18n/ScriptType.hpp> @@ -712,7 +705,7 @@ uno::Reference < i18n::XExtendedInputSequenceChecker > TextEngine::GetInputSeque // if ( !xISC.is() ) { uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - uno::Reference< uno::XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) ); + uno::Reference< uno::XInterface > xI = xMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.InputSequenceChecker" )) ); if ( xI.is() ) { Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XExtendedInputSequenceChecker >*)0) ); @@ -2098,7 +2091,6 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan return; sal_uLong nParaHeight = CalcParaHeight( nPara ); - sal_uInt16 nIndex = 0; if ( ( !pPaintArea || ( ( nY + (long)nParaHeight ) > pPaintArea->Top() ) ) && ( !pPaintRange || ( ( nPara >= pPaintRange->GetStart().GetPara() ) && ( nPara <= pPaintRange->GetEnd().GetPara() ) ) ) ) { @@ -2106,6 +2098,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan // Ueber die Zeilen des Absatzes... // -------------------------------------------------- sal_uInt16 nLines = pPortion->GetLines().Count(); + sal_uInt16 nIndex = 0; for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ ) { TextLine* pLine = pPortion->GetLines().GetObject(nLine); @@ -2258,7 +2251,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan #endif } break; - default: DBG_ERROR( "ImpPaint: Unknown Portion-Type !" ); + default: OSL_FAIL( "ImpPaint: Unknown Portion-Type !" ); } } @@ -2397,7 +2390,6 @@ sal_Bool TextEngine::CreateLines( sal_uLong nPara ) while ( nIndex < pNode->GetText().Len() ) { sal_Bool bEOL = sal_False; - sal_Bool bEOC = sal_False; sal_uInt16 nPortionStart = 0; sal_uInt16 nPortionEnd = 0; @@ -2462,7 +2454,6 @@ sal_Bool TextEngine::CreateLines( sal_uLong nPara ) nPortionStart = nTmpPos; nTmpPortion--; bEOL = sal_False; - bEOC = sal_False; nTmpWidth -= pPortion->GetWidth(); if ( pPortion->GetKind() == PORTIONKIND_TAB ) @@ -2474,7 +2465,6 @@ sal_Bool TextEngine::CreateLines( sal_uLong nPara ) else { bEOL = sal_True; - bEOC = sal_True; pLine->SetEnd( nPortionEnd ); DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "Keine TextPortions?" ); pLine->SetEndPortion( (sal_uInt16)pTEParaPortion->GetTextPortions().Count() - 1 ); @@ -2489,7 +2479,6 @@ sal_Bool TextEngine::CreateLines( sal_uLong nPara ) { pLine->SetEnd( nPortionStart+1 ); pLine->SetEndPortion( nTmpPortion-1 ); - bEOC = sal_False; // wurde oben gesetzt, vielleich mal die if's umstellen? } else if ( !bEOL ) { @@ -3301,3 +3290,5 @@ long TextEngine::ImpGetOutputOffset( sal_uLong nPara, TextLine* pLine, sal_uInt1 return nX; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textund2.hxx b/svtools/source/edit/textund2.hxx index ba559c3dc98c..63937c31e0e8 100644 --- a/svtools/source/edit/textund2.hxx +++ b/svtools/source/edit/textund2.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -146,3 +147,5 @@ public: }; #endif // _TEXTUND2_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textundo.cxx b/svtools/source/edit/textundo.cxx index 742c3ed4c707..660c272397f5 100644 --- a/svtools/source/edit/textundo.cxx +++ b/svtools/source/edit/textundo.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -54,7 +55,7 @@ TextUndoManager::~TextUndoManager() { } -sal_Bool __EXPORT TextUndoManager::Undo() +sal_Bool TextUndoManager::Undo() { if ( GetUndoActionCount() == 0 ) return sal_False; @@ -70,7 +71,7 @@ sal_Bool __EXPORT TextUndoManager::Undo() return bDone; } -sal_Bool __EXPORT TextUndoManager::Redo() +sal_Bool TextUndoManager::Redo() { if ( GetRedoActionCount() == 0 ) return sal_False; @@ -119,7 +120,7 @@ TextUndo::~TextUndo() { } -XubString __EXPORT TextUndo::GetComment() const +XubString TextUndo::GetComment() const { // return mpTextEngine->GetUndoComment( this ); return String(); @@ -146,7 +147,7 @@ TextUndoDelPara::~TextUndoDelPara() delete mpNode; } -void __EXPORT TextUndoDelPara::Undo() +void TextUndoDelPara::Undo() { GetTextEngine()->InsertContent( mpNode, mnPara ); mbDelObject = sal_False; // gehoert wieder der Engine @@ -158,7 +159,7 @@ void __EXPORT TextUndoDelPara::Undo() } } -void __EXPORT TextUndoDelPara::Redo() +void TextUndoDelPara::Redo() { // pNode stimmt nicht mehr, falls zwischendurch Undos, in denen // Absaetze verschmolzen sind. @@ -194,13 +195,13 @@ TextUndoConnectParas::~TextUndoConnectParas() { } -void __EXPORT TextUndoConnectParas::Undo() +void TextUndoConnectParas::Undo() { TextPaM aPaM = GetTextEngine()->SplitContent( mnPara, mnSepPos ); SetSelection( aPaM ); } -void __EXPORT TextUndoConnectParas::Redo() +void TextUndoConnectParas::Redo() { TextPaM aPaM = GetTextEngine()->ConnectContents( mnPara ); SetSelection( aPaM ); @@ -218,13 +219,13 @@ TextUndoSplitPara::~TextUndoSplitPara() { } -void __EXPORT TextUndoSplitPara::Undo() +void TextUndoSplitPara::Undo() { TextPaM aPaM = GetTextEngine()->ConnectContents( mnPara ); SetSelection( aPaM ); } -void __EXPORT TextUndoSplitPara::Redo() +void TextUndoSplitPara::Redo() { TextPaM aPaM = GetTextEngine()->SplitContent( mnPara, mnSepPos ); SetSelection( aPaM ); @@ -237,7 +238,7 @@ TextUndoInsertChars::TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM { } -void __EXPORT TextUndoInsertChars::Undo() +void TextUndoInsertChars::Undo() { TextSelection aSel( maTextPaM, maTextPaM ); aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.Len(); @@ -245,7 +246,7 @@ void __EXPORT TextUndoInsertChars::Undo() SetSelection( aPaM ); } -void __EXPORT TextUndoInsertChars::Redo() +void TextUndoInsertChars::Redo() { TextSelection aSel( maTextPaM, maTextPaM ); GetTextEngine()->ImpInsertText( aSel, maText ); @@ -254,7 +255,7 @@ void __EXPORT TextUndoInsertChars::Redo() SetSelection( TextSelection( aSel.GetStart(), aNewPaM ) ); } -sal_Bool __EXPORT TextUndoInsertChars::Merge( SfxUndoAction* pNextAction ) +sal_Bool TextUndoInsertChars::Merge( SfxUndoAction* pNextAction ) { if ( !pNextAction->ISA( TextUndoInsertChars ) ) return sal_False; @@ -279,7 +280,7 @@ TextUndoRemoveChars::TextUndoRemoveChars( TextEngine* pTextEngine, const TextPaM { } -void __EXPORT TextUndoRemoveChars::Undo() +void TextUndoRemoveChars::Undo() { TextSelection aSel( maTextPaM, maTextPaM ); GetTextEngine()->ImpInsertText( aSel, maText ); @@ -287,7 +288,7 @@ void __EXPORT TextUndoRemoveChars::Undo() SetSelection( aSel ); } -void __EXPORT TextUndoRemoveChars::Redo() +void TextUndoRemoveChars::Redo() { TextSelection aSel( maTextPaM, maTextPaM ); aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.Len(); @@ -311,7 +312,7 @@ TextUndoSetAttribs::~TextUndoSetAttribs() // ............... } -void __EXPORT TextUndoSetAttribs::Undo() +void TextUndoSetAttribs::Undo() { for ( sal_uLong nPara = maSelection.GetStart().GetPara(); nPara <= maSelection.GetEnd().GetPara(); nPara++ ) { @@ -326,7 +327,7 @@ void __EXPORT TextUndoSetAttribs::Undo() SetSelection( maSelection ); } -void __EXPORT TextUndoSetAttribs::Redo() +void TextUndoSetAttribs::Redo() { // if ( !bSetIsRemove ) // GetTextEngine()->SetAttribs( aSel, aNewAttribs, nSpecial ); @@ -334,3 +335,5 @@ void __EXPORT TextUndoSetAttribs::Redo() // GetTextEngine()->RemoveCharAttribs( aSel, bRemoveParaAttribs, nRemoveWhich ); SetSelection( maSelection ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textundo.hxx b/svtools/source/edit/textundo.hxx index 357331057aeb..b8189eaa9711 100644 --- a/svtools/source/edit/textundo.hxx +++ b/svtools/source/edit/textundo.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,3 +81,5 @@ public: }; #endif // _TEXTUNDO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx index 0b4fb6ee2ca5..f2b370a9a923 100644 --- a/svtools/source/edit/textview.cxx +++ b/svtools/source/edit/textview.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -43,17 +44,11 @@ #include <sot/formats.hxx> #include <svl/urlbmk.hxx> -#ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_ #include <com/sun/star/i18n/XBreakIterator.hpp> -#endif -#ifndef _COM_SUN_STAR_TEXT_CHARACTERITERATORMODE_HPP_ #include <com/sun/star/i18n/CharacterIteratorMode.hpp> -#endif -#ifndef _COM_SUN_STAR_TEXT_WORDTYPE_HPP_ #include <com/sun/star/i18n/WordType.hpp> -#endif #include <cppuhelper/weak.hxx> #include <vcl/unohelp.hxx> #include <com/sun/star/datatransfer/XTransferable.hpp> @@ -61,9 +56,7 @@ #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#ifndef _COM_SUN_STAR_DATATRANSFER_DND_DNDCONSTANS_HPP_ #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> -#endif #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> @@ -73,7 +66,7 @@ #include <sot/exchange.hxx> #include <sot/formats.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> using namespace ::com::sun::star; @@ -163,9 +156,6 @@ sal_Bool TETextDataObject::isDataFlavorSupported( const datatransfer::DataFlavor return ( nT == SOT_FORMAT_STRING ); } -/*-- 24.06.2004 13:54:36--------------------------------------------------- - - -----------------------------------------------------------------------*/ struct ImpTextView { TextEngine* mpTextEngine; @@ -2096,7 +2086,7 @@ void TextView::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd: { if ( mpImpl->mbClickedInSelection ) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; DBG_ASSERT( mpImpl->maSelection.HasRange(), "TextView::dragGestureRecognized: mpImpl->mbClickedInSelection, but no selection?" ); @@ -2149,7 +2139,7 @@ void TextView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourc void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; sal_Bool bChanges = sal_False; if ( !mpImpl->mbReadOnly && mpImpl->mpDDInfo ) @@ -2265,13 +2255,13 @@ void TextView::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetD void TextView::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; ImpHideDDCursor(); } void TextView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aVclGuard( Application::GetSolarMutex() ); + SolarMutexGuard aVclGuard; if ( !mpImpl->mpDDInfo ) mpImpl->mpDDInfo = new TextDDInfo; @@ -2396,11 +2386,11 @@ TextSelFunctionSet::TextSelFunctionSet( TextView* pView ) mpView = pView; } -void __EXPORT TextSelFunctionSet::BeginDrag() +void TextSelFunctionSet::BeginDrag() { } -void __EXPORT TextSelFunctionSet::CreateAnchor() +void TextSelFunctionSet::CreateAnchor() { // TextSelection aSel( mpView->GetSelection() ); // aSel.GetStart() = aSel.GetEnd(); @@ -2411,27 +2401,27 @@ void __EXPORT TextSelFunctionSet::CreateAnchor() mpView->ImpSetSelection( mpView->mpImpl->maSelection.GetEnd() ); } -sal_Bool __EXPORT TextSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel, sal_Bool ) +sal_Bool TextSelFunctionSet::SetCursorAtPoint( const Point& rPointPixel, sal_Bool ) { return mpView->SetCursorAtPoint( rPointPixel ); } -sal_Bool __EXPORT TextSelFunctionSet::IsSelectionAtPoint( const Point& rPointPixel ) +sal_Bool TextSelFunctionSet::IsSelectionAtPoint( const Point& rPointPixel ) { return mpView->IsSelectionAtPoint( rPointPixel ); } -void __EXPORT TextSelFunctionSet::DeselectAll() +void TextSelFunctionSet::DeselectAll() { CreateAnchor(); } -void __EXPORT TextSelFunctionSet::DeselectAtPoint( const Point& ) +void TextSelFunctionSet::DeselectAtPoint( const Point& ) { // Nur bei Mehrfachselektion } -void __EXPORT TextSelFunctionSet::DestroyAnchor() +void TextSelFunctionSet::DestroyAnchor() { // Nur bei Mehrfachselektion } @@ -2468,3 +2458,4 @@ sal_Bool TextView::IsInsertMode() const void TextView::SupportProtectAttribute(sal_Bool bSupport) { mpImpl->mbSupportProtectAttribute = bSupport;} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textwindowpeer.cxx b/svtools/source/edit/textwindowpeer.cxx index 7f31e95c75a7..00a439eb4cd7 100644 --- a/svtools/source/edit/textwindowpeer.cxx +++ b/svtools/source/edit/textwindowpeer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -57,3 +58,5 @@ namespace svt ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/txtattr.cxx b/svtools/source/edit/txtattr.cxx index 810132731712..022a40ae848f 100644 --- a/svtools/source/edit/txtattr.cxx +++ b/svtools/source/edit/txtattr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -155,43 +156,32 @@ int TextAttribHyperLink::operator==( const TextAttrib& rAttr ) const ( maColor == ((const TextAttribHyperLink&)rAttr).maColor ) ); } -/*-- 24.06.2004 14:49:44--------------------------------------------------- - - -----------------------------------------------------------------------*/ TextAttribProtect::TextAttribProtect() : TextAttrib( TEXTATTR_PROTECTED ) { } -/*-- 24.06.2004 14:49:44--------------------------------------------------- - -----------------------------------------------------------------------*/ TextAttribProtect::TextAttribProtect( const TextAttribProtect&) : TextAttrib( TEXTATTR_PROTECTED ) { } -/*-- 24.06.2004 14:49:44--------------------------------------------------- - -----------------------------------------------------------------------*/ TextAttribProtect::~TextAttribProtect() { } -/*-- 24.06.2004 14:49:44--------------------------------------------------- - -----------------------------------------------------------------------*/ void TextAttribProtect::SetFont( Font& ) const { } -/*-- 24.06.2004 14:49:44--------------------------------------------------- - -----------------------------------------------------------------------*/ TextAttrib* TextAttribProtect::Clone() const { return new TextAttribProtect(); } -/*-- 24.06.2004 14:49:45--------------------------------------------------- - -----------------------------------------------------------------------*/ int TextAttribProtect::operator==( const TextAttrib& rAttr ) const { return ( TextAttrib::operator==(rAttr ) ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/xtextedt.cxx b/svtools/source/edit/xtextedt.cxx index 0241c7c3cbbc..eaef852b9d6d 100644 --- a/svtools/source/edit/xtextedt.cxx +++ b/svtools/source/edit/xtextedt.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -419,3 +420,4 @@ sal_Bool ExtTextView::UnindentBlock() return ImpIndentBlock( sal_False ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/FilterConfigCache.cxx b/svtools/source/filter/FilterConfigCache.cxx index 979eba91767d..73e89d747a21 100644 --- a/svtools/source/filter/FilterConfigCache.cxx +++ b/svtools/source/filter/FilterConfigCache.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -106,10 +107,9 @@ sal_Bool FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUSt if ( sFilterName.EqualsIgnoreCaseAscii( *pPtr ) ) bIsPixelFormat = sal_True; } - String aTemp( OUString::createFromAscii( SVLIBRARY( "?" ) ) ); - xub_StrLen nIndex = aTemp.Search( (sal_Unicode)'?' ); - aTemp.Replace( nIndex, 1, sFilterName ); - sFilterName = aTemp; + rtl::OUString sTemp(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("?"))); + sal_Int32 nIndex = sTemp.indexOf(static_cast<sal_Unicode>('?')); + sFilterName = sTemp.replaceAt(nIndex, 1, sFilterName); } return sFilterName.Len() != 0; } @@ -150,7 +150,7 @@ Reference< XInterface > openConfig(const char* sPackage) { // get access to config API (not to file!) Reference< XMultiServiceFactory > xConfigProvider( xSMGR->createInstance( - OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), UNO_QUERY); + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ))), UNO_QUERY); if (xConfigProvider.is()) { @@ -158,16 +158,16 @@ Reference< XInterface > openConfig(const char* sPackage) PropertyValue aParam ; // define cfg path for open - aParam.Name = OUString::createFromAscii("nodepath"); + aParam.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" )); if (TYPEPKG.equalsIgnoreAsciiCaseAscii(sPackage)) - aParam.Value <<= OUString::createFromAscii("/org.openoffice.TypeDetection.Types/Types"); + aParam.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.TypeDetection.Types/Types" )); if (FILTERPKG.equalsIgnoreAsciiCaseAscii(sPackage)) - aParam.Value <<= OUString::createFromAscii("/org.openoffice.TypeDetection.GraphicFilter/Filters"); + aParam.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.TypeDetection.GraphicFilter/Filters" )); lParams[0] = makeAny(aParam); // get access to file xCfg = xConfigProvider->createInstanceWithArguments( - OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), lParams); + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )), lParams); } } catch(const RuntimeException&) @@ -349,7 +349,6 @@ FilterConfigCache::FilterConfigCache( sal_Bool bConfig ) : FilterConfigCache::~FilterConfigCache() { - } String FilterConfigCache::GetImportFilterName( sal_uInt16 nFormat ) @@ -595,3 +594,5 @@ sal_Bool FilterConfigCache::IsExportDialog( sal_uInt16 nFormat ) } // ------------------------------------------------------------------------ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/FilterConfigCache.hxx b/svtools/source/filter/FilterConfigCache.hxx index 2c6b7361e540..b1579bec092a 100644 --- a/svtools/source/filter/FilterConfigCache.hxx +++ b/svtools/source/filter/FilterConfigCache.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -143,3 +144,4 @@ class SVT_DLLPUBLIC FilterConfigCache #endif // _FILTER_CONFIG_CACHE_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/FilterConfigItem.cxx b/svtools/source/filter/FilterConfigItem.cxx index 8d7752ddd7df..fddeec1f0482 100644 --- a/svtools/source/filter/FilterConfigItem.cxx +++ b/svtools/source/filter/FilterConfigItem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -160,7 +161,7 @@ void FilterConfigItem::ImpInitTree( const String& rSubTree ) } catch ( ::com::sun::star::uno::Exception& ) { - DBG_ERROR( "FilterConfigItem::FilterConfigItem - Could not access configuration Key" ); + OSL_FAIL( "FilterConfigItem::FilterConfigItem - Could not access configuration Key" ); } } } @@ -201,7 +202,7 @@ FilterConfigItem::~FilterConfigItem() } catch ( ::com::sun::star::uno::Exception& ) { - DBG_ERROR( "FilterConfigItem::FilterConfigItem - Could not update configuration data" ); + OSL_FAIL( "FilterConfigItem::FilterConfigItem - Could not update configuration data" ); } } } @@ -364,7 +365,7 @@ Size FilterConfigItem::ReadSize( const OUString& rKey, const Size& rDefault ) } catch ( ::com::sun::star::uno::Exception& ) { - DBG_ERROR( "FilterConfigItem::ReadSize - could not read PropertyValue" ); + OSL_FAIL( "FilterConfigItem::ReadSize - could not read PropertyValue" ); } PropertyValue aWidth; aWidth.Name = sWidth; @@ -441,7 +442,7 @@ void FilterConfigItem::WriteBool( const OUString& rKey, sal_Bool bNewValue ) } catch ( ::com::sun::star::uno::Exception& ) { - DBG_ERROR( "FilterConfigItem::WriteBool - could not set PropertyValue" ); + OSL_FAIL( "FilterConfigItem::WriteBool - could not set PropertyValue" ); } } } @@ -475,7 +476,7 @@ void FilterConfigItem::WriteInt32( const OUString& rKey, sal_Int32 nNewValue ) } catch ( ::com::sun::star::uno::Exception& ) { - DBG_ERROR( "FilterConfigItem::WriteInt32 - could not set PropertyValue" ); + OSL_FAIL( "FilterConfigItem::WriteInt32 - could not set PropertyValue" ); } } } @@ -527,7 +528,7 @@ void FilterConfigItem::WriteSize( const OUString& rKey, const Size& rNewValue ) } catch ( ::com::sun::star::uno::Exception& ) { - DBG_ERROR( "FilterConfigItem::WriteSize - could not read PropertyValue" ); + OSL_FAIL( "FilterConfigItem::WriteSize - could not read PropertyValue" ); } } } @@ -559,7 +560,7 @@ void FilterConfigItem::WriteString( const OUString& rKey, const OUString& rNewVa } catch ( ::com::sun::star::uno::Exception& ) { - DBG_ERROR( "FilterConfigItem::WriteInt32 - could not set PropertyValue" ); + OSL_FAIL( "FilterConfigItem::WriteInt32 - could not set PropertyValue" ); } } } @@ -587,7 +588,7 @@ void FilterConfigItem::WriteAny( const OUString& rKey, const Any& rNewAny ) } catch ( com::sun::star::uno::Exception& ) { - DBG_ERROR( "FilterConfigItem::WriteAny - could not set PropertyValue" ); + OSL_FAIL( "FilterConfigItem::WriteAny - could not set PropertyValue" ); } } @@ -621,3 +622,4 @@ Reference< XStatusIndicator > FilterConfigItem::GetStatusIndicator() const return xStatusIndicator; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter/SvFilterOptionsDialog.cxx index 1c4eeeff1bbf..6f78dd19fb6e 100644 --- a/svtools/source/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter/SvFilterOptionsDialog.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -143,7 +144,7 @@ uno::Sequence< beans::PropertyValue > SvFilterOptionsDialog::getPropertyValues() sal_Int32 i, nCount; for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) { - if ( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) + if ( maMediaDescriptor[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FilterData")) ) break; } if ( i == nCount ) @@ -165,7 +166,7 @@ void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::Prope sal_Int32 i, nCount; for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) { - if ( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) + if ( maMediaDescriptor[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FilterData")) ) { maMediaDescriptor[ i ].Value >>= maFilterDataSequence; } @@ -268,3 +269,4 @@ void SvFilterOptionsDialog::setSourceDocument( const uno::Reference< lang::XComp } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/SvFilterOptionsDialog.hxx b/svtools/source/filter/SvFilterOptionsDialog.hxx index 027fac99c2e8..6cc10d98d6a7 100644 --- a/svtools/source/filter/SvFilterOptionsDialog.hxx +++ b/svtools/source/filter/SvFilterOptionsDialog.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -103,3 +104,4 @@ public: #endif // _SV_FILTER_OPTIONS_DIALOG_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 472fe327329d..0a03904cf176 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -521,7 +522,7 @@ Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) Bitmap aRet; Graphic aGraphic; GraphicFilter aFilter( sal_False ); - if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK ) + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast<com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*>(NULL), NULL ) == GRFILTER_OK ) { aRet = aGraphic.GetBitmap(); } @@ -1510,3 +1511,5 @@ IMPL_LINK( ExportDialog, OK, void *, EMPTYARG ) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/svtools/source/filter/exportdialog.hxx b/svtools/source/filter/exportdialog.hxx index 20a9ac3ea832..d15f143701ec 100644 --- a/svtools/source/filter/exportdialog.hxx +++ b/svtools/source/filter/exportdialog.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -214,3 +215,4 @@ public: #endif // _EXPORTDIALOG_HXX_ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx index 78d97cc25c5c..eb4d4a57ce75 100644 --- a/svtools/source/filter/filter.cxx +++ b/svtools/source/filter/filter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,7 @@ #if defined UNX && defined ALPHA #include <fstream.hxx> #endif -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <comphelper/processfactory.hxx> #include <ucbhelper/content.hxx> #include <cppuhelper/implbase1.hxx> @@ -61,9 +62,7 @@ #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/uno/XWeak.hpp> #include <com/sun/star/uno/XAggregation.hpp> -#ifndef _COM_SUN_STAR_UNO_XTYPEPROVIDER_HPP_ #include <com/sun/star/lang/XTypeProvider.hpp> -#endif #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XOutputStream.hpp> @@ -80,23 +79,11 @@ #define PMGCHUNG_msOG 0x6d734f47 // Microsoft Office Animated GIF -#if (defined OS2 && !defined ICC) - -#define IMPORT_FUNCTION_NAME "_GraphicImport" -#define EXPORT_FUNCTION_NAME "_GraphicExport" -#define IMPDLG_FUNCTION_NAME "_DoImportDialog" -#define EXPDLG_FUNCTION_NAME "_DoExportDialog" - -#else - #define IMPORT_FUNCTION_NAME "GraphicImport" #define EXPORT_FUNCTION_NAME "GraphicExport" #define IMPDLG_FUNCTION_NAME "DoImportDialog" #define EXPDLG_FUNCTION_NAME "DoExportDialog" -#endif - - // ----------- // - statics - // ----------- @@ -112,8 +99,6 @@ static ::osl::Mutex& getListMutex() return s_aListProtection; } -static GraphicFilter* pGraphicFilter=0; - // ------------------------- // - ImpFilterOutputStream - // ------------------------- @@ -146,11 +131,11 @@ sal_Bool ImplDirEntryHelper::Exists( const INetURLObject& rObj ) bExists = aCnt.isDocument(); } - catch( ::com::sun::star::ucb::CommandAbortedException& ) + catch(const ::com::sun::star::ucb::CommandAbortedException&) { DBG_ERRORFILE( "CommandAbortedException" ); } - catch( ::com::sun::star::ucb::ContentCreationException& ) + catch(const ::com::sun::star::ucb::ContentCreationException&) { DBG_ERRORFILE( "ContentCreationException" ); } @@ -170,10 +155,10 @@ void ImplDirEntryHelper::Kill( const String& rMainUrl ) ::ucbhelper::Content aCnt( rMainUrl, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), + aCnt.executeCommand( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "delete" )), ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); } - catch( ::com::sun::star::ucb::CommandAbortedException& ) + catch(const ::com::sun::star::ucb::CommandAbortedException&) { DBG_ERRORFILE( "CommandAbortedException" ); } @@ -244,9 +229,6 @@ inline String ImpGetExtension( const String &rPath ) |* dem Format ist, ODER WENN DAS FORMAT |* DIESER FUNKTION NICHT BEKANNT IST! |* -|* Ersterstellung OH 26.05.95 -|* Letzte Aenderung OH 07.08.95 -|* *************************************************************************/ static sal_Bool ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, sal_Bool bTest ) @@ -1055,7 +1037,6 @@ GraphicFilter::~GraphicFilter() } } - delete pErrorEx; } @@ -1323,16 +1304,17 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& } sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, - sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, sal_uInt32 nImportFlags ) + sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, sal_uInt32 nImportFlags, WMF_APMFILEHEADER *pAPMHeader ) { - return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, NULL ); + return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, NULL, pAPMHeader ); } //------------------------------------------------------------------------- sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, sal_uInt32 nImportFlags, - com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData ) + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData, + WMF_APMFILEHEADER *pAPMHeader ) { String aFilterName; sal_uLong nStmBegin; @@ -1354,7 +1336,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, sal_Int32 i; for ( i = 0; i < pFilterData->getLength(); i++ ) { - if ( (*pFilterData)[ i ].Name.equalsAscii( "PreviewSizeHint" ) ) + if ( (*pFilterData)[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("PreviewSizeHint")) ) { awt::Size aSize; if ( (*pFilterData)[ i ].Value >>= aSize ) @@ -1366,7 +1348,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, nImportFlags &=~GRFILTER_I_FLAGS_FOR_PREVIEW; } } - else if ( (*pFilterData)[ i ].Name.equalsAscii( "AllowPartialStreamRead" ) ) + else if ( (*pFilterData)[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("AllowPartialStreamRead")) ) { (*pFilterData)[ i ].Value >>= bAllowPartialStreamRead; if ( bAllowPartialStreamRead ) @@ -1374,7 +1356,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, else nImportFlags &=~GRFILTER_I_FLAGS_ALLOW_PARTIAL_STREAMREAD; } - else if ( (*pFilterData)[ i ].Name.equalsAscii( "CreateNativeLink" ) ) + else if ( (*pFilterData)[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("CreateNativeLink")) ) { (*pFilterData)[ i ].Value >>= bCreateNativeLink; } @@ -1470,7 +1452,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, break; } } - aIter++; + ++aIter; } } @@ -1509,7 +1491,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, vcl::SVGReader aSVGReader( rIStream ); GDIMetaFile aSVGMtf; - if( 0 == aSVGReader.Read( aSVGMtf ).GetActionCount() ) + if( 0 == aSVGReader.Read( aSVGMtf ).GetActionSize() ) nStatus = GRFILTER_FILTERERROR; else rGraphic = Graphic( aSVGMtf ); @@ -1550,7 +1532,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, aFilterName.EqualsIgnoreCaseAscii( IMP_EMF ) ) { GDIMetaFile aMtf; - if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, NULL ) ) + if( !ConvertWMFToGDIMetaFile( rIStream, aMtf, NULL, pAPMHeader ) ) nStatus = GRFILTER_FORMATERROR; else { @@ -1683,7 +1665,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, { pBuf = new sal_uInt8[ nBufSize ]; } - catch (std::bad_alloc) + catch (const std::bad_alloc&) { nStatus = GRFILTER_TOOBIG; } @@ -1932,7 +1914,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& sal_Int32 k, j, i = 0; for ( i = 0; i < pFilterData->getLength(); i++ ) { - if ( (*pFilterData)[ i ].Name.equalsAscii( "AdditionalChunks" ) ) + if ( (*pFilterData)[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("AdditionalChunks")) ) { com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aAdditionalChunkSequence; if ( (*pFilterData)[ i ].Value >>= aAdditionalChunkSequence ) @@ -2010,10 +1992,10 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& if( xMgr.is() ) { ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > xSaxWriter( xMgr->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" ) ), ::com::sun::star::uno::UNO_QUERY ); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" )) ), ::com::sun::star::uno::UNO_QUERY ); ::com::sun::star::uno::Reference< ::com::sun::star::svg::XSVGWriter > xSVGWriter( xMgr->createInstance( - ::rtl::OUString::createFromAscii( "com.sun.star.svg.SVGWriter" ) ), ::com::sun::star::uno::UNO_QUERY ); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svg.SVGWriter" )) ), ::com::sun::star::uno::UNO_QUERY ); if( xSaxWriter.is() && xSVGWriter.is() ) { @@ -2038,7 +2020,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& } } } - catch( ::com::sun::star::uno::Exception& ) + catch(const ::com::sun::star::uno::Exception&) { nStatus = GRFILTER_IOERROR; } @@ -2123,7 +2105,7 @@ sal_Bool GraphicFilter::DoExportDialog( Window*, sal_uInt16 nFormat, FieldUnit ) xSMgr( ::comphelper::getProcessServiceFactory() ); uno::Reference< com::sun::star::uno::XInterface > xFilterOptionsDialog - ( xSMgr->createInstance( rtl::OUString::createFromAscii( "com.sun.star.svtools.SvFilterOptionsDialog" ) ), + ( xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.svtools.SvFilterOptionsDialog" )) ), com::sun::star::uno::UNO_QUERY ); if ( xFilterOptionsDialog.is() ) { @@ -2209,16 +2191,24 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData*, pData ) return nRet; } -// ------------------------------------------------------------------------ - -GraphicFilter* GraphicFilter::GetGraphicFilter() +namespace { - if( !pGraphicFilter ) + class StandardGraphicFilter { - pGraphicFilter = new GraphicFilter; - pGraphicFilter->GetImportFormatCount(); - } - return pGraphicFilter; + public: + StandardGraphicFilter() + { + m_aFilter.GetImportFormatCount(); + } + GraphicFilter m_aFilter; + }; + + class theGraphicFilter : public rtl::Static<StandardGraphicFilter, theGraphicFilter> {}; +} + +GraphicFilter& GraphicFilter::GetGraphicFilter() +{ + return theGraphicFilter::get().m_aFilter; } int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName, @@ -2226,7 +2216,7 @@ int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName, sal_uInt16* pDeterminedFormat ) { if ( !pFilter ) - pFilter = GetGraphicFilter(); + pFilter = &GetGraphicFilter(); const sal_uInt16 nFilter = rFilterName.Len() && pFilter->GetImportFormatCount() ? pFilter->GetImportFormatNumber( rFilterName ) @@ -2258,3 +2248,5 @@ int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName, return nRes; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/filter2.cxx b/svtools/source/filter/filter2.cxx index 58fafc47c0f2..d34825312470 100644 --- a/svtools/source/filter/filter2.cxx +++ b/svtools/source/filter/filter2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -433,7 +434,6 @@ sal_Bool GraphicDescriptor::ImpDetectJPG( SvStream& rStm, sal_Bool bExtendedInf sal_uInt8 nNumberOfImageComponents; sal_uInt8 nComponentsIdentifier; sal_uInt8 nHorizontalSamplingFactor; - sal_uInt8 nVerticalSamplingFactor; sal_uInt8 nQuantizationTableDestinationSelector; rStm >> nSamplePrecision >> nNumberOfLines @@ -442,7 +442,6 @@ sal_Bool GraphicDescriptor::ImpDetectJPG( SvStream& rStm, sal_Bool bExtendedInf >> nComponentsIdentifier >> nHorizontalSamplingFactor >> nQuantizationTableDestinationSelector; - nVerticalSamplingFactor = nHorizontalSamplingFactor & 0xf; nHorizontalSamplingFactor >>= 4; aPixSize.Height() = nNumberOfLines; @@ -1352,3 +1351,5 @@ String GraphicDescriptor::GetImportFormatShortName( sal_uInt16 nFormat ) return String( aKeyName, RTL_TEXTENCODING_ASCII_US ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/svtools/source/filter/igif/decode.cxx b/svtools/source/filter/igif/decode.cxx index ddea94a5555e..03a69414cd4b 100644 --- a/svtools/source/filter/igif/decode.cxx +++ b/svtools/source/filter/igif/decode.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -213,3 +214,5 @@ sal_Bool GIFLZWDecompressor::ProcessOneCode() return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/igif/decode.hxx b/svtools/source/filter/igif/decode.hxx index e85cc30eaf9e..3dd6328839d9 100644 --- a/svtools/source/filter/igif/decode.hxx +++ b/svtools/source/filter/igif/decode.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _DECODE_HXX #define _DECODE_HXX -#ifndef _BMPACC_HXX #include <vcl/bmpacc.hxx> -#endif struct GIFLZWTableEntry; @@ -66,3 +65,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/igif/gifread.cxx b/svtools/source/filter/igif/gifread.cxx index 16318e5b143e..6765937081d7 100644 --- a/svtools/source/filter/igif/gifread.cxx +++ b/svtools/source/filter/igif/gifread.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -450,7 +451,7 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount ) { if( bInterlaced ) { - long nT1, nT2; + long nT1; // falls Interlaced, werden die Zeilen kopiert if( nLastInterCount ) @@ -488,7 +489,7 @@ void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount ) if( nT1 >= nImageHeight ) { - nT2 = nImageY - ( ( nImageHeight + 7 ) >> 3 ); + long nT2 = nImageY - ( ( nImageHeight + 7 ) >> 3 ); nT1 = ( nT2 << 3 ) + 4; nLastInterCount = 3; @@ -856,3 +857,5 @@ sal_Bool ImportGIF( SvStream & rStm, Graphic& rGraphic ) return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/ixbm/xbmread.cxx b/svtools/source/filter/ixbm/xbmread.cxx index 5084f7267e46..0870eecb7187 100644 --- a/svtools/source/filter/ixbm/xbmread.cxx +++ b/svtools/source/filter/ixbm/xbmread.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -286,7 +287,6 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) if ( rIStm.GetError() != ERRCODE_IO_PENDING ) { ByteString aLine; - int nValue; rIStm.Seek( nLastPos ); bStatus = sal_False; @@ -294,6 +294,7 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) if ( bStatus ) { + int nValue; if ( ( nValue = (int) ParseDefine( aLine.GetBuffer() ) ) > 0 ) { nWidth = nValue; @@ -396,3 +397,5 @@ sal_Bool ImportXBM( SvStream& rStm, Graphic& rGraphic ) return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/ixpm/rgbtable.hxx b/svtools/source/filter/ixpm/rgbtable.hxx index 054e1e86b064..738c3f33460c 100644 --- a/svtools/source/filter/ixpm/rgbtable.hxx +++ b/svtools/source/filter/ixpm/rgbtable.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -693,3 +694,5 @@ static XPMRGBTab pRGBTable[] = { { "LightGreen", 144, 238, 144 }, { NULL, 0 , 0, 0} }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/ixpm/xpmread.cxx b/svtools/source/filter/ixpm/xpmread.cxx index 425ed6323bcc..c218cff1630f 100644 --- a/svtools/source/filter/ixpm/xpmread.cxx +++ b/svtools/source/filter/ixpm/xpmread.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifndef _BMPACC_HXX #include <vcl/bmpacc.hxx> -#endif -#ifndef _GRAPH_HXX #include <vcl/graph.hxx> -#endif #include "rgbtable.hxx" #define _XPMPRIVATE #include "xpmread.hxx" @@ -700,3 +697,5 @@ sal_Bool ImportXPM( SvStream& rStm, Graphic& rGraphic ) return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/jpeg/jpeg.cxx b/svtools/source/filter/jpeg/jpeg.cxx index 2f43b1b025f3..14a6988893c4 100644 --- a/svtools/source/filter/jpeg/jpeg.cxx +++ b/svtools/source/filter/jpeg/jpeg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -775,3 +776,5 @@ sal_Bool ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, JPEGWriter aJPEGWriter( rOStm, pFilterData, pExportWasGrey ); return aJPEGWriter.Write( rGraphic ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/jpeg/jpeg.h b/svtools/source/filter/jpeg/jpeg.h index ca9b294d2f9d..a77c335d4b66 100644 --- a/svtools/source/filter/jpeg/jpeg.h +++ b/svtools/source/filter/jpeg/jpeg.h @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -68,3 +69,5 @@ void* CreateBitmap( void* pJPEGReader, void* pJPEGCreateBitmapParam ); void SetJpegPreviewSizeHint( int nWidth, int nHeight ); #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/jpeg/jpegc.c b/svtools/source/filter/jpeg/jpegc.c index 8d3a82a86ef3..06c7d4f69964 100644 --- a/svtools/source/filter/jpeg/jpegc.c +++ b/svtools/source/filter/jpeg/jpegc.c @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -282,3 +283,5 @@ Exit: return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/sgfbram.cxx b/svtools/source/filter/sgfbram.cxx index 9b981f8c0d94..8559cbee30eb 100644 --- a/svtools/source/filter/sgfbram.cxx +++ b/svtools/source/filter/sgfbram.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,10 +42,6 @@ |* |* operator>>( SvStream&, SgfHeader& ) |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead) { @@ -70,10 +67,6 @@ SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead) |* |* SgfHeader::ChkMagic() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ sal_Bool SgfHeader::ChkMagic() { return Magic=='J'*256+'J'; } @@ -86,10 +79,6 @@ sal_uInt32 SgfHeader::GetOffset() |* |* operator>>( SvStream&, SgfEntry& ) |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ SvStream& operator>>(SvStream& rIStream, SgfEntry& rEntr) { @@ -113,10 +102,6 @@ sal_uInt32 SgfEntry::GetOffset() |* |* operator>>( SvStream&, SgfVector& ) |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ SvStream& operator>>(SvStream& rIStream, SgfVector& rVect) { @@ -136,10 +121,6 @@ SvStream& operator>>(SvStream& rIStream, SgfVector& rVect) |* |* operator<<( SvStream&, BmpFileHeader& ) |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ SvStream& operator<<(SvStream& rOStream, BmpFileHeader& rHead) { @@ -186,10 +167,6 @@ sal_uInt32 BmpFileHeader::GetOfs() |* |* operator<<( SvStream&, BmpInfoHeader& ) |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ SvStream& operator<<(SvStream& rOStream, BmpInfoHeader& rInfo) { @@ -228,10 +205,6 @@ SvStream& operator<<(SvStream& rOStream, BmpInfoHeader& rInfo) |* |* operator<<( SvStream&, RGBQuad& ) |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ SvStream& operator<<(SvStream& rOStream, const RGBQuad& rQuad) { @@ -277,10 +250,6 @@ sal_uInt8 PcxExpand::GetByte(SvStream& rInp) |* |* SgfFilterBmp() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ sal_Bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) { @@ -292,7 +261,7 @@ sal_Bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntr sal_uInt16 nColBits; // Anzahl der Bits/Pixel (2, 4, 8) sal_uInt16 i,j,k; // Spaltenzaehler, Zeilenzaehler, Planezaehler sal_uInt16 a,b; // Hilfsvariable - sal_uInt8 pl1 = 0,pl2= 0; // Masken fuer die Planes + sal_uInt8 pl1 = 0; // Masken fuer die Planes sal_uInt8* pBuf=NULL; // Buffer fuer eine Pixelzeile PcxExpand aPcx; sal_uLong nOfs; @@ -339,6 +308,8 @@ sal_Bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntr rOut.Write((char*)pBuf,nWdtOut); } } else if (nColors==16) { + sal_uInt8 pl2= 0; // Masken fuer die Planes + rOut<<RGBQuad(0x00,0x00,0x00); // Schwarz rOut<<RGBQuad(0x24,0x24,0x24); // Grau 80% rOut<<RGBQuad(0x49,0x49,0x49); // Grau 60% @@ -414,10 +385,6 @@ sal_Bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntr |* |* SgfBMapFilter() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ sal_Bool SgfBMapFilter(SvStream& rInp, SvStream& rOut) { @@ -492,10 +459,6 @@ Color Hpgl2SvFarbe( sal_uInt8 nFarb ) |* |* SgfFilterVect() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ sal_Bool SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMtf) { @@ -569,10 +532,6 @@ sal_Bool SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& |* |* SgfVectFilter() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ sal_Bool SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf) { @@ -607,10 +566,6 @@ sal_Bool SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf) |* |* SgfFilterPScr() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ sal_Bool SgfFilterPScr(SvStream&, SgfHeader&, SgfEntry&) { @@ -623,8 +578,6 @@ sal_Bool SgfFilterPScr(SvStream&, SgfHeader&, SgfEntry&) |* CheckSgfTyp() |* |* Beschreibung Feststellen, um was fuer ein SGF/SGV es sich handelt. -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 |* *************************************************************************/ sal_uInt8 CheckSgfTyp(SvStream& rInp, sal_uInt16& nVersion) @@ -660,3 +613,5 @@ sal_uInt8 CheckSgfTyp(SvStream& rInp, sal_uInt16& nVersion) return SGF_DONTKNOW; } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/sgvmain.cxx b/svtools/source/filter/sgvmain.cxx index 3b0f3ebd2912..ad0c530382f8 100644 --- a/svtools/source/filter/sgvmain.cxx +++ b/svtools/source/filter/sgvmain.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -39,10 +40,6 @@ #include "sgvspln.hxx" #include <unotools/ucbstreamhelper.hxx> -//#if OSL_DEBUG_LEVEL > 1 -//#include "Debug.c" -//#endif - #define SWAPPOINT(p) { \ p.x=SWAPSHORT(p.x); \ p.y=SWAPSHORT(p.y); } @@ -326,10 +323,6 @@ SvStream& operator>>(SvStream& rInp, GrupType& rGrup) |* |* Sgv2SvFarbe() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ Color Sgv2SvFarbe(sal_uInt8 nFrb1, sal_uInt8 nFrb2, sal_uInt8 nInts) { @@ -422,10 +415,6 @@ void SetArea(ObjAreaType& rArea, OutputDevice& rOut) |* |* ObjkType::DrawObjekt() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ void ObjkType::Draw(OutputDevice&) { @@ -438,10 +427,6 @@ void Obj0Type::Draw(OutputDevice&) {} |* |* StrkType::DrawObjekt() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ void StrkType::Draw(OutputDevice& rOut) { @@ -453,10 +438,6 @@ void StrkType::Draw(OutputDevice& rOut) |* |* RectType::DrawObjekt() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ void SgfAreaColorIntens(sal_uInt16 Muster, sal_uInt8 Col1, sal_uInt8 Col2, sal_uInt8 Int, OutputDevice& rOut) { @@ -598,10 +579,6 @@ void RectType::Draw(OutputDevice& rOut) |* |* PolyType::Draw() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ void PolyType::Draw(OutputDevice& rOut) { @@ -621,10 +598,6 @@ void PolyType::Draw(OutputDevice& rOut) |* |* SplnType::Draw() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ void SplnType::Draw(OutputDevice& rOut) { @@ -647,10 +620,6 @@ void SplnType::Draw(OutputDevice& rOut) |* |* CircType::Draw() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ void DrawSlideCirc(sal_Int16 cx, sal_Int16 cy, sal_Int16 rx, sal_Int16 ry, ObjAreaType& F, OutputDevice& rOut) { @@ -794,16 +763,11 @@ void CircType::Draw(OutputDevice& rOut) |* |* BmapType::Draw() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ void BmapType::Draw(OutputDevice& rOut) { //ifstream aInp; - unsigned char nSgfTyp; sal_uInt16 nVersion; String aStr( reinterpret_cast< char const * >(&Filename[ 1 ]), @@ -813,13 +777,12 @@ void BmapType::Draw(OutputDevice& rOut) SvStream* pInp = ::utl::UcbStreamHelper::CreateStream( aFNam.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); if ( pInp ) { - nSgfTyp=CheckSgfTyp( *pInp,nVersion); + unsigned char nSgfTyp=CheckSgfTyp( *pInp,nVersion); switch(nSgfTyp) { case SGF_BITIMAGE: { GraphicFilter aFlt; Graphic aGrf; - sal_uInt16 nRet; - nRet=aFlt.ImportGraphic(aGrf,aFNam); + aFlt.ImportGraphic(aGrf,aFNam); aGrf.Draw(&rOut,Point(Pos1.x,Pos1.y),Size(Pos2.x-Pos1.x,Pos2.y-Pos1.y)); } break; case SGF_SIMPVECT: { @@ -851,10 +814,6 @@ void BmapType::Draw(OutputDevice& rOut) |* |* GrupType::... |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ sal_uInt32 GrupType::GetSubPtr() { @@ -865,10 +824,6 @@ sal_uInt32 GrupType::GetSubPtr() |* |* DrawObjkList() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ void DrawObjkList( SvStream& rInp, OutputDevice& rOut ) { @@ -954,10 +909,6 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut ) |* |* SkipObjkList() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ void SkipObjkList(SvStream& rInp) { @@ -980,10 +931,6 @@ void SkipObjkList(SvStream& rInp) |* |* SgfFilterSDrw() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ sal_Bool SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf ) { @@ -1040,10 +987,6 @@ sal_Bool SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf |* |* SgfSDrwFilter() |* -|* Beschreibung -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 -|* *************************************************************************/ sal_Bool SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath ) { @@ -1128,3 +1071,4 @@ for n:=0 to 63 do end; */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/sgvspln.cxx b/svtools/source/filter/sgvspln.cxx index aac7e1f04e0a..864ff3ee5c8b 100644 --- a/svtools/source/filter/sgvspln.cxx +++ b/svtools/source/filter/sgvspln.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,10 +34,6 @@ #include <tools/poly.hxx> -#if defined( PM2 ) && defined( __BORLANDC__ ) -#pragma option -Od -#endif - extern "C" { /*.pn 277 */ @@ -449,8 +446,6 @@ sal_uInt16 ZyklTriDiagGS(sal_Bool rep, sal_uInt16 n, double* lower, double* diag |* |* Beschreibung Berechnet die Koeffizienten eines natuerlichen |* kubischen Polynomsplines mit n Stuetzstellen. -|* Ersterstellung JOE 17-08.93 -|* Letzte Aenderung JOE 17-08.93 |* *************************************************************************/ @@ -557,8 +552,6 @@ sal_uInt16 NaturalSpline(sal_uInt16 n, double* x, double* y, |* |* Beschreibung Berechnet die Koeffizienten eines periodischen |* kubischen Polynomsplines mit n Stuetzstellen. -|* Ersterstellung JOE 17-08.93 -|* Letzte Aenderung JOE 17-08.93 |* *************************************************************************/ @@ -636,8 +629,6 @@ sal_uInt16 PeriodicSpline(sal_uInt16 n, double* x, double* y, |* Beschreibung Berechnet die Koeffizienten eines parametrischen |* natuerlichen oder periodischen kubischen |* Polynomsplines mit n Stuetzstellen. -|* Ersterstellung JOE 17-08.93 -|* Letzte Aenderung JOE 17-08.93 |* *************************************************************************/ @@ -648,7 +639,7 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond, double* bx, double* cx, double* dx, double* by, double* cy, double* dy) { - sal_uInt16 Error,Marg; + sal_uInt16 Error; sal_uInt16 i; double deltX,deltY,delt, alphX = 0,alphY = 0, @@ -666,9 +657,8 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond, } } switch (MargCond) { - case 0: Marg=0; break; + case 0: break; case 1: case 2: { - Marg=MargCond; alphX=Marg01; betX=MargN1; alphY=Marg02; betY=MargN2; } break; @@ -677,7 +667,6 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond, if (y[n]!=y[0]) return 4; } break; case 4: { - Marg=1; if (abs(Marg01)>=MAXROOT) { alphX=0.0; alphY=sign(1.0,y[1]-y[0]); @@ -724,8 +713,6 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond, |* ist Speicher fuer die Koeffizientenarrays |* allokiert, der dann spaeter vom Aufrufer mittels |* delete freizugeben ist. -|* Ersterstellung JOE 17-08.93 -|* Letzte Aenderung JOE 17-08.93 |* *************************************************************************/ @@ -734,7 +721,7 @@ sal_Bool CalcSpline(Polygon& rPoly, sal_Bool Periodic, sal_uInt16& n, double*& cx, double*& cy, double*& dx, double*& dy, double*& T) { sal_uInt8 Marg; - double Marg01,Marg02; + double Marg01; double MargN1,MargN2; sal_uInt16 i; Point P0(-32768,-32768); @@ -773,7 +760,6 @@ sal_Bool CalcSpline(Polygon& rPoly, sal_Bool Periodic, sal_uInt16& n, T =new double[n+1]; Marg01=0.0; - Marg02=0.0; MargN1=0.0; MargN2=0.0; if (n>0) n--; // n Korregieren (Anzahl der Teilpolynome) @@ -813,15 +799,10 @@ sal_Bool CalcSpline(Polygon& rPoly, sal_Bool Periodic, sal_uInt16& n, |* Fall hat das Polygon 0, im 2. Fall PolyMax Punkte. |* Um Koordinatenueberlaeufe zu vermeiden werden diese |* auf +/-32000 begrenzt. -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 |* *************************************************************************/ sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly) { - short MinKoord=-32000; // zur Vermeidung - short MaxKoord=32000; // von Ueberlaeufen - double* ax; // Koeffizienten der Polynome double* ay; double* bx; @@ -832,19 +813,20 @@ sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly) double* dy; double* tv; - double Step; // Schrittweite fuer t - double dt1,dt2,dt3; // Delta t, y, ^3 - double t; sal_Bool bEnde; // Teilpolynom zu Ende? sal_uInt16 n; // Anzahl der zu zeichnenden Teilpolynome sal_uInt16 i; // aktuelles Teilpolynom sal_Bool bOk; // noch alles ok? - sal_uInt16 PolyMax=16380;// Maximale Anzahl von Polygonpunkten - long x,y; bOk=CalcSpline(rSpln,Periodic,n,ax,ay,bx,by,cx,cy,dx,dy,tv); if (bOk) { - Step =10; + short MinKoord=-32000; // zur Vermeidung + short MaxKoord=32000; // von Ueberlaeufen + double Step =10; + double dt1,dt2,dt3; // Delta t, y, ^3 + double t; + sal_uInt16 PolyMax=16380;// Maximale Anzahl von Polygonpunkten + long x,y; rPoly.SetSize(1); rPoly.SetPoint(Point(short(ax[0]),short(ay[0])),0); // erster Punkt @@ -884,3 +866,5 @@ sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly) rPoly.SetSize(0); return sal_False; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx index f0130b21c9d6..ddda27f2efa2 100644 --- a/svtools/source/filter/sgvtext.cxx +++ b/svtools/source/filter/sgvtext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -34,7 +35,6 @@ #include "sgffilt.hxx" #include "sgfbram.hxx" #include "sgvmain.hxx" -// #include "Debug.c" extern SgfFontLst* pSgfFonts; @@ -617,8 +617,8 @@ sal_uInt16 SetTextContext(OutputDevice& rOut, ObjTextType& Atr, sal_Bool Kapt, s switch (Atr.GetFont()) { case 92500: case 92501: case 92504: case 92505: { -#if defined(WNT) || defined(PM2) - FNam=String::CreateFromAscii( "Times New Roman" ); // CG Times ist unter Windows und OS/2 Times New Roman +#if defined(WNT) + FNam=String::CreateFromAscii( "Times New Roman" ); // CG Times ist unter Windows Times New Roman #else FNam=String::CreateFromAscii( "Times" ); // ansonsten ist das einfach Times #endif @@ -765,7 +765,6 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A sal_uInt16& nChars, sal_uInt16 Rest, short* Line, UCHAR* cLine) { - sal_uInt16 KernDist=0; // Wert fuer Kerning sal_uInt16 ChrWidth; UCHAR c; UCHAR c1; @@ -775,6 +774,7 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A AbsEnd=(c==AbsatzEnd || c==TextEnd); if (AbsEnd==sal_False) { + sal_uInt16 KernDist=0; // Wert fuer Kerning R.OutCh=ConvertTextChar(c); // von HardTrenn nach '-', ... R.Kapt=(R.Attrib.Schnitt & TextKaptBit) !=0 && UpcasePossible(R.OutCh); if (R.Kapt) R.OutCh=Upcase(R.OutCh); @@ -1031,10 +1031,6 @@ void DrawChar(OutputDevice& rOut, UCHAR c, ObjTextType T, PointType Pos, sal_uIn |* |* TextType::Draw() |* -|* Beschreibung -|* Ersterstellung JOE 09.08.93 -|* Letzte Aenderung JOE 09.08.93 -|* *************************************************************************/ void TextType::Draw(OutputDevice& rOut) { @@ -1332,3 +1328,5 @@ SgfFontOne* SgfFontLst::GetFontDesc(sal_uInt32 ID) } return LastLn; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/emfwr.cxx b/svtools/source/filter/wmf/emfwr.cxx index 99ca92c76abb..4efaa1bbbb88 100644 --- a/svtools/source/filter/wmf/emfwr.cxx +++ b/svtools/source/filter/wmf/emfwr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -169,9 +170,9 @@ // - EMFWriter - // ------------- -sal_Bool EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfigItem* pFilterConfigItem ) +sal_Bool EMFWriter::WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pFilterConfigItem ) { - const sal_uLong nHeaderPos = rOStm.Tell(); + const sal_uLong nHeaderPos = m_rStm.Tell(); mpHandlesUsed = new sal_Bool[ MAXHANDLES ]; memset( mpHandlesUsed, 0, MAXHANDLES * sizeof( sal_Bool ) ); @@ -179,7 +180,6 @@ sal_Bool EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterCo mnLineHandle = mnFillHandle = mnTextHandle = HANDLE_INVALID; mbRecordOpen = sal_False; - mpStm = &rOStm; maVDev.EnableOutput( sal_False ); maVDev.SetMapMode( rMtf.GetPrefMapMode() ); mpFilterConfigItem = pFilterConfigItem; @@ -192,51 +192,51 @@ sal_Bool EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterCo // seek over header // use [MS-EMF 2.2.11] HeaderExtension2 Object, otherwise resulting EMF cannot be converted with GetWinMetaFileBits() - rOStm.SeekRel( 108 ); + m_rStm.SeekRel( 108 ); // write initial values // set 100th mm map mode in EMF ImplBeginRecord( WIN_EMR_SETMAPMODE ); - (*mpStm) << (sal_Int32) MM_ANISOTROPIC; + m_rStm << (sal_Int32) MM_ANISOTROPIC; ImplEndRecord(); ImplBeginRecord( WIN_EMR_SETVIEWPORTEXTEX ); - (*mpStm) << (sal_Int32) maVDev.ImplGetDPIX() << (sal_Int32) maVDev.ImplGetDPIY(); + m_rStm << (sal_Int32) maVDev.ImplGetDPIX() << (sal_Int32) maVDev.ImplGetDPIY(); ImplEndRecord(); ImplBeginRecord( WIN_EMR_SETWINDOWEXTEX ); - (*mpStm) << (sal_Int32) 2540 << (sal_Int32) 2540; + m_rStm << (sal_Int32) 2540 << (sal_Int32) 2540; ImplEndRecord(); ImplBeginRecord( WIN_EMR_SETVIEWPORTORGEX ); - (*mpStm) << (sal_Int32) 0 << (sal_Int32) 0; + m_rStm << (sal_Int32) 0 << (sal_Int32) 0; ImplEndRecord(); ImplBeginRecord( WIN_EMR_SETWINDOWORGEX ); - (*mpStm) << (sal_Int32) 0 << (sal_Int32) 0; + m_rStm << (sal_Int32) 0 << (sal_Int32) 0; ImplEndRecord(); ImplWriteRasterOp( ROP_OVERPAINT ); ImplBeginRecord( WIN_EMR_SETBKMODE ); - (*mpStm) << (sal_uInt32) 1; // TRANSPARENT + m_rStm << (sal_uInt32) 1; // TRANSPARENT ImplEndRecord(); // write emf data ImplWrite( rMtf ); ImplBeginRecord( WIN_EMR_EOF ); - (*mpStm)<< (sal_uInt32)0 // nPalEntries + m_rStm<< (sal_uInt32)0 // nPalEntries << (sal_uInt32)0x10 // offPalEntries << (sal_uInt32)0x14; // nSizeLast ImplEndRecord(); // write header - const sal_uLong nEndPos = mpStm->Tell(); mpStm->Seek( nHeaderPos ); + const sal_uLong nEndPos = m_rStm.Tell(); m_rStm.Seek( nHeaderPos ); - (*mpStm) << (sal_uInt32) 0x00000001 << (sal_uInt32) 108 //use [MS-EMF 2.2.11] HeaderExtension2 Object + m_rStm << (sal_uInt32) 0x00000001 << (sal_uInt32) 108 //use [MS-EMF 2.2.11] HeaderExtension2 Object << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) ( aMtfSizePix.Width() - 1 ) << (sal_Int32) ( aMtfSizePix.Height() - 1 ) << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) ( aMtfSizeLog.Width() - 1 ) << (sal_Int32) ( aMtfSizeLog.Height() - 1 ) << (sal_uInt32) 0x464d4520 << (sal_uInt32) 0x10000 << (sal_uInt32) ( nEndPos - nHeaderPos ) @@ -246,10 +246,10 @@ sal_Bool EMFWriter::WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterCo << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_Int32) ( aMtfSizeLog.Width() * 10 ) << (sal_Int32) ( aMtfSizeLog.Height() * 10 ); //use [MS-EMF 2.2.11] HeaderExtension2 Object - mpStm->Seek( nEndPos ); + m_rStm.Seek( nEndPos ); delete[] mpHandlesUsed; - return( mpStm->GetError() == ERRCODE_NONE ); + return( m_rStm.GetError() == ERRCODE_NONE ); } // ----------------------------------------------------------------------------- @@ -290,10 +290,10 @@ void EMFWriter::ImplBeginRecord( sal_uInt32 nType ) if( !mbRecordOpen ) { mbRecordOpen = sal_True; - mnRecordPos = mpStm->Tell(); + mnRecordPos = m_rStm.Tell(); - (*mpStm) << nType; - mpStm->SeekRel( 4 ); + m_rStm << nType; + m_rStm.SeekRel( 4 ); } } @@ -305,16 +305,16 @@ void EMFWriter::ImplEndRecord() if( mbRecordOpen ) { - sal_Int32 nFillBytes, nActPos = mpStm->Tell(); - mpStm->Seek( mnRecordPos + 4 ); + sal_Int32 nFillBytes, nActPos = m_rStm.Tell(); + m_rStm.Seek( mnRecordPos + 4 ); nFillBytes = nActPos - mnRecordPos; nFillBytes += 3; // each record has to be dword aligned nFillBytes ^= 3; nFillBytes &= 3; - *mpStm << (sal_uInt32)( ( nActPos - mnRecordPos ) + nFillBytes ); - mpStm->Seek( nActPos ); + m_rStm << (sal_uInt32)( ( nActPos - mnRecordPos ) + nFillBytes ); + m_rStm.Seek( nActPos ); while( nFillBytes-- ) - *mpStm << (sal_uInt8)0; + m_rStm << (sal_uInt8)0; mnRecordCount++; mbRecordOpen = sal_False; } @@ -337,12 +337,12 @@ sal_Bool EMFWriter::ImplPrepareHandleSelect( sal_uInt32& rHandle, sal_uLong nSel // select stock object first ImplBeginRecord( WIN_EMR_SELECTOBJECT ); - ( *mpStm ) << nStockObject; + m_rStm << nStockObject; ImplEndRecord(); // destroy handle of created object ImplBeginRecord( WIN_EMR_DELETEOBJECT ); - ( *mpStm ) << rHandle; + m_rStm << rHandle; ImplEndRecord(); // mark handle as free @@ -364,12 +364,12 @@ void EMFWriter::ImplCheckLineAttr() sal_uInt32 nWidth = 0, nHeight = 0; ImplBeginRecord( WIN_EMR_CREATEPEN ); - (*mpStm) << mnLineHandle << nStyle << nWidth << nHeight; + m_rStm << mnLineHandle << nStyle << nWidth << nHeight; ImplWriteColor( maVDev.GetLineColor() ); ImplEndRecord(); ImplBeginRecord( WIN_EMR_SELECTOBJECT ); - (*mpStm) << mnLineHandle; + m_rStm << mnLineHandle; ImplEndRecord(); } } @@ -384,13 +384,13 @@ void EMFWriter::ImplCheckFillAttr() sal_uInt32 nPatternStyle = 0; ImplBeginRecord( WIN_EMR_CREATEBRUSHINDIRECT ); - (*mpStm) << mnFillHandle << nStyle; + m_rStm << mnFillHandle << nStyle; ImplWriteColor( maVDev.GetFillColor() ); - (*mpStm) << nPatternStyle; + m_rStm << nPatternStyle; ImplEndRecord(); ImplBeginRecord( WIN_EMR_SELECTOBJECT ); - (*mpStm) << mnFillHandle; + m_rStm << mnFillHandle; ImplEndRecord(); } } @@ -408,10 +408,10 @@ void EMFWriter::ImplCheckTextAttr() sal_uInt8 nPitchAndFamily; ImplBeginRecord( WIN_EMR_EXTCREATEFONTINDIRECTW ); - (*mpStm) << mnTextHandle; + m_rStm << mnTextHandle; ImplWriteExtent( -rFont.GetSize().Height() ); ImplWriteExtent( rFont.GetSize().Width() ); - (*mpStm) << (sal_Int32) rFont.GetOrientation() << (sal_Int32) rFont.GetOrientation(); + m_rStm << (sal_Int32) rFont.GetOrientation() << (sal_Int32) rFont.GetOrientation(); switch( rFont.GetWeight() ) { @@ -428,12 +428,12 @@ void EMFWriter::ImplCheckTextAttr() default: nWeight = 0; break; } - (*mpStm) << nWeight; - (*mpStm) << (sal_uInt8) ( ( ITALIC_NONE == rFont.GetItalic() ) ? 0 : 1 ); - (*mpStm) << (sal_uInt8) ( ( UNDERLINE_NONE == rFont.GetUnderline() ) ? 0 : 1 ); - (*mpStm) << (sal_uInt8) ( ( STRIKEOUT_NONE == rFont.GetStrikeout() ) ? 0 : 1 ); - (*mpStm) << (sal_uInt8) ( ( RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet() ) ? 2 : 0 ); - (*mpStm) << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0; + m_rStm << nWeight; + m_rStm << (sal_uInt8) ( ( ITALIC_NONE == rFont.GetItalic() ) ? 0 : 1 ); + m_rStm << (sal_uInt8) ( ( UNDERLINE_NONE == rFont.GetUnderline() ) ? 0 : 1 ); + m_rStm << (sal_uInt8) ( ( STRIKEOUT_NONE == rFont.GetStrikeout() ) ? 0 : 1 ); + m_rStm << (sal_uInt8) ( ( RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet() ) ? 2 : 0 ); + m_rStm << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0; switch( rFont.GetPitch() ) { @@ -452,33 +452,33 @@ void EMFWriter::ImplCheckTextAttr() default: break; } - (*mpStm) << nPitchAndFamily; + m_rStm << nPitchAndFamily; for( i = 0; i < 32; i++ ) - (*mpStm) << (sal_Unicode) ( ( i < aFontName.Len() ) ? aFontName.GetChar( i ) : 0 ); + m_rStm << (sal_Unicode) ( ( i < aFontName.Len() ) ? aFontName.GetChar( i ) : 0 ); // dummy elfFullName for( i = 0; i < 64; i++ ) - (*mpStm) << (sal_Unicode) 0; + m_rStm << (sal_Unicode) 0; // dummy elfStyle for( i = 0; i < 32; i++ ) - (*mpStm) << (sal_Unicode) 0; + m_rStm << (sal_Unicode) 0; // dummy elfVersion, elfStyleSize, elfMatch, elfReserved - (*mpStm) << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 ; + m_rStm << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 ; // dummy elfVendorId - (*mpStm) << (sal_uInt32) 0; + m_rStm << (sal_uInt32) 0; // dummy elfCulture - (*mpStm) << (sal_uInt32) 0; + m_rStm << (sal_uInt32) 0; // dummy elfPanose - (*mpStm) << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0; + m_rStm << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0; // fill record to get a record size divideable by 4 - (*mpStm) << (sal_uInt16) 0; + m_rStm << (sal_uInt16) 0; ImplEndRecord(); @@ -494,7 +494,7 @@ void EMFWriter::ImplCheckTextAttr() nTextAlign |= mnHorTextAlign; ImplBeginRecord( WIN_EMR_SETTEXTALIGN ); - (*mpStm) << nTextAlign; + m_rStm << nTextAlign; ImplEndRecord(); // Text color @@ -503,7 +503,7 @@ void EMFWriter::ImplCheckTextAttr() ImplEndRecord(); ImplBeginRecord( WIN_EMR_SELECTOBJECT ); - (*mpStm) << mnTextHandle; + m_rStm << mnTextHandle; ImplEndRecord(); } } @@ -517,7 +517,7 @@ void EMFWriter::ImplWriteColor( const Color& rColor ) nCol |= ( (sal_uInt32) rColor.GetGreen() ) << 8; nCol |= ( (sal_uInt32) rColor.GetBlue() ) << 16; - (*mpStm) << nCol; + m_rStm << nCol; } // ----------------------------------------------------------------------------- @@ -534,7 +534,7 @@ void EMFWriter::ImplWriteRasterOp( RasterOp eRop ) } ImplBeginRecord( WIN_EMR_SETROP2 ); - (*mpStm) << nROP2; + m_rStm << nROP2; ImplEndRecord(); } @@ -543,7 +543,7 @@ void EMFWriter::ImplWriteRasterOp( RasterOp eRop ) void EMFWriter::ImplWriteExtent( long nExtent ) { nExtent = maVDev.LogicToLogic( Size( nExtent, 0 ), maVDev.GetMapMode(), maDestMapMode ).Width(); - (*mpStm) << (sal_Int32) nExtent; + m_rStm << (sal_Int32) nExtent; } // ----------------------------------------------------------------------------- @@ -551,7 +551,7 @@ void EMFWriter::ImplWriteExtent( long nExtent ) void EMFWriter::ImplWritePoint( const Point& rPoint ) { const Point aPoint( maVDev.LogicToLogic( rPoint, maVDev.GetMapMode(), maDestMapMode )); - (*mpStm) << (sal_Int32) aPoint.X() << (sal_Int32) aPoint.Y(); + m_rStm << (sal_Int32) aPoint.X() << (sal_Int32) aPoint.Y(); } // ----------------------------------------------------------------------------- @@ -559,7 +559,7 @@ void EMFWriter::ImplWritePoint( const Point& rPoint ) void EMFWriter::ImplWriteSize( const Size& rSize) { const Size aSize( maVDev.LogicToLogic( rSize, maVDev.GetMapMode(), maDestMapMode )); - (*mpStm) << (sal_Int32) aSize.Width() << (sal_Int32) aSize.Height(); + m_rStm << (sal_Int32) aSize.Width() << (sal_Int32) aSize.Height(); } // ----------------------------------------------------------------------------- @@ -567,7 +567,7 @@ void EMFWriter::ImplWriteSize( const Size& rSize) void EMFWriter::ImplWriteRect( const Rectangle& rRect ) { const Rectangle aRect( maVDev.LogicToLogic ( rRect, maVDev.GetMapMode(), maDestMapMode )); - (*mpStm) << aRect.Left() << aRect.Top() << aRect.Right() << aRect.Bottom(); + m_rStm << aRect.Left() << aRect.Top() << aRect.Right() << aRect.Bottom(); } // ----------------------------------------------------------------------------- @@ -587,7 +587,7 @@ void EMFWriter::ImplWritePolygonRecord( const Polygon& rPoly, sal_Bool bClose ) ImplBeginRecord( bClose ? WIN_EMR_POLYGON : WIN_EMR_POLYLINE ); ImplWriteRect( rPoly.GetBoundRect() ); - (*mpStm) << (sal_uInt32) rPoly.GetSize(); + m_rStm << (sal_uInt32) rPoly.GetSize(); for( sal_uInt16 i = 0; i < rPoly.GetSize(); i++ ) ImplWritePoint( rPoly[ i ] ); @@ -629,10 +629,10 @@ void EMFWriter::ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly ) ImplBeginRecord( WIN_EMR_POLYPOLYGON ); ImplWriteRect( rPolyPoly.GetBoundRect() ); - (*mpStm) << (sal_uInt32)nPolyCount << nTotalPoints; + m_rStm << (sal_uInt32)nPolyCount << nTotalPoints; for( i = 0; i < nPolyCount; i++ ) - (*mpStm) << (sal_uInt32)rPolyPoly[ i ].GetSize(); + m_rStm << (sal_uInt32)rPolyPoly[ i ].GetSize(); for( i = 0; i < nPolyCount; i++ ) { @@ -688,7 +688,7 @@ void EMFWriter::ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClosed ) for ( o = 0; o < nBezPoints; o++ ) aNewPoly[ o + 1 ] = rPoly[ n + o ]; ImplWriteRect( aNewPoly.GetBoundRect() ); - (*mpStm) << (sal_uInt32)nBezPoints; + m_rStm << (sal_uInt32)nBezPoints; for( o = 1; o < aNewPoly.GetSize(); o++ ) ImplWritePoint( aNewPoly[ o ] ); ImplEndRecord(); @@ -708,7 +708,7 @@ void EMFWriter::ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClosed ) for ( o = 1; o <= nPoints; o++ ) aNewPoly[ o ] = rPoly[ n - 1 + o ]; ImplWriteRect( aNewPoly.GetBoundRect() ); - (*mpStm) << (sal_uInt32)( nPoints ); + m_rStm << (sal_uInt32)( nPoints ); for( o = 1; o < aNewPoly.GetSize(); o++ ) ImplWritePoint( aNewPoly[ o ] ); ImplEndRecord(); @@ -748,13 +748,13 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, ImplBeginRecord( WIN_EMR_STRETCHDIBITS ); ImplWriteRect( Rectangle( rPt, rSz ) ); ImplWritePoint( rPt ); - (*mpStm) << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) aBmpSizePixel.Width() << (sal_Int32) aBmpSizePixel.Height(); + m_rStm << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) aBmpSizePixel.Width() << (sal_Int32) aBmpSizePixel.Height(); // write offset positions and sizes later - const sal_uLong nOffPos = mpStm->Tell(); - mpStm->SeekRel( 16 ); + const sal_uLong nOffPos = m_rStm.Tell(); + m_rStm.SeekRel( 16 ); - (*mpStm) << (sal_uInt32) 0 << ( ( ROP_XOR == maVDev.GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP ); + m_rStm << (sal_uInt32) 0 << ( ( ROP_XOR == maVDev.GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP ); ImplWriteSize( rSz ); rBmp.Write( aMemStm, sal_True, sal_False ); @@ -773,13 +773,13 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, nPalCount = ( nBitCount <= 8 ) ? ( nColsUsed ? nColsUsed : ( 1 << (sal_uInt32) nBitCount ) ) : ( ( 3 == nCompression ) ? 12 : 0 ); - mpStm->Write( aMemStm.GetData(), nDIBSize ); + m_rStm.Write( aMemStm.GetData(), nDIBSize ); - const sal_uLong nEndPos = mpStm->Tell(); - mpStm->Seek( nOffPos ); - (*mpStm) << (sal_uInt32) 80 << (sal_uInt32)( nHeaderSize + ( nPalCount << 2 ) ); - (*mpStm) << (sal_uInt32)( 80 + ( nHeaderSize + ( nPalCount << 2 ) ) ) << nImageSize; - mpStm->Seek( nEndPos ); + const sal_uLong nEndPos = m_rStm.Tell(); + m_rStm.Seek( nOffPos ); + m_rStm << (sal_uInt32) 80 << (sal_uInt32)( nHeaderSize + ( nPalCount << 2 ) ); + m_rStm << (sal_uInt32)( 80 + ( nHeaderSize + ( nPalCount << 2 ) ) ) << nImageSize; + m_rStm.Seek( nEndPos ); ImplEndRecord(); } @@ -828,20 +828,20 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const String rText, cons ImplBeginRecord( WIN_EMR_EXTTEXTOUTW ); ImplWriteRect( Rectangle( rPos, Size( nNormWidth, maVDev.GetTextHeight() ) ) ); - (*mpStm) << (sal_uInt32)1; - (*mpStm) << (sal_Int32) 0 << (sal_Int32) 0; + m_rStm << (sal_uInt32)1; + m_rStm << (sal_Int32) 0 << (sal_Int32) 0; ImplWritePoint( rPos ); - (*mpStm) << (sal_uInt32) nLen << (sal_uInt32) 76 << (sal_uInt32) 2; - (*mpStm) << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) 0; - (*mpStm) << (sal_uInt32) ( 76 + ( nLen << 1 ) + ( (nLen & 1 ) ? 2 : 0 ) ); + m_rStm << (sal_uInt32) nLen << (sal_uInt32) 76 << (sal_uInt32) 2; + m_rStm << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) 0; + m_rStm << (sal_uInt32) ( 76 + ( nLen << 1 ) + ( (nLen & 1 ) ? 2 : 0 ) ); // write text for( i = 0; i < nLen; i++ ) - (*mpStm) << (sal_Unicode)rText.GetChar( i ); + m_rStm << (sal_Unicode)rText.GetChar( i ); // padding word if( nLen & 1 ) - (*mpStm) << (sal_uInt16) 0; + m_rStm << (sal_uInt16) 0; // write DX array ImplWriteExtent( pDX[ 0 ] ); @@ -903,7 +903,7 @@ void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const bas void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) { - for( sal_uLong j = 0, nActionCount = rMtf.GetActionCount(); j < nActionCount; j++ ) + for( size_t j = 0, nActionCount = rMtf.GetActionSize(); j < nActionCount; j++ ) { const MetaAction* pAction = rMtf.GetAction( j ); const sal_uInt16 nType = pAction->GetType(); @@ -1157,7 +1157,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) const MetaEPSAction* pA = (const MetaEPSAction*) pAction; const GDIMetaFile aSubstitute( pA->GetSubstitute() ); - for( sal_uLong i = 0, nCount = aSubstitute.GetActionCount(); i < nCount; i++ ) + for( size_t i = 0, nCount = aSubstitute.GetActionSize(); i < nCount; i++ ) { const MetaAction* pSubstAct = aSubstitute.GetAction( i ); if( pSubstAct->GetType() == META_BMPSCALE_ACTION ) @@ -1176,7 +1176,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) maVDev.Pop(); ImplBeginRecord( WIN_EMR_RESTOREDC ); - (*mpStm) << (sal_Int32) -1; + m_rStm << (sal_Int32) -1; ImplEndRecord(); break; } @@ -1366,7 +1366,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) ( (MetaAction*) pAction )->Execute( &maVDev ); ImplBeginRecord( WIN_EMR_RESTOREDC ); - (*mpStm) << (sal_Int32) -1; + m_rStm << (sal_Int32) -1; ImplEndRecord(); ImplWriteRasterOp( maVDev.GetRasterOp() ); @@ -1429,8 +1429,10 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) break; default: - DBG_ERROR( ( ByteString( "EMFWriter::ImplWriteActions: unsupported MetaAction #" ) += ByteString::CreateFromInt32( nType ) ).GetBuffer() ); + OSL_FAIL( ( ByteString( "EMFWriter::ImplWriteActions: unsupported MetaAction #" ) += ByteString::CreateFromInt32( nType ) ).GetBuffer() ); break; } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/emfwr.hxx b/svtools/source/filter/wmf/emfwr.hxx index 8c65e91e5f73..ee3b723ace3e 100644 --- a/svtools/source/filter/wmf/emfwr.hxx +++ b/svtools/source/filter/wmf/emfwr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -49,7 +50,7 @@ private: VirtualDevice maVDev; MapMode maDestMapMode; FilterConfigItem* mpFilterConfigItem; - SvStream* mpStm; + SvStream& m_rStm; sal_Bool* mpHandlesUsed; sal_uLong mnHandleCount; sal_uLong mnLastPercent; @@ -92,9 +93,11 @@ private: public: - EMFWriter() {} + EMFWriter(SvStream &rStream) : m_rStm(rStream) {} - sal_Bool WriteEMF( const GDIMetaFile& rMtf, SvStream& rOStm, FilterConfigItem* pConfigItem = NULL ); + sal_Bool WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pConfigItem = NULL ); }; #endif // _EMFWR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx index ec7fec9fdb1e..23990473aa60 100644 --- a/svtools/source/filter/wmf/enhwmf.cxx +++ b/svtools/source/filter/wmf/enhwmf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -158,6 +159,8 @@ #define EMR_SETLINKEDUFIS 119 #define EMR_SETTEXTJUSTIFICATION 120 +#define EMFP_DEBUG(x) +//#define EMFP_DEBUG(x) x //----------------------------------------------------------------------------------- @@ -176,7 +179,7 @@ SvStream& operator>>( SvStream& rIn, XForm& rXForm ) { if ( sizeof( float ) != 4 ) { - DBG_ERROR( "EnhWMFReader::sizeof( float ) != 4" ); + OSL_FAIL( "EnhWMFReader::sizeof( float ) != 4" ); rXForm = XForm(); } else @@ -229,6 +232,106 @@ static sal_Bool ImplReadRegion( PolyPolygon& rPolyPoly, SvStream& rSt, sal_uInt3 return bOk; } +EMFP_DEBUG(void dumpWords( SvStream& s, int i ) +{ + sal_uInt32 pos = s.Tell(); + sal_Int16 data; + for( ; i > 0; i -- ) { + s >> data; + EMFP_DEBUG(printf ("\t\t\tdata: %04hx\n", data)); + } + s.Seek (pos); +}); + +void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC) +{ + if (!bEMFPlus) { + pOut->PassEMFPlusHeaderInfo(); + + // debug code - write the stream to debug file /tmp/emf-stream.emf + EMFP_DEBUG(int pos = pWMF->Tell(); + pWMF->Seek(0); + SvFileStream file( UniString::CreateFromAscii( "/tmp/emf-stream.emf" ), STREAM_WRITE | STREAM_TRUNC ); + + *pWMF >> file; + file.Flush(); + file.Close(); + + pWMF->Seek( pos );) + } + bEMFPlus = true; + + void *buffer = malloc( length ); + + int pos = pWMF->Tell(); + pOut->PassEMFPlus( buffer, pWMF->Read( buffer, length ) ); + pWMF->Seek( pos ); + + bHaveDC = false; + + length -= 4; + + while (length > 0) { + sal_uInt16 type, flags; + sal_uInt32 size, dataSize; + sal_uInt32 next; + + *pWMF >> type >> flags >> size >> dataSize; + + EMFP_DEBUG(printf ("\t\tEMF+ record type: %d\n", type)); + + // GetDC + if( type == 16388 ) { + bHaveDC = true; + EMFP_DEBUG(printf ("\t\tEMF+ lock DC (device context)\n", type)); + } + + next = pWMF->Tell() + ( size - 12 ); + + length -= size; + + pWMF->Seek( next ); + } + + free( buffer ); +} + +void EnhWMFReader::ReadGDIComment() +{ + sal_uInt32 type; + + *pWMF >> type; + + switch( type ) { + case 2: { + sal_Int32 x, y, r, b; + + EMFP_DEBUG(printf ("\t\tBEGINGROUP\n")); + + *pWMF >> x >> y >> r >> b; + EMFP_DEBUG(printf ("\t\tbounding rectangle: %d,%d x %d,%d\n", x, y, r, b)); + + sal_uInt32 l; + + *pWMF >> l; + EMFP_DEBUG(printf ("\t\tdescription length: %d\n", l)); + + break; + } + case 3: { + EMFP_DEBUG(printf ("\t\tENDGROUP\n")); + break; + } + case 0x40000004: { + EMFP_DEBUG(printf ("\t\tMULTIFORMATS\n")); + break; + } + default: + EMFP_DEBUG(printf ("\t\tunknown GDIComment\n")); + EMFP_DEBUG(dumpWords (*pWMF, 16)); + } +} + sal_Bool EnhWMFReader::ReadEnhWMF() { sal_uInt32 nStretchBltMode = 0; @@ -239,6 +342,14 @@ sal_Bool EnhWMFReader::ReadEnhWMF() sal_Int16 nX16, nY16; sal_Bool bFlag, bStatus = ReadHeader(); + sal_Bool bHaveDC = false; + +#ifdef UNX + static sal_Bool bEnableEMFPlus = ( getenv( "EMF_PLUS_DISABLE" ) == NULL ); +#else + // TODO: make it possible to disable emf+ on windows + static sal_Bool bEnableEMFPlus = sal_False; +#endif while( bStatus && nRecordCount-- ) { @@ -263,6 +374,34 @@ sal_Bool EnhWMFReader::ReadEnhWMF() bFlag = sal_False; + EMFP_DEBUG(printf ("0x%04x-0x%04x record type: %d size: %d\n", nNextPos - nRecSize, nNextPos, nRecType, nRecSize)); + + if( bEnableEMFPlus && nRecType == EMR_GDICOMMENT ) { + sal_uInt32 length; + + *pWMF >> length; + + EMFP_DEBUG(printf ("\tGDI comment\n\t\tlength: %d\n", length)); + + if( length >= 4 ) { + sal_uInt32 id; + + *pWMF >> id; + + EMFP_DEBUG(printf ("\t\tbegin %c%c%c%c id: 0x%x\n", (char)(id & 0xff), (char)((id & 0xff00) >> 8), (char)((id & 0xff0000) >> 16), (char)((id & 0xff000000) >> 24), id)); + + // EMF+ comment (fixme: BE?) + if( id == 0x2B464D45 && nRecSize >= 12 ) + ReadEMFPlusComment( length, bHaveDC ); + // GDIC comment, doesn't do anything useful yet => enabled only for debug + else if( id == 0x43494447 && nRecSize >= 12 ) { + EMFP_DEBUG(ReadGDIComment()); + } else { + EMFP_DEBUG(printf ("\t\tunknown id: 0x%x\n", id)); + } + } + } else if( !bEMFPlus || bHaveDC || nRecType == EMR_EOF ) + switch( nRecType ) { case EMR_POLYBEZIERTO : @@ -867,7 +1006,10 @@ sal_Bool EnhWMFReader::ReadEnhWMF() Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) ); aBitmap.Crop( aCropRect ); } - aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop ), LIST_APPEND ); + /* Pseudocomment to add more context so that make patch.unapply + * works better. Ha! + */ + aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ), LIST_APPEND ); } } } @@ -921,7 +1063,8 @@ sal_Bool EnhWMFReader::ReadEnhWMF() Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) ); aBitmap.Crop( aCropRect ); } - aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop ), LIST_APPEND ); + /* Another pseudocomment to make make patch.unapply work better */ + aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop, pOut->GetFillStyle () ), LIST_APPEND ); } } } @@ -1192,6 +1335,53 @@ sal_Bool EnhWMFReader::ReadEnhWMF() } break; + case EMR_CREATEDIBPATTERNBRUSHPT : + { + sal_uInt32 nStart = pWMF->Tell() - 8; + Bitmap aBitmap; + + *pWMF >> nIndex; + + if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 ) + { + sal_uInt32 usage, offBmi, cbBmi, offBits, cbBits; + + *pWMF >> usage; + *pWMF >> offBmi; + *pWMF >> cbBmi; + *pWMF >> offBits; + *pWMF >> cbBits; + + if ( (cbBits > (SAL_MAX_UINT32 - 14)) || ((SAL_MAX_UINT32 - 14) - cbBits < cbBmi) ) + bStatus = sal_False; + else if ( offBmi ) + { + sal_uInt32 nSize = cbBmi + cbBits + 14; + if ( nSize <= ( nEndPos - nStartPos ) ) + { + char* pBuf = new char[ nSize ]; + + SvMemoryStream aTmp( pBuf, nSize, STREAM_READ | STREAM_WRITE ); + aTmp.ObjectOwnsMemory( sal_True ); + aTmp << (sal_uInt8)'B' + << (sal_uInt8)'M' + << (sal_uInt32)cbBits + << (sal_uInt16)0 + << (sal_uInt16)0 + << (sal_uInt32)cbBmi + 14; + pWMF->Seek( nStart + offBmi ); + pWMF->Read( pBuf + 14, cbBmi ); + pWMF->Seek( nStart + offBits ); + pWMF->Read( pBuf + 14 + cbBmi, cbBits ); + aTmp.Seek( 0 ); + aBitmap.Read( aTmp, sal_True ); + } + } + } + + pOut->CreateObject( nIndex, GDI_BRUSH, new WinMtfFillStyle( aBitmap ) ); + } + break; #ifdef WIN_MTF_ASSERT default : WinMtfAssertHandler( "Unknown Meta Action" ); break; @@ -1211,7 +1401,6 @@ sal_Bool EnhWMFReader::ReadEnhWMF() case EMR_ANGLEARC : WinMtfAssertHandler( "AngleArc" ); break; case EMR_SETCOLORADJUSTMENT : WinMtfAssertHandler( "SetColorAdjustment" ); break; case EMR_POLYDRAW16 : WinMtfAssertHandler( "PolyDraw16" ); break; - case EMR_CREATEDIBPATTERNBRUSHPT : WinMtfAssertHandler( "CreateDibPatternBrushPt" ); break; case EMR_POLYTEXTOUTA : WinMtfAssertHandler( "PolyTextOutA" ); break; case EMR_POLYTEXTOUTW : WinMtfAssertHandler( "PolyTextOutW" ); break; case EMR_CREATECOLORSPACE : WinMtfAssertHandler( "CreateColorSpace" ); break; @@ -1340,3 +1529,5 @@ EnhWMFReader::~EnhWMFReader() { }; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/winmtf.cxx b/svtools/source/filter/wmf/winmtf.cxx index 30fc670ac22f..d2a4b0ec50c2 100644 --- a/svtools/source/filter/wmf/winmtf.cxx +++ b/svtools/source/filter/wmf/winmtf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,111 +31,72 @@ #include "winmtf.hxx" +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> #include <vcl/metaact.hxx> +#include <vcl/graphictools.hxx> +#include <vcl/canvastools.hxx> #include <vcl/metric.hxx> +#include <vcl/svapp.hxx> #include <rtl/tencinfo.h> // ------------------------------------------------------------------------ #define WIN_MTF_MAX_CLIP_DEPTH 16 -void WinMtfClipPath::ImpUpdateType() -{ - if ( !aPolyPoly.Count() ) - eType = EMPTY; - else if ( aPolyPoly.IsRect() ) - eType = RECTANGLE; - else - eType = COMPLEX; - - bNeedsUpdate = sal_True; -} +#define EMFP_DEBUG(x) +//#define EMFP_DEBUG(x) x -void WinMtfClipPath::IntersectClipRect( const Rectangle& rRect ) +void WinMtfClipPath::intersectClipRect( const Rectangle& rRect ) { - if ( !aPolyPoly.Count() ) - aPolyPoly = Polygon( rRect ); - else if ( nDepth < WIN_MTF_MAX_CLIP_DEPTH ) - { - Polygon aPolygon( rRect ); - PolyPolygon aIntersection; - PolyPolygon aPolyPolyRect( aPolygon ); - aPolyPoly.GetIntersection( aPolyPolyRect, aIntersection ); - aPolyPoly = aIntersection; - nDepth++; - } - ImpUpdateType(); + maClip.intersectRange( + vcl::unotools::b2DRectangleFromRectangle(rRect)); } -void WinMtfClipPath::ExcludeClipRect( const Rectangle& rRect ) +void WinMtfClipPath::excludeClipRect( const Rectangle& rRect ) { - if ( aPolyPoly.Count() && ( nDepth < WIN_MTF_MAX_CLIP_DEPTH ) ) - { - Polygon aPolygon( rRect ); - PolyPolygon aPolyPolyRect( aPolygon ); - PolyPolygon aDifference; - aPolyPoly.GetDifference( aPolyPolyRect, aDifference ); - aPolyPoly = aDifference; - nDepth++; - } - ImpUpdateType(); + maClip.subtractRange( + vcl::unotools::b2DRectangleFromRectangle(rRect)); } -void WinMtfClipPath::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode ) +void WinMtfClipPath::setClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode ) { - if ( !rPolyPolygon.Count() ) - aPolyPoly = rPolyPolygon; - else if ( nDepth < WIN_MTF_MAX_CLIP_DEPTH ) + const basegfx::B2DPolyPolygon& rB2DPoly=rPolyPolygon.getB2DPolyPolygon(); + switch ( nClippingMode ) { - nDepth++; - - PolyPolygon aNewClipPath; - - // #115345# Watch out for empty aPolyPoly here - conceptually, - // an empty clip path is a rectangle of infinite size, but it - // is represented by an empty aPolyPoly. When intersecting - // rPolyPolygon with this _empty_ aPolyPoly, set algebra - // guarantees wrong results. - switch ( nClippingMode ) - { - case RGN_OR : - // #115345# clip stays empty, when ORing an arbitrary - // rPolyPolygon. Thus, we can save us the unnecessary - // clipper call. - if( aPolyPoly.Count() ) - aPolyPoly.GetUnion( rPolyPolygon, aNewClipPath ); + case RGN_OR : + maClip.unionPolyPolygon(rB2DPoly); break; - case RGN_XOR : - // TODO: - // #115345# Cannot handle this case, for the time being - aPolyPoly.GetXOR( rPolyPolygon, aNewClipPath ); + case RGN_XOR : + maClip.xorPolyPolygon(rB2DPoly); break; - case RGN_DIFF : - // TODO: - // #115345# Cannot handle this case, for the time being - aPolyPoly.GetDifference( rPolyPolygon, aNewClipPath ); + case RGN_DIFF : + maClip.subtractPolyPolygon(rB2DPoly); break; - case RGN_AND : - // #115345# Clip becomes rPolyPolygon, when ANDing - // with an arbitrary rPolyPolygon - if( aPolyPoly.Count() ) - aPolyPoly.GetIntersection( rPolyPolygon, aNewClipPath ); - else - aNewClipPath = rPolyPolygon; + case RGN_AND : + maClip.intersectPolyPolygon(rB2DPoly); break; - case RGN_COPY : - aNewClipPath = rPolyPolygon; + case RGN_COPY : + maClip = basegfx::tools::B2DClipState(rB2DPoly); break; - } - aPolyPoly = aNewClipPath; } - ImpUpdateType(); } -void WinMtfClipPath::MoveClipRegion( const Size& rSize ) +void WinMtfClipPath::moveClipRegion( const Size& rSize ) { - aPolyPoly.Move( rSize.Width(), rSize.Height() ); - bNeedsUpdate = sal_True; + // what a weird concept. emulate, don't want this in B2DClipState + // API + basegfx::B2DPolyPolygon aCurrClip=maClip.getClipPoly(); + basegfx::B2DHomMatrix aTranslate; + aTranslate.translate(rSize.Width(), rSize.Height()); + + aCurrClip.transform(aTranslate); + maClip = basegfx::tools::B2DClipState( aCurrClip ); +} + +basegfx::B2DPolyPolygon WinMtfClipPath::getClipPath() const +{ + return maClip.getClipPoly(); } // ------------------------------------------------------------------------ @@ -192,11 +154,11 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont ) { CharSet eCharSet; if ( ( rFont.lfCharSet == OEM_CHARSET ) || ( rFont.lfCharSet == DEFAULT_CHARSET ) ) - eCharSet = gsl_getSystemTextEncoding(); + eCharSet = RTL_TEXTENCODING_MS_1252; else eCharSet = rtl_getTextEncodingFromWindowsCharset( rFont.lfCharSet ); if ( eCharSet == RTL_TEXTENCODING_DONTKNOW ) - eCharSet = gsl_getSystemTextEncoding(); + eCharSet = RTL_TEXTENCODING_MS_1252; aFont.SetCharSet( eCharSet ); aFont.SetName( rFont.alfFaceName ); FontFamily eFamily; @@ -416,6 +378,19 @@ Point WinMtfOutput::ImplMap( const Point& rPt ) { switch( mnMapMode ) { + case MM_TEXT: + fX2 -= mnWinOrgX; + fY2 -= mnWinOrgY; + if( mnDevWidth != 1 || mnDevHeight != 1 ) { + fX2 *= 2540.0/mnUnitsPerInch; + fY2 *= 2540.0/mnUnitsPerInch; + } + fX2 += mnDevOrgX; + fY2 += mnDevOrgY; + fX2 *= (double)mnMillX * 100.0 / (double)mnPixX; + fY2 *= (double)mnMillY * 100.0 / (double)mnPixY; + + break; case MM_LOENGLISH : { fX2 -= mnWinOrgX; @@ -491,6 +466,15 @@ Size WinMtfOutput::ImplMap( const Size& rSz ) { switch( mnMapMode ) { + case MM_TEXT: + if( mnDevWidth != 1 && mnDevHeight != 1 ) { + fWidth *= 2540.0/mnUnitsPerInch; + fHeight*= 2540.0/mnUnitsPerInch; + } else { + fWidth *= (double)mnMillX * 100 / (double)mnPixX; + fHeight *= (double)mnMillY * 100 / (double)mnPixY; + } + break; case MM_LOENGLISH : { fWidth *= 25.40; @@ -855,7 +839,7 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pS break; default: - DBG_ERROR( "unsupported style not deleted" ); + OSL_FAIL( "unsupported style not deleted" ); break; } } @@ -879,31 +863,35 @@ void WinMtfOutput::DeleteObject( sal_Int32 nIndex ) void WinMtfOutput::IntersectClipRect( const Rectangle& rRect ) { - aClipPath.IntersectClipRect( ImplMap( rRect ) ); + mbClipNeedsUpdate=true; + aClipPath.intersectClipRect( ImplMap( rRect ) ); } //----------------------------------------------------------------------------------- void WinMtfOutput::ExcludeClipRect( const Rectangle& rRect ) { - aClipPath.ExcludeClipRect( ImplMap( rRect ) ); + mbClipNeedsUpdate=true; + aClipPath.excludeClipRect( ImplMap( rRect ) ); } //----------------------------------------------------------------------------------- void WinMtfOutput::MoveClipRegion( const Size& rSize ) { - aClipPath.MoveClipRegion( ImplMap( rSize ) ); + mbClipNeedsUpdate=true; + aClipPath.moveClipRegion( ImplMap( rSize ) ); } void WinMtfOutput::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode, sal_Bool bIsMapped ) { + mbClipNeedsUpdate=true; if ( bIsMapped ) - aClipPath.SetClipPath( rPolyPolygon, nClippingMode ); + aClipPath.setClipPath( rPolyPolygon, nClippingMode ); else { PolyPolygon aPP( rPolyPolygon ); - aClipPath.SetClipPath( ImplMap( aPP ), nClippingMode ); + aClipPath.setClipPath( ImplMap( aPP ), nClippingMode ); } } @@ -925,8 +913,11 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) : maActPos ( Point() ), mbNopMode ( sal_False ), mbFillStyleSelected ( sal_False ), + mbClipNeedsUpdate ( true ), + mbComplexClip ( false ), mnGfxMode ( GM_COMPATIBLE ), mnMapMode ( MM_TEXT ), + mnUnitsPerInch ( 96 ), mnDevOrgX ( 0 ), mnDevOrgY ( 0 ), mnDevWidth ( 1 ), @@ -947,7 +938,7 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) : // SetClipRgn( NULL ) and similar ClipRgn actions (SJ) maFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Arial" )) ); // sj: #i57205#, we do have some scaling problems if using - maFont.SetCharSet( gsl_getSystemTextEncoding() ); // the default font then most times a x11 font is used, we + maFont.SetCharSet( RTL_TEXTENCODING_MS_1252 ); // the default font then most times a x11 font is used, we maFont.SetHeight( 423 ); // will prevent this defining a font maLatestLineStyle.aLineColor = Color( 0x12, 0x34, 0x56 ); @@ -976,31 +967,25 @@ WinMtfOutput::~WinMtfOutput() void WinMtfOutput::UpdateClipRegion() { - if ( aClipPath.bNeedsUpdate ) + if ( mbClipNeedsUpdate ) { - aClipPath.bNeedsUpdate = sal_False; + mbClipNeedsUpdate = false; + mbComplexClip = false; mpGDIMetaFile->AddAction( new MetaPopAction() ); // taking the orignal clipregion mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_CLIPREGION ) ); // - switch ( aClipPath.GetType() ) + // skip for 'no clipping at all' case + if( !aClipPath.isEmpty() ) { - case RECTANGLE : - case COMPLEX : - { -// we will not generate a RegionClipRegion Action, because this action -// cannot be saved to the wmf format - saving to wmf always happens -// if the placeholder graphic for ole objects is generated. (SJ) - -// Region aClipRegion( aClipPath.GetClipPath() ); -// mpGDIMetaFile->AddAction( new MetaISectRegionClipRegionAction( aClipRegion ) ); - - Rectangle aClipRect( aClipPath.GetClipPath().GetBoundRect() ); - mpGDIMetaFile->AddAction( new MetaISectRectClipRegionAction( aClipRect ) ); - } - break; - case EMPTY: - break; // -Wall not handled. + const basegfx::B2DPolyPolygon& rClipPoly( aClipPath.getClipPath() ); + mpGDIMetaFile->AddAction( + new MetaISectRectClipRegionAction( + vcl::unotools::rectangleFromB2DRectangle( + rClipPoly.getB2DRange()))); + + mbComplexClip = rClipPoly.count() > 1 + || !basegfx::tools::isRectangle(rClipPoly); } } } @@ -1038,7 +1023,8 @@ void WinMtfOutput::UpdateFillStyle() if (!( maLatestFillStyle == maFillStyle ) ) { maLatestFillStyle = maFillStyle; - mpGDIMetaFile->AddAction( new MetaFillColorAction( maFillStyle.aFillColor, !maFillStyle.bTransparent ) ); + if (maFillStyle.aType == FillStyleSolid) + mpGDIMetaFile->AddAction( new MetaFillColorAction( maFillStyle.aFillColor, !maFillStyle.bTransparent ) ); } } @@ -1178,12 +1164,12 @@ void WinMtfOutput::DrawRect( const Rectangle& rRect, sal_Bool bEdge ) UpdateClipRegion(); UpdateFillStyle(); - if ( aClipPath.GetType() == COMPLEX ) + if ( mbComplexClip ) { Polygon aPoly( ImplMap( rRect ) ); PolyPolygon aPolyPolyRect( aPoly ); PolyPolygon aDest; - aClipPath.GetClipPath().GetIntersection( aPolyPolyRect, aDest ); + PolyPolygon(aClipPath.getClipPath()).GetIntersection( aPolyPolyRect, aDest ); ImplDrawClippedPolyPolygon( aDest ); } else @@ -1338,11 +1324,11 @@ void WinMtfOutput::DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath ) { UpdateFillStyle(); - if ( aClipPath.GetType() == COMPLEX ) + if ( mbComplexClip ) { PolyPolygon aPolyPoly( rPolygon ); PolyPolygon aDest; - aClipPath.GetClipPath().GetIntersection( aPolyPoly, aDest ); + PolyPolygon(aClipPath.getClipPath()).GetIntersection( aPolyPoly, aDest ); ImplDrawClippedPolyPolygon( aDest ); } else @@ -1366,7 +1352,35 @@ void WinMtfOutput::DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath ) else { UpdateLineStyle(); - mpGDIMetaFile->AddAction( new MetaPolygonAction( rPolygon ) ); + + if (maLatestFillStyle.aType != FillStylePattern) + mpGDIMetaFile->AddAction( new MetaPolygonAction( rPolygon ) ); + else { + SvtGraphicFill aFill = SvtGraphicFill( PolyPolygon( rPolygon ), + Color(), + 0.0, + SvtGraphicFill::fillNonZero, + SvtGraphicFill::fillTexture, + SvtGraphicFill::Transform(), + true, + SvtGraphicFill::hatchSingle, + Color(), + SvtGraphicFill::gradientLinear, + Color(), + Color(), + 0, + Graphic (maLatestFillStyle.aBmp) ); + + SvMemoryStream aMemStm; + + aMemStm << aFill; + + mpGDIMetaFile->AddAction( new MetaCommentAction( "XPATHFILL_SEQ_BEGIN", 0, + static_cast<const sal_uInt8*>(aMemStm.GetData()), + aMemStm.Seek( STREAM_SEEK_TO_END ) ) ); + mpGDIMetaFile->AddAction( new MetaCommentAction( "XPATHFILL_SEQ_END" ) ); + } + } } } @@ -1386,10 +1400,10 @@ void WinMtfOutput::DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordP { UpdateFillStyle(); - if ( aClipPath.GetType() == COMPLEX ) + if ( mbComplexClip ) { PolyPolygon aDest; - aClipPath.GetClipPath().GetIntersection( rPolyPolygon, aDest ); + PolyPolygon(aClipPath.getClipPath()).GetIntersection( rPolyPolygon, aDest ); ImplDrawClippedPolyPolygon( aDest ); } else @@ -1604,6 +1618,8 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry sal_Int32* pDX = pDXArry; if ( !pDXArry ) { + SolarMutexGuard aGuard; + pDX = new sal_Int32[ rText.Len() ]; if ( !pVDev ) pVDev = new VirtualDevice; @@ -1624,7 +1640,7 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap ) { BitmapEx aBmpEx( rBitmap ); - if ( aClipPath.GetType() == COMPLEX ) + if ( mbComplexClip ) { VirtualDevice aVDev; MapMode aMapMode( MAP_100TH_MM ); @@ -1639,7 +1655,7 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B aVDev.SetMapMode( aMapMode ); aVDev.SetOutputSizePixel( aSizePixel ); aVDev.SetFillColor( Color( COL_BLACK ) ); - const PolyPolygon aClip( aClipPath.GetClipPath() ); + const PolyPolygon aClip( aClipPath.getClipPath() ); aVDev.DrawPolyPolygon( aClip ); const Point aEmptyPoint; @@ -1709,7 +1725,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) if ( ( nRasterOperation & 0xaa ) != ( ( nRasterOperation & 0x55 ) << 1 ) ) nUsed |= 4; // destination is used - if ( (nUsed & 1) && (( nUsed & 2 ) == 0) ) + if ( (nUsed & 1) && (( nUsed & 2 ) == 0) && nWinRop != PATINVERT ) { // patterns aren't well supported yet sal_uInt32 nOldRop = SetRasterOp( ROP_OVERPAINT ); // in this case nRasterOperation is either 0 or 0xff UpdateFillStyle(); @@ -2024,6 +2040,14 @@ void WinMtfOutput::SetMapMode( sal_uInt32 nMapMode ) //----------------------------------------------------------------------------------- +void WinMtfOutput::SetUnitsPerInch( sal_uInt16 nUnitsPerInch ) +{ + if( nUnitsPerInch != 0 ) + mnUnitsPerInch = nUnitsPerInch; +} + +//----------------------------------------------------------------------------------- + void WinMtfOutput::SetWorldTransform( const XForm& rXForm ) { maXForm.eM11 = rXForm.eM11; @@ -2188,7 +2212,7 @@ void WinMtfOutput::Pop() if ( ! ( aClipPath == pSave->aClipPath ) ) { aClipPath = pSave->aClipPath; - aClipPath.bNeedsUpdate = sal_True; + mbClipNeedsUpdate = true; } if ( meLatestRasterOp != meRasterOp ) mpGDIMetaFile->AddAction( new MetaRasterOpAction( meRasterOp ) ); @@ -2200,3 +2224,40 @@ void WinMtfOutput::AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile ) { rGDIMetaFile.Play( *mpGDIMetaFile, 0xFFFFFFFF ); } + +void WinMtfOutput::PassEMFPlusHeaderInfo() +{ + EMFP_DEBUG(printf ("\t\t\tadd EMF_PLUS header info\n")); + + SvMemoryStream mem; + sal_Int32 nLeft, nRight, nTop, nBottom; + + nLeft = mrclFrame.Left(); + nTop = mrclFrame.Top(); + nRight = mrclFrame.Right(); + nBottom = mrclFrame.Bottom(); + + // emf header info + mem << nLeft << nTop << nRight << nBottom; + mem << mnPixX << mnPixY << mnMillX << mnMillY; + + float one, zero; + + one = 1; + zero = 0; + + // add transformation matrix to be used in vcl's metaact.cxx for + // rotate and scale operations + mem << one << zero << zero << one << zero << zero; + + mpGDIMetaFile->AddAction( new MetaCommentAction( "EMF_PLUS_HEADER_INFO", 0, (const sal_uInt8*) mem.GetData(), mem.GetEndOfData() ) ); + mpGDIMetaFile->UseCanvas( sal_True ); +} + +void WinMtfOutput::PassEMFPlus( void* pBuffer, sal_uInt32 nLength ) +{ + EMFP_DEBUG(printf ("\t\t\tadd EMF_PLUS comment length %d\n", nLength)); + mpGDIMetaFile->AddAction( new MetaCommentAction( "EMF_PLUS", 0, static_cast<const sal_uInt8*>(pBuffer), nLength ) ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx index ca7b62b38ef3..16e9296a2b8f 100644 --- a/svtools/source/filter/wmf/winmtf.hxx +++ b/svtools/source/filter/wmf/winmtf.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,18 +34,15 @@ #endif #include <sot/object.hxx> -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif -#ifndef _TOOL_DEBUG_HXX #include <tools/debug.hxx> -#endif #include <tools/stack.hxx> #include <tools/table.hxx> #include <tools/dynary.hxx> #include <vcl/graph.hxx> #include <vcl/virdev.hxx> #include <tools/poly.hxx> +#include <basegfx/tools/b2dclipstate.hxx> #include <vcl/font.hxx> #include <vcl/bmpacc.hxx> #include <vcl/lineinfo.hxx> @@ -159,6 +157,7 @@ struct LOGFONTW sal_uInt8 lfPitchAndFamily; String alfFaceName; }; +struct WMF_APMFILEHEADER; #define TA_NOUPDATECP 0x0000 #define TA_UPDATECP 0x0001 @@ -308,35 +307,26 @@ struct LOGFONTW void WinMtfAssertHandler( const sal_Char*, sal_uInt32 nFlags = WIN_MTF_ASSERT_MIFE ); #endif -enum WinMtfClipPathType{ EMPTY, RECTANGLE, COMPLEX }; - class WinMtfClipPath { - PolyPolygon aPolyPoly; - WinMtfClipPathType eType; - sal_Int32 nDepth; - - void ImpUpdateType(); + basegfx::tools::B2DClipState maClip; - public : - - sal_Bool bNeedsUpdate; +public : + WinMtfClipPath(): maClip() {}; - WinMtfClipPath(): eType(EMPTY), nDepth( 0 ), bNeedsUpdate( sal_False ){}; + void setClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode ); + void intersectClipRect( const Rectangle& rRect ); + void excludeClipRect( const Rectangle& rRect ); + void moveClipRegion( const Size& rSize ); - void SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode ); - void IntersectClipRect( const Rectangle& rRect ); - void ExcludeClipRect( const Rectangle& rRect ); - void MoveClipRegion( const Size& rSize ); + bool isEmpty() const { return maClip.isCleared(); } - WinMtfClipPathType GetType() const { return eType; }; - const PolyPolygon& GetClipPath() const { return aPolyPoly; }; + basegfx::B2DPolyPolygon getClipPath() const; - sal_Bool operator==( const WinMtfClipPath& rPath ) - { - return ( rPath.eType == eType ) && - ( rPath.aPolyPoly == aPolyPoly ); - }; + bool operator==( const WinMtfClipPath& rPath ) const + { + return maClip == rPath.maClip; + }; }; class WinMtfPathObj : public PolyPolygon @@ -364,29 +354,44 @@ struct WinMtfFontStyle // ----------------------------------------------------------------------------- +typedef enum { + FillStyleSolid, + FillStylePattern +} WinMtfFillStyleType; + struct WinMtfFillStyle { - Color aFillColor; + Color aFillColor; sal_Bool bTransparent; + WinMtfFillStyleType aType; + Bitmap aBmp; - WinMtfFillStyle() : - aFillColor ( Color( COL_BLACK ) ), - bTransparent( sal_False ) + WinMtfFillStyle() + : aFillColor(Color(COL_BLACK)) + , bTransparent(sal_False) + , aType(FillStyleSolid) { - }; + } - WinMtfFillStyle( const Color& rColor, sal_Bool bTrans = sal_False ) : - aFillColor ( rColor ), - bTransparent( bTrans ) + WinMtfFillStyle( const Color& rColor, sal_Bool bTrans = sal_False ) + : aFillColor(rColor) + , bTransparent(bTrans) + , aType(FillStyleSolid) { - }; + } + + WinMtfFillStyle(Bitmap& rBmp) + : aType(FillStylePattern) + , aBmp(rBmp) + { + } sal_Bool operator==( const WinMtfFillStyle& rStyle ) - { return ( ( aFillColor == rStyle.aFillColor ) && ( bTransparent == rStyle.bTransparent ) ); }; + { return ( ( aFillColor == rStyle.aFillColor ) && ( bTransparent == rStyle.bTransparent ) && ( aType == rStyle.aType ) ); } sal_Bool operator==( WinMtfFillStyle* pStyle ) - { return ( ( aFillColor == pStyle->aFillColor ) && ( bTransparent == pStyle->bTransparent ) ); }; - void operator=( const WinMtfFillStyle& rStyle ) { aFillColor = rStyle.aFillColor; bTransparent = rStyle.bTransparent; }; - void operator=( WinMtfFillStyle* pStyle ) { aFillColor = pStyle->aFillColor; bTransparent = pStyle->bTransparent; }; + { return ( ( aFillColor == pStyle->aFillColor ) && ( bTransparent == pStyle->bTransparent ) && ( aType == pStyle->aType ) ); } + WinMtfFillStyle& operator=( const WinMtfFillStyle& rStyle ) { aFillColor = rStyle.aFillColor; bTransparent = rStyle.bTransparent; aBmp = rStyle.aBmp; aType = rStyle.aType; return *this; } + WinMtfFillStyle& operator=( WinMtfFillStyle* pStyle ) { aFillColor = pStyle->aFillColor; bTransparent = pStyle->bTransparent; aBmp = pStyle->aBmp; aType = pStyle->aType; return *this; } }; // ----------------------------------------------------------------------------- @@ -399,32 +404,34 @@ struct WinMtfLineStyle WinMtfLineStyle() : aLineColor ( COL_BLACK ), - bTransparent( sal_False ) {}; + bTransparent( sal_False ) {} WinMtfLineStyle( const Color& rColor, sal_Bool bTrans = sal_False ) : aLineColor ( rColor ), - bTransparent( bTrans ) {}; + bTransparent( bTrans ) {} WinMtfLineStyle( const Color& rColor, const LineInfo rStyle, sal_Bool bTrans = sal_False ) : aLineColor ( rColor ), aLineInfo ( rStyle ), - bTransparent( bTrans ) {}; + bTransparent( bTrans ) {} - sal_Bool operator==( const WinMtfLineStyle& rStyle ) { return ( ( aLineColor == rStyle.aLineColor ) && ( bTransparent == rStyle.bTransparent ) && ( aLineInfo == rStyle.aLineInfo ) ); }; - sal_Bool operator==( WinMtfLineStyle* pStyle ) { return ( ( aLineColor == pStyle->aLineColor ) && ( bTransparent == pStyle->bTransparent ) && ( aLineInfo == pStyle->aLineInfo ) ); }; - void operator=( const WinMtfLineStyle& rStyle ) + sal_Bool operator==( const WinMtfLineStyle& rStyle ) { return ( ( aLineColor == rStyle.aLineColor ) && ( bTransparent == rStyle.bTransparent ) && ( aLineInfo == rStyle.aLineInfo ) ); } + sal_Bool operator==( WinMtfLineStyle* pStyle ) { return ( ( aLineColor == pStyle->aLineColor ) && ( bTransparent == pStyle->bTransparent ) && ( aLineInfo == pStyle->aLineInfo ) ); } + WinMtfLineStyle& operator=( const WinMtfLineStyle& rStyle ) { aLineColor = rStyle.aLineColor; bTransparent = rStyle.bTransparent; aLineInfo = rStyle.aLineInfo; - }; + return *this; + } - void operator=( WinMtfLineStyle* pStyle ) + WinMtfLineStyle& operator=( WinMtfLineStyle* pStyle ) { aLineColor = pStyle->aLineColor; bTransparent = pStyle->bTransparent; aLineInfo = pStyle->aLineInfo; - }; + return *this; + } }; // ----------------------------------------------------------------------------- @@ -441,7 +448,7 @@ struct XForm { eM11 = eM22 = 1.0f; eDx = eDy = eM12 = eM21 = 0.0f; - }; + } friend SvStream& operator>>( SvStream& rIn, XForm& rXForm ); }; @@ -478,12 +485,13 @@ typedef ::boost::shared_ptr< SaveStruct > SaveStructPtr; struct BSaveStruct { - Bitmap aBmp; - Rectangle aOutRect; + Bitmap aBmp; + Rectangle aOutRect; sal_uInt32 nWinRop; + WinMtfFillStyle aStyle; - BSaveStruct( const Bitmap& rBmp, const Rectangle& rOutRect, sal_uInt32 nRop ) : - aBmp( rBmp ), aOutRect( rOutRect ), nWinRop( nRop ){}; + BSaveStruct( const Bitmap& rBmp, const Rectangle& rOutRect, sal_uInt32 nRop, WinMtfFillStyle& rStyle ) : + aBmp( rBmp ), aOutRect( rOutRect ), nWinRop( nRop ), aStyle ( rStyle ){} }; // ----------------------------------------------------------------------------- @@ -499,10 +507,10 @@ struct GDIObj pStyle ( NULL ), eType ( GDI_DUMMY ) { - }; + } - GDIObj( GDIObjectType eT, void* pS ) { pStyle = pS; eType = eT; }; - void Set( GDIObjectType eT, void* pS ) { pStyle = pS; eType = eT; }; + GDIObj( GDIObjectType eT, void* pS ) { pStyle = pS; eType = eT; } + void Set( GDIObjectType eT, void* pS ) { pStyle = pS; eType = eT; } void Delete() { if ( pStyle ) @@ -520,12 +528,12 @@ struct GDIObj break; default: - DBG_ERROR( "unsupported style deleted" ); + OSL_FAIL( "unsupported style deleted" ); break; } pStyle = NULL; } - }; + } ~GDIObj() { @@ -567,11 +575,15 @@ class WinMtfOutput sal_uInt32 mnRop; sal_Bool mbNopMode; sal_Bool mbFillStyleSelected; + sal_Bool mbClipNeedsUpdate; + sal_Bool mbComplexClip; std::vector< SaveStructPtr > vSaveStack; sal_uInt32 mnGfxMode; sal_uInt32 mnMapMode; + sal_uInt16 mnUnitsPerInch; + XForm maXForm; sal_Int32 mnDevOrgX, mnDevOrgY; sal_Int32 mnDevWidth, mnDevHeight; @@ -618,6 +630,7 @@ class WinMtfOutput sal_uInt32 GetMapMode() const { return mnMapMode; }; void SetMapMode( sal_uInt32 mnMapMode ); + void SetUnitsPerInch( sal_uInt16 nUnitsPerInch ); void SetWorldTransform( const XForm& rXForm ); void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ); @@ -638,6 +651,7 @@ class WinMtfOutput void DeleteObject( sal_Int32 nIndex ); void SelectObject( sal_Int32 nIndex ); CharSet GetCharSet(){ return maFont.GetCharSet(); }; + WinMtfFillStyle& GetFillStyle () { return maFillStyle; } void SetFont( const Font& rFont ); const Font& GetFont() const; void SetTextLayoutMode( const sal_uInt32 nLayoutMode ); @@ -672,6 +686,9 @@ class WinMtfOutput void UpdateClipRegion(); void AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile ); + void PassEMFPlus( void* pBuffer, sal_uInt32 nLength ); + void PassEMFPlusHeaderInfo(); + WinMtfOutput( GDIMetaFile& rGDIMetaFile ); virtual ~WinMtfOutput(); }; @@ -710,6 +727,8 @@ class EnhWMFReader : public WinMtf { sal_Bool bRecordPath; sal_Int32 nRecordCount; + sal_Bool bEMFPlus; + sal_Bool ReadHeader(); Rectangle ReadRectangle( sal_Int32, sal_Int32, sal_Int32, sal_Int32 ); // Liesst und konvertiert ein Rechteck @@ -717,10 +736,12 @@ class EnhWMFReader : public WinMtf public: EnhWMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL ) - : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ), bRecordPath( sal_False ) {}; + : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ), bRecordPath( sal_False ), bEMFPlus( sal_False ) {}; ~EnhWMFReader(); sal_Bool ReadEnhWMF(); + void ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC); + void ReadGDIComment(); }; //============================ WMFReader ================================== @@ -750,7 +771,7 @@ private: sal_uInt32 nUnicodeEscapeAction; // Liesst den Kopf der WMF-Datei - sal_Bool ReadHeader(); + sal_Bool ReadHeader(WMF_APMFILEHEADER *pAPMHeader); // Liesst die Parameter des Rocords mit der Funktionsnummer nFunction. void ReadRecordParams( sal_uInt16 nFunction ); @@ -764,12 +785,16 @@ private: public: WMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL ) - : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ) {}; + : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ) + , pEMFStream(NULL) + {} ~WMFReader(); // Liesst aus dem Stream eine WMF-Datei und fuellt das GDIMetaFile - void ReadWMF(); + void ReadWMF(WMF_APMFILEHEADER *pAPMHeader=NULL); }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/winwmf.cxx b/svtools/source/filter/wmf/winwmf.cxx index feb1a2895793..a794da5b3274 100644 --- a/svtools/source/filter/wmf/winwmf.cxx +++ b/svtools/source/filter/wmf/winwmf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,6 +31,7 @@ #include "winmtf.hxx" #include <vcl/gdimtf.hxx> +#include <svtools/wmf.hxx> #include <rtl/crc.h> #include <rtl/tencinfo.h> #include <osl/endian.h> @@ -569,7 +571,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) aBmp.Crop( aCropRect ); } Rectangle aDestRect( aPoint, Size( nSxe, nSye ) ); - aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP ), LIST_APPEND ); + aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ), LIST_APPEND ); } } } @@ -619,7 +621,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) Rectangle aCropRect( Point( nSx, nSy ), Size( nSxe, nSye ) ); aBmp.Crop( aCropRect ); } - aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP ), LIST_APPEND ); + aBmpSaveList.Insert( new BSaveStruct( aBmp, aDestRect, nWinROP, pOut->GetFillStyle () ), LIST_APPEND ); } } } @@ -996,7 +998,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) // ------------------------------------------------------------------------ -sal_Bool WMFReader::ReadHeader() +sal_Bool WMFReader::ReadHeader(WMF_APMFILEHEADER *pAPMHeader) { Rectangle aPlaceableBound; sal_uInt32 nl, nStrmPos = pWMF->Tell(); @@ -1029,12 +1031,20 @@ sal_Bool WMFReader::ReadHeader() } else { - nUnitsPerInch = 96; - pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the the metaactions - GetPlaceableBound( aPlaceableBound, pWMF ); - pWMF->Seek( nStrmPos ); + nUnitsPerInch = (pAPMHeader!=NULL?pAPMHeader->inch:96); + pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the the metaactions + GetPlaceableBound( aPlaceableBound, pWMF ); + pWMF->Seek( nStrmPos ); + if (pAPMHeader!=NULL) { + // #n417818#: If we have an external header then overwrite the bounds! + aPlaceableBound=Rectangle(pAPMHeader->left*567*nUnitsPerInch/1440/1000, + pAPMHeader->top*567*nUnitsPerInch/1440/1000, + pAPMHeader->right*567*nUnitsPerInch/1440/1000, + pAPMHeader->bottom*567*nUnitsPerInch/1440/1000); + } } + pOut->SetUnitsPerInch( nUnitsPerInch ); pOut->SetWinOrg( aPlaceableBound.TopLeft() ); aWMFSize = Size( labs( aPlaceableBound.GetWidth() ), labs( aPlaceableBound.GetHeight() ) ); pOut->SetWinExt( aWMFSize ); @@ -1067,7 +1077,7 @@ sal_Bool WMFReader::ReadHeader() return sal_True; } -void WMFReader::ReadWMF() +void WMFReader::ReadWMF(WMF_APMFILEHEADER *pAPMHeader) { sal_uInt16 nFunction; sal_uLong nPos, nPercent, nLastPercent; @@ -1092,7 +1102,7 @@ void WMFReader::ReadWMF() pWMF->Seek( nStartPos ); Callback( (sal_uInt16) ( nLastPercent = 0 ) ); - if ( ReadHeader() ) + if ( ReadHeader( pAPMHeader ) ) { nPos = pWMF->Tell(); @@ -1210,10 +1220,6 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt rPlaceableBound.Right() = (sal_Int32)0x80000000; rPlaceableBound.Bottom() = (sal_Int32)0x80000000; - sal_Int16 nMapMode = MM_ANISOTROPIC; - - sal_uInt16 nFunction; - sal_uInt32 nRSize; sal_uInt32 nPos = pStm->Tell(); sal_uInt32 nEnd = pStm->Seek( STREAM_SEEK_TO_END ); @@ -1221,6 +1227,10 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt if( nEnd - nPos ) { + sal_Int16 nMapMode = MM_ANISOTROPIC; + sal_uInt16 nFunction; + sal_uInt32 nRSize; + while( bRet ) { *pStm >> nRSize >> nFunction; @@ -1321,7 +1331,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt case W_META_SETPIXEL: { - const Color aColor = ReadColor(); + ReadColor(); GetWinExtMax( ReadYX(), rPlaceableBound, nMapMode ); } break; @@ -1342,12 +1352,11 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt case W_META_EXTTEXTOUT: { sal_uInt16 nLen, nOptions; - sal_Int32 nRecordPos, nRecordSize; + sal_Int32 nRecordSize; Point aPosition; Rectangle aRect; pStm->SeekRel(-6); - nRecordPos = pStm->Tell(); *pStm >> nRecordSize; pStm->SeekRel(2); aPosition = ReadYX(); @@ -1428,3 +1437,5 @@ WMFReader::~WMFReader() if( pEMFStream ) delete pEMFStream; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/wmf.cxx b/svtools/source/filter/wmf/wmf.cxx index 4e84cd920b56..9b2a8edf2d6e 100644 --- a/svtools/source/filter/wmf/wmf.cxx +++ b/svtools/source/filter/wmf/wmf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,7 +36,7 @@ // ----------------------------------------------------------------------------- -sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem ) +sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem, WMF_APMFILEHEADER *pAPMHeader ) { sal_uInt32 nMetaType; sal_uInt32 nOrgPos = rStreamWMF.Tell(); @@ -51,7 +52,7 @@ sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaF } else { - WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadWMF(); + WMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadWMF( pAPMHeader ); } rStreamWMF.SetNumberFormatInt( nOrigNumberFormat ); return !rStreamWMF.GetError(); @@ -95,8 +96,8 @@ sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetSt sal_Bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem ) { - EMFWriter aEMFWriter; - return aEMFWriter.WriteEMF( rMTF, rTargetStream, pConfigItem ); + EMFWriter aEMFWriter(rTargetStream); + return aEMFWriter.WriteEMF( rMTF, pConfigItem ); } // ----------------------------------------------------------------------------- @@ -112,3 +113,5 @@ sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ) { return WMFWriter().WriteWMF( rMTF, rStream, NULL, sal_False ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/wmfwr.cxx b/svtools/source/filter/wmf/wmfwr.cxx index 26bda76a11d9..18c0336740e1 100644 --- a/svtools/source/filter/wmf/wmfwr.cxx +++ b/svtools/source/filter/wmf/wmfwr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,9 +38,7 @@ #include <rtl/tencinfo.h> #include <tools/tenccvt.hxx> #include <osl/endian.h> -#ifndef INCLUDED_I18NUTIL_UNICODE_HXX #include <i18nutil/unicode.hxx> //unicode::getUnicodeScriptType -#endif #include <vcl/metric.hxx> #include <basegfx/polygon/b2dpolygon.hxx> @@ -248,34 +247,6 @@ #define PRIVATE_ESCAPE_UNICODE 2 -/// copied from writerwordglue.cxx - -/* - Utility to categorize unicode characters into the best fit windows charset - range for exporting to ww6, or as a hint to non \u unicode token aware rtf - readers -*/ -rtl_TextEncoding getScriptClass(sal_Unicode cChar) -{ - using namespace com::sun::star::i18n; - - static ScriptTypeList aScripts[] = - { - { UnicodeScript_kBasicLatin, UnicodeScript_kBasicLatin, RTL_TEXTENCODING_MS_1252}, - { UnicodeScript_kLatin1Supplement, UnicodeScript_kLatin1Supplement, RTL_TEXTENCODING_MS_1252}, - { UnicodeScript_kLatinExtendedA, UnicodeScript_kLatinExtendedA, RTL_TEXTENCODING_MS_1250}, - { UnicodeScript_kLatinExtendedB, UnicodeScript_kLatinExtendedB, RTL_TEXTENCODING_MS_1257}, - { UnicodeScript_kGreek, UnicodeScript_kGreek, RTL_TEXTENCODING_MS_1253}, - { UnicodeScript_kCyrillic, UnicodeScript_kCyrillic, RTL_TEXTENCODING_MS_1251}, - { UnicodeScript_kHebrew, UnicodeScript_kHebrew, RTL_TEXTENCODING_MS_1255}, - { UnicodeScript_kArabic, UnicodeScript_kArabic, RTL_TEXTENCODING_MS_1256}, - { UnicodeScript_kThai, UnicodeScript_kThai, RTL_TEXTENCODING_MS_1258}, - { UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, RTL_TEXTENCODING_MS_1252} - }; - return unicode::getUnicodeScriptType(cChar, aScripts, - RTL_TEXTENCODING_MS_1252); -} - //========================== Methoden von WMFWriter ========================== void WMFWriter::MayCallback() @@ -303,11 +274,11 @@ void WMFWriter::MayCallback() void WMFWriter::CountActionsAndBitmaps( const GDIMetaFile & rMTF ) { - sal_uLong nAction, nActionCount; + size_t nAction, nActionCount; - nActionCount = rMTF.GetActionCount(); + nActionCount = rMTF.GetActionSize(); - for ( nAction=0; nAction<nActionCount; nAction++ ) + for ( nAction=0; nAction < nActionCount; nAction++ ) { MetaAction* pMA = rMTF.GetAction( nAction ); @@ -601,13 +572,13 @@ sal_Bool WMFWriter::WMFRecord_Escape_Unicode( const Point& rPoint, const String& { // try again, with determining a better charset from unicode char pBuf = rUniStr.GetBuffer(); const sal_Unicode* pCheckChar = pBuf; - rtl_TextEncoding aTextEncoding = getScriptClass (*pCheckChar); // try the first character + rtl_TextEncoding aTextEncoding = getBestMSEncodingByChar(*pCheckChar); // try the first character for ( i = 1; i < nStringLen; i++) { if (aTextEncoding != aTextEncodingOrg) // found something break; pCheckChar++; - aTextEncoding = getScriptClass (*pCheckChar); // try the next character + aTextEncoding = getBestMSEncodingByChar(*pCheckChar); // try the next character } aByteStr = ByteString ( rUniStr, aTextEncoding ); @@ -844,13 +815,6 @@ void WMFWriter::WMFRecord_SelectObject(sal_uInt16 nObjectHandle) } -void WMFWriter::WMFRecord_SetBkColor(const Color & rColor) -{ - WriteRecordHeader(0x00000005,W_META_SETBKCOLOR); - WriteColor(rColor); -} - - void WMFWriter::WMFRecord_SetBkMode(sal_Bool bTransparent) { WriteRecordHeader(0x00000004,W_META_SETBKMODE); @@ -1182,16 +1146,16 @@ void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx: void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) { - sal_uLong nA, nACount; + size_t nA, nACount; MetaAction* pMA; if( bStatus ) { - nACount = rMTF.GetActionCount(); + nACount = rMTF.GetActionSize(); WMFRecord_SetStretchBltMode(); - for( nA=0; nA<nACount; nA++ ) + for( nA=0; nA < nACount; nA++ ) { pMA = rMTF.GetAction( nA ); @@ -1622,10 +1586,11 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) const MetaFontAction* pA = (const MetaFontAction*) pMA; aSrcFont = pA->GetFont(); - if ( aSrcFont.GetCharSet() == RTL_TEXTENCODING_DONTKNOW ) - aSrcFont.SetCharSet( GetExtendedTextEncoding( gsl_getSystemTextEncoding() ) ); - if ( aSrcFont.GetCharSet() == RTL_TEXTENCODING_UNICODE ) + if ( (aSrcFont.GetCharSet() == RTL_TEXTENCODING_DONTKNOW) + || (aSrcFont.GetCharSet() == RTL_TEXTENCODING_UNICODE) ) + { aSrcFont.SetCharSet( RTL_TEXTENCODING_MS_1252 ); + } eSrcTextAlign = aSrcFont.GetAlign(); aSrcTextColor = aSrcFont.GetColor(); aSrcFont.SetAlign( ALIGN_BASELINE ); @@ -1700,8 +1665,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) const MetaEPSAction* pA = (const MetaEPSAction*)pMA; const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() ); - sal_Int32 nCount = aGDIMetaFile.GetActionCount(); - for ( sal_Int32 i = 0; i < nCount; i++ ) + size_t nCount = aGDIMetaFile.GetActionSize(); + for ( size_t i = 0; i < nCount; i++ ) { const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i ); if ( pMetaAct->GetType() == META_BMPSCALE_ACTION ) @@ -1780,7 +1745,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) case META_MASKSCALE_ACTION: case META_MASKSCALEPART_ACTION: { - DBG_ERROR( "Unsupported action: MetaMask...Action!" ); + OSL_FAIL( "Unsupported action: MetaMask...Action!" ); } break; @@ -1789,13 +1754,13 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) case META_ISECTREGIONCLIPREGION_ACTION: { - DBG_ERROR( "Unsupported action: MetaISectRegionClipRegionAction!" ); + OSL_FAIL( "Unsupported action: MetaISectRegionClipRegionAction!" ); } break; case META_MOVECLIPREGION_ACTION: { - DBG_ERROR( "Unsupported action: MetaMoveClipRegionAction!" ); + OSL_FAIL( "Unsupported action: MetaMoveClipRegionAction!" ); } break; @@ -1821,7 +1786,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) default: { - DBG_ERROR( "Unsupported meta action!" ); + OSL_FAIL( "Unsupported meta action!" ); } break; } @@ -1985,7 +1950,7 @@ sal_Bool WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream, bDstIsClipping = bSrcIsClipping = sal_False; Font aFont; - aFont.SetCharSet( GetExtendedTextEncoding( gsl_getSystemTextEncoding() ) ); + aFont.SetCharSet( GetExtendedTextEncoding( RTL_TEXTENCODING_MS_1252 ) ); aFont.SetColor( Color( COL_WHITE ) ); aFont.SetAlign( ALIGN_BASELINE ); aDstFont = aSrcFont = aFont; @@ -2050,10 +2015,10 @@ sal_uInt16 WMFWriter::CalcSaveTargetMapMode(MapMode& rMapMode, void WMFWriter::WriteEmbeddedEMF( const GDIMetaFile& rMTF ) { - EMFWriter aEMFWriter; SvMemoryStream aStream; + EMFWriter aEMFWriter(aStream); - if( aEMFWriter.WriteEMF( rMTF, aStream ) ) + if( aEMFWriter.WriteEMF( rMTF ) ) { sal_Size nTotalSize = aStream.Tell(); if( nTotalSize > SAL_MAX_UINT32 ) @@ -2122,3 +2087,5 @@ void WMFWriter::WriteEMFRecord( SvMemoryStream& rStream, sal_uInt32 nCurSize, sa rStream.SeekRel( nCurSize ); UpdateRecordHeader(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/wmf/wmfwr.hxx b/svtools/source/filter/wmf/wmfwr.hxx index a76b39ad154f..75cf46c0bcb3 100644 --- a/svtools/source/filter/wmf/wmfwr.hxx +++ b/svtools/source/filter/wmf/wmfwr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -181,7 +182,6 @@ private: void WMFRecord_RoundRect(const Rectangle & rRect, long nHorzRound, long nVertRound); void WMFRecord_SaveDC(); void WMFRecord_SelectObject(sal_uInt16 nObjectHandle); - void WMFRecord_SetBkColor(const Color & rColor); void WMFRecord_SetBkMode(sal_Bool bTransparent); void WMFRecord_SetStretchBltMode(); void WMFRecord_SetPixel(const Point & rPoint, const Color & rColor); @@ -227,3 +227,5 @@ public: }; #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx index 395d3dfea0de..d76b50b54a01 100644 --- a/svtools/source/graphic/descriptor.cxx +++ b/svtools/source/graphic/descriptor.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,11 +31,11 @@ #include "descriptor.hxx" -#include <rtl/uuid.h> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <unotools/ucbstreamhelper.hxx> #include <svtools/filter.hxx> #include <svl/itemprop.hxx> +#include <comphelper/servicehelper.hxx> #include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -304,28 +305,22 @@ uno::Sequence< uno::Type > SAL_CALL GraphicDescriptor::getTypes() return aTypes; } -// ------------------------------------------------------------------------------ +namespace +{ + class theGraphicDescriptorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicDescriptorUnoTunnelId > {}; +} uno::Sequence< sal_Int8 > SAL_CALL GraphicDescriptor::getImplementationId() throw( uno::RuntimeException ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); - static uno::Sequence< sal_Int8 > aId; - - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); - } - - return aId; + return theGraphicDescriptorUnoTunnelId::get().getSeq(); } // ------------------------------------------------------------------------------ ::comphelper::PropertySetInfo* GraphicDescriptor::createPropertySetInfo() { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo(); static ::comphelper::PropertyMapEntry aEntries[] = @@ -364,7 +359,7 @@ void GraphicDescriptor::_setPropertyValues( const comphelper::PropertyMapEntry** void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValues ) throw( beans::UnknownPropertyException, lang::WrappedTargetException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; while( *ppEntries ) { @@ -409,7 +404,7 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** } if( !aMimeType.getLength() && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) - aMimeType = ::rtl::OUString::createFromAscii( MIMETYPE_VCLGRAPHIC ); + aMimeType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_VCLGRAPHIC )); } else aMimeType = maMimeType; @@ -497,3 +492,5 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/descriptor.hxx b/svtools/source/graphic/descriptor.hxx index 2a8c06723eb6..2eeff29b9927 100644 --- a/svtools/source/graphic/descriptor.hxx +++ b/svtools/source/graphic/descriptor.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -138,3 +139,5 @@ private: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx index 52c03c611241..cf212d9d8fce 100644 --- a/svtools/source/graphic/graphic.cxx +++ b/svtools/source/graphic/graphic.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,13 +29,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <rtl/uuid.h> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/graphic/GraphicType.hpp> #include <com/sun/star/graphic/XGraphicTransformer.hpp> #include <vcl/graph.hxx> #include "graphic.hxx" +#include <comphelper/servicehelper.hxx> using namespace com::sun::star; @@ -113,19 +114,15 @@ void SAL_CALL Graphic::release() throw() // ------------------------------------------------------------------------------ +namespace +{ + class theGraphicUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicUnoTunnelId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId_Static() throw(uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); - static uno::Sequence< sal_Int8 > aId; - - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); - } - - return aId; + return theGraphicUnoTunnelId::get().getSeq(); } // ------------------------------------------------------------------------------ @@ -235,7 +232,7 @@ uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId() awt::Size SAL_CALL Graphic::getSize( ) throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::Size aVclSize; if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) @@ -248,7 +245,7 @@ awt::Size SAL_CALL Graphic::getSize( ) throw (uno::RuntimeException) uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getDIB( ) throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) { @@ -266,7 +263,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getDIB( ) throw (uno::RuntimeExce uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getMaskDIB( ) throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if( mpGraphic && ( mpGraphic->GetType() != GRAPHIC_NONE ) ) { @@ -298,3 +295,5 @@ sal_Int64 SAL_CALL Graphic::getSomething( const uno::Sequence< sal_Int8 >& rId ) } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/graphic.hxx b/svtools/source/graphic/graphic.hxx index 1a6594a3e543..a82c9cca7ced 100644 --- a/svtools/source/graphic/graphic.hxx +++ b/svtools/source/graphic/graphic.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -101,3 +102,5 @@ private: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/graphicunofactory.cxx b/svtools/source/graphic/graphicunofactory.cxx index f29b34b66743..c1e2f13068de 100644 --- a/svtools/source/graphic/graphicunofactory.cxx +++ b/svtools/source/graphic/graphicunofactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -101,3 +102,5 @@ sdecl::class_<GObjectImpl, sdecl::with_args<true> > serviceBI; extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicObject", "com.sun.star.graphic.GraphicObject" ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/grfattr.cxx b/svtools/source/graphic/grfattr.cxx index 68c0ea9ae4a7..a85cd90df079 100644 --- a/svtools/source/graphic/grfattr.cxx +++ b/svtools/source/graphic/grfattr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -116,3 +117,5 @@ SvStream& operator<<( SvStream& rOStm, const GraphicAttr& rAttr ) return rOStm; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index cd8125a6cc79..df7bfa9f88b1 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <vos/timer.hxx> +#include <salhelper/timer.hxx> #include <tools/debug.hxx> #include <vcl/outdev.hxx> #include <tools/poly.hxx> @@ -117,7 +118,7 @@ GraphicID::GraphicID( const GraphicObject& rObj ) { const GDIMetaFile aMtf( rGraphic.GetGDIMetaFile() ); - mnID1 |= ( aMtf.GetActionCount() & 0x0fffffff ); + mnID1 |= ( aMtf.GetActionSize() & 0x0fffffff ); mnID2 = aMtf.GetPrefSize().Width(); mnID3 = aMtf.GetPrefSize().Height(); mnID4 = rGraphic.GetChecksum(); @@ -170,7 +171,6 @@ private: sal_Bool mbSwappedAll; sal_Bool ImplInit( const GraphicObject& rObj ); - sal_Bool ImplMatches( const GraphicObject& rObj ) const { return( GraphicID( rObj ) == maID ); } void ImplFillSubstitute( Graphic& rSubstitute ); public: @@ -409,7 +409,7 @@ class GraphicDisplayCacheEntry { private: - ::vos::TTimeValue maReleaseTime; + ::salhelper::TTimeValue maReleaseTime; const GraphicCacheEntry* mpRefCacheEntry; GDIMetaFile* mpMtf; BitmapEx* mpBmpEx; @@ -462,8 +462,8 @@ public: sal_uLong GetOutDevDrawMode() const { return mnOutDevDrawMode; } sal_uInt16 GetOutDevBitCount() const { return mnOutDevBitCount; } - void SetReleaseTime( const ::vos::TTimeValue& rReleaseTime ) { maReleaseTime = rReleaseTime; } - const ::vos::TTimeValue& GetReleaseTime() const { return maReleaseTime; } + void SetReleaseTime( const ::salhelper::TTimeValue& rReleaseTime ) { maReleaseTime = rReleaseTime; } + const ::salhelper::TTimeValue& GetReleaseTime() const { return maReleaseTime; } sal_Bool Matches( OutputDevice* pOut, const Point& /*rPtPixel*/, const Size& rSzPixel, const GraphicCacheEntry* pCacheEntry, const GraphicAttr& rAttr ) const @@ -512,7 +512,7 @@ sal_uLong GraphicDisplayCacheEntry::GetNeededSize( OutputDevice* pOut, const Poi } else { - DBG_ERROR( "GraphicDisplayCacheEntry::GetNeededSize(): pOut->GetBitCount() == 0" ); + OSL_FAIL( "GraphicDisplayCacheEntry::GetNeededSize(): pOut->GetBitCount() == 0" ); nNeededSize = 256000; } } @@ -801,12 +801,12 @@ void GraphicCache::SetCacheTimeout( sal_uLong nTimeoutSeconds ) if( mnReleaseTimeoutSeconds != nTimeoutSeconds ) { GraphicDisplayCacheEntry* pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.First(); - ::vos::TTimeValue aReleaseTime; + ::salhelper::TTimeValue aReleaseTime; if( ( mnReleaseTimeoutSeconds = nTimeoutSeconds ) != 0 ) { osl_getSystemTime( &aReleaseTime ); - aReleaseTime.addTime( ::vos::TTimeValue( nTimeoutSeconds, 0 ) ); + aReleaseTime.addTime( ::salhelper::TTimeValue( nTimeoutSeconds, 0 ) ); } while( pDisplayEntry ) @@ -897,10 +897,10 @@ sal_Bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& r if( GetCacheTimeout() ) { - ::vos::TTimeValue aReleaseTime; + ::salhelper::TTimeValue aReleaseTime; osl_getSystemTime( &aReleaseTime ); - aReleaseTime.addTime( ::vos::TTimeValue( GetCacheTimeout(), 0 ) ); + aReleaseTime.addTime( ::salhelper::TTimeValue( GetCacheTimeout(), 0 ) ); pNewEntry->SetReleaseTime( aReleaseTime ); } @@ -931,10 +931,10 @@ sal_Bool GraphicCache::CreateDisplayCacheObj( OutputDevice* pOut, const Point& r if( GetCacheTimeout() ) { - ::vos::TTimeValue aReleaseTime; + ::salhelper::TTimeValue aReleaseTime; osl_getSystemTime( &aReleaseTime ); - aReleaseTime.addTime( ::vos::TTimeValue( GetCacheTimeout(), 0 ) ); + aReleaseTime.addTime( ::salhelper::TTimeValue( GetCacheTimeout(), 0 ) ); pNewEntry->SetReleaseTime( aReleaseTime ); } @@ -961,7 +961,7 @@ sal_Bool GraphicCache::DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt { if( pDisplayCacheEntry->Matches( pOut, aPtPixel, aSzPixel, pCacheEntry, rAttr ) ) { - ::vos::TTimeValue aReleaseTime; + ::salhelper::TTimeValue aReleaseTime; // put found object at last used position maDisplayCache.Insert( maDisplayCache.Remove( pDisplayCacheEntry ), LIST_APPEND ); @@ -969,7 +969,7 @@ sal_Bool GraphicCache::DrawDisplayCacheObj( OutputDevice* pOut, const Point& rPt if( GetCacheTimeout() ) { osl_getSystemTime( &aReleaseTime ); - aReleaseTime.addTime( ::vos::TTimeValue( GetCacheTimeout(), 0 ) ); + aReleaseTime.addTime( ::salhelper::TTimeValue( GetCacheTimeout(), 0 ) ); } pDisplayCacheEntry->SetReleaseTime( aReleaseTime ); @@ -1036,14 +1036,14 @@ IMPL_LINK( GraphicCache, ReleaseTimeoutHdl, Timer*, pTimer ) { pTimer->Stop(); - ::vos::TTimeValue aCurTime; + ::salhelper::TTimeValue aCurTime; GraphicDisplayCacheEntry* pDisplayEntry = (GraphicDisplayCacheEntry*) maDisplayCache.First(); osl_getSystemTime( &aCurTime ); while( pDisplayEntry ) { - const ::vos::TTimeValue& rReleaseTime = pDisplayEntry->GetReleaseTime(); + const ::salhelper::TTimeValue& rReleaseTime = pDisplayEntry->GetReleaseTime(); if( !rReleaseTime.isEmpty() && ( rReleaseTime < aCurTime ) ) { @@ -1060,3 +1060,5 @@ IMPL_LINK( GraphicCache, ReleaseTimeoutHdl, Timer*, pTimer ) return 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/grfcache.hxx b/svtools/source/graphic/grfcache.hxx index 0885667aa2b7..cfa946f6bca9 100644 --- a/svtools/source/graphic/grfcache.hxx +++ b/svtools/source/graphic/grfcache.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ #ifndef _GRFCACHE_HXX #define _GRFCACHE_HXX -#include <tools/list.hxx> #include <vcl/graph.hxx> #include <vcl/timer.hxx> #include <svtools/grfmgr.hxx> @@ -107,3 +107,5 @@ public: }; #endif // _GRFCACHE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 9241cbd04d51..19b09e8f67a7 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,27 +45,13 @@ #include <unotools/cacheoptions.hxx> #include <svtools/grfmgr.hxx> -// --> OD 2010-01-04 #i105243# #include <vcl/pdfextoutdevdata.hxx> -// <-- - -// ----------- -// - Defines - -// ----------- #define WATERMARK_LUM_OFFSET 50 #define WATERMARK_CON_OFFSET -70 -// ----------- -// - statics - -// ----------- - GraphicManager* GraphicObject::mpGlobalMgr = NULL; -// --------------------- -// - GrfDirectCacheObj - -// --------------------- - struct GrfSimpleCacheObj { Graphic maGraphic; @@ -74,14 +61,8 @@ struct GrfSimpleCacheObj maGraphic( rGraphic ), maAttr( rAttr ) {} }; -// ----------------- -// - GraphicObject - -// ----------------- - TYPEINIT1_AUTOFACTORY( GraphicObject, SvDataCopyStream ); -// ----------------------------------------------------------------------------- - GraphicObject::GraphicObject( const GraphicManager* pMgr ) : mpLink ( NULL ), mpUserData ( NULL ) @@ -91,8 +72,6 @@ GraphicObject::GraphicObject( const GraphicManager* pMgr ) : ImplSetGraphicManager( pMgr ); } -// ----------------------------------------------------------------------------- - GraphicObject::GraphicObject( const Graphic& rGraphic, const GraphicManager* pMgr ) : maGraphic ( rGraphic ), mpLink ( NULL ), @@ -103,8 +82,6 @@ GraphicObject::GraphicObject( const Graphic& rGraphic, const GraphicManager* pMg ImplSetGraphicManager( pMgr ); } -// ----------------------------------------------------------------------------- - GraphicObject::GraphicObject( const Graphic& rGraphic, const String& rLink, const GraphicManager* pMgr ) : maGraphic ( rGraphic ), mpLink ( rLink.Len() ? ( new String( rLink ) ) : NULL ), @@ -115,8 +92,6 @@ GraphicObject::GraphicObject( const Graphic& rGraphic, const String& rLink, cons ImplSetGraphicManager( pMgr ); } -// ----------------------------------------------------------------------------- - GraphicObject::GraphicObject( const GraphicObject& rGraphicObj, const GraphicManager* pMgr ) : SvDataCopyStream(), maGraphic ( rGraphicObj.GetGraphic() ), @@ -129,8 +104,6 @@ GraphicObject::GraphicObject( const GraphicObject& rGraphicObj, const GraphicMan ImplSetGraphicManager( pMgr, NULL, &rGraphicObj ); } -// ----------------------------------------------------------------------------- - GraphicObject::GraphicObject( const ByteString& rUniqueID, const GraphicManager* pMgr ) : mpLink ( NULL ), mpUserData ( NULL ) @@ -146,8 +119,6 @@ GraphicObject::GraphicObject( const ByteString& rUniqueID, const GraphicManager* ImplAssignGraphicData(); } -// ----------------------------------------------------------------------------- - GraphicObject::~GraphicObject() { if( mpMgr ) @@ -165,8 +136,6 @@ GraphicObject::~GraphicObject() delete mpSimpleCache; } -// ----------------------------------------------------------------------------- - void GraphicObject::ImplConstruct() { mpMgr = NULL; @@ -179,8 +148,6 @@ void GraphicObject::ImplConstruct() mbIsInSwapOut = sal_False; } -// ----------------------------------------------------------------------------- - void GraphicObject::ImplAssignGraphicData() { maPrefSize = maGraphic.GetPrefSize(); @@ -196,8 +163,6 @@ void GraphicObject::ImplAssignGraphicData() mnAnimationLoopCount = ( mbAnimated ? maGraphic.GetAnimationLoopCount() : 0 ); } -// ----------------------------------------------------------------------------- - void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const ByteString* pID, const GraphicObject* pCopyObj ) { if( !mpMgr || ( pMgr != mpMgr ) ) @@ -235,8 +200,6 @@ void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const Byt } } -// ----------------------------------------------------------------------------- - void GraphicObject::ImplAutoSwapIn() { if( IsSwappedOut() ) @@ -299,7 +262,6 @@ void GraphicObject::ImplAutoSwapIn() } } -// ----------------------------------------------------------------------------- sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz, const GraphicAttr* pAttr, PolyPolygon& rClipPolyPoly, sal_Bool& bRectClipRegion ) const { @@ -310,9 +272,6 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& Polygon aClipPoly( Rectangle( rPt, rSz ) ); const sal_uInt16 nRot10 = pAttr->GetRotation() % 3600; const Point aOldOrigin( rPt ); - // --> OD 2005-09-30 #i54875# - It's not needed to get the graphic again. -// const Graphic& rGraphic = GetGraphic(); - // <-- const MapMode aMap100( MAP_100TH_MM ); Size aSize100; long nTotalWidth, nTotalHeight; @@ -329,12 +288,6 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rClipPolyPoly = aClipPoly; - // --> OD 2005-09-30 #i54875# - directly access member <maGraphic> to - // get <PrefSize> and <PrefMapMode>. -// if( rGraphic.GetPrefMapMode() == MAP_PIXEL ) -// aSize100 = Application::GetDefaultDevice()->PixelToLogic( rGraphic.GetPrefSize(), aMap100 ); -// else -// aSize100 = pOut->LogicToLogic( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode(), aMap100 ); if( maGraphic.GetPrefMapMode() == MAP_PIXEL ) aSize100 = Application::GetDefaultDevice()->PixelToLogic( maGraphic.GetPrefSize(), aMap100 ); else @@ -342,7 +295,6 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& MapMode m(maGraphic.GetPrefMapMode()); aSize100 = pOut->LogicToLogic( maGraphic.GetPrefSize(), &m, &aMap100 ); } - // <-- nTotalWidth = aSize100.Width() - pAttr->GetLeftCrop() - pAttr->GetRightCrop(); nTotalHeight = aSize100.Height() - pAttr->GetTopCrop() - pAttr->GetBottomCrop(); @@ -381,8 +333,6 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& return bRet; } -// ----------------------------------------------------------------------------- - GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj ) { if( &rGraphicObj != this ) @@ -408,8 +358,6 @@ GraphicObject& GraphicObject::operator=( const GraphicObject& rGraphicObj ) return *this; } -// ----------------------------------------------------------------------------- - sal_Bool GraphicObject::operator==( const GraphicObject& rGraphicObj ) const { return( ( rGraphicObj.maGraphic == maGraphic ) && @@ -417,29 +365,21 @@ sal_Bool GraphicObject::operator==( const GraphicObject& rGraphicObj ) const ( rGraphicObj.GetLink() == GetLink() ) ); } -// ------------------------------------------------------------------------ - void GraphicObject::Load( SvStream& rIStm ) { rIStm >> *this; } -// ------------------------------------------------------------------------ - void GraphicObject::Save( SvStream& rOStm ) { rOStm << *this; } -// ------------------------------------------------------------------------ - void GraphicObject::Assign( const SvDataCopyStream& rCopyStream ) { *this = (const GraphicObject& ) rCopyStream; } -// ----------------------------------------------------------------------------- - ByteString GraphicObject::GetUniqueID() const { if ( !IsInSwapIn() && ( IsEPS() || IsRenderGraphic() ) ) @@ -453,30 +393,22 @@ ByteString GraphicObject::GetUniqueID() const return aRet; } -// ----------------------------------------------------------------------------- - sal_uLong GraphicObject::GetChecksum() const { return( ( maGraphic.IsSupportedGraphic() && !maGraphic.IsSwapOut() ) ? maGraphic.GetChecksum() : 0 ); } -// ----------------------------------------------------------------------------- - SvStream* GraphicObject::GetSwapStream() const { return( HasSwapStreamHdl() ? (SvStream*) mpSwapStreamHdl->Call( (void*) this ) : GRFMGR_AUTOSWAPSTREAM_NONE ); } -// ----------------------------------------------------------------------------- - // !!! to be removed sal_uLong GraphicObject::GetReleaseFromCache() const { return 0; } -// ----------------------------------------------------------------------------- - void GraphicObject::SetAttr( const GraphicAttr& rAttr ) { maAttr = rAttr; @@ -485,23 +417,17 @@ void GraphicObject::SetAttr( const GraphicAttr& rAttr ) delete mpSimpleCache, mpSimpleCache = NULL; } -// ----------------------------------------------------------------------------- - void GraphicObject::SetLink() { if( mpLink ) delete mpLink, mpLink = NULL; } -// ----------------------------------------------------------------------------- - void GraphicObject::SetLink( const String& rLink ) { delete mpLink, mpLink = new String( rLink ); } -// ----------------------------------------------------------------------------- - String GraphicObject::GetLink() const { if( mpLink ) @@ -510,23 +436,17 @@ String GraphicObject::GetLink() const return String(); } -// ----------------------------------------------------------------------------- - void GraphicObject::SetUserData() { if( mpUserData ) delete mpUserData, mpUserData = NULL; } -// ----------------------------------------------------------------------------- - void GraphicObject::SetUserData( const String& rUserData ) { delete mpUserData, mpUserData = new String( rUserData ); } -// ----------------------------------------------------------------------------- - String GraphicObject::GetUserData() const { if( mpUserData ) @@ -535,8 +455,6 @@ String GraphicObject::GetUserData() const return String(); } -// ----------------------------------------------------------------------------- - void GraphicObject::SetSwapStreamHdl() { if( mpSwapStreamHdl ) @@ -546,8 +464,6 @@ void GraphicObject::SetSwapStreamHdl() } } -// ----------------------------------------------------------------------------- - void GraphicObject::SetSwapStreamHdl( const Link& rHdl, const sal_uLong nSwapOutTimeout ) { delete mpSwapStreamHdl, mpSwapStreamHdl = new Link( rHdl ); @@ -567,8 +483,6 @@ void GraphicObject::SetSwapStreamHdl( const Link& rHdl, const sal_uLong nSwapOut delete mpSwapOutTimer, mpSwapOutTimer = NULL; } -// ----------------------------------------------------------------------------- - Link GraphicObject::GetSwapStreamHdl() const { if( mpSwapStreamHdl ) @@ -577,22 +491,16 @@ Link GraphicObject::GetSwapStreamHdl() const return Link(); } -// ----------------------------------------------------------------------------- - void GraphicObject::FireSwapInRequest() { ImplAutoSwapIn(); } -// ----------------------------------------------------------------------------- - void GraphicObject::FireSwapOutRequest() { ImplAutoSwapOutHdl( NULL ); } -// ----------------------------------------------------------------------------- - void GraphicObject::GraphicManagerDestroyed() { // we're alive, but our manager doesn't live anymore ==> connect to default manager @@ -600,15 +508,11 @@ void GraphicObject::GraphicManagerDestroyed() ImplSetGraphicManager( NULL ); } -// ----------------------------------------------------------------------------- - void GraphicObject::SetGraphicManager( const GraphicManager& rMgr ) { ImplSetGraphicManager( &rMgr ); } -// ----------------------------------------------------------------------------- - sal_Bool GraphicObject::IsCached( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicAttr* pAttr, sal_uLong nFlags ) const { @@ -616,10 +520,6 @@ sal_Bool GraphicObject::IsCached( OutputDevice* pOut, const Point& rPt, const Si if( nFlags & GRFMGR_DRAW_CACHED ) { - // --> OD 2005-10-11 #i54875# - Consider cropped graphics. - // Note: The graphic manager caches a cropped graphic with its - // uncropped position and size. -// bRet = mpMgr->IsInCache( pOut, rPt, rSz, *this, ( pAttr ? *pAttr : GetAttr() ) ); Point aPt( rPt ); Size aSz( rSz ); if ( pAttr->IsCropped() ) @@ -636,30 +536,22 @@ sal_Bool GraphicObject::IsCached( OutputDevice* pOut, const Point& rPt, const Si return bRet; } -// ----------------------------------------------------------------------------- - void GraphicObject::ReleaseFromCache() { mpMgr->ReleaseFromCache( *this ); } -// ----------------------------------------------------------------------------- - void GraphicObject::SetAnimationNotifyHdl( const Link& rLink ) { maGraphic.SetAnimationNotifyHdl( rLink ); } -// ----------------------------------------------------------------------------- - List* GraphicObject::GetAnimationInfoList() const { return maGraphic.GetAnimationInfoList(); } -// ----------------------------------------------------------------------------- - sal_Bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicAttr* pAttr, sal_uLong nFlags ) { @@ -737,7 +629,7 @@ sal_Bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& return bRet; } -// --> OD 2010-01-04 #i105243# +// #i105243# sal_Bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev, const Point& rPt, const Size& rSz, const GraphicAttr* pGrfAttr, @@ -797,9 +689,6 @@ sal_Bool GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev, return bRet; } -// <-- - -// ----------------------------------------------------------------------------- sal_Bool GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSize, const Size& rOffset, const GraphicAttr* pAttr, sal_uLong nFlags, int nTileCacheSize1D ) @@ -823,8 +712,6 @@ sal_Bool GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, c return ImplDrawTiled( pOut, rArea, aOutTileSize, rOffset, pAttr, nFlags, nTileCacheSize1D ); } -// ----------------------------------------------------------------------------- - sal_Bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData, const GraphicAttr* pAttr, sal_uLong /*nFlags*/, OutputDevice* pFirstFrameOutDev ) @@ -883,16 +770,12 @@ sal_Bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, co return bRet; } -// ----------------------------------------------------------------------------- - void GraphicObject::StopAnimation( OutputDevice* pOut, long nExtraData ) { if( mpSimpleCache ) mpSimpleCache->maGraphic.StopAnimation( pOut, nExtraData ); } -// ----------------------------------------------------------------------------- - const Graphic& GraphicObject::GetGraphic() const { if( mbAutoSwapped ) @@ -901,8 +784,6 @@ const Graphic& GraphicObject::GetGraphic() const return maGraphic; } -// ----------------------------------------------------------------------------- - void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj ) { mpMgr->ImplUnregisterObj( *this ); @@ -922,16 +803,12 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pC mpSwapOutTimer->Start(); } -// ----------------------------------------------------------------------------- - void GraphicObject::SetGraphic( const Graphic& rGraphic, const String& rLink ) { SetGraphic( rGraphic ); mpLink = new String( rLink ); } -// ----------------------------------------------------------------------------- - Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMode& rDestMap, const GraphicAttr& rAttr ) const { // #104550# Extracted from svx/source/svdraw/svdograf.cxx @@ -1116,8 +993,6 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo return aTransGraphic; } -// ----------------------------------------------------------------------------- - Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const // TODO: Change to Impl { GetGraphic(); @@ -1168,8 +1043,6 @@ Graphic GraphicObject::GetTransformedGraphic( const GraphicAttr* pAttr ) const / return aGraphic; } -// ----------------------------------------------------------------------------- - void GraphicObject::ResetAnimationLoopCount() { if( IsAnimated() && !IsSwappedOut() ) @@ -1181,8 +1054,6 @@ void GraphicObject::ResetAnimationLoopCount() } } -// ----------------------------------------------------------------------------- - sal_Bool GraphicObject::SwapOut() { sal_Bool bRet = ( !mbAutoSwapped ? maGraphic.SwapOut() : sal_False ); @@ -1193,8 +1064,6 @@ sal_Bool GraphicObject::SwapOut() return bRet; } -// ----------------------------------------------------------------------------- - sal_Bool GraphicObject::SwapOut( SvStream* pOStm ) { sal_Bool bRet = ( !mbAutoSwapped ? maGraphic.SwapOut( pOStm ) : sal_False ); @@ -1205,8 +1074,6 @@ sal_Bool GraphicObject::SwapOut( SvStream* pOStm ) return bRet; } -// ----------------------------------------------------------------------------- - sal_Bool GraphicObject::SwapIn() { sal_Bool bRet; @@ -1232,8 +1099,6 @@ sal_Bool GraphicObject::SwapIn() return bRet; } -// ----------------------------------------------------------------------------- - sal_Bool GraphicObject::SwapIn( SvStream* pIStm ) { sal_Bool bRet; @@ -1259,8 +1124,6 @@ sal_Bool GraphicObject::SwapIn( SvStream* pIStm ) return bRet; } -// ----------------------------------------------------------------------------- - void GraphicObject::SetSwapState() { if( !IsSwappedOut() ) @@ -1272,8 +1135,6 @@ void GraphicObject::SetSwapState() } } -// ----------------------------------------------------------------------------- - IMPL_LINK( GraphicObject, ImplAutoSwapOutHdl, void*, EMPTYARG ) { if( !IsSwappedOut() ) @@ -1307,8 +1168,6 @@ IMPL_LINK( GraphicObject, ImplAutoSwapOutHdl, void*, EMPTYARG ) return 0L; } -// ------------------------------------------------------------------------ - SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj ) { VersionCompat aCompat( rIStm, STREAM_READ ); @@ -1335,8 +1194,6 @@ SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj ) return rIStm; } -// ------------------------------------------------------------------------ - SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj ) { VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); @@ -1354,7 +1211,7 @@ SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj ) GraphicObject GraphicObject::CreateGraphicObjectFromURL( const ::rtl::OUString &rURL ) { - const String aURL( rURL ), aPrefix( RTL_CONSTASCII_STRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX) ); + const String aURL( rURL ), aPrefix( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX) ); if( aURL.Search( aPrefix ) == 0 ) { // graphic manager url @@ -1374,3 +1231,5 @@ GraphicObject GraphicObject::CreateGraphicObjectFromURL( const ::rtl::OUString & return GraphicObject( aGraphic ); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 4a6fb67187bc..1115635157a8 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,7 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <vos/macros.hxx> #include <vcl/bmpacc.hxx> #include <tools/poly.hxx> #include <vcl/outdev.hxx> @@ -1355,14 +1355,16 @@ sal_Bool GraphicManager::ImplCreateRotatedScaled( const BitmapEx& rBmpEx, // create horizontal mapping table for( nX = 0L, nTmpX = aNewBound.Left() + nStartX; nX < nDstW; nX++ ) { - pCosX[ nX ] = FRound( fCosAngle * ( fTmp = nTmpX++ << 8 ) ); + fTmp = nTmpX++ << 8; + pCosX[ nX ] = FRound( fCosAngle * fTmp ); pSinX[ nX ] = FRound( fSinAngle * fTmp ); } // create vertical mapping table for( nY = 0L, nTmpY = aNewBound.Top() + nStartY; nY < nDstH; nY++ ) { - pCosY[ nY ] = FRound( fCosAngle * ( fTmp = nTmpY++ << 8 ) ); + fTmp = nTmpY++ << 8; + pCosY[ nY ] = FRound( fCosAngle * fTmp ); pSinY[ nY ] = FRound( fSinAngle * fTmp ); } @@ -1806,7 +1808,7 @@ void GraphicManager::ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, sa if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) { - DBG_ERROR( "Missing implementation: Mtf-Transparency" ); + OSL_FAIL( "Missing implementation: Mtf-Transparency" ); } } @@ -1854,12 +1856,12 @@ void GraphicManager::ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr if( ( nAdjustmentFlags & ADJUSTMENT_ROTATE ) && aAttr.IsRotated() ) { - DBG_ERROR( "Missing implementation: Animation-Rotation" ); + OSL_FAIL( "Missing implementation: Animation-Rotation" ); } if( ( nAdjustmentFlags & ADJUSTMENT_TRANSPARENCY ) && aAttr.IsTransparent() ) { - DBG_ERROR( "Missing implementation: Animation-Transparency" ); + OSL_FAIL( "Missing implementation: Animation-Transparency" ); } } @@ -2381,3 +2383,5 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index 5645f7ee9ddf..a8785a5381b1 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <rtl/uuid.h> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <vcl/image.hxx> #include <vcl/metaact.hxx> @@ -45,6 +45,7 @@ #include <vcl/virdev.hxx> #include <com/sun/star/io/XStream.hpp> #include <com/sun/star/text/GraphicCrop.hpp> +#include <comphelper/servicehelper.hxx> #include "descriptor.hxx" #include "graphic.hxx" @@ -142,21 +143,15 @@ uno::Sequence< uno::Type > SAL_CALL GraphicProvider::getTypes() return aTypes; } -// ------------------------------------------------------------------------------ +namespace +{ + class theGraphicProviderUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicProviderUnoTunnelId > {}; +} uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId() throw(uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); - static uno::Sequence< sal_Int8 > aId; - - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); - } - - return aId; + return theGraphicProviderUnoTunnelId::get().getSeq(); } // ------------------------------------------------------------------------------ @@ -231,19 +226,19 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( co if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:standardimage" ) ) ) { rtl::OUString sImageName( rResourceURL.copy( nIndex ) ); - if ( sImageName.equalsAscii( "info" ) ) + if ( sImageName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("info")) ) { xRet = InfoBox::GetStandardImage().GetXGraphic(); } - else if ( sImageName.equalsAscii( "warning" ) ) + else if ( sImageName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("warning")) ) { xRet = WarningBox::GetStandardImage().GetXGraphic(); } - else if ( sImageName.equalsAscii( "error" ) ) + else if ( sImageName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("error")) ) { xRet = ErrorBox::GetStandardImage().GetXGraphic(); } - else if ( sImageName.equalsAscii( "query" ) ) + else if ( sImageName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("query")) ) { xRet = QueryBox::GetStandardImage().GetXGraphic(); } @@ -497,13 +492,12 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co if( pIStm ) { - ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter(); + ::GraphicFilter& rFilter = ::GraphicFilter::GetGraphicFilter(); - if( pFilter ) { ::Graphic aVCLGraphic; - if( ( pFilter->ImportGraphic( aVCLGraphic, aPath, *pIStm ) == GRFILTER_OK ) && + if( ( rFilter.ImportGraphic( aVCLGraphic, aPath, *pIStm ) == GRFILTER_OK ) && ( aVCLGraphic.GetType() != GRAPHIC_NONE ) ) { ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; @@ -657,7 +651,7 @@ void ImplApplyFilterData( ::Graphic& rGraphic, uno::Sequence< beans::PropertyVal aDummyVDev.EnableOutput( sal_False ); aDummyVDev.SetMapMode( aNewMapMode ); - for( sal_uInt32 i = 0, nObjCount = aMtf.GetActionCount(); i < nObjCount; i++ ) + for( size_t i = 0, nObjCount = aMtf.GetActionSize(); i < nObjCount; i++ ) { MetaAction* pAction = aMtf.GetAction( i ); switch( pAction->GetType() ) @@ -825,9 +819,8 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG if( pFilterShortName ) { - ::GraphicFilter* pFilter = ::GraphicFilter::GetGraphicFilter(); + ::GraphicFilter& rFilter = ::GraphicFilter::GetGraphicFilter(); - if( pFilter ) { const uno::Reference< XInterface > xIFace( rxGraphic, uno::UNO_QUERY ); const ::Graphic* pGraphic = ::unographic::Graphic::getImplementation( xIFace ); @@ -845,8 +838,8 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG aMemStrm << aGraphic; else { - pFilter->ExportGraphic( aGraphic, aPath, aMemStrm, - pFilter->GetExportFormatNumberForShortName( ::rtl::OUString::createFromAscii( pFilterShortName ) ), + rFilter.ExportGraphic( aGraphic, aPath, aMemStrm, + rFilter.GetExportFormatNumberForShortName( ::rtl::OUString::createFromAscii( pFilterShortName ) ), ( aFilterDataSeq.getLength() ? &aFilterDataSeq : NULL ) ); } aMemStrm.Seek( STREAM_SEEK_TO_END ); @@ -859,3 +852,5 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx index b8a0ea73b92c..ef6385c1298c 100644 --- a/svtools/source/graphic/renderer.cxx +++ b/svtools/source/graphic/renderer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,13 +32,13 @@ #include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/awt/Rectangle.hpp> -#include <rtl/uuid.h> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/propertysetinfo.hxx> #include <svl/itemprop.hxx> #include <svtools/grfmgr.hxx> +#include <comphelper/servicehelper.hxx> #include "graphic.hxx" #include "renderer.hxx" @@ -191,28 +192,22 @@ uno::Sequence< uno::Type > SAL_CALL GraphicRendererVCL::getTypes() return aTypes; } -// ------------------------------------------------------------------------------ +namespace +{ + class theGraphicRendererVCLUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theGraphicRendererVCLUnoTunnelId > {}; +} uno::Sequence< sal_Int8 > SAL_CALL GraphicRendererVCL::getImplementationId() throw( uno::RuntimeException ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); - static uno::Sequence< sal_Int8 > aId; - - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aId.getArray() ), 0, sal_True ); - } - - return aId; + return theGraphicRendererVCLUnoTunnelId::get().getSeq(); } // ------------------------------------------------------------------------------ ::comphelper::PropertySetInfo* GraphicRendererVCL::createPropertySetInfo() { - vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo(); static ::comphelper::PropertyMapEntry aEntries[] = @@ -238,7 +233,7 @@ void GraphicRendererVCL::_setPropertyValues( const comphelper::PropertyMapEntry* lang::IllegalArgumentException, lang::WrappedTargetException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; while( *ppEntries ) { @@ -290,7 +285,7 @@ void GraphicRendererVCL::_setPropertyValues( const comphelper::PropertyMapEntry* void GraphicRendererVCL::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValues ) throw( beans::UnknownPropertyException, lang::WrappedTargetException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; while( *ppEntries ) { @@ -343,3 +338,5 @@ void SAL_CALL GraphicRendererVCL::render( const uno::Reference< graphic::XGraphi } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx index 5c234c8d5ecb..03c470d2ac69 100644 --- a/svtools/source/graphic/transformer.cxx +++ b/svtools/source/graphic/transformer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <rtl/uuid.h> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <vcl/image.hxx> #include <vcl/metaact.hxx> @@ -154,3 +154,5 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::colorChange( } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/transformer.hxx b/svtools/source/graphic/transformer.hxx index c4002bb4bbae..0ee340c40631 100644 --- a/svtools/source/graphic/transformer.hxx +++ b/svtools/source/graphic/transformer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -61,3 +62,5 @@ class GraphicTransformer : public GraphicTransformer_UnoImplHelper1 } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx index 09dc7018dc42..de44feea6f18 100644 --- a/svtools/source/hatchwindow/documentcloser.cxx +++ b/svtools/source/hatchwindow/documentcloser.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,7 +37,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/XVclWindowPeer.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <vcl/dialog.hxx> #include <tools/link.hxx> @@ -89,7 +90,7 @@ IMPL_STATIC_LINK( MainThreadFrameCloserRequest, worker, MainThreadFrameCloserReq if ( pMTRequest->m_xFrame.is() ) { // this is the main thread, the solar mutex must be locked - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; try { @@ -293,3 +294,4 @@ uno::Reference< uno::XInterface > SAL_CALL ODocumentCloser::impl_staticCreateSel return static_cast< cppu::OWeakObject * >( new ODocumentCloser( xContext ) ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/documentcloser.hxx b/svtools/source/hatchwindow/documentcloser.hxx index 98e30b4d1683..3b278e2e91ee 100644 --- a/svtools/source/hatchwindow/documentcloser.hxx +++ b/svtools/source/hatchwindow/documentcloser.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -87,3 +88,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/hatchwindow.cxx b/svtools/source/hatchwindow/hatchwindow.cxx index b26f7bbf091b..484ff32cb526 100644 --- a/svtools/source/hatchwindow/hatchwindow.cxx +++ b/svtools/source/hatchwindow/hatchwindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ #include "ipwin.hxx" #include <toolkit/helper/convert.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> using namespace ::com::sun::star; @@ -52,7 +53,7 @@ void VCLXHatchWindow::initializeWindow( const uno::Reference< awt::XWindowPeer > const awt::Rectangle& aBounds, const awt::Size& aSize ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; Window* pParent = NULL; VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( xParent ); @@ -87,7 +88,7 @@ void VCLXHatchWindow::QueryObjAreaPixel( Rectangle & aRect ) } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Can't adjust rectangle size!\n" ); + OSL_FAIL( "Can't adjust rectangle size!\n" ); } } } @@ -103,7 +104,7 @@ void VCLXHatchWindow::RequestObjAreaPixel( const Rectangle & aRect ) } catch( uno::Exception& ) { - OSL_ENSURE( sal_False, "Can't request resizing!\n" ); + OSL_FAIL( "Can't request resizing!\n" ); } } } @@ -237,3 +238,5 @@ void VCLXHatchWindow::Deactivated() if ( m_xController.is() ) m_xController->deactivated(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/hatchwindow.hxx b/svtools/source/hatchwindow/hatchwindow.hxx index fa3e70ee8901..0ece4e6acb64 100644 --- a/svtools/source/hatchwindow/hatchwindow.hxx +++ b/svtools/source/hatchwindow/hatchwindow.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,3 +78,4 @@ public: #endif // _SVT_HATCHWINDOW_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index 1222013372f7..a0ff0d4daf17 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -41,15 +42,15 @@ using namespace ::com::sun::star; uno::Sequence< ::rtl::OUString > SAL_CALL OHatchWindowFactory::impl_staticGetSupportedServiceNames() { uno::Sequence< ::rtl::OUString > aRet(2); - aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.embed.HatchWindowFactory"); - aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.HatchWindowFactory"); + aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.HatchWindowFactory" )); + aRet[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.embed.HatchWindowFactory" )); return aRet; } //------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OHatchWindowFactory::impl_staticGetImplementationName() { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.HatchWindowFactory"); + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.embed.HatchWindowFactory" )); } //------------------------------------------------------------------------- @@ -70,7 +71,7 @@ uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchW if ( !xParent.is() ) throw lang::IllegalArgumentException(); // TODO - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; VCLXHatchWindow* pResult = new VCLXHatchWindow(); pResult->initializeWindow( xParent, aBounds, aHandlerSize ); return uno::Reference< embed::XHatchWindow >( static_cast< embed::XHatchWindow* >( pResult ) ); @@ -148,3 +149,5 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( } } // extern "C" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/hatchwindowfactory.hxx b/svtools/source/hatchwindow/hatchwindowfactory.hxx index 9a59c7a95f6d..b7848503d2dc 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.hxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,9 +33,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> -#ifndef _CPPUHELPER_IMPLBASE5_HXX_ #include <cppuhelper/implbase2.hxx> -#endif class OHatchWindowFactory : public ::cppu::WeakImplHelper2< @@ -72,3 +71,4 @@ public: #endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/ipwin.cxx b/svtools/source/hatchwindow/ipwin.cxx index 65db0f444faa..c4a68a49ec2a 100644 --- a/svtools/source/hatchwindow/ipwin.cxx +++ b/svtools/source/hatchwindow/ipwin.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -642,3 +643,4 @@ long SvResizeWindow::Notify( NotifyEvent& rEvt ) return Window::Notify(rEvt); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/ipwin.hxx b/svtools/source/hatchwindow/ipwin.hxx index 1c58bc5b7178..c5331a9e580c 100644 --- a/svtools/source/hatchwindow/ipwin.hxx +++ b/svtools/source/hatchwindow/ipwin.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -108,3 +109,4 @@ public: #endif // _IPWIN_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/configitems/accessibilityoptions_const.hxx b/svtools/source/inc/configitems/accessibilityoptions_const.hxx index 177edce8c3f0..184e5a9850f0 100644 --- a/svtools/source/inc/configitems/accessibilityoptions_const.hxx +++ b/svtools/source/inc/configitems/accessibilityoptions_const.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,16 +36,18 @@ namespace { - static const ::rtl::OUString s_sAccessibility = ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/Accessibility"); - static const ::rtl::OUString s_sAutoDetectSystemHC = ::rtl::OUString::createFromAscii("AutoDetectSystemHC"); - static const ::rtl::OUString s_sIsForPagePreviews = ::rtl::OUString::createFromAscii("IsForPagePreviews"); - static const ::rtl::OUString s_sIsHelpTipsDisappear = ::rtl::OUString::createFromAscii("IsHelpTipsDisappear"); - static const ::rtl::OUString s_sHelpTipSeconds = ::rtl::OUString::createFromAscii("HelpTipSeconds"); - static const ::rtl::OUString s_sIsAllowAnimatedGraphics = ::rtl::OUString::createFromAscii("IsAllowAnimatedGraphics"); - static const ::rtl::OUString s_sIsAllowAnimatedText = ::rtl::OUString::createFromAscii("IsAllowAnimatedText"); - static const ::rtl::OUString s_sIsAutomaticFontColor = ::rtl::OUString::createFromAscii("IsAutomaticFontColor"); - static const ::rtl::OUString s_sIsSystemFont = ::rtl::OUString::createFromAscii("IsSystemFont"); - static const ::rtl::OUString s_sIsSelectionInReadonly = ::rtl::OUString::createFromAscii("IsSelectionInReadonly"); + static const ::rtl::OUString s_sAccessibility(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Accessibility")); + static const ::rtl::OUString s_sAutoDetectSystemHC(RTL_CONSTASCII_USTRINGPARAM("AutoDetectSystemHC")); + static const ::rtl::OUString s_sIsForPagePreviews(RTL_CONSTASCII_USTRINGPARAM("IsForPagePreviews")); + static const ::rtl::OUString s_sIsHelpTipsDisappear(RTL_CONSTASCII_USTRINGPARAM("IsHelpTipsDisappear")); + static const ::rtl::OUString s_sHelpTipSeconds(RTL_CONSTASCII_USTRINGPARAM("HelpTipSeconds")); + static const ::rtl::OUString s_sIsAllowAnimatedGraphics(RTL_CONSTASCII_USTRINGPARAM("IsAllowAnimatedGraphics")); + static const ::rtl::OUString s_sIsAllowAnimatedText(RTL_CONSTASCII_USTRINGPARAM("IsAllowAnimatedText")); + static const ::rtl::OUString s_sIsAutomaticFontColor(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticFontColor")); + static const ::rtl::OUString s_sIsSystemFont(RTL_CONSTASCII_USTRINGPARAM("IsSystemFont")); + static const ::rtl::OUString s_sIsSelectionInReadonly(RTL_CONSTASCII_USTRINGPARAM("IsSelectionInReadonly")); } #endif // INCLUDE_CONFIGITEMS_ACCESSIBILITYOPTIONS_CONST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/gifread.hxx b/svtools/source/inc/gifread.hxx index 89e6c8e0df4b..1b92271dfc9f 100644 --- a/svtools/source/inc/gifread.hxx +++ b/svtools/source/inc/gifread.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,8 @@ #ifndef _GIFREAD_HXX #define _GIFREAD_HXX -#ifndef _GRAPH_HXX #include <vcl/graph.hxx> -#endif -#ifndef _BMPACC_HXX #include <vcl/bmpacc.hxx> -#endif #ifdef _GIFPRIVATE @@ -142,3 +139,5 @@ public: sal_Bool ImportGIF( SvStream& rStream, Graphic& rGraphic ); #endif // _GIFREAD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/gradwrap.hxx b/svtools/source/inc/gradwrap.hxx deleted file mode 100644 index 41887b67822a..000000000000 --- a/svtools/source/inc/gradwrap.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _SVGEN_HXX -#include <svgen.hxx> -#endif - - -/****************************************************************************** -|* -|* class GradientWrapper -|* -|* Ersterstellung: KA 24.11.95 -|* letzte Aenderung: KA 24.11.95 -|* -|* Zeck: dient beim MetaFile-Export dazu, die eigentliche Berechungs- -|* funktionalitaet zu kapseln. Das Schreiben der Records fuer -|* die unterschiedlichen File-Formate geschieht ueber LinkHandler. -|* -|* Klassen, die diesen Wrapper benutzen, muessen drei Linkhandler -|* zur Verfuegung stellen, die im Ctor uebergeben werden: -|* -|* 1. Linkhandler zum Schreiben eines Records fuer Polygonausgabe -|* 2. Linkhandler zum Schreiben eines Records fuer PolyPolygonausgabe -|* 3. Linkhandler zum Schreiben eines Records fuer Setzen der Brush -|* -\******************************************************************************/ - - -class GradientWrapper -{ - Link aDrawPolyRecordHdl; - Link aDrawPolyPolyRecordHdl; - Link aSetFillInBrushRecordHdl; - - GradientWrapper() {}; - - -public: - GradientWrapper(const Link& rDrawPolyRecordHdl, - const Link& rDrawPolyPolyRecordHdl, - const Link& rSetFillInBrushHdl); - ~GradientWrapper(); - - - void WriteLinearGradient(const Rectangle& rRect, - const Gradient& rGradient); - void WriteRadialGradient(const Rectangle& rRect, - const Gradient& rGradient); - void WriteRectGradient(const Rectangle& rRect, - const Gradient& rGradient); -}; diff --git a/svtools/source/inc/iodlg.hrc b/svtools/source/inc/iodlg.hrc index e78e3fb687fe..b94d0dfe8f8d 100644 --- a/svtools/source/inc/iodlg.hrc +++ b/svtools/source/inc/iodlg.hrc @@ -28,9 +28,7 @@ #ifndef _SVTOOLS_IODLGIMPL_HRC #define _SVTOOLS_IODLGIMPL_HRC -#ifndef _SVTOOLS_HRC #include <svtools/svtools.hrc> -#endif // ModalDialog DLG_SVT_EXPLORERFILE diff --git a/svtools/source/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx index 0d8db406132a..00c267f71650 100644 --- a/svtools/source/inc/jpeg.hxx +++ b/svtools/source/inc/jpeg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _JPEG_HXX #define _JPEG_HXX -#ifndef _GRAPH_HXX #include <vcl/graph.hxx> -#endif #include <svtools/fltcall.hxx> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> @@ -129,3 +128,5 @@ sal_Bool ExportJPEG( SvStream& rStream, ); #endif // _JPEG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/msgrd.hxx b/svtools/source/inc/msgrd.hxx index 21c0460a1c0b..dd39a1446af2 100644 --- a/svtools/source/inc/msgrd.hxx +++ b/svtools/source/inc/msgrd.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,3 +36,5 @@ sal_Bool ConvertMSGToGDIMetaFile( SvStream & rMSG, GDIMetaFile & rGDIMetaFile, #endif // _MSGRD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/msgwr.hxx b/svtools/source/inc/msgwr.hxx index d133031673e7..c382397899e2 100644 --- a/svtools/source/inc/msgwr.hxx +++ b/svtools/source/inc/msgwr.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -36,3 +37,4 @@ sal_Bool ConvertGraphicToMSG(const Graphic & rGraphic, SvStream & rTargetStream, #endif // _MSGWR_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/property.hxx b/svtools/source/inc/property.hxx index aa9a721fa292..a6ef27fda9af 100644 --- a/svtools/source/inc/property.hxx +++ b/svtools/source/inc/property.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,27 +29,13 @@ #ifndef SV_PROPERTY_HXX #define SV_PROPERTY_HXX -#ifndef _VIRDEV_HXX //autogen #include <vcl/virdev.hxx> -#endif -#ifndef SV_FIXED_HXX #include <vcl/fixed.hxx> -#endif -#ifndef SV_LSTBOX_HXX #include <vcl/lstbox.hxx> -#endif -#ifndef SV_GROUP_HXX #include <vcl/group.hxx> -#endif -#ifndef SV_BUTTON_HXX #include <vcl/button.hxx> -#endif -#ifndef SV_MOREBTN_HXX #include <vcl/morebtn.hxx> -#endif -#ifndef _DIALOG_HXX //autogen #include <vcl/dialog.hxx> -#endif #include <vcl/combobox.hxx> #include <vcl/field.hxx> #include <svl/svarray.hxx> @@ -583,3 +570,4 @@ public: #endif // SC_AUTOFMT_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/provider.hxx b/svtools/source/inc/provider.hxx index c54215482a0e..0674d8d8ea6c 100644 --- a/svtools/source/inc/provider.hxx +++ b/svtools/source/inc/provider.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -80,3 +81,5 @@ private: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/renderer.hxx b/svtools/source/inc/renderer.hxx index b58bd065245b..741d052bf9de 100644 --- a/svtools/source/inc/renderer.hxx +++ b/svtools/source/inc/renderer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -98,3 +99,5 @@ private: } #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/sgfbram.hxx b/svtools/source/inc/sgfbram.hxx index aa4ed5836606..ef3ee7a7bfe4 100644 --- a/svtools/source/inc/sgfbram.hxx +++ b/svtools/source/inc/sgfbram.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -155,3 +156,5 @@ public: }; #endif //_SGFBRAM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/sgffilt.hxx b/svtools/source/inc/sgffilt.hxx index 28d48fe13820..427ba7edc8b0 100644 --- a/svtools/source/inc/sgffilt.hxx +++ b/svtools/source/inc/sgffilt.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -44,3 +45,5 @@ sal_Bool SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath #define SGV_VERSION 3 /* SGV mit anderer Version wird abgewiesen */ /* 3 entspricht StarDraw 2.00/2.01 M„rz'93 */ #endif //_SGFFILT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/sgvmain.hxx b/svtools/source/inc/sgvmain.hxx index 3006a23f5f10..b4c79e748ab6 100644 --- a/svtools/source/inc/sgvmain.hxx +++ b/svtools/source/inc/sgvmain.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -351,3 +352,4 @@ public: #endif //_SGVMAIN_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/sgvspln.hxx b/svtools/source/inc/sgvspln.hxx index 3bb7ea85374b..18c86f743715 100644 --- a/svtools/source/inc/sgvspln.hxx +++ b/svtools/source/inc/sgvspln.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,8 +43,6 @@ |* ist Speicher fr die Koeffizientenarrays |* allokiert, der dann sp„ter vom Aufrufer mittels |* delete freizugeben ist. -|* Ersterstellung JOE 17-08.93 -|* Letzte Aenderung JOE 17-08.93 |* *************************************************************************/ @@ -64,10 +63,10 @@ sal_Bool CalcSpline(Polygon& rPoly, sal_Bool Periodic, sal_uInt16& n, |* Fall hat das Polygon 0, im 2. Fall PolyMax Punkte. |* Um Koordinatenberl„ufe zu vermeiden werden diese |* auf +/-32000 begrenzt. -|* Ersterstellung JOE 23.06.93 -|* Letzte Aenderung JOE 23.06.93 |* *************************************************************************/ sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly); #endif //_SGVSPLN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index d90329afb28d..c7603827f61e 100644 --- a/svtools/source/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,8 @@ #ifndef _SVIMPLBOX_HXX #define _SVIMPLBOX_HXX -#ifndef _SELENG_HXX #include <vcl/seleng.hxx> -#endif -#ifndef _SCRBAR_HXX #include <vcl/scrbar.hxx> -#endif #include <vcl/vclevent.hxx> // #102891# ---------------- #include <unotools/intlwrapper.hxx> @@ -50,6 +47,13 @@ class SvLBoxEntry; class SvLBoxItem; class SvLBoxTab; class TabBar; +namespace comphelper +{ + namespace string + { + class NaturalStringSorter; + } +} class ImpLBSelEng : public FunctionSet { @@ -114,8 +118,6 @@ private: static Image* s_pDefCollapsed; static Image* s_pDefExpanded; - static Image* s_pDefCollapsedHC; - static Image* s_pDefExpandedHC; static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed // Node Bitmaps @@ -132,8 +134,6 @@ private: // all our images Image m_aNodeAndEntryImages[ IT_IMAGE_COUNT ]; - // plus the high contrast versions - Image m_aNodeAndEntryImages_HC[ IT_IMAGE_COUNT ]; // wg. kompat. hier Size aOutputSize; @@ -170,7 +170,7 @@ private: Timer aEditTimer; // #102891# ------------------- - IntlWrapper * pIntlWrapper; + comphelper::string::NaturalStringSorter *m_pStringSorter; // #97680# -------------------- std::vector< short > aContextBmpWidthVector; @@ -246,8 +246,7 @@ private: static void implInitDefaultNodeImages(); - // #102891# ------------------- - void UpdateIntlWrapper(); + void UpdateStringSorter(); // #97680# -------------------- short UpdateContextBmpWidthVector( SvLBoxEntry* pEntry, short nWidth ); @@ -318,24 +317,22 @@ public: void PaintDDCursor( SvLBoxEntry* ); // Images - inline Image& implGetImageLocation( const ImageType _eType, BmpColorMode _eMode ); - inline Image& implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const; + inline Image& implGetImageLocation( const ImageType _eType ); - inline void SetExpandedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline void SetCollapsedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline void SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); + inline void SetExpandedNodeBmp( const Image& _rImg ); + inline void SetCollapsedNodeBmp( const Image& _rImg ); - inline const Image& GetExpandedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; - inline const Image& GetCollapsedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; - inline const Image& GetDontKnowNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const; + inline const Image& GetExpandedNodeBmp( ); + inline const Image& GetCollapsedNodeBmp( ); + inline const Image& GetDontKnowNodeBmp( ); - inline void SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline void SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline const Image& GetDefaultEntryExpBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ); - inline const Image& GetDefaultEntryColBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ); + inline void SetDefaultEntryExpBmp( const Image& _rImg ); + inline void SetDefaultEntryColBmp( const Image& _rImg ); + inline const Image& GetDefaultEntryExpBmp( ); + inline const Image& GetDefaultEntryColBmp( ); - static const Image& GetDefaultExpandedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ); - static const Image& GetDefaultCollapsedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL ); + static const Image& GetDefaultExpandedNodeImage( ); + static const Image& GetDefaultCollapsedNodeImage( ); const Size& GetOutputSize() const { return aOutputSize;} void KeyUp( sal_Bool bPageUp, sal_Bool bNotifyScroll = sal_True ); @@ -374,76 +371,60 @@ public: bool IsSelectable( const SvLBoxEntry* pEntry ); }; -inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType, BmpColorMode _eMode ) +inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType ) { - DBG_ASSERT( ( BMP_COLOR_HIGHCONTRAST == _eMode ) || ( BMP_COLOR_NORMAL == _eMode ), - "SvImpLBox::implGetImageLocation: invalid mode!" ); DBG_ASSERT( ( _eType >= 0 ) && ( _eType < IT_IMAGE_COUNT ), "SvImpLBox::implGetImageLocation: invalid image index (will crash)!" ); - Image* _pSet = ( BMP_COLOR_HIGHCONTRAST == _eMode ) ? m_aNodeAndEntryImages_HC : m_aNodeAndEntryImages; + Image* _pSet = m_aNodeAndEntryImages; return *( _pSet + (sal_Int32)_eType ); } -inline Image& SvImpLBox::implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const -{ - Image& rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, _eMode ); - if ( !rImage ) - // fallback to normal images in case the one for the special mode has not been set - rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, BMP_COLOR_NORMAL ); - return rImage; -} - -inline void SvImpLBox::SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode ) -{ - implGetImageLocation( itNodeDontKnow, _eMode ) = rImg; -} - -inline void SvImpLBox::SetExpandedNodeBmp( const Image& rImg, BmpColorMode _eMode ) +inline void SvImpLBox::SetExpandedNodeBmp( const Image& rImg ) { - implGetImageLocation( itNodeExpanded, _eMode ) = rImg; + implGetImageLocation( itNodeExpanded ) = rImg; SetNodeBmpYOffset( rImg ); } -inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rImg, BmpColorMode _eMode ) +inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rImg ) { - implGetImageLocation( itNodeCollapsed, _eMode ) = rImg; + implGetImageLocation( itNodeCollapsed ) = rImg; SetNodeBmpYOffset( rImg ); } -inline const Image& SvImpLBox::GetDontKnowNodeBmp( BmpColorMode _eMode ) const +inline const Image& SvImpLBox::GetDontKnowNodeBmp( ) { - return implGetImageLocationWithFallback( itNodeDontKnow, _eMode ); + return implGetImageLocation( itNodeDontKnow ); } -inline const Image& SvImpLBox::GetExpandedNodeBmp( BmpColorMode _eMode ) const +inline const Image& SvImpLBox::GetExpandedNodeBmp( ) { - return implGetImageLocationWithFallback( itNodeExpanded, _eMode ); + return implGetImageLocation( itNodeExpanded ); } -inline const Image& SvImpLBox::GetCollapsedNodeBmp( BmpColorMode _eMode ) const +inline const Image& SvImpLBox::GetCollapsedNodeBmp( ) { - return implGetImageLocationWithFallback( itNodeCollapsed, _eMode ); + return implGetImageLocation( itNodeCollapsed ); } -inline void SvImpLBox::SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode ) +inline void SvImpLBox::SetDefaultEntryExpBmp( const Image& _rImg ) { - implGetImageLocation( itEntryDefExpanded, _eMode ) = _rImg; + implGetImageLocation( itEntryDefExpanded ) = _rImg; } -inline void SvImpLBox::SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode ) +inline void SvImpLBox::SetDefaultEntryColBmp( const Image& _rImg ) { - implGetImageLocation( itEntryDefCollapsed, _eMode ) = _rImg; + implGetImageLocation( itEntryDefCollapsed ) = _rImg; } -inline const Image& SvImpLBox::GetDefaultEntryExpBmp( BmpColorMode _eMode ) +inline const Image& SvImpLBox::GetDefaultEntryExpBmp( ) { - return implGetImageLocationWithFallback( itEntryDefExpanded, _eMode ); + return implGetImageLocation( itEntryDefExpanded ); } -inline const Image& SvImpLBox::GetDefaultEntryColBmp( BmpColorMode _eMode ) +inline const Image& SvImpLBox::GetDefaultEntryColBmp( ) { - return implGetImageLocationWithFallback( itEntryDefCollapsed, _eMode ); + return implGetImageLocation( itEntryDefCollapsed ); } inline Point SvImpLBox::GetEntryPosition( SvLBoxEntry* pEntry ) const @@ -472,3 +453,4 @@ inline void SvImpLBox::TreeInserted( SvLBoxEntry* pInsTree ) #endif // #ifndef _SVIMPLBOX_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/svimpicn.hxx b/svtools/source/inc/svimpicn.hxx index b516ca9bfe25..585827ff0c05 100644 --- a/svtools/source/inc/svimpicn.hxx +++ b/svtools/source/inc/svimpicn.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,13 +28,9 @@ #ifndef _SVIMPICN_HXX #define _SVIMPICN_HXX -#ifndef _VIRDEV_HXX #include <vcl/virdev.hxx> -#endif -#ifndef _SCRBAR_HXX #include <vcl/scrbar.hxx> -#endif #include <limits.h> class SvLBoxEntry; @@ -318,3 +315,4 @@ inline void SvImpIconView::MakeVisible( SvLBoxEntry* pEntry ) #endif // #ifndef _SVIMPICN_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/svtaccessiblefactory.hxx b/svtools/source/inc/svtaccessiblefactory.hxx index 7760b6427da4..909f113cbf60 100644 --- a/svtools/source/inc/svtaccessiblefactory.hxx +++ b/svtools/source/inc/svtaccessiblefactory.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -71,3 +72,4 @@ namespace svt #endif // SVTOOLS_ACCESSIBLE_FACTORY_ACCESS_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx index f15cb7c10d4c..5b5667aad85e 100644 --- a/svtools/source/inc/unoiface.hxx +++ b/svtools/source/inc/unoiface.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -439,3 +440,5 @@ public: }; #endif // _SVT_UNOIFACE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/xbmread.hxx b/svtools/source/inc/xbmread.hxx index 5d6db03f73a7..0e9b178e9428 100644 --- a/svtools/source/inc/xbmread.hxx +++ b/svtools/source/inc/xbmread.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,8 @@ #ifndef _XBMREAD_HXX #define _XBMREAD_HXX -#ifndef _GRAPH_HXX #include <vcl/graph.hxx> -#endif -#ifndef _BMPACC_HXX #include <vcl/bmpacc.hxx> -#endif #ifdef _XBMPRIVATE @@ -95,3 +92,5 @@ public: sal_Bool ImportXBM( SvStream& rStream, Graphic& rGraphic ); #endif // _XBMREAD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/xpmread.hxx b/svtools/source/inc/xpmread.hxx index aea09db7596e..825a0efe34ea 100644 --- a/svtools/source/inc/xpmread.hxx +++ b/svtools/source/inc/xpmread.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,9 +29,7 @@ #ifndef _XPMREAD_HXX #define _XPMREAD_HXX -#ifndef _BITMAP_HXX #include <vcl/bitmap.hxx> -#endif #ifdef _XPMPRIVATE @@ -129,3 +128,5 @@ public: sal_Bool ImportXPM( SvStream& rStream, Graphic& rGraphic ); #endif // _XPMREAD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/java/javacontext.cxx b/svtools/source/java/javacontext.cxx index 7ebd3ea76d1f..56b72ef1453c 100644 --- a/svtools/source/java/javacontext.cxx +++ b/svtools/source/java/javacontext.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,14 +39,6 @@ using namespace com::sun::star::task; namespace svt { -JavaContext::JavaContext( const Reference< XCurrentContext > & ctx ) - : - m_aRefCount(0), - m_xNextContext( ctx ), - m_bShowErrorsOnce(false) -{ -} - JavaContext::JavaContext( const Reference< XCurrentContext > & ctx, bool bShowErrorsOnce) : m_aRefCount(0), @@ -104,3 +97,5 @@ Any SAL_CALL JavaContext::getValueByName( const ::rtl::OUString& Name) throw (Ru } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src index d5990c05a663..f7c9763d90fc 100644 --- a/svtools/source/java/javaerror.src +++ b/svtools/source/java/javaerror.src @@ -52,7 +52,7 @@ ErrorBox ERRORBOX_JVMCREATIONFAILED { Buttons = WB_OK; DefButton = WB_DEF_OK ; - Message[ en-US ] = "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools - Options - %PRODUCTNAME - Java."; + Message[ en-US ] = "%PRODUCTNAME requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools - Options - %PRODUCTNAME - Java."; }; ErrorBox ERRORBOX_RESTARTREQUIRED @@ -89,5 +89,3 @@ String STR_ERROR_JVMCREATIONFAILED { Text[ en-US ] = "JRE is Defective" ; }; - - diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx index 1b236a1e4bee..e4bf442ed42d 100644 --- a/svtools/source/java/javainteractionhandler.cxx +++ b/svtools/source/java/javainteractionhandler.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,7 +43,7 @@ #include <com/sun/star/java/RestartRequiredException.hpp> #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/string.hxx> #include <tools/rcid.h> #include <jvmfwk/framework.h> @@ -57,18 +58,6 @@ using namespace com::sun::star::task; namespace svt { -JavaInteractionHandler::JavaInteractionHandler(): - m_aRefCount(0), - m_bShowErrorsOnce(false), - m_bJavaDisabled_Handled(false), - m_bInvalidSettings_Handled(false), - m_bJavaNotFound_Handled(false), - m_bVMCreationFailure_Handled(false), - m_bRestartRequired_Handled(false), - m_nResult_JavaDisabled(RET_NO) -{ -} - JavaInteractionHandler::JavaInteractionHandler(bool bReportErrorOnce) : m_aRefCount(0), m_bShowErrorsOnce(bReportErrorOnce), @@ -145,7 +134,7 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque if( ! (m_bShowErrorsOnce && m_bJavaNotFound_Handled)) { // No suitable JRE found - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; m_bJavaNotFound_Handled = true; WarningBox aWarningBox( NULL, SvtResId( WARNINGBOX_JAVANOTFOUND ) ); String aTitle( SvtResId( STR_WARNING_JAVANOTFOUND ) ); @@ -162,7 +151,7 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque if( !(m_bShowErrorsOnce && m_bInvalidSettings_Handled)) { // javavendors.xml was updated and Java has not been configured yet - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; m_bInvalidSettings_Handled = true; WarningBox aWarningBox( NULL, SvtResId( WARNINGBOX_INVALIDJAVASETTINGS ) ); String aTitle( SvtResId(STR_WARNING_INVALIDJAVASETTINGS)); @@ -178,7 +167,7 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque { if( !(m_bShowErrorsOnce && m_bJavaDisabled_Handled)) { - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; m_bJavaDisabled_Handled = true; // Java disabled. Give user a chance to enable Java inside Office. QueryBox aQueryBox( NULL, SvtResId( QBX_JAVADISABLED ) ); @@ -203,7 +192,7 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque if( !(m_bShowErrorsOnce && m_bVMCreationFailure_Handled)) { // Java not correctly installed, or damaged - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; m_bVMCreationFailure_Handled = true; ErrorBox aErrorBox( NULL, SvtResId( ERRORBOX_JVMCREATIONFAILED ) ); String aTitle( SvtResId( STR_ERROR_JVMCREATIONFAILED ) ); @@ -221,7 +210,7 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque { // a new JRE was selected, but office needs to be restarted //before it can be used. - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; m_bRestartRequired_Handled = true; ErrorBox aErrorBox(NULL, SvtResId( ERRORBOX_RESTARTREQUIRED ) ); String aTitle( SvtResId( STR_ERROR_RESTARTREQUIRED ) ); @@ -249,3 +238,5 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index 59df22b580c6..c18071664a03 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,51 +32,21 @@ //=============================================== // includes - -#ifndef __COM_SUN_STAR_FRAME_XMODULEMANAGER_HPP_ #include <com/sun/star/frame/XModuleManager.hpp> -#endif - -#ifndef __COM_SUN_STAR_FRAME_XDESKTOP_HPP_ #include <com/sun/star/frame/XDesktop.hpp> -#endif - -#ifndef __COM_SUN_STAR_UI_XUICONFIGURATIONMANAGER_HPP_ #include <com/sun/star/ui/XUIConfigurationManager.hpp> -#endif - -#ifndef __COM_SUN_STAR_UI_XMODULEUICONFIGURATIONMANAGERSUPPLIER_HPP_ #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> -#endif - -#ifndef __COM_SUN_STAR_UI_XUICONFIGURATIONMANAGERSUPPLIER_HPP_ #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> -#endif - -#ifndef __COM_SUN_STAR_AWT_XTOPWINDOW_HPP_ #include <com/sun/star/awt/XTopWindow.hpp> -#endif - -#ifndef __COM_SUN_STAR_AWT_KEYMODIFIER_HPP_ #include <com/sun/star/awt/KeyModifier.hpp> -#endif - -#ifndef __COM_SUN_STAR_UNO_SEQUENCE_HXX_ #include <com/sun/star/uno/Sequence.hxx> -#endif - -#ifndef __COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ #include <com/sun/star/beans/PropertyValue.hpp> -#endif - -#ifndef __COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include <com/sun/star/lang/DisposedException.hpp> -#endif #include <toolkit/helper/vclunohelper.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> //=============================================== // namespace @@ -92,7 +63,6 @@ namespace svt class SVT_DLLPRIVATE AsyncAccelExec { public: - //--------------------------------------- /** creates a new instance of this class, which can be used one times only! @@ -106,7 +76,6 @@ class SVT_DLLPRIVATE AsyncAccelExec void execAsync(); private: - //--------------------------------------- /** @short allow creation of instances of this class by using our factory only! @@ -117,7 +86,6 @@ class SVT_DLLPRIVATE AsyncAccelExec DECL_DLLPRIVATE_LINK(impl_ts_asyncCallback, void*); private: - ::vcl::EventPoster m_aAsyncCallback; css::uno::Reference< css::frame::XDispatch > m_xDispatch; css::util::URL m_aURL; @@ -172,7 +140,7 @@ void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServic // <- SAFE ------------------------------ css::uno::Reference< css::frame::XDispatchProvider > xDispatcher( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), + xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), css::uno::UNO_QUERY_THROW); // SAFE -> ------------------------------ @@ -347,91 +315,62 @@ KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey) { case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_LINE: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToStartOfLine" ) ); - case com::sun::star::awt::Key::DELETE_TO_END_OF_LINE: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToEndOfLine" ) ); - case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToStartOfPara" ) ); - case com::sun::star::awt::Key::DELETE_TO_END_OF_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToEndOfPara" ) ); - case com::sun::star::awt::Key::DELETE_WORD_BACKWARD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToStartOfWord" ) ); - case com::sun::star::awt::Key::DELETE_WORD_FORWARD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DelToEndOfWord" ) ); - case com::sun::star::awt::Key::INSERT_LINEBREAK: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertLinebreak" ) ); - case com::sun::star::awt::Key::INSERT_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertPara" ) ); - case com::sun::star::awt::Key::MOVE_WORD_BACKWARD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToPrevWord" ) ); - case com::sun::star::awt::Key::MOVE_WORD_FORWARD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToNextWord" ) ); - case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine" ) ); - case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine" ) ); - case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfPara" ) ); - case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfPara" ) ); - case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc" ) ); - case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc" ) ); - case com::sun::star::awt::Key::SELECT_BACKWARD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharLeftSel" ) ); - case com::sun::star::awt::Key::SELECT_FORWARD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharRightSel" ) ); - case com::sun::star::awt::Key::SELECT_WORD_BACKWARD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:WordLeftSel" ) ); - case com::sun::star::awt::Key::SELECT_WORD_FORWARD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:WordRightSel" ) ); - case com::sun::star::awt::Key::SELECT_WORD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectWord" ) ); - case com::sun::star::awt::Key::SELECT_LINE: - return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) ); - + return rtl::OUString(); case com::sun::star::awt::Key::SELECT_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectText" ) ); - case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfLineSel" ) ); - case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfLineSel" ) ); - case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfParaSel" ) ); - case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfParaSel" ) ); - case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfDocumentSel" ) ); - case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfDocumentSel" ) ); - case com::sun::star::awt::Key::SELECT_ALL: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectAll" ) ); default: @@ -446,7 +385,7 @@ KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey) css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openGlobalConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) { css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.ui.GlobalAcceleratorConfiguration")), + xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.GlobalAcceleratorConfiguration" ))), css::uno::UNO_QUERY_THROW); return xAccCfg; } @@ -456,7 +395,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st const css::uno::Reference< css::frame::XFrame >& xFrame) { css::uno::Reference< css::frame::XModuleManager > xModuleDetection( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")), + xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))), css::uno::UNO_QUERY_THROW); ::rtl::OUString sModule; @@ -470,7 +409,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st { return css::uno::Reference< css::ui::XAcceleratorConfiguration >(); } css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUISupplier( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")), + xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ))), css::uno::UNO_QUERY_THROW); css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg; @@ -511,7 +450,7 @@ css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_ge // <- SAFE ---------------------------------- css::uno::Reference< css::util::XURLTransformer > xParser( - xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer")), + xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), css::uno::UNO_QUERY_THROW); // SAFE -> ---------------------------------- @@ -576,3 +515,5 @@ IMPL_LINK(AsyncAccelExec, impl_ts_asyncCallback, void*,) } } // namespace svt + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/bindablecontrolhelper.cxx b/svtools/source/misc/bindablecontrolhelper.cxx new file mode 100644 index 000000000000..27e5991745d5 --- /dev/null +++ b/svtools/source/misc/bindablecontrolhelper.cxx @@ -0,0 +1,161 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include "bindablecontrolhelper.hxx" +#include <com/sun/star/form/binding/XBindableValue.hpp> +#include <com/sun/star/form/binding/XValueBinding.hpp> +#include <com/sun/star/form/binding/XListEntrySink.hpp> +#include <com/sun/star/form/binding/XListEntrySource.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/sheet/XCellRangeReferrer.hpp> +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/beans/NamedValue.hpp> + +//........................................................................ +namespace svt +{ +//........................................................................ + +#ifndef C2U +#define C2U(cChar) rtl::OUString::createFromAscii(cChar) +#endif + + using namespace ::com::sun::star; + +bool lcl_isNamedRange( const rtl::OUString& sAddress, const uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress ) +{ + bool bRes = false; + const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges")); + uno::Reference< sheet::XCellRangeReferrer > xReferrer; + try + { + uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW ); + xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY ); + } + catch( uno::Exception& /*e*/ ) + { + // do nothing + } + if ( xReferrer.is() ) + { + uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY ); + if ( xRangeAddressable.is() ) + { + aAddress = xRangeAddressable->getRangeAddress(); + bRes = true; + } + } + return bRes; +} + + +void +BindableControlHelper::ApplyListSourceAndBindableData( const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& rObj, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource ) +{ +// XBindable etc. + uno::Reference< lang::XMultiServiceFactory > xFac; + if ( xModel.is() ) + xFac.set( xModel, uno::UNO_QUERY ); + uno::Reference< form::binding::XBindableValue > xBindable( rObj, uno::UNO_QUERY ); + if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() ) + { + + // OOo address structures + // RefCell - convert from XL + // pretend we converted the imported string address into the + // appropriate address structure + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY ); + table::CellAddress aAddress; + if ( xConvertor.is() ) + { + // we need this service to properly convert XL notation also + // Should be easy to extend + xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) ); + xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress; + } + + beans::NamedValue aArg1; + aArg1.Name = C2U("BoundCell"); + aArg1.Value <<= aAddress; + + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= aArg1; + + uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY ); + xBindable->setValueBinding( xBinding ); + } + else if ( xBindable.is() ) // reset it + xBindable->setValueBinding( uno::Reference< form::binding::XValueBinding >() ); + uno::Reference< form::binding::XListEntrySink > xListEntrySink( rObj, uno::UNO_QUERY ); + if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() ) + { + + // OOo address structures + // RefCell - convert from XL + // pretend we converted the imported string address into the + // appropriate address structure + uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY ); + table::CellRangeAddress aAddress; + if ( xConvertor.is() ) + { + if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) ) + { + // we need this service to properly convert XL notation also + // Should be easy to extend + xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) ); + xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress; + } + } + + beans::NamedValue aArg1; + aArg1.Name = C2U("CellRange"); + aArg1.Value <<= aAddress; + + uno::Sequence< uno::Any > aArgs(1); + aArgs[ 0 ] <<= aArg1; + + uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY ); + xListEntrySink->setListEntrySource( xSource ); + } + else if ( xListEntrySink.is() ) // reset + xListEntrySink->setListEntrySource( uno::Reference< form::binding::XListEntrySource >() ); + +} + +//........................................................................ +} // namespace svt +//........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/chartprettypainter.cxx b/svtools/source/misc/chartprettypainter.cxx index bc2d02384816..ff461a17ada2 100644 --- a/svtools/source/misc/chartprettypainter.cxx +++ b/svtools/source/misc/chartprettypainter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,10 +33,8 @@ #include <tools/globname.hxx> #include <sot/clsids.hxx> -// header for function rtl_createUuid -#include <rtl/uuid.h> #include <vcl/pdfextoutdevdata.hxx> - +#include <comphelper/servicehelper.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <svtools/embedhlp.hxx> @@ -55,21 +54,14 @@ bool ChartPrettyPainter::DoPaint(OutputDevice* /*pOutDev*/, const Rectangle& /*r return false; } -//static +namespace +{ + class theChartPrettyPainterUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theChartPrettyPainterUnoTunnelId > {}; +} + const uno::Sequence<sal_Int8>& ChartPrettyPainter::getUnoTunnelId() { - static uno::Sequence<sal_Int8> * pSeq = 0; - if( !pSeq ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; + return theChartPrettyPainterUnoTunnelId::get().getSeq(); } bool ChartPrettyPainter::IsChart( const svt::EmbeddedObjectRef& xObjRef ) @@ -133,8 +125,9 @@ bool ChartPrettyPainter::DoPrettyPaintChart( uno::Reference< frame::XModel > xCh catch( uno::Exception& e ) { (void)e; - DBG_ERROR( "Chart cannot be painted pretty!" ); + OSL_FAIL( "Chart cannot be painted pretty!" ); } return false; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/cliplistener.cxx b/svtools/source/misc/cliplistener.cxx index 266950f10697..f059e5eb9c0b 100644 --- a/svtools/source/misc/cliplistener.cxx +++ b/svtools/source/misc/cliplistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,7 @@ #include <vcl/svapp.hxx> #include <vcl/window.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <svtools/cliplistener.hxx> #include <svtools/transfer.hxx> @@ -61,7 +62,7 @@ void SAL_CALL TransferableClipboardListener::changedContents( { if ( aLink.IsSet() ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; TransferableDataHelper aDataHelper( rEventObject.Contents ); aLink.Call( &aDataHelper ); @@ -96,3 +97,4 @@ void TransferableClipboardListener::ClearCallbackLink() aLink = Link(); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/dialogclosedlistener.cxx b/svtools/source/misc/dialogclosedlistener.cxx index 9e5b72989601..f07d24b536a9 100644 --- a/svtools/source/misc/dialogclosedlistener.cxx +++ b/svtools/source/misc/dialogclosedlistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -73,3 +74,4 @@ namespace svt //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/dialogcontrolling.cxx b/svtools/source/misc/dialogcontrolling.cxx index 2b33734c245f..d5e9ac545962 100644 --- a/svtools/source/misc/dialogcontrolling.cxx +++ b/svtools/source/misc/dialogcontrolling.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -312,3 +313,4 @@ namespace svt } // namespace svt //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index a8af73419271..7d1f47300b69 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,18 +28,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/debug.hxx> #include <tools/rcid.h> #include <tools/wintypes.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> -#if defined(OS2) -#include <vcl/sound.hxx> -#endif - -#ifndef GCC -#endif #include <svtools/ehdl.hxx> #include <svtools/svtdata.hxx> @@ -64,7 +59,7 @@ static sal_uInt16 aWndFunc( { - vos:: OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; // aus den Flags die benoetigten WinBits ermitteln WinBits eBits=0; @@ -177,8 +172,7 @@ SfxErrorHandler::SfxErrorHandler(sal_uInt16 nIdP, sal_uLong lStartP, sal_uLong l SfxErrorHandler::~SfxErrorHandler() { - if( pFreeMgr ) - delete pFreeMgr; + delete pFreeMgr; } //------------------------------------------------------------------------- @@ -377,7 +371,7 @@ sal_Bool SfxErrorHandler::GetErrorString( */ { - vos:: OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sal_Bool bRet = sal_False; rStr=String(SvtResId(RID_ERRHDL_CLASS)); @@ -454,7 +448,7 @@ sal_Bool SfxErrorContext::GetString(sal_uLong nErrId, String &rStr) } if( pMgr ) { - vos:: OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; ResId aResId( nResId, *pMgr ); @@ -487,3 +481,5 @@ sal_Bool SfxErrorContext::GetString(sal_uLong nErrId, String &rStr) } return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 239e9dcfa665..2d589f59b53a 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,9 +43,7 @@ #include <tools/globname.hxx> #include <sot/clsids.hxx> #include <com/sun/star/util/XModifyListener.hpp> -#ifndef _COM_SUN_STAR_UTIL_XMODIFYiBLE_HPP_ #include <com/sun/star/util/XModifiable.hpp> -#endif #include <com/sun/star/embed/EmbedStates.hpp> #include <com/sun/star/embed/EmbedMisc.hpp> #include <com/sun/star/embed/XStateChangeListener.hpp> @@ -55,7 +54,7 @@ #include <cppuhelper/implbase4.hxx> #include "vcl/svapp.hxx" #include <rtl/logfile.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> using namespace com::sun::star; @@ -134,7 +133,7 @@ void SAL_CALL EmbedEventListener_Impl::stateChanged( const lang::EventObject&, ::sal_Int32 nNewState ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; nState = nNewState; if ( !pObject ) return; @@ -170,7 +169,7 @@ void SAL_CALL EmbedEventListener_Impl::stateChanged( const lang::EventObject&, void SAL_CALL EmbedEventListener_Impl::modified( const lang::EventObject& ) throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( pObject && pObject->GetViewAspect() != embed::Aspects::MSOLE_ICON ) { if ( nState == embed::EmbedStates::RUNNING ) @@ -181,7 +180,9 @@ void SAL_CALL EmbedEventListener_Impl::modified( const lang::EventObject& ) thro else pObject->UpdateReplacement(); } - else if ( nState == embed::EmbedStates::UI_ACTIVE || nState == embed::EmbedStates::INPLACE_ACTIVE ) + else if ( nState == embed::EmbedStates::ACTIVE || + nState == embed::EmbedStates::UI_ACTIVE || + nState == embed::EmbedStates::INPLACE_ACTIVE ) { // in case the object is inplace or UI active the replacement image should be updated on demand pObject->UpdateReplacementOnDemand(); @@ -191,18 +192,9 @@ void SAL_CALL EmbedEventListener_Impl::modified( const lang::EventObject& ) thro void SAL_CALL EmbedEventListener_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; -#if 0 - if ( pObject && aEvent.EventName.equalsAscii("OnSaveDone") || aEvent.EventName.equalsAscii("OnSaveAsDone") ) - { - // TODO/LATER: container must be set before! - // When is this event created? Who sets the new container when it changed? - pObject->UpdateReplacement(); - } - else -#endif - if ( pObject && aEvent.EventName.equalsAscii("OnVisAreaChanged") && pObject->GetViewAspect() != embed::Aspects::MSOLE_ICON && !pObject->IsChart() ) + if ( pObject && aEvent.EventName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OnVisAreaChanged")) && pObject->GetViewAspect() != embed::Aspects::MSOLE_ICON && !pObject->IsChart() ) { pObject->UpdateReplacement(); } @@ -243,7 +235,6 @@ struct EmbeddedObjectRef_Impl ::rtl::OUString aMediaType; comphelper::EmbeddedObjectContainer* pContainer; Graphic* pGraphic; - Graphic* pHCGraphic; sal_Int64 nViewAspect; sal_Bool bIsLocked; sal_Bool bNeedUpdate; @@ -258,7 +249,6 @@ void EmbeddedObjectRef::Construct_Impl() mpImp = new EmbeddedObjectRef_Impl; mpImp->pContainer = 0; mpImp->pGraphic = 0; - mpImp->pHCGraphic = 0; mpImp->nViewAspect = embed::Aspects::MSOLE_CONTENT; mpImp->bIsLocked = sal_False; mpImp->bNeedUpdate = sal_False; @@ -297,42 +287,16 @@ EmbeddedObjectRef::EmbeddedObjectRef( const EmbeddedObjectRef& rObj ) else mpImp->pGraphic = 0; - mpImp->pHCGraphic = 0; mpImp->mnGraphicVersion = 0; } EmbeddedObjectRef::~EmbeddedObjectRef() { delete mpImp->pGraphic; - if ( mpImp->pHCGraphic ) - DELETEZ( mpImp->pHCGraphic ); Clear(); + delete mpImp; } -/* -EmbeddedObjectRef& EmbeddedObjectRef::operator = ( const EmbeddedObjectRef& rObj ) -{ - DBG_ASSERT( !mxObj.is(), "Never assign an already assigned object!" ); - - delete mpImp->pGraphic; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); - Clear(); - mpImp->nViewAspect = rObj.mpImp->nViewAspect; - mpImp->bIsLocked = rObj.mpImp->bIsLocked; - mxObj = rObj.mxObj; - mpImp->xListener = EmbedEventListener_Impl::Create( this ); - mpImp->pContainer = rObj.mpImp->pContainer; - mpImp->aPersistName = rObj.mpImp->aPersistName; - mpImp->aMediaType = rObj.mpImp->aMediaType; - mpImp->bNeedUpdate = rObj.mpImp->bNeedUpdate; - - if ( rObj.mpImp->pGraphic && !rObj.mpImp->bNeedUpdate ) - mpImp->pGraphic = new Graphic( *rObj.mpImp->pGraphic ); - else - mpImp->pGraphic = 0; - return *this; -} -*/ void EmbeddedObjectRef::Assign( const NS_UNO::Reference < NS_EMBED::XEmbeddedObject >& xObj, sal_Int64 nAspect ) { DBG_ASSERT( !mxObj.is(), "Never assign an already assigned object!" ); @@ -375,13 +339,13 @@ void EmbeddedObjectRef::Clear() mxObj->changeState( embed::EmbedStates::LOADED ); xClose->close( sal_True ); } - catch ( util::CloseVetoException& ) + catch (const util::CloseVetoException&) { // there's still someone who needs the object! } - catch ( uno::Exception& ) + catch (const uno::Exception&) { - OSL_ENSURE( sal_False, "Error on switching of the object to loaded state and closing!\n" ); + OSL_FAIL( "Error on switching of the object to loaded state and closing!\n" ); } } } @@ -457,8 +421,6 @@ void EmbeddedObjectRef::GetReplacement( sal_Bool bUpdate ) DELETEZ( mpImp->pGraphic ); mpImp->aMediaType = ::rtl::OUString(); mpImp->pGraphic = new Graphic; - if ( mpImp->pHCGraphic ) - DELETEZ( mpImp->pHCGraphic ); mpImp->mnGraphicVersion++; } else if ( !mpImp->pGraphic ) @@ -468,16 +430,16 @@ void EmbeddedObjectRef::GetReplacement( sal_Bool bUpdate ) } else { - DBG_ERROR("No update, but replacement exists already!"); + OSL_FAIL("No update, but replacement exists already!"); return; } SvStream* pGraphicStream = GetGraphicStream( bUpdate ); if ( pGraphicStream ) { - GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); if( mpImp->pGraphic ) - pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + rGF.ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); mpImp->mnGraphicVersion++; delete pGraphicStream; } @@ -522,21 +484,21 @@ Size EmbeddedObjectRef::GetSize( MapMode* pTargetMapMode ) const { aSize = mxObj->getVisualAreaSize( mpImp->nViewAspect ); } - catch( embed::NoVisualAreaSizeException& ) + catch(const embed::NoVisualAreaSizeException&) { } - catch( uno::Exception& ) + catch(const uno::Exception&) { - OSL_ENSURE( sal_False, "Something went wrong on getting of the size of the object!" ); + OSL_FAIL( "Something went wrong on getting of the size of the object!" ); } try { aSourceMapMode = VCLUnoHelper::UnoEmbed2VCLMapUnit( mxObj->getMapUnit( mpImp->nViewAspect ) ); } - catch( uno::Exception ) + catch(const uno::Exception&) { - OSL_ENSURE( sal_False, "Can not get the map mode!" ); + OSL_FAIL( "Can not get the map mode!" ); } } @@ -555,70 +517,6 @@ Size EmbeddedObjectRef::GetSize( MapMode* pTargetMapMode ) const return aResult; } -Graphic* EmbeddedObjectRef::GetHCGraphic() const -{ - if ( !mpImp->pHCGraphic ) - { - uno::Reference< io::XInputStream > xInStream; - try - { - // if the object needs size on load, that means that it is not our object - // currently the HC mode is supported only for OOo own objects so the following - // check is used as an optimization - // TODO/LATER: shouldn't there be a special status flag to detect alien implementation? - if ( mpImp->nViewAspect == embed::Aspects::MSOLE_CONTENT - && mxObj.is() && !( mxObj->getStatus( mpImp->nViewAspect ) & embed::EmbedMisc::EMBED_NEEDSSIZEONLOAD ) ) - { - // TODO/LATER: optimization, it makes no sence to do it for OLE objects - if ( mxObj->getCurrentState() == embed::EmbedStates::LOADED ) - mxObj->changeState( embed::EmbedStates::RUNNING ); - - // TODO: return for the aspect of the document - embed::VisualRepresentation aVisualRepresentation; - uno::Reference< datatransfer::XTransferable > xTransferable( mxObj->getComponent(), uno::UNO_QUERY ); - if ( !xTransferable.is() ) - throw uno::RuntimeException(); - - datatransfer::DataFlavor aDataFlavor( - ::rtl::OUString::createFromAscii( - "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"" ), - ::rtl::OUString::createFromAscii( "GDIMetaFile" ), - ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) ); - - uno::Sequence < sal_Int8 > aSeq; - if ( ( xTransferable->getTransferData( aDataFlavor ) >>= aSeq ) && aSeq.getLength() ) - xInStream = new ::comphelper::SequenceInputStream( aSeq ); - } - } - catch ( uno::Exception& ) - { - } - - if ( xInStream.is() ) - { - SvStream* pStream = NULL; - pStream = ::utl::UcbStreamHelper::CreateStream( xInStream ); - if ( pStream ) - { - if ( !pStream->GetError() ) - { - GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); - Graphic* pGraphic = new Graphic(); - if ( pGF->ImportGraphic( *pGraphic, String(), *pStream, GRFILTER_FORMAT_DONTKNOW ) == 0 ) - mpImp->pHCGraphic = pGraphic; - else - delete pGraphic; - mpImp->mnGraphicVersion++; - } - - delete pStream; - } - } - } - - return mpImp->pHCGraphic; -} - void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream >& xInGrStream, const ::rtl::OUString& rMediaType ) { @@ -626,16 +524,14 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream delete mpImp->pGraphic; mpImp->pGraphic = new Graphic(); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) - DELETEZ( mpImp->pHCGraphic ); mpImp->mnGraphicVersion++; SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( xInGrStream ); if ( pGraphicStream ) { - GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); - pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + GraphicFilter& rGF = GraphicFilter::GetGraphicFilter(); + rGF.ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) @@ -659,8 +555,6 @@ void EmbeddedObjectRef::SetGraphic( const Graphic& rGraphic, const ::rtl::OUStri delete mpImp->pGraphic; mpImp->pGraphic = new Graphic( rGraphic ); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) - DELETEZ( mpImp->pHCGraphic ); mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) @@ -839,7 +733,7 @@ sal_Bool EmbeddedObjectRef::TryRunningState( const uno::Reference < embed::XEmbe if ( xEmbObj->getCurrentState() == embed::EmbedStates::LOADED ) xEmbObj->changeState( embed::EmbedStates::RUNNING ); } - catch ( uno::Exception& ) + catch (const uno::Exception&) { return sal_False; } @@ -862,7 +756,7 @@ void EmbeddedObjectRef::SetGraphicToContainer( const Graphic& rGraphic, aContainer.InsertGraphicStream( xStream, aName, aMediaType ); } else - OSL_ENSURE( sal_False, "Export of graphic is failed!\n" ); + OSL_FAIL( "Export of graphic is failed!\n" ); } sal_Bool EmbeddedObjectRef::ObjectIsModified( const uno::Reference< embed::XEmbeddedObject >& xObj ) @@ -896,8 +790,6 @@ void EmbeddedObjectRef::UpdateReplacementOnDemand() { DELETEZ( mpImp->pGraphic ); mpImp->bNeedUpdate = sal_True; - if ( mpImp->pHCGraphic ) - DELETEZ( mpImp->pHCGraphic ); mpImp->mnGraphicVersion++; if( mpImp->pContainer ) @@ -954,3 +846,4 @@ void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM ) } // namespace svt +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index 451eee04d814..3773f84e24a6 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -115,7 +116,7 @@ sal_Bool SvEmbedTransferHelper::GetData( const ::com::sun::star::datatransfer::D if ( xPers.is() ) { uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetTemporaryStorage(); - ::rtl::OUString aName = ::rtl::OUString::createFromAscii("Dummy"); + ::rtl::OUString aName( RTL_CONSTASCII_USTRINGPARAM( "Dummy" )); SvStream* pStream = NULL; sal_Bool bDeleteStream = sal_False; uno::Sequence < beans::PropertyValue > aEmpty; @@ -240,7 +241,7 @@ void SvEmbedTransferHelper::FillTransferableObjectDescriptor( TransferableObject } catch( embed::NoVisualAreaSizeException& ) { - OSL_ENSURE( sal_False, "Can not get visual area size!\n" ); + OSL_FAIL( "Can not get visual area size!\n" ); aSize = Size( 5000, 5000 ); } @@ -254,3 +255,4 @@ void SvEmbedTransferHelper::FillTransferableObjectDescriptor( TransferableObject rDesc.mbCanLink = sal_False; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/filechangedchecker.cxx b/svtools/source/misc/filechangedchecker.cxx new file mode 100644 index 000000000000..6a3d04107420 --- /dev/null +++ b/svtools/source/misc/filechangedchecker.cxx @@ -0,0 +1,115 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * [ Surendran Mahendran <surenspost@gmail.com>] + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include "svtools/filechangedchecker.hxx" +#include <osl/time.h> +#include "com/sun/star/system/XSystemShellExecute.hpp" +#include "com/sun/star/system/SystemShellExecuteFlags.hpp" +#include <comphelper/processfactory.hxx> + +using namespace ::com::sun::star; + +FileChangedChecker::FileChangedChecker(const rtl::OUString& rFilename, const ::boost::function0<void>& rCallback) : + mTimer(), + mFileName(rFilename), + mLastModTime(), + mpCallback(rCallback) +{ + // Get the curren last file modified Status + getCurrentModTime(mLastModTime); + + // associate the callback function for the timer + mTimer.SetTimeoutHdl(LINK(this, FileChangedChecker, TimerHandler)); + + //start the timer + resetTimer(); +} + +void FileChangedChecker::resetTimer() +{ + //Start the timer if its not active + if(!mTimer.IsActive()) + mTimer.Start(); + + // Set a timeout of 3 seconds + mTimer.SetTimeout(3000); +} + +bool FileChangedChecker::getCurrentModTime(TimeValue& o_rValue) const +{ + // Need a Directory item to fetch file status + osl::DirectoryItem aItem; + osl::DirectoryItem::get(mFileName, aItem); + + // Retrieve the status - we are only interested in last File + // Modified time + osl::FileStatus aStatus( osl_FileStatus_Mask_ModifyTime ); + if( osl::FileBase::E_None != aItem.getFileStatus(aStatus) ) + return false; + + o_rValue = aStatus.getModifyTime(); + return true; +} + +bool FileChangedChecker::hasFileChanged() +{ + // Get the current file Status + TimeValue newTime={0,0}; + if( !getCurrentModTime(newTime) ) + return true; // well. hard to answer correctly here ... + + // Check if the seconds time stamp has any difference + // If so, then our file has changed meanwhile + if( newTime.Seconds != mLastModTime.Seconds || + newTime.Seconds != mLastModTime.Seconds ) + { + // Since the file has changed, set the new status as the file status and + // return True + mLastModTime = newTime ; + + return true; + } + else + return false; +} + +IMPL_LINK(FileChangedChecker, TimerHandler, Timer *, EMPTYARG) +{ + // If the file has changed, then update the graphic in the doc + OSL_TRACE("Timeout Called \n"); + if(hasFileChanged()) + { + OSL_TRACE("File modified \n"); + mpCallback(); + } + + // Reset the timer in any case + resetTimer(); + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/filterutils.cxx b/svtools/source/misc/filterutils.cxx new file mode 100644 index 000000000000..06640c55f10e --- /dev/null +++ b/svtools/source/misc/filterutils.cxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" +#include <svtools/filterutils.hxx> +#include <rtl/ustrbuf.hxx> + +namespace svt +{ +//........................................................................ + + using namespace ::com::sun::star; + + rtl::OUString lcl_createStringFromArray( const char* pcCharArr, sal_uInt32 nBufSize, bool bIsCompressed ) + { + rtl::OUStringBuffer aBuffer; + if( bIsCompressed ) + { + // buffer contains compressed Unicode, not encoded bytestring + sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ); + aBuffer.setLength( nStrLen ); + const char* pcCurrChar = pcCharArr; + for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar, ++pcCurrChar ) + /* *pcCurrChar may contain negative values and therefore MUST be + casted to unsigned char, before assigned to a sal_Unicode. */ + aBuffer.setCharAt( nChar, static_cast< unsigned char >( *pcCurrChar ) ); + } + else + { + // buffer contains Little-Endian Unicode + sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2; + aBuffer.setLength( nStrLen ); + const char* pcCurrChar = pcCharArr; + for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar ) + { + /* *pcCurrChar may contain negative values and therefore MUST be + casted to unsigned char, before assigned to a sal_Unicode. */ + sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ ); + cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8); + aBuffer.setCharAt( nChar, cChar ); + } + } + return aBuffer.makeStringAndClear(); + } + + rtl::OUString BinFilterUtils::CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize ) + { + return lcl_createStringFromArray( pcCharArr, nBufSize, false ); + } + + rtl::OUString BinFilterUtils::CreateOUStringFromStringArray( const char* pcCharArr, sal_uInt32 nBufSize ) + { + return lcl_createStringFromArray( pcCharArr, nBufSize, true ); + } +//........................................................................ +} // namespace svt +//........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/helpagent.src b/svtools/source/misc/helpagent.src index 1f2eaaa291a3..d3566a404a01 100644 --- a/svtools/source/misc/helpagent.src +++ b/svtools/source/misc/helpagent.src @@ -31,11 +31,10 @@ Bitmap BMP_HELP_AGENT_IMAGE { - File = "helpagent.bmp"; + File = "helpagent.png"; }; Bitmap BMP_HELP_AGENT_CLOSER { - File = "closer.bmp"; + File = "closer.png"; }; - diff --git a/svtools/source/misc/helpagentwindow.cxx b/svtools/source/misc/helpagentwindow.cxx index a270e8b68bf9..50a2341d1290 100644 --- a/svtools/source/misc/helpagentwindow.cxx +++ b/svtools/source/misc/helpagentwindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -183,3 +184,4 @@ namespace svt } // namespace svt //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 0fa861281196..e6c5ecb1f934 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -52,7 +53,8 @@ #include <svtools/svtools.hrc> #include <svtools/imagemgr.hrc> #include <svtools/svtdata.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> +#include <vcl/lazydelete.hxx> // globals ******************************************************************* @@ -68,7 +70,7 @@ struct SvtExtensionResIdMapping_Impl sal_uInt16 _nImgId; }; -static SvtExtensionResIdMapping_Impl __READONLY_DATA ExtensionMap_Impl[] = +static SvtExtensionResIdMapping_Impl const ExtensionMap_Impl[] = { { "awk", sal_True, STR_DESCRIPTION_SOURCEFILE, 0 }, { "bas", sal_True, STR_DESCRIPTION_SOURCEFILE, 0 }, @@ -184,36 +186,6 @@ static SvtExtensionResIdMapping_Impl __READONLY_DATA ExtensionMap_Impl[] = { 0, sal_False, 0, 0 } }; -#ifdef OS2 - SvtExtensionResIdMapping_Impl Mappings[] = - { - {"StarWriter 4.0", sal_False,STR_DESCRIPTION_SWRITER_DOC, IMG_WRITER}, - {"StarWriter 3.0", sal_False,STR_DESCRIPTION_SWRITER_DOC, IMG_WRITER}, - {"StarCalc 4.0", sal_False,STR_DESCRIPTION_SCALC_DOC, IMG_CALC}, - {"StarCalc 3.0", sal_False,STR_DESCRIPTION_SCALC_DOC, IMG_CALC}, - {"StarImpress 4.0", sal_False,STR_DESCRIPTION_SIMPRESS_DOC,IMG_IMPRESS}, - {"StarDraw 4.0", sal_False,STR_DESCRIPTION_SDRAW_DOC, IMG_DRAW}, - {"StarDraw 3.0", sal_False,STR_DESCRIPTION_SDRAW_DOC, IMG_DRAW}, - {"StarChart 3.0", sal_False,STR_DESCRIPTION_SCHART_DOC, IMG_CHART}, - {"StarChart 4.0", sal_False,STR_DESCRIPTION_SCHART_DOC, IMG_CHART}, - {"Bitmap", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_BITMAP}, - {"AutoCAD", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_SIM}, - {"Gif-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_GIF}, - {"JPEG-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_JPG}, - {"Metafile ", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_SIM}, - {"Photo-CD ", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_PCD}, - {"Mac Pict", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_PCT}, - {"PCX-File ", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_PCX}, - {"PNG-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_SIM}, - {"SV-Metafile", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_SIM}, - {"TIFF-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_TIFF}, - {"MS-Metafile", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_WMF}, - {"XBM-File", sal_False,STR_DESCRIPTION_GRAPHIC_DOC, IMG_BITMAP}, - {"UniformResourceLocator", sal_False,STR_DESCRIPTION_LINK, IMG_URL}, - {NULL, 0} - }; -#endif - struct SvtFactory2ExtensionMapping_Impl { const char* _pFactory; @@ -222,7 +194,7 @@ struct SvtFactory2ExtensionMapping_Impl // mapping from "private:factory" url to extension -static SvtFactory2ExtensionMapping_Impl __READONLY_DATA Fac2ExtMap_Impl[] = +static SvtFactory2ExtensionMapping_Impl const Fac2ExtMap_Impl[] = { { "swriter", "odt" }, { "swriter/web", "html" }, @@ -407,7 +379,7 @@ static sal_uInt16 GetImageId_Impl( const INetURLObject& rObject, sal_Bool bDetec { String aURLPath = sURL.Copy( URL_PREFIX_PRIV_SOFFICE_LEN ); String aType = aURLPath.GetToken( 0, INET_PATH_TOKEN ); - if ( aType == String( RTL_CONSTASCII_STRINGPARAM("factory") ) ) + if ( aType == String( RTL_CONSTASCII_USTRINGPARAM("factory") ) ) { // detect an image id for our "private:factory" urls aExt = GetImageExtensionByFactory_Impl( sURL ); @@ -415,7 +387,7 @@ static sal_uInt16 GetImageId_Impl( const INetURLObject& rObject, sal_Bool bDetec nImage = GetImageId_Impl( aExt ); return nImage; } - else if ( aType == String( RTL_CONSTASCII_STRINGPARAM("image") ) ) + else if ( aType == String( RTL_CONSTASCII_USTRINGPARAM("image") ) ) nImage = (sal_uInt16)aURLPath.GetToken( 1, INET_PATH_TOKEN ).ToInt32(); } else @@ -493,7 +465,7 @@ static String GetDescriptionByFactory_Impl( const String& rFactory ) String aRet; if ( nResId ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; aRet = String( SvtResId( nResId ) ); } return aRet; @@ -529,196 +501,42 @@ static sal_uInt16 GetFolderDescriptionId_Impl( const String& rURL ) return nRet; } -/* -static ResMgr* GetIsoResMgr_Impl() -{ - static ResMgr* pIsoResMgr = NULL; - - if ( !pIsoResMgr ) - { - ByteString aResMgrName( "iso" ); - pIsoResMgr = ResMgr::CreateResMgr( - aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - if ( !pIsoResMgr ) - { - // no "iso" resource -> search for "ooo" resource - aResMgrName = ByteString( "ooo" ); - pIsoResMgr = ResMgr::CreateResMgr( - aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - } - } - - return pIsoResMgr; -} - -static ImageList* CreateImageList_Impl( sal_uInt16 nResId ) -{ - ImageList* pList = NULL; - ResMgr* pResMgr = GetIsoResMgr_Impl(); - DBG_ASSERT( pResMgr, "SvFileInformationManager::CreateImageList_Impl(): no resmgr" ); - ResId aResId( nResId, *pResMgr ); - aResId.SetRT( RSC_IMAGELIST ); - if ( pResMgr->IsAvailable( aResId ) ) - pList = new ImageList( aResId ); - else - pList = new ImageList(); - return pList; -} - -static Image GetOfficeImageFromList_Impl( sal_uInt16 nImageId, sal_Bool bBig, sal_Bool bHighContrast ) -{ - ImageList* pList = NULL; - - static ImageList* _pSmallOfficeImgList = NULL; - static ImageList* _pBigOfficeImgList = NULL; - static ImageList* _pSmallHCOfficeImgList = NULL; - static ImageList* _pBigHCOfficeImgList = NULL; - static sal_uLong nStyle = Application::GetSettings().GetStyleSettings().GetSymbolsStyle(); - - // If the style has been changed, throw away our cache of the older images - if ( nStyle != Application::GetSettings().GetStyleSettings().GetSymbolsStyle() ) - { - delete _pSmallOfficeImgList, _pSmallOfficeImgList = NULL; - delete _pBigOfficeImgList, _pBigOfficeImgList = NULL; - delete _pSmallHCOfficeImgList, _pSmallHCOfficeImgList = NULL; - delete _pBigHCOfficeImgList, _pBigHCOfficeImgList = NULL; - nStyle = Application::GetSettings().GetStyleSettings().GetSymbolsStyle(); - } - - // #i21242# MT: For B&W we need the HC Image and must transform. - // bHiContrast is sal_True for all dark backgrounds, but we need HC Images for HC White also, - // so we can't rely on bHighContrast. - sal_Bool bBlackAndWhite = Application::GetSettings().GetStyleSettings().IsHighContrastBlackAndWhite(); - if ( bBlackAndWhite ) - bHighContrast = sal_True; - - - if ( bBig ) - { - if ( bHighContrast ) - { - if ( !_pBigHCOfficeImgList ) - _pBigHCOfficeImgList = CreateImageList_Impl( RID_SVTOOLS_IMAGELIST_BIG_HIGHCONTRAST ); - pList = _pBigHCOfficeImgList; - } - else - { - if ( !_pBigOfficeImgList ) - _pBigOfficeImgList = CreateImageList_Impl( RID_SVTOOLS_IMAGELIST_BIG ); - pList = _pBigOfficeImgList; - } - } - else - { - if ( bHighContrast ) - { - if ( !_pSmallHCOfficeImgList ) - _pSmallHCOfficeImgList = CreateImageList_Impl( RID_SVTOOLS_IMAGELIST_SMALL_HIGHCONTRAST ); - pList = _pSmallHCOfficeImgList; - } - else - { - if ( !_pSmallOfficeImgList ) - _pSmallOfficeImgList = CreateImageList_Impl( RID_SVTOOLS_IMAGELIST_SMALL ); - pList = _pSmallOfficeImgList; - } - } - - Image aImage = pList->GetImage( nImageId ); - - if ( bBlackAndWhite ) - { - // First invert the Image, because it's designed for black background, structures are bright - aImage.Invert(); - // Now make monochrome... - ImageColorTransform eTrans = IMAGECOLORTRANSFORM_MONOCHROME_WHITE; - if ( Application::GetSettings().GetStyleSettings().GetFaceColor().GetColor() == COL_WHITE ) - eTrans = IMAGECOLORTRANSFORM_MONOCHROME_BLACK; - aImage = aImage.GetColorTransformedImage( eTrans ); - } - - return aImage; -} -*/ - -static Image GetImageFromList_Impl( sal_uInt16 nImageId, sal_Bool bBig, sal_Bool bHighContrast ) +static Image GetImageFromList_Impl( sal_uInt16 nImageId, sal_Bool bBig ) { - if ( !bBig && IMG_FOLDER == nImageId && !bHighContrast ) + if ( !bBig && IMG_FOLDER == nImageId ) // return our new small folder image (256 colors) return Image( SvtResId( IMG_SVT_FOLDER ) ); ImageList* pList = NULL; - static ImageList* _pSmallImageList = NULL; - static ImageList* _pBigImageList = NULL; - static ImageList* _pSmallHCImageList = NULL; - static ImageList* _pBigHCImageList = NULL; + static vcl::DeleteOnDeinit< ImageList > xSmallImageList( NULL ); + static vcl::DeleteOnDeinit< ImageList > xBigImageList( NULL ); static sal_uLong nStyle = Application::GetSettings().GetStyleSettings().GetSymbolsStyle(); // If the style has been changed, throw away our cache of the older images if ( nStyle != Application::GetSettings().GetStyleSettings().GetSymbolsStyle() ) { - delete _pSmallImageList, _pSmallImageList = NULL; - delete _pBigImageList, _pBigImageList = NULL; - delete _pSmallHCImageList, _pSmallHCImageList = NULL; - delete _pBigHCImageList, _pBigHCImageList = NULL; + xSmallImageList.reset(); + xBigImageList.reset(); nStyle = Application::GetSettings().GetStyleSettings().GetSymbolsStyle(); } if ( bBig ) { - if ( bHighContrast ) - { - if ( !_pBigHCImageList ) - _pBigHCImageList = new ImageList( SvtResId( RID_SVTOOLS_IMAGELIST_BIG_HIGHCONTRAST ) ); - pList = _pBigHCImageList; - } - else - { - if ( !_pBigImageList ) - _pBigImageList = new ImageList( SvtResId( RID_SVTOOLS_IMAGELIST_BIG ) ); - pList = _pBigImageList; - } + if ( !xBigImageList.get() ) + xBigImageList.reset(new ImageList(SvtResId(RID_SVTOOLS_IMAGELIST_BIG))); + pList = xBigImageList.get(); } else { - if ( bHighContrast ) - { - if ( !_pSmallHCImageList ) - _pSmallHCImageList = new ImageList( SvtResId( RID_SVTOOLS_IMAGELIST_SMALL_HIGHCONTRAST ) ); - pList = _pSmallHCImageList; - } - else - { - if ( !_pSmallImageList ) - _pSmallImageList = new ImageList( SvtResId( RID_SVTOOLS_IMAGELIST_SMALL ) ); - pList = _pSmallImageList; - } + if ( !xSmallImageList.get() ) + xSmallImageList.reset(new ImageList(SvtResId(RID_SVTOOLS_IMAGELIST_SMALL))); + pList = xSmallImageList.get(); } if ( pList->HasImageAtPos( nImageId ) ) return pList->GetImage( nImageId ); - else - return Image(); - //return GetOfficeImageFromList_Impl( nImageId, bBig, bHighContrast ); -} - -//**************************************************************************** - -void ReplaceStarOfficeVar( String& _rDescription ) -{ - static String sVariable( RTL_CONSTASCII_STRINGPARAM( "%STAROFFICE" ) ); - static String sProductName; - if ( sProductName.Len() == 0 ) - { - ::rtl::OUString sTemp; - ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ) >>= sTemp; - if ( sTemp.equalsAscii( "StarSuite" ) == sal_False ) - sProductName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarOffice" ) ); - else - sProductName = String( sTemp ); - } - _rDescription.SearchAndReplace( sVariable, sProductName ); + return Image(); } String SvFileInformationManager::GetDescription_Impl( const INetURLObject& rObject, sal_Bool bDetectFolder ) @@ -738,7 +556,7 @@ String SvFileInformationManager::GetDescription_Impl( const INetURLObject& rObje { String aURLPath = sURL.Copy( URL_PREFIX_PRIV_SOFFICE_LEN ); String aType = aURLPath.GetToken( 0, INET_PATH_TOKEN ); - if ( aType == String( RTL_CONSTASCII_STRINGPARAM("factory") ) ) + if ( aType == String( RTL_CONSTASCII_USTRINGPARAM("factory") ) ) { sDescription = GetDescriptionByFactory_Impl( aURLPath.Copy( aURLPath.Search( INET_PATH_TOKEN ) + 1 ) ); bDetected = sal_True; @@ -774,7 +592,7 @@ String SvFileInformationManager::GetDescription_Impl( const INetURLObject& rObje sDescription = sExtension; sDescription += '-'; } - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; sDescription += String( SvtResId( nResId ) ); } @@ -782,50 +600,29 @@ String SvFileInformationManager::GetDescription_Impl( const INetURLObject& rObje if ( bShowExt ) { - sDescription += String( RTL_CONSTASCII_STRINGPARAM(" (") ); + sDescription += String( RTL_CONSTASCII_USTRINGPARAM(" (") ); sDescription += sExtension; sDescription += ')'; } - ReplaceStarOfficeVar( sDescription ); return sDescription; } Image SvFileInformationManager::GetImage( const INetURLObject& rObject, sal_Bool bBig ) { - return GetImage( rObject, bBig, sal_False ); -} - -Image SvFileInformationManager::GetFileImage( const INetURLObject& rObject, sal_Bool bBig ) -{ - return GetFileImage( rObject, bBig, sal_False ); -} - -Image SvFileInformationManager::GetImageNoDefault( const INetURLObject& rObject, sal_Bool bBig ) -{ - return GetImageNoDefault( rObject, bBig, sal_False ); -} - -Image SvFileInformationManager::GetFolderImage( const svtools::VolumeInfo& rInfo, sal_Bool bBig ) -{ - return GetFolderImage( rInfo, bBig, sal_False ); -} - -Image SvFileInformationManager::GetImage( const INetURLObject& rObject, sal_Bool bBig, sal_Bool bHighContrast ) -{ sal_uInt16 nImage = GetImageId_Impl( rObject, sal_True ); DBG_ASSERT( nImage, "invalid ImageId" ); - return GetImageFromList_Impl( nImage, bBig, bHighContrast ); + return GetImageFromList_Impl( nImage, bBig ); } -Image SvFileInformationManager::GetFileImage( const INetURLObject& rObject, sal_Bool bBig, sal_Bool bHighContrast ) +Image SvFileInformationManager::GetFileImage( const INetURLObject& rObject, sal_Bool bBig ) { - sal_uInt16 nImage = GetImageId_Impl( rObject, sal_False ); + sal_Int16 nImage = GetImageId_Impl( rObject, sal_False ); DBG_ASSERT( nImage, "invalid ImageId" ); - return GetImageFromList_Impl( nImage, bBig, bHighContrast ); + return GetImageFromList_Impl( nImage, bBig ); } -Image SvFileInformationManager::GetImageNoDefault( const INetURLObject& rObject, sal_Bool bBig, sal_Bool bHighContrast ) +Image SvFileInformationManager::GetImageNoDefault( const INetURLObject& rObject, sal_Bool bBig ) { sal_uInt16 nImage = GetImageId_Impl( rObject, sal_True ); DBG_ASSERT( nImage, "invalid ImageId" ); @@ -833,10 +630,10 @@ Image SvFileInformationManager::GetImageNoDefault( const INetURLObject& rObject, if ( nImage == IMG_FILE ) return Image(); - return GetImageFromList_Impl( nImage, bBig, bHighContrast ); + return GetImageFromList_Impl( nImage, bBig ); } -Image SvFileInformationManager::GetFolderImage( const svtools::VolumeInfo& rInfo, sal_Bool bBig, sal_Bool bHighContrast ) +Image SvFileInformationManager::GetFolderImage( const svtools::VolumeInfo& rInfo, sal_Bool bBig ) { sal_uInt16 nImage = IMG_FOLDER; DBG_ASSERT( nImage, "invalid ImageId" ); @@ -850,7 +647,7 @@ Image SvFileInformationManager::GetFolderImage( const svtools::VolumeInfo& rInfo else if ( rInfo.m_bIsVolume ) nImage = IMG_FIXEDDEV; - return GetImageFromList_Impl( nImage, bBig, bHighContrast ); + return GetImageFromList_Impl( nImage, bBig ); } String SvFileInformationManager::GetDescription( const INetURLObject& rObject ) @@ -879,3 +676,4 @@ String SvFileInformationManager::GetFolderDescription( const svtools::VolumeInfo return sDescription; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/imagemgr.src b/svtools/source/misc/imagemgr.src index d00a8717f709..62104ea09d54 100644 --- a/svtools/source/misc/imagemgr.src +++ b/svtools/source/misc/imagemgr.src @@ -32,89 +32,73 @@ // images ******************************************************************** #define X_IMAGE_LIST \ - IMG_IMPRESS ; \ - IMG_CALC ; \ - IMG_CALCTEMPLATE ; \ - IMG_CHART ; \ - IMG_IMPRESSTEMPLATE ; \ - IMG_HTML ; \ - IMG_MATH ; \ - IMG_WRITER ; \ - IMG_WRITERTEMPLATE ; \ - IMG_MACROLIB ; \ - IMG_GLOBAL_DOC ; \ - IMG_DRAW ; \ - IMG_DRAWTEMPLATE ; \ - IMG_NEWFROMTEMPLATE ; \ - IMG_DATABASE; \ - IMG_WORKPLACE ; \ - IMG_BITMAP ; \ - IMG_EXCEL ; \ - IMG_EXCELTEMPLATE ; \ - IMG_FTPSERVER ; \ - IMG_GALLERY ; \ - IMG_GALLERYTHEME ; \ - IMG_GIF ; \ - IMG_HELP ; \ - IMG_HTML ; \ - IMG_JPG ; \ - IMG_LINK ; \ - IMG_LOTUS ; \ - IMG_MATHTEMPLATE ; \ - IMG_FILE ; \ - IMG_APP ; \ - IMG_PCD ; \ - IMG_PCT ; \ - IMG_PCX ; \ - IMG_SIM ; \ - IMG_TEXTFILE ; \ - IMG_SVHELP ; \ - IMG_TIFF ; \ - IMG_URL ; \ - IMG_WMF ; \ - IMG_WORD ; \ - IMG_FIXEDDEV ; \ - IMG_REMOVEABLEDEV ; \ - IMG_CDROMDEV ; \ - IMG_NETWORKDEV ; \ - IMG_RAMDEV ; \ - IMG_TABLEFOLDER ; \ - IMG_TABLE ; \ - IMG_FOLDER ; \ - IMG_EXPANDEDFOLDER ; \ - IMG_XXX ; \ - IMG_GALLERYIMPORT ; \ - IMG_QUERYFOLDER ; \ - IMG_QUERY ; \ - IMG_FORM ; \ - IMG_FORMFOLDER ; \ - IMG_REPORT ; \ - IMG_REPORTFOLDER ; \ - IMG_OTHERS ; \ - IMG_DXF ; \ - IMG_MET ; \ - IMG_PNG ; \ - IMG_SGF ; \ - IMG_SGV ; \ - IMG_SVM ; \ - IMG_TASK ; \ - IMG_APPOINTMENT ; \ - IMG_RELATION ; \ - IMG_IMPRESSPACKED ; \ - IMG_POWERPOINT ; \ - IMG_POWERPOINTTEMPLATE ; \ - IMG_OO_DATABASE_DOC ; \ - IMG_OO_DRAW_DOC ; \ - IMG_OO_MATH_DOC ; \ - IMG_OO_GLOBAL_DOC ; \ - IMG_OO_IMPRESS_DOC ; \ - IMG_OO_CALC_DOC ; \ - IMG_OO_WRITER_DOC ; \ - IMG_OO_DRAW_TEMPLATE ; \ - IMG_OO_IMPRESS_TEMPLATE ; \ - IMG_OO_CALC_TEMPLATE ; \ - IMG_OO_WRITER_TEMPLATE ; \ - IMG_EXTENSION ; + IMG_IMPRESS ; \ + IMG_CALC ; \ + IMG_CALCTEMPLATE ; \ + IMG_CHART ; \ + IMG_IMPRESSTEMPLATE ; \ + IMG_HTML ; \ + IMG_MATH ; \ + IMG_WRITER ; \ + IMG_WRITERTEMPLATE ; \ + IMG_MACROLIB ; \ + IMG_GLOBAL_DOC ; \ + IMG_DRAW ; \ + IMG_DRAWTEMPLATE ; \ + IMG_NEWFROMTEMPLATE ; \ + IMG_DATABASE; \ + IMG_BITMAP ; \ + IMG_CALC ; \ + IMG_CALCTEMPLATE ; \ + IMG_CDROMDEV ; \ + IMG_CHART ; \ + IMG_DATABASE ; \ + IMG_DRAW ; \ + IMG_DRAWTEMPLATE ; \ + IMG_DXF ; \ + IMG_EXTENSION ; \ + IMG_FILE ; \ + IMG_FIXEDDEV ; \ + IMG_FOLDER ; \ + IMG_GIF ; \ + IMG_GLOBAL_DOC ; \ + IMG_HTML ; \ + IMG_IMPRESS ; \ + IMG_IMPRESSTEMPLATE ; \ + IMG_JPG ; \ + IMG_MATH ; \ + IMG_MATHTEMPLATE ; \ + IMG_MET ; \ + IMG_NETWORKDEV ; \ + IMG_OO_CALC_DOC ; \ + IMG_OO_CALC_TEMPLATE ; \ + IMG_OO_DATABASE_DOC ; \ + IMG_OO_DRAW_DOC ; \ + IMG_OO_DRAW_TEMPLATE ; \ + IMG_OO_GLOBAL_DOC ; \ + IMG_OO_IMPRESS_DOC ; \ + IMG_OO_IMPRESS_TEMPLATE ; \ + IMG_OO_MATH_DOC ; \ + IMG_OO_WRITER_DOC ; \ + IMG_OO_WRITER_TEMPLATE ; \ + IMG_PCD ; \ + IMG_PCT ; \ + IMG_PCX ; \ + IMG_PNG ; \ + IMG_REMOVEABLEDEV ; \ + IMG_SGF ; \ + IMG_SGV ; \ + IMG_SIM ; \ + IMG_SVM ; \ + IMG_TABLE ; \ + IMG_TEXTFILE ; \ + IMG_TIFF ; \ + IMG_WMF ; \ + IMG_WRITER ; \ + IMG_WRITERTEMPLATE ; \ + /* svx */ \ + IMG_MACROLIB ; \ + IMG_NEWFROMTEMPLATE ; ImageList RID_SVTOOLS_IMAGELIST_BIG { @@ -126,7 +110,7 @@ ImageList RID_SVTOOLS_IMAGELIST_BIG }; IdCount = { - 83 ; + 66 ; }; }; @@ -140,41 +124,22 @@ ImageList RID_SVTOOLS_IMAGELIST_SMALL }; IdCount = { - 83; + 66; }; }; -ImageList RID_SVTOOLS_IMAGELIST_BIG_HIGHCONTRAST +Bitmap BMP_PLUGIN { - Prefix = "lxh"; - MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - IdList = - { - X_IMAGE_LIST - }; - IdCount = - { - 83 ; - }; + File = "plugin.png" ; }; -ImageList RID_SVTOOLS_IMAGELIST_SMALL_HIGHCONTRAST +Image BMP_LIST_ADD { - Prefix = "sxh"; - MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - IdList = - { - X_IMAGE_LIST - }; - IdCount = + ImageBitmap = Bitmap { - 83; + File = "list_add.png" ; }; -}; - -Bitmap BMP_PLUGIN -{ - File = "plugin.png" ; + MaskColor = Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }; }; // description strings @@ -242,7 +207,7 @@ String STR_DESCRIPTION_SDRAW_DOC String STR_DESCRIPTION_SDATABASE_DOC { - Text [ en-US ] = "%STAROFFICE Database" ; + Text [ en-US ] = "StarOffice Database" ; }; String STR_DESCRIPTION_SCALC_DOC @@ -263,7 +228,7 @@ String STR_DESCRIPTION_GLOBALDOC }; String STR_DESCRIPTION_SIMAGE_DOC { - Text [ en-US ] = "%STAROFFICE Image" ; + Text [ en-US ] = "StarOffice Image" ; }; String STR_DESCRIPTION_TEXTFILE { @@ -275,7 +240,7 @@ String STR_DESCRIPTION_LINK }; String STR_DESCRIPTION_SOFFICE_TEMPLATE_DOC { - Text [ en-US ] = "%STAROFFICE 3.0 - 5.0 Template" ; + Text [ en-US ] = "StarOffice 3.0 - 5.0 Template" ; }; String STR_DESCRIPTION_EXCEL_DOC { @@ -459,7 +424,6 @@ String STR_DESCRIPTION_OO_WRITER_TEMPLATE { Text [ en-US ] = "OpenDocument Text Template" ; }; - String STR_DESCRIPTION_EXTENSION { Text [ en-US ] = "%PRODUCTNAME Extension" ; diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx index a4fd7e372880..afddd729abc8 100644 --- a/svtools/source/misc/imageresourceaccess.cxx +++ b/svtools/source/misc/imageresourceaccess.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -191,7 +192,7 @@ namespace svt } catch( const Exception& ) { - OSL_ENSURE( sal_False, "GraphicAccess::getImageStream: caught an exception!" ); + OSL_FAIL( "GraphicAccess::getImageStream: caught an exception!" ); } return pReturn; @@ -207,3 +208,4 @@ namespace svt } // namespace svt //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index 425eb0ac8481..d4ee29924801 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1220,3 +1221,5 @@ void ImageMap::Read( SvStream& rIStm, const String& rBaseURL ) rIStm.SetNumberFormatInt( nOldFormat ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index dedfb22532cb..20e8ae6431b8 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,12 +30,9 @@ #include "precompiled_svtools.hxx" #include <string.h> -// #include <math.h> #include <vcl/svapp.hxx> #include <tools/urlobj.hxx> -#ifndef _WRKWIN_HXX //autogen #include <vcl/wrkwin.hxx> -#endif #include <sot/formats.hxx> #include "svl/urihelper.hxx" @@ -749,3 +747,5 @@ sal_uLong ImageMap::ImpDetectFormat( SvStream& rIStm ) return nRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/imap3.cxx b/svtools/source/misc/imap3.cxx index 49d5f4c5984e..21cce8e7672f 100644 --- a/svtools/source/misc/imap3.cxx +++ b/svtools/source/misc/imap3.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,3 +96,4 @@ IMapCompat::~IMapCompat() +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/itemdel.cxx b/svtools/source/misc/itemdel.cxx index 676ae5383e63..0850947b9064 100644 --- a/svtools/source/misc/itemdel.cxx +++ b/svtools/source/misc/itemdel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -133,3 +134,4 @@ void DeleteOnIdleItems() } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/langhelp.cxx b/svtools/source/misc/langhelp.cxx new file mode 100644 index 000000000000..930d157f6576 --- /dev/null +++ b/svtools/source/misc/langhelp.cxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Thorsten Behrens <tbehrens@novell.com> + * + * Contributor(s): Thorsten Behrens <tbehrens@novell.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#include <svtools/langhelp.hxx> + +#include <vcl/svapp.hxx> +#include <rtl/ustring.hxx> + +void localizeWebserviceURI( ::rtl::OUString& rURI ) +{ + ::rtl::OUString aLang = Application::GetSettings().GetUILocale().Language; + if ( aLang.equalsIgnoreAsciiCaseAscii( "pt" ) + && Application::GetSettings().GetUILocale().Country.equalsIgnoreAsciiCaseAscii("br") ) + { + aLang = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pt-br" )); + } + + rURI += aLang; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index 61d397afbec9..7d5bb5d49f35 100755..100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,12 +29,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -// include --------------------------------------------------------------- - #include <tools/shl.hxx> #include <tools/debug.hxx> -//#include <com/sun/star/i18n/XCharacterClassification.hpp> #include <com/sun/star/i18n/DirectionProperty.hpp> #include <i18npool/lang.h> @@ -206,3 +204,4 @@ LanguageType SvtLanguageTable::GetTypeAtIndex( sal_uInt32 nIndex ) const //------------------------------------------------------------------------ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index bb5fa2dfd363..9998b2f18854 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -148,6 +148,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Norwegian, Nynorsk" ; LANGUAGE_NORWEGIAN_NYNORSK ; > ; < "Oriya" ; LANGUAGE_ORIYA ; > ; < "Polish" ; LANGUAGE_POLISH ; > ; + < "Portuguese (Angola)" ; LANGUAGE_USER_PORTUGUESE_ANGOLA ; > ; < "Portuguese (Portugal)" ; LANGUAGE_PORTUGUESE ; > ; < "Portuguese (Brazil)" ; LANGUAGE_PORTUGUESE_BRAZILIAN ; > ; < "Punjabi" ; LANGUAGE_PUNJABI ; > ; @@ -323,12 +324,22 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Yoruba" ; LANGUAGE_YORUBA ; > ; < "Rusyn (Ukraine)" ; LANGUAGE_USER_RUSYN_UKRAINE ; > ; < "Rusyn (Slovakia)" ; LANGUAGE_USER_RUSYN_SLOVAKIA ; > ; + < "Kabyle Latin" ; LANGUAGE_TAMAZIGHT_LATIN ; > ; < "Yiddish (USA)" ; LANGUAGE_USER_YIDDISH_US ; > ; < "Hawaiian" ; LANGUAGE_HAWAIIAN_UNITED_STATES ; > ; < "Limbu" ; LANGUAGE_USER_LIMBU ; > ; < "Lojban" ; LANGUAGE_USER_LOJBAN ; > ; < "Kabyle" ; LANGUAGE_USER_KABYLE ; > ; < "Haitian" ; LANGUAGE_USER_HAITIAN ; > ; + < "Beembe" ; LANGUAGE_USER_BEEMBE ; > ; + < "Bekwel" ; LANGUAGE_USER_BEKWEL ; > ; + < "Kituba" ; LANGUAGE_USER_KITUBA ; > ; + < "Lari" ; LANGUAGE_USER_LARI ; > ; + < "Mbochi" ; LANGUAGE_USER_MBOCHI ; > ; + < "Teke-Eboo" ; LANGUAGE_USER_TEKE_EBOO ; > ; + < "Teke-Ibali" ; LANGUAGE_USER_TEKE_IBALI ; > ; + < "Teke-Tyee" ; LANGUAGE_USER_TEKE_TYEE ; > ; + < "Vili" ; LANGUAGE_USER_VILI ; > ; }; }; diff --git a/svtools/source/misc/stringtransfer.cxx b/svtools/source/misc/stringtransfer.cxx index fa216b27f99c..0d6165abd3e2 100644 --- a/svtools/source/misc/stringtransfer.cxx +++ b/svtools/source/misc/stringtransfer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -110,3 +111,4 @@ namespace svt } // namespace svt //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx index b20863db3208..b63d1084e045 100755..100644 --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ b/svtools/source/misc/svtaccessiblefactory.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -283,14 +284,13 @@ namespace svt // load the library implementing the factory if ( !s_pFactory.get() ) { - const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii( + const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "acc" ) - ); + )); s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 ); if ( s_hAccessibleImplementationModule != NULL ) { - const ::rtl::OUString sFactoryCreationFunc = - ::rtl::OUString::createFromAscii( "getSvtAccessibilityComponentFactory" ); + const ::rtl::OUString sFactoryCreationFunc( RTL_CONSTASCII_USTRINGPARAM( "getSvtAccessibilityComponentFactory" )); s_pAccessibleFactoryFunc = (GetSvtAccessibilityComponentFactory) osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData ); @@ -353,3 +353,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/svtdata.cxx b/svtools/source/misc/svtdata.cxx index f4d959ec8793..23c98175f7a2 100644 --- a/svtools/source/misc/svtdata.cxx +++ b/svtools/source/misc/svtdata.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,7 +32,6 @@ #include <map> #include <tools/resmgr.hxx> #include <tools/shl.hxx> -#include <vos/process.hxx> #include <svtools/svtdata.hxx> #include <vcl/svapp.hxx> @@ -76,3 +76,4 @@ SvtResId::SvtResId(sal_uInt16 nId, const ::com::sun::star::lang::Locale aLocale) SvtResId::SvtResId(sal_uInt16 nId): ResId(nId, *ImpSvtData::GetSvtData().GetResMgr()) {} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx index 3c118445c6f4..20d82fe6e02b 100644 --- a/svtools/source/misc/templatefoldercache.cxx +++ b/svtools/source/misc/templatefoldercache.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -38,8 +39,8 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/util/XOfficeInstallationDirectories.hpp> #include <ucbhelper/content.hxx> -#include <vos/ref.hxx> -#include <vos/refernce.hxx> +#include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> #include <tools/urlobj.hxx> #include <tools/debug.hxx> #include <unotools/pathoptions.hxx> @@ -115,13 +116,13 @@ namespace svt //= TemplateContent //===================================================================== struct TemplateContent; - typedef ::std::vector< ::vos::ORef< TemplateContent > > TemplateFolderContent; + typedef ::std::vector< ::rtl::Reference< TemplateContent > > TemplateFolderContent; typedef TemplateFolderContent::const_iterator ConstFolderIterator; typedef TemplateFolderContent::iterator FolderIterator; /** a struct describing one content in one of the template dirs (or at least it's relevant aspects) */ - struct TemplateContent : public ::vos::OReference + struct TemplateContent : public ::salhelper::SimpleReferenceObject { public: @@ -160,7 +161,7 @@ namespace svt inline TemplateFolderContent::size_type size() const { return m_aSubContents.size(); } - inline void push_back( const ::vos::ORef< TemplateContent >& _rxNewElement ) + inline void push_back( const ::rtl::Reference< TemplateContent >& _rxNewElement ) { m_aSubContents.push_back( _rxNewElement ); } }; @@ -206,12 +207,12 @@ namespace svt //--------------------------------------------------------------------- /// compares two TemplateContent by URL struct TemplateContentURLLess - :public ::std::binary_function < ::vos::ORef< TemplateContent > - , ::vos::ORef< TemplateContent > + :public ::std::binary_function < ::rtl::Reference< TemplateContent > + , ::rtl::Reference< TemplateContent > , bool > { - bool operator() ( const ::vos::ORef< TemplateContent >& _rxLHS, const ::vos::ORef< TemplateContent >& _rxRHS ) const + bool operator() ( const ::rtl::Reference< TemplateContent >& _rxLHS, const ::rtl::Reference< TemplateContent >& _rxRHS ) const { return _rxLHS->getURL() < _rxRHS->getURL() ? true @@ -221,7 +222,7 @@ namespace svt //--------------------------------------------------------------------- /// sorts the sib contents of a TemplateFolderContent - struct SubContentSort : public ::std::unary_function< ::vos::ORef< TemplateContent >, void > + struct SubContentSort : public ::std::unary_function< ::rtl::Reference< TemplateContent >, void > { void operator() ( TemplateFolderContent& _rFolder ) const { @@ -240,9 +241,9 @@ namespace svt ); } - void operator() ( const ::vos::ORef< TemplateContent >& _rxContent ) const + void operator() ( const ::rtl::Reference< TemplateContent >& _rxContent ) const { - if ( _rxContent.isValid() && _rxContent->size() ) + if ( _rxContent.is() && _rxContent->size() ) { operator()( _rxContent->getSubContents() ); } @@ -252,17 +253,17 @@ namespace svt /** does a deep compare of two template contents */ struct TemplateContentEqual - :public ::std::binary_function < ::vos::ORef< TemplateContent > - , ::vos::ORef< TemplateContent > + :public ::std::binary_function < ::rtl::Reference< TemplateContent > + , ::rtl::Reference< TemplateContent > , bool > { //................................................................. - bool operator() (const ::vos::ORef< TemplateContent >& _rLHS, const ::vos::ORef< TemplateContent >& _rRHS ) + bool operator() (const ::rtl::Reference< TemplateContent >& _rLHS, const ::rtl::Reference< TemplateContent >& _rRHS ) { - if ( !_rLHS.isValid() || !_rRHS.isValid() ) + if ( !_rLHS.is() || !_rRHS.is() ) { - DBG_ERROR( "TemplateContentEqual::operator(): invalid contents!" ); + OSL_FAIL( "TemplateContentEqual::operator(): invalid contents!" ); return true; // this is not strictly true, in case only one is invalid - but this is a heavy error anyway } @@ -319,12 +320,12 @@ namespace svt //--------------------------------------------------------------------- /// functor which stores the local name of a TemplateContent struct StoreLocalContentName - :public ::std::unary_function< ::vos::ORef< TemplateContent >, void > + :public ::std::unary_function< ::rtl::Reference< TemplateContent >, void > ,public StoreString { StoreLocalContentName( SvStream& _rStorage ) : StoreString( _rStorage ) { } - void operator() ( const ::vos::ORef< TemplateContent >& _rxContent ) const + void operator() ( const ::rtl::Reference< TemplateContent >& _rxContent ) const { DBG_ERRORFILE( "This method must not be used, the whole URL must be stored!" ); @@ -335,7 +336,7 @@ namespace svt //--------------------------------------------------------------------- struct StoreContentURL - :public ::std::unary_function< ::vos::ORef< TemplateContent >, void > + :public ::std::unary_function< ::rtl::Reference< TemplateContent >, void > ,public StoreString { uno::Reference< util::XOfficeInstallationDirectories > m_xOfficeInstDirs; @@ -346,7 +347,7 @@ namespace svt xOfficeInstDirs ) : StoreString( _rStorage ), m_xOfficeInstDirs( xOfficeInstDirs ) { } - void operator() ( const ::vos::ORef< TemplateContent >& _rxContent ) const + void operator() ( const ::rtl::Reference< TemplateContent >& _rxContent ) const { // use the base class operator with the local name of the content String sURL = _rxContent->getURL(); @@ -360,7 +361,7 @@ namespace svt //--------------------------------------------------------------------- /// functor which stores the complete content of a TemplateContent struct StoreFolderContent - :public ::std::unary_function< ::vos::ORef< TemplateContent >, void > + :public ::std::unary_function< ::rtl::Reference< TemplateContent >, void > ,public StorageHelper { uno::Reference< util::XOfficeInstallationDirectories > m_xOfficeInstDirs; @@ -396,9 +397,9 @@ namespace svt } //................................................................. - void operator() ( const ::vos::ORef< TemplateContent >& _rxContent ) const + void operator() ( const ::rtl::Reference< TemplateContent >& _rxContent ) const { - if ( _rxContent.isValid() ) + if ( _rxContent.is() ) { operator()( *_rxContent ); } @@ -408,7 +409,7 @@ namespace svt //--------------------------------------------------------------------- /// functor which reads a complete TemplateContent instance struct ReadFolderContent - :public ::std::unary_function< ::vos::ORef< TemplateContent >, void > + :public ::std::unary_function< ::rtl::Reference< TemplateContent >, void > ,public StorageHelper { uno::Reference< util::XOfficeInstallationDirectories > m_xOfficeInstDirs; @@ -453,9 +454,9 @@ namespace svt } //................................................................. - void operator() ( const ::vos::ORef< TemplateContent >& _rxContent ) const + void operator() ( const ::rtl::Reference< TemplateContent >& _rxContent ) const { - if ( _rxContent.isValid() ) + if ( _rxContent.is() ) { operator()( *_rxContent ); } @@ -489,7 +490,6 @@ namespace svt void storeState( sal_Bool _bForceRetrieval ); private: - void initTemplDirs( ::std::vector< String >& _rRootDirs ); sal_Bool openCacheStream( sal_Bool _bForRead ); void closeCacheStream( ); @@ -500,7 +500,7 @@ namespace svt String implParseSmart( const String& _rPath ); - sal_Bool implReadFolder( const ::vos::ORef< TemplateContent >& _rxRoot ); + sal_Bool implReadFolder( const ::rtl::Reference< TemplateContent >& _rxRoot ); static String getCacheFileName(); static sal_Int32 getMagicNumber(); @@ -627,17 +627,17 @@ namespace svt } //--------------------------------------------------------------------- - sal_Bool TemplateFolderCacheImpl::implReadFolder( const ::vos::ORef< TemplateContent >& _rxRoot ) + sal_Bool TemplateFolderCacheImpl::implReadFolder( const ::rtl::Reference< TemplateContent >& _rxRoot ) { try { // create a content for the current folder root Reference< XResultSet > xResultSet; Sequence< ::rtl::OUString > aContentProperties( 4); - aContentProperties[0] = ::rtl::OUString::createFromAscii( "Title" ); - aContentProperties[1] = ::rtl::OUString::createFromAscii( "DateModified" ); - aContentProperties[2] = ::rtl::OUString::createFromAscii( "DateCreated" ); - aContentProperties[3] = ::rtl::OUString::createFromAscii( "IsFolder" ); + aContentProperties[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" )); + aContentProperties[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateModified" )); + aContentProperties[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateCreated" )); + aContentProperties[3] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFolder" )); // get the set of sub contents in the folder try @@ -669,7 +669,7 @@ namespace svt INetURLObject aSubContentURL( xContentAccess->queryContentIdentifierString() ); // a new content instance - ::vos::ORef< TemplateContent > xChild = new TemplateContent( aSubContentURL ); + ::rtl::Reference< TemplateContent > xChild = new TemplateContent( aSubContentURL ); // the modified date xChild->setModDate( xRow->getTimestamp( 2 ) ); // date modified @@ -691,7 +691,7 @@ namespace svt } catch( const Exception& ) { - DBG_ERROR( "TemplateFolderCacheImpl::implReadFolder: caught an exception!" ); + OSL_FAIL( "TemplateFolderCacheImpl::implReadFolder: caught an exception!" ); return sal_False; } return sal_True; @@ -791,7 +791,7 @@ namespace svt INetURLObject aStorageURL( sStorageURL ); if ( INET_PROT_NOT_VALID == aStorageURL.GetProtocol() ) { - DBG_ERROR( "TemplateFolderCacheImpl::openCacheStream: invalid storage path!" ); + OSL_FAIL( "TemplateFolderCacheImpl::openCacheStream: invalid storage path!" ); return sal_False; } @@ -841,11 +841,6 @@ namespace svt } //--------------------------------------------------------------------- - void TemplateFolderCacheImpl::initTemplDirs( ::std::vector< String >& ) - { - } - - //--------------------------------------------------------------------- uno::Reference< util::XOfficeInstallationDirectories > TemplateFolderCacheImpl::getOfficeInstDirs() { @@ -920,3 +915,4 @@ namespace svt } // namespace sfx2 //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index fcd519398c8e..4b24ed4330fd 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,20 +29,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #ifdef WNT -#include <tools/prewin.h> -#if defined _MSC_VER -#pragma warning(push, 1) -#pragma warning(disable: 4917) -#endif +#include <prewin.h> +#include <postwin.h> #include <shlobj.h> -#if defined _MSC_VER -#pragma warning(pop) -#endif -#include <tools/postwin.h> #endif -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <rtl/memory.h> -#include <rtl/uuid.h> #include <rtl/uri.hxx> #include <tools/debug.hxx> #include <tools/urlobj.hxx> @@ -55,6 +48,7 @@ #include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <sot/filelist.hxx> #include <cppuhelper/implbase1.hxx> @@ -154,20 +148,20 @@ const ::rtl::OUString aQuotedParamChars = ::rtl::OUString( RTL_CONSTASCII_USTRIN static ::rtl::OUString ImplGetParameterString( const TransferableObjectDescriptor& rObjDesc ) { - const ::rtl::OUString aChar( ::rtl::OUString::createFromAscii( "\"" ) ); + const ::rtl::OUString aChar( RTL_CONSTASCII_USTRINGPARAM( "\"" )); const ::rtl::OUString aClassName( rObjDesc.maClassName.GetHexName() ); ::rtl::OUString aParams; if( aClassName.getLength() ) { - aParams += ::rtl::OUString::createFromAscii( ";classname=\"" ); + aParams += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";classname=\"" )); aParams += aClassName; aParams += aChar; } if( rObjDesc.maTypeName.Len() ) { - aParams += ::rtl::OUString::createFromAscii( ";typename=\"" ); + aParams += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";typename=\"" )); aParams += rObjDesc.maTypeName; aParams += aChar; } @@ -187,28 +181,28 @@ static ::rtl::OUString ImplGetParameterString( const TransferableObjectDescripto pToAccept[nChar] = sal_True; } - aParams += ::rtl::OUString::createFromAscii( ";displayname=\"" ); + aParams += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";displayname=\"" )); aParams += ::rtl::Uri::encode( rObjDesc.maDisplayName, pToAccept, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ); aParams += aChar; } - aParams += ::rtl::OUString::createFromAscii( ";viewaspect=\"" ); + aParams += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";viewaspect=\"" )); aParams += ::rtl::OUString::valueOf( static_cast< sal_Int32 >( rObjDesc.mnViewAspect ) ); aParams += aChar; - aParams += ::rtl::OUString::createFromAscii( ";width=\"" ); + aParams += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";width=\"" )); aParams += ::rtl::OUString::valueOf( rObjDesc.maSize.Width() ); aParams += aChar; - aParams += ::rtl::OUString::createFromAscii( ";height=\"" ); + aParams += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";height=\"" )); aParams += ::rtl::OUString::valueOf( rObjDesc.maSize.Height() ); aParams += aChar; - aParams += ::rtl::OUString::createFromAscii( ";posx=\"" ); + aParams += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";posx=\"" )); aParams += ::rtl::OUString::valueOf( rObjDesc.maDragStartPos.X() ); aParams += aChar; - aParams += ::rtl::OUString::createFromAscii( ";posy=\"" ); + aParams += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";posy=\"" )); aParams += ::rtl::OUString::valueOf( rObjDesc.maDragStartPos.X() ); aParams += aChar; @@ -226,8 +220,7 @@ static void ImplSetParameterString( TransferableObjectDescriptor& rObjDesc, cons { if( xFact.is() ) { - xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString::createFromAscii( - "com.sun.star.datatransfer.MimeContentTypeFactory" ) ), + xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.datatransfer.MimeContentTypeFactory" )) ), UNO_QUERY ); } @@ -237,14 +230,14 @@ static void ImplSetParameterString( TransferableObjectDescriptor& rObjDesc, cons if( xMimeType.is() ) { - const ::rtl::OUString aClassNameString( ::rtl::OUString::createFromAscii( "classname" ) ); - const ::rtl::OUString aTypeNameString( ::rtl::OUString::createFromAscii( "typename" ) ); - const ::rtl::OUString aDisplayNameString( ::rtl::OUString::createFromAscii( "displayname" ) ); - const ::rtl::OUString aViewAspectString( ::rtl::OUString::createFromAscii( "viewaspect" ) ); - const ::rtl::OUString aWidthString( ::rtl::OUString::createFromAscii( "width" ) ); - const ::rtl::OUString aHeightString( ::rtl::OUString::createFromAscii( "height" ) ); - const ::rtl::OUString aPosXString( ::rtl::OUString::createFromAscii( "posx" ) ); - const ::rtl::OUString aPosYString( ::rtl::OUString::createFromAscii( "posy" ) ); + const ::rtl::OUString aClassNameString(RTL_CONSTASCII_USTRINGPARAM( "classname" )); + const ::rtl::OUString aTypeNameString(RTL_CONSTASCII_USTRINGPARAM( "typename" )); + const ::rtl::OUString aDisplayNameString(RTL_CONSTASCII_USTRINGPARAM( "displayname" )); + const ::rtl::OUString aViewAspectString(RTL_CONSTASCII_USTRINGPARAM( "viewaspect" )); + const ::rtl::OUString aWidthString(RTL_CONSTASCII_USTRINGPARAM( "width" )); + const ::rtl::OUString aHeightString(RTL_CONSTASCII_USTRINGPARAM( "height" )); + const ::rtl::OUString aPosXString(RTL_CONSTASCII_USTRINGPARAM( "posx" )); + const ::rtl::OUString aPosYString(RTL_CONSTASCII_USTRINGPARAM( "posy" )); if( xMimeType->hasParameter( aClassNameString ) ) { @@ -353,7 +346,7 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) th { if( !maAny.hasValue() || !mpFormats->size() || ( maLastFormat != rFlavor.MimeType ) ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; maLastFormat = rFlavor.MimeType; maAny = Any(); @@ -470,7 +463,7 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) th Sequence< DataFlavor > SAL_CALL TransferableHelper::getTransferDataFlavors() throw( RuntimeException ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; try { @@ -497,7 +490,7 @@ Sequence< DataFlavor > SAL_CALL TransferableHelper::getTransferDataFlavors() thr sal_Bool SAL_CALL TransferableHelper::isDataFlavorSupported( const DataFlavor& rFlavor ) throw( RuntimeException ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; sal_Bool bRet = sal_False; try @@ -529,7 +522,7 @@ sal_Bool SAL_CALL TransferableHelper::isDataFlavorSupported( const DataFlavor& r void SAL_CALL TransferableHelper::lostOwnership( const Reference< XClipboard >&, const Reference< XTransferable >& ) throw( RuntimeException ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; try { @@ -539,7 +532,7 @@ void SAL_CALL TransferableHelper::lostOwnership( const Reference< XClipboard >&, if( xFact.is() ) { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); + Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); if( xDesktop.is() ) xDesktop->removeTerminateListener( mxTerminateListener ); @@ -565,7 +558,7 @@ void SAL_CALL TransferableHelper::disposing( const EventObject& ) throw( Runtime void SAL_CALL TransferableHelper::dragDropEnd( const DragSourceDropEvent& rDSDE ) throw( RuntimeException ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; try { @@ -634,7 +627,7 @@ void TransferableHelper::ImplFlush() } catch( const ::com::sun::star::uno::Exception& ) { - DBG_ERROR( "Could not flush clipboard" ); + OSL_FAIL( "Could not flush clipboard" ); } Application::AcquireSolarMutex( nRef ); @@ -819,7 +812,7 @@ sal_Bool TransferableHelper::SetBitmap( const Bitmap& rBitmap, const DataFlavor& sal_Bool TransferableHelper::SetGDIMetaFile( const GDIMetaFile& rMtf, const DataFlavor& ) { - if( rMtf.GetActionCount() ) + if( rMtf.GetActionSize() ) { SvMemoryStream aMemStm( 65535, 65535 ); @@ -950,7 +943,7 @@ sal_Bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk, case SOT_FORMATSTR_ID_FILECONTENT: { - String aStr( RTL_CONSTASCII_STRINGPARAM( "[InternetShortcut]\x0aURL=" ) ); + String aStr( RTL_CONSTASCII_USTRINGPARAM( "[InternetShortcut]\x0aURL=" ) ); maAny <<= ::rtl::OUString( aStr += rBmk.GetURL() ); } break; @@ -1038,7 +1031,7 @@ sal_Bool TransferableHelper::SetInterface( const ::com::sun::star::uno::Referenc sal_Bool TransferableHelper::WriteObject( SotStorageStreamRef&, void*, sal_uInt32, const DataFlavor& ) { - DBG_ERROR( "TransferableHelper::WriteObject( ... ) not implemented" ); + OSL_FAIL( "TransferableHelper::WriteObject( ... ) not implemented" ); return sal_False; } @@ -1089,7 +1082,7 @@ void TransferableHelper::CopyToClipboard( Window *pWindow ) const if( xFact.is() ) { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); + Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); if( xDesktop.is() ) xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) ); @@ -1126,7 +1119,7 @@ void TransferableHelper::CopyToSelection( Window *pWindow ) const if( xFact.is() ) { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); + Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); if( xDesktop.is() ) xDesktop->addTerminateListener( pThis->mxTerminateListener = new TerminateListener( *pThis ) ); @@ -1214,23 +1207,14 @@ Reference< XClipboard> TransferableHelper::GetSystemClipboard() return Reference< XClipboard > (); } -// ----------------------------------------------------------------------------- +namespace +{ + class theTransferableHelperUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theTransferableHelperUnoTunnelId > {}; +} const Sequence< sal_Int8 >& TransferableHelper::getUnoTunnelId() { - static Sequence< sal_Int8 > aSeq; - - if( !aSeq.getLength() ) - { - static osl::Mutex aCreateMutex; - osl::Guard< osl::Mutex > aGuard( aCreateMutex ); - - aSeq.realloc( 16 ); - rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); - } - - - return aSeq; + return theTransferableHelperUnoTunnelId::get().getSeq(); } // --------------------------------- @@ -1286,7 +1270,7 @@ TransferableClipboardNotifier::TransferableClipboardNotifier( const Reference< X void SAL_CALL TransferableClipboardNotifier::changedContents( const clipboard::ClipboardEvent& event ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; // the SolarMutex here is necessary, since // - we cannot call mpListener without our own mutex locked // - Rebind respectively InitFormats (called by Rebind) will @@ -1415,11 +1399,10 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor Reference< XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); Reference< XMimeContentTypeFactory > xMimeFact; DataFlavorEx aFlavorEx; - const ::rtl::OUString aCharsetStr( ::rtl::OUString::createFromAscii( "charset" ) ); + const ::rtl::OUString aCharsetStr(RTL_CONSTASCII_USTRINGPARAM( "charset" )); if( xFact.is() ) - xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString::createFromAscii( - "com.sun.star.datatransfer.MimeContentTypeFactory" ) ), + xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.datatransfer.MimeContentTypeFactory" )) ), UNO_QUERY ); for( sal_Int32 i = 0; i < rDataFlavorSeq.getLength(); i++ ) @@ -1467,35 +1450,35 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor aFlavorEx.mnSotId = SOT_FORMATSTR_ID_HTML_NO_COMMENT; rDataFlavorExVector.push_back( aFlavorEx ); } - else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "text/plain" ) ) ) + else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/plain" )) ) ) { // add, if it is a UTF-8 byte buffer if( xMimeType->hasParameter( aCharsetStr ) ) { const ::rtl::OUString aCharset( xMimeType->getParameterValue( aCharsetStr ) ); - if( xMimeType->getParameterValue( aCharsetStr ).equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "unicode" ) ) || - xMimeType->getParameterValue( aCharsetStr ).equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "utf-16" ) ) ) + if( xMimeType->getParameterValue( aCharsetStr ).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unicode" )) ) || + xMimeType->getParameterValue( aCharsetStr ).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "utf-16" )) ) ) { rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = FORMAT_STRING; } } } - else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "text/rtf" ) ) ) + else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/rtf" )) ) ) { rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = FORMAT_RTF; } - else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "text/html" ) ) ) + else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/html" )) ) ) { rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SOT_FORMATSTR_ID_HTML; } - else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "text/uri-list" ) ) ) + else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/uri-list" )) ) ) { rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SOT_FORMAT_FILE_LIST; } - else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "application/x-openoffice-objectdescriptor-xml" ) ) ) + else if( xMimeType.is() && xMimeType->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-objectdescriptor-xml" )) ) ) { rDataFlavorExVector[ rDataFlavorExVector.size() - 1 ].mnSotId = SOT_FORMATSTR_ID_OBJECTDESCRIPTOR; } @@ -1510,7 +1493,7 @@ void TransferableDataHelper::FillDataFlavorExVector( const Sequence< DataFlavor void TransferableDataHelper::InitFormats() { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( mpImpl->maMutex ); mpFormats->clear(); @@ -2144,7 +2127,7 @@ sal_Bool TransferableDataHelper::GetFileList( if( GetSotStorageStream( aFlavor, xStm ) ) { - if( aFlavor.MimeType.indexOf( ::rtl::OUString::createFromAscii( "text/uri-list" ) ) > -1 ) + if( aFlavor.MimeType.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/uri-list" )) ) > -1 ) { ByteString aByteString; @@ -2286,28 +2269,27 @@ TransferableDataHelper TransferableDataHelper::CreateFromSystemClipboard( Window DBG_ASSERT( pWindow, "Window pointer is NULL" ); Reference< XClipboard > xClipboard; - TransferableDataHelper aRet; + TransferableDataHelper aRet; if( pWindow ) xClipboard = pWindow->GetClipboard(); if( xClipboard.is() ) - { - try - + { + try { Reference< XTransferable > xTransferable( xClipboard->getContents() ); if( xTransferable.is() ) { aRet = TransferableDataHelper( xTransferable ); - aRet.mxClipboard = xClipboard; - // also copy the clipboard - 99030 - 23.05.2002 - fs@openoffice.org + // also copy the clipboard + aRet.mxClipboard = xClipboard; } - } + } catch( const ::com::sun::star::uno::Exception& ) { - } + } } return aRet; @@ -2362,8 +2344,7 @@ sal_Bool TransferableDataHelper::IsEqual( const ::com::sun::star::datatransfer:: try { if( xFact.is() ) - xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString::createFromAscii( - "com.sun.star.datatransfer.MimeContentTypeFactory" ) ), + xMimeFact = Reference< XMimeContentTypeFactory >( xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.datatransfer.MimeContentTypeFactory" )) ), UNO_QUERY ); if( xMimeFact.is() ) @@ -2375,22 +2356,22 @@ sal_Bool TransferableDataHelper::IsEqual( const ::com::sun::star::datatransfer:: { if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( xRequestType2->getFullMediaType() ) ) { - if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "text/plain" ) ) ) + if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/plain" )) ) ) { // special handling for text/plain media types - const ::rtl::OUString aCharsetString( ::rtl::OUString::createFromAscii( "charset" ) ); + const ::rtl::OUString aCharsetString(RTL_CONSTASCII_USTRINGPARAM( "charset" )); if( !xRequestType2->hasParameter( aCharsetString ) || - xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "utf-16" ) ) || - xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "unicode" ) ) ) + xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "utf-16" )) ) || + xRequestType2->getParameterValue( aCharsetString ).equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unicode" )) ) ) { bRet = sal_True; } } - else if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString::createFromAscii( "application/x-openoffice" ) ) ) + else if( xRequestType1->getFullMediaType().equalsIgnoreAsciiCase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice" )) ) ) { // special handling for application/x-openoffice media types - const ::rtl::OUString aFormatString( ::rtl::OUString::createFromAscii( "windows_formatname" ) ); + const ::rtl::OUString aFormatString(RTL_CONSTASCII_USTRINGPARAM( "windows_formatname" )); if( xRequestType1->hasParameter( aFormatString ) && xRequestType2->hasParameter( aFormatString ) && @@ -2412,3 +2393,5 @@ sal_Bool TransferableDataHelper::IsEqual( const ::com::sun::star::datatransfer:: return bRet; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 841ac4d38135..5e4fa8e56077 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <tools/debug.hxx> #include <tools/urlobj.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -81,7 +82,7 @@ void SAL_CALL DragSourceHelper::DragGestureListener::disposing( const EventObjec void SAL_CALL DragSourceHelper::DragGestureListener::dragGestureRecognized( const DragGestureEvent& rDGE ) throw( RuntimeException ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; const Point aPtPixel( rDGE.DragOriginX, rDGE.DragOriginY ); mrParent.StartDrag( rDGE.DragAction, aPtPixel ); @@ -142,7 +143,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::disposing( const EventObject void SAL_CALL DropTargetHelper::DropTargetListener::drop( const DropTargetDropEvent& rDTDE ) throw( RuntimeException ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; try { @@ -193,7 +194,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::drop( const DropTargetDropEv void SAL_CALL DropTargetHelper::DropTargetListener::dragEnter( const DropTargetDragEnterEvent& rDTDEE ) throw( RuntimeException ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; try { @@ -210,7 +211,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragEnter( const DropTargetD void SAL_CALL DropTargetHelper::DropTargetListener::dragOver( const DropTargetDragEvent& rDTDE ) throw( RuntimeException ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; try { @@ -236,7 +237,7 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragOver( const DropTargetDr void SAL_CALL DropTargetHelper::DropTargetListener::dragExit( const DropTargetEvent& ) throw( RuntimeException ) { - const ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SolarMutexGuard aGuard; try { @@ -626,3 +627,5 @@ void TransferDataContainer::DragFinished( sal_Int8 nDropAction ) if( pImpl->aFinshedLnk.IsSet() ) pImpl->aFinshedLnk.Call( &nDropAction ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/undo.src b/svtools/source/misc/undo.src index 6f341741b112..33c179a65032 100644 --- a/svtools/source/misc/undo.src +++ b/svtools/source/misc/undo.src @@ -40,5 +40,4 @@ String STR_REDO String STR_REPEAT { Text [ en-US ] = "~Repeat: " ; -}; - +};
\ No newline at end of file diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index fa92a6ecb0be..17adaeaecd81 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -6,9 +7,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dlgutil.cxx,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -63,6 +61,9 @@ void SetFieldUnit( MetricField& rField, FieldUnit eUnit, sal_Bool bAll ) rField.SetUnit( eUnit ); switch( eUnit ) { + // _CHAR and _LINE sets the step of "char" and "line" unit, they are same as FUNIT_MM + case FUNIT_CHAR: + case FUNIT_LINE: case FUNIT_MM: rField.SetSpinSize( 50 ); break; @@ -761,3 +762,4 @@ long TransformMetric( long nVal, FieldUnit aOld, FieldUnit aNew ) return ConvertTable[nOld][nNew]( nVal ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/wallitem.cxx b/svtools/source/misc/wallitem.cxx index 859958cea41c..b9d0300a140c 100644 --- a/svtools/source/misc/wallitem.cxx +++ b/svtools/source/misc/wallitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -63,3 +64,4 @@ void SfxBrushItemLink::Set( SfxBrushItemLink* pLink ) delete pLink; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/xwindowitem.cxx b/svtools/source/misc/xwindowitem.cxx index 3f499dca0a96..eea3f65577aa 100644 --- a/svtools/source/misc/xwindowitem.cxx +++ b/svtools/source/misc/xwindowitem.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -95,3 +96,4 @@ int XWindowItem::operator == ( const SfxPoolItem & rAttr ) const ////////////////////////////////////////////////////////////////////// +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/plugapp/testtool.src b/svtools/source/plugapp/testtool.src index e456200943f6..27f89221e0ba 100644 --- a/svtools/source/plugapp/testtool.src +++ b/svtools/source/plugapp/testtool.src @@ -40,16 +40,9 @@ ToolBox DisplayHidToolBox { ToolBoxItem { Type = TOOLBOXITEM_BUTTON; _ToolBoxItemFlags = TIB_AUTOCHECK ; - -/* -class FlagToolBoxState -{ - TIB_CHECKABLE, TIB_AUTOCHECK, TIB_RADIOCHECK, TIB_LEFT, - TIB_AUTOSIZE, TIB_DROPDOWN, -};*/ Identifier = TT_SHOW; ItemBitmap = Bitmap { - File = "ttshow.bmp"; + File = "ttshow.png"; }; Text[ en-US ] = "Display IDs"; }; @@ -67,7 +60,7 @@ class FlagToolBoxState ToolBoxItem { Identifier = TT_SEND_DATA; ItemBitmap = Bitmap { - File = "ttremote.bmp"; + File = "ttremote.png"; }; Text[ en-US ] = "Transfer to TestTool"; }; @@ -77,21 +70,21 @@ class FlagToolBoxState ToolBoxItem { Identifier = TT_ALLWIN; ItemBitmap = Bitmap { - File = "ttall.bmp"; + File = "ttall.png"; }; Text[ en-US ] = "Show all windows"; }; ToolBoxItem { Identifier = TT_KURZNAME; ItemBitmap = Bitmap { - File = "ttdef.bmp"; + File = "ttdef.png"; }; Text[ en-US ] = "Show short names (if available)"; }; ToolBoxItem { Identifier = TT_LANGNAME; ItemBitmap = Bitmap { - File = "tthid.bmp"; + File = "tthid.png"; }; Text[ en-US ] = "Always show long-name"; }; @@ -100,7 +93,7 @@ class FlagToolBoxState }; Bitmap TT_SHOW2 { - File = "ttshow2.bmp"; + File = "ttshow2.png"; }; WorkWindow TT_INLINE_TRANSLATION { @@ -112,66 +105,66 @@ WorkWindow TT_INLINE_TRANSLATION { Closeable = TRUE; Border = TRUE; GroupBox TT_GB_TRANSLATION { - Pos = MAP_APPFONT( 2, 3 ); - Size = MAP_APPFONT( 173, 44 ); + Pos = MAP_APPFONT( 2, 3 ); + Size = MAP_APPFONT( 173, 44 ); Text[ en-US ] = "Translation"; }; Edit TT_E_NEW { HelpID = "svtools:Edit:TT_INLINE_TRANSLATION:TT_E_NEW"; - Disable = TRUE; - Border = TRUE; - Pos = MAP_APPFONT( 7, 16 ); - Size = MAP_APPFONT( 162, 12 ); - TabStop = TRUE; + Disable = TRUE; + Border = TRUE; + Pos = MAP_APPFONT( 7, 16 ); + Size = MAP_APPFONT( 162, 12 ); + TabStop = TRUE; Text[ en-US ] = "~Edit"; }; FixedText TT_FT_OLD { - Pos = MAP_APPFONT( 7, 33 ); - Size = MAP_APPFONT( 162, 10 ); + Pos = MAP_APPFONT( 7, 33 ); + Size = MAP_APPFONT( 162, 10 ); Text[ en-US ] = "Original Text"; }; GroupBox TT_GB_COMMENT { - Pos = MAP_APPFONT( 2, 52 ); - Size = MAP_APPFONT( 173, 32 ); + Pos = MAP_APPFONT( 2, 52 ); + Size = MAP_APPFONT( 173, 32 ); Text[ en-US ] = "Comment"; }; Edit TT_E_COMMENT { HelpID = "svtools:Edit:TT_INLINE_TRANSLATION:TT_E_COMMENT"; - Disable = TRUE; - Border = TRUE; - Pos = MAP_APPFONT( 7, 64 ); - Size = MAP_APPFONT( 162, 12 ); - TabStop = TRUE; + Disable = TRUE; + Border = TRUE; + Pos = MAP_APPFONT( 7, 64 ); + Size = MAP_APPFONT( 162, 12 ); + TabStop = TRUE; Text[ en-US ] = "~Comment"; }; PushButton TT_PB_SELECT { HelpID = "svtools:PushButton:TT_INLINE_TRANSLATION:TT_PB_SELECT"; - Pos = MAP_APPFONT( Control_Border, 89 ); - Size = MAP_APPFONT( ButtonWidth, 12 ); - TabStop = TRUE; + Pos = MAP_APPFONT( Control_Border, 89 ); + Size = MAP_APPFONT( ButtonWidth, 12 ); + TabStop = TRUE; Text[ en-US ] = "~Select"; }; PushButton TT_PB_RESTORE { HelpID = "svtools:PushButton:TT_INLINE_TRANSLATION:TT_PB_RESTORE"; - Disable = TRUE; - Pos = MAP_APPFONT( Control_Border + ButtonWidth + Button_Button, 89 ); - Size = MAP_APPFONT( ButtonWidth, 12 ); - TabStop = TRUE; + Disable = TRUE; + Pos = MAP_APPFONT( Control_Border + ButtonWidth + Button_Button, 89 ); + Size = MAP_APPFONT( ButtonWidth, 12 ); + TabStop = TRUE; Text[ en-US ] = "~Restore"; }; PushButton TT_PB_ACCEPT { HelpID = "svtools:PushButton:TT_INLINE_TRANSLATION:TT_PB_ACCEPT"; - Disable = TRUE; - Pos = MAP_APPFONT( Control_Border + 2*(ButtonWidth + Button_Button), 89 ); - Size = MAP_APPFONT( ButtonWidth, 12 ); - TabStop = TRUE; + Disable = TRUE; + Pos = MAP_APPFONT( Control_Border + 2*(ButtonWidth + Button_Button), 89 ); + Size = MAP_APPFONT( ButtonWidth, 12 ); + TabStop = TRUE; Text[ en-US ] = "~Accept"; }; PushButton TT_PB_NEXT { HelpID = "svtools:PushButton:TT_INLINE_TRANSLATION:TT_PB_NEXT"; - Pos = MAP_APPFONT( Control_Border + 3*(ButtonWidth + Button_Button), 89 ); - Size = MAP_APPFONT( ButtonWidth, 12 ); - TabStop = TRUE; + Pos = MAP_APPFONT( Control_Border + 3*(ButtonWidth + Button_Button), 89 ); + Size = MAP_APPFONT( ButtonWidth, 12 ); + TabStop = TRUE; Text[ en-US ] = "~Next"; }; Text[ en-US ] = "Inplace Translation"; diff --git a/svtools/source/plugapp/ttprops.cxx b/svtools/source/plugapp/ttprops.cxx index d80f643cff71..3c6be8fac141 100644 --- a/svtools/source/plugapp/ttprops.cxx +++ b/svtools/source/plugapp/ttprops.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -77,3 +78,4 @@ SvtResId TTProperties::GetSvtResId( sal_uInt16 nId ) return SvtResId( nId ); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index cb3a9b7a7702..a4251652aac2 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -31,9 +32,7 @@ #include "productregistration.hxx" #include "unotools/regoptions.hxx" #include "registrationdlg.hxx" -#ifndef _SVTOOLS_HRC #include <svtools/svtools.hrc> -#endif #include "cppuhelper/factory.hxx" #include <cppuhelper/implbase1.hxx> #include <com/sun/star/lang/XInitialization.hpp> @@ -105,14 +104,14 @@ namespace svt //-------------------------------------------------------------------- OUString SAL_CALL OProductRegistration::getImplementationName_Static( ) { - return OUString::createFromAscii( PRODREG_IMPLNAME ); + return OUString(RTL_CONSTASCII_USTRINGPARAM( PRODREG_IMPLNAME )); } //-------------------------------------------------------------------- Sequence< OUString > SAL_CALL OProductRegistration::getSupportedServiceNames_Static( ) throw (RuntimeException) { Sequence< OUString > aServiceNames( 1 ); - aServiceNames[ 0 ] = OUString::createFromAscii( PRODREG_SERVNAME ); + aServiceNames[ 0 ] = OUString(RTL_CONSTASCII_USTRINGPARAM( PRODREG_SERVNAME )); return aServiceNames; } @@ -164,7 +163,7 @@ namespace svt } catch(const Exception& ) { - OSL_ENSURE( sal_False, "lcl_getActiveFrame: caught an exception!" ); + OSL_FAIL( "lcl_getActiveFrame: caught an exception!" ); return Reference< XFrame >(); } } @@ -185,7 +184,7 @@ namespace svt } catch( const Exception& ) { - OSL_ENSURE( sal_False, "lcl_getPreferredDialogParent: caught an exception!" ); + OSL_FAIL( "lcl_getPreferredDialogParent: caught an exception!" ); } return pReturn; @@ -217,7 +216,7 @@ namespace svt } catch( const Exception& ) { - OSL_ENSURE( false, "lcl_isEvalVersion: caught an exception!" ); + OSL_FAIL( "lcl_isEvalVersion: caught an exception!" ); } return bIsEvaluationVersion; @@ -267,7 +266,7 @@ namespace svt } catch( const Exception& ) { - OSL_ENSURE( false, "lcl_getOnlineRegistrationDispatch: caught an exception!" ); + OSL_FAIL( "lcl_getOnlineRegistrationDispatch: caught an exception!" ); return false; } } @@ -334,7 +333,6 @@ namespace svt // thus, there is no help during the lifetime of the dialog. // To fake this, we explicitly load the necessary services when the user // really requests help herein. - // #110791# - 2003-06-11 - fs@openoffice.org Reference < XInitialization > xOfficeWrapper( m_xORB->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.OfficeWrapper" ) ) @@ -377,7 +375,7 @@ namespace svt break; default: - OSL_ENSURE( sal_False, "OProductRegistration::execute: invalid response from the dialog!" ); + OSL_FAIL( "OProductRegistration::execute: invalid response from the dialog!" ); } // prefer new style registration @@ -387,7 +385,7 @@ namespace svt } Sequence< NamedValue > aJobResponse( 1 ); - aJobResponse[0].Name = OUString::createFromAscii( "Deactivate" ); + aJobResponse[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Deactivate" )); aJobResponse[0].Value <<= bDeactivateJob; aReturn <<= aJobResponse; } @@ -403,7 +401,7 @@ namespace svt { // create the Desktop component which can load components Reference< XSystemShellExecute > xSystemShell( - m_xORB->createInstance( OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" ) ), + m_xORB->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" )) ), UNO_QUERY ); OSL_ENSURE( xSystemShell.is(), "OProductRegistration::doOnlineRegistration: invalid SystemExecute component!" ); @@ -442,7 +440,7 @@ namespace svt OProductRegistration::EventType OProductRegistration::classify( const OUString& _rEventDesc ) { EventType eReturn = etUnknown; - if ( _rEventDesc.equalsAscii( "RegistrationRequired" ) ) + if ( _rEventDesc.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("RegistrationRequired")) ) { eReturn = etRegistrationRequired; } @@ -486,3 +484,5 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( } } // extern "C" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/productregistration/productregistration.hxx b/svtools/source/productregistration/productregistration.hxx index efaa624887b0..edebe0cc9ba1 100644 --- a/svtools/source/productregistration/productregistration.hxx +++ b/svtools/source/productregistration/productregistration.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -98,3 +99,4 @@ namespace svt #endif // SVTOOLS_PRODUCTREGISTRATION_HXX +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx index 7cface187915..f2bc90416313 100644 --- a/svtools/source/productregistration/registrationdlg.cxx +++ b/svtools/source/productregistration/registrationdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,16 +30,7 @@ #include "precompiled_svtools.hxx" #include "registrationdlg.hxx" -#if 0 /* @@@ */ -#include <svtools/svtdata.hxx> -#ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> -#endif -#endif /* @@@ */ - -#ifndef SVTOOLS_REGISTRATIONDLG_HRC #include "registrationdlg.hrc" -#endif #include <vcl/msgbox.hxx> #include <tools/debug.hxx> @@ -141,7 +133,7 @@ namespace svt #ifdef DBG_UTIL else { - DBG_ERROR( "RegistrationDialog::Execute: invalid dialog state!" ); + OSL_FAIL( "RegistrationDialog::Execute: invalid dialog state!" ); } #endif } @@ -169,3 +161,4 @@ namespace svt //........................................................................ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/productregistration/registrationdlg.hxx b/svtools/source/productregistration/registrationdlg.hxx index 16761aff08fc..48126d63efae 100644 --- a/svtools/source/productregistration/registrationdlg.hxx +++ b/svtools/source/productregistration/registrationdlg.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -29,9 +30,7 @@ #define SVTOOLS_REGISTRATIONDLG_HXX #include <vcl/fixed.hxx> -#ifndef _SV_BUTTON_HXX #include <vcl/button.hxx> -#endif #include <vcl/dialog.hxx> //........................................................................ @@ -85,3 +84,5 @@ namespace svt //........................................................................ #endif // SVTOOLS_REGISTRATIONDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/productregistration/registrationdlg.src b/svtools/source/productregistration/registrationdlg.src index 64f1063f1ba3..01127b44227c 100644 --- a/svtools/source/productregistration/registrationdlg.src +++ b/svtools/source/productregistration/registrationdlg.src @@ -25,15 +25,9 @@ * ************************************************************************/ -#ifndef SVTOOLS_REGISTRATIONDLG_HRC #include "registrationdlg.hrc" -#endif -#ifndef _SVTOOLS_HRC #include <svtools/svtools.hrc> -#endif -#ifndef _SVT_HELPID_HRC #include <svtools/helpid.hrc> -#endif ModalDialog DLG_REGISTRATION_REQUEST { @@ -52,7 +46,7 @@ ModalDialog DLG_REGISTRATION_REQUEST { ImageBitmap = Bitmap { - File = "regkey.bmp" ; + File = "regkey.png" ; }; MaskColor = Color { Red = 0x0000 ; Green = 0x0000 ; Blue = 0xFFFF ; }; }; diff --git a/svtools/source/svhtml/htmlkywd.cxx b/svtools/source/svhtml/htmlkywd.cxx index 2c949c1a6c4e..0565b52f9f4c 100644 --- a/svtools/source/svhtml/htmlkywd.cxx +++ b/svtools/source/svhtml/htmlkywd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,16 +29,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <ctype.h> -#include <stdlib.h> -#include <string.h> -#include <limits.h> - -#include <svtools/svparser.hxx> -#include <svtools/htmlkywd.hxx> +#include <limits.h> // for USHRT_MAX +#include <sal/types.h> // for sal_Char, sal_Unicode, etc +#include <stdlib.h> // for bsearch, qsort +#include <string.h> // for strcmp #include <svtools/htmltokn.h> +#include <tools/solar.h> // for String +#include <svtools/htmlkywd.hxx> +#include <tools/string.hxx> // for String::CompareToAscii, etc -// die Tabelle muss noch sortiert werden +// Table has still to be sorted struct HTML_TokenEntry { union @@ -48,10 +49,10 @@ struct HTML_TokenEntry int nToken; }; -// Flag: RTF-Token Tabelle wurde schon sortiert -static int __FAR_DATA bSortKeyWords = sal_False; +// Flag: RTF token table has already been sorted +static bool bSortKeyWords = false; -static HTML_TokenEntry __FAR_DATA aHTMLTokenTab[] = { +static HTML_TokenEntry aHTMLTokenTab[] = { {{OOO_STRING_SVTOOLS_HTML_area}, HTML_AREA}, // Netscape 2.0 {{OOO_STRING_SVTOOLS_HTML_base}, HTML_BASE}, // HTML 3.0 {{OOO_STRING_SVTOOLS_HTML_comment}, HTML_COMMENT}, @@ -202,14 +203,7 @@ static HTML_TokenEntry __FAR_DATA aHTMLTokenTab[] = { extern "C" { -static int -#if defined( WNT ) - __cdecl -#endif -#if defined( ICC ) && defined( OS2 ) - _Optlink -#endif - HTMLKeyCompare( const void *pFirst, const void *pSecond) +static int SAL_CALL HTMLKeyCompare( const void *pFirst, const void *pSecond) { int nRet = 0; if( -1 == ((HTML_TokenEntry*)pFirst)->nToken ) @@ -244,7 +238,7 @@ int GetHTMLToken( const String& rName ) sizeof( aHTMLTokenTab ) / sizeof( HTML_TokenEntry ), sizeof( HTML_TokenEntry ), HTMLKeyCompare ); - bSortKeyWords = sal_True; + bSortKeyWords = true; } int nRet = 0; @@ -266,8 +260,6 @@ int GetHTMLToken( const String& rName ) return nRet; } -/**/ - struct HTML_CharEntry { union @@ -278,10 +270,10 @@ struct HTML_CharEntry sal_Unicode cChar; }; -// Flag: RTF-Token Tabelle wurde schon sortiert -static int __FAR_DATA bSortCharKeyWords = sal_False; +// Flag: RTF token table has already been sorted +static bool bSortCharKeyWords = false; -static HTML_CharEntry __FAR_DATA aHTMLCharNameTab[] = { +static HTML_CharEntry aHTMLCharNameTab[] = { {{OOO_STRING_SVTOOLS_HTML_C_lt}, 60}, {{OOO_STRING_SVTOOLS_HTML_C_gt}, 62}, {{OOO_STRING_SVTOOLS_HTML_C_amp}, 38}, @@ -352,7 +344,7 @@ static HTML_CharEntry __FAR_DATA aHTMLCharNameTab[] = { {{OOO_STRING_SVTOOLS_HTML_S_thorn}, 254}, {{OOO_STRING_SVTOOLS_HTML_S_yuml}, 255}, -// Sonderzeichen +// special characters {{OOO_STRING_SVTOOLS_HTML_S_acute}, 180}, {{OOO_STRING_SVTOOLS_HTML_S_brvbar}, 166}, {{OOO_STRING_SVTOOLS_HTML_S_cedil}, 184}, @@ -386,7 +378,7 @@ static HTML_CharEntry __FAR_DATA aHTMLCharNameTab[] = { {{OOO_STRING_SVTOOLS_HTML_S_uml}, 168}, {{OOO_STRING_SVTOOLS_HTML_S_yen}, 165}, -// Netscape kennt noch ein paar in Grossbuchstaben ... +// Netscape has some in upper case... {{OOO_STRING_SVTOOLS_HTML_C_LT}, 60}, {{OOO_STRING_SVTOOLS_HTML_C_GT}, 62}, {{OOO_STRING_SVTOOLS_HTML_C_AMP}, 38}, @@ -394,7 +386,7 @@ static HTML_CharEntry __FAR_DATA aHTMLCharNameTab[] = { {{OOO_STRING_SVTOOLS_HTML_S_COPY}, 169}, {{OOO_STRING_SVTOOLS_HTML_S_REG}, 174}, -// Sonderzeichen, die zu Tokens konvertiert werden !!! +// special characters, which will be converted to tokens !!! {{OOO_STRING_SVTOOLS_HTML_S_nbsp}, 1}, {{OOO_STRING_SVTOOLS_HTML_S_shy}, 2}, @@ -557,14 +549,7 @@ static HTML_CharEntry __FAR_DATA aHTMLCharNameTab[] = { extern "C" { -static int -#if defined( WNT ) - __cdecl -#endif -#if defined( ICC ) && defined( OS2 ) - _Optlink -#endif - HTMLCharNameCompare( const void *pFirst, const void *pSecond) +static int SAL_CALL HTMLCharNameCompare( const void *pFirst, const void *pSecond) { int nRet = 0; if( USHRT_MAX == ((HTML_CharEntry*)pFirst)->cChar ) @@ -599,7 +584,7 @@ sal_Unicode GetHTMLCharName( const String& rName ) sizeof( aHTMLCharNameTab ) / sizeof( HTML_CharEntry ), sizeof( HTML_CharEntry ), HTMLCharNameCompare ); - bSortCharKeyWords = sal_True; + bSortCharKeyWords = true; } sal_Unicode cRet = 0; @@ -617,14 +602,12 @@ sal_Unicode GetHTMLCharName( const String& rName ) return cRet; } -/**/ - -// Flag: Optionen-Tabelle wurde schon sortiert -static int __FAR_DATA bSortOptionKeyWords = sal_False; +// Flag: Options table has already been sorted +static bool bSortOptionKeyWords = false; -static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = { +static HTML_TokenEntry aHTMLOptionTab[] = { -// Attribute ohne Wert +// Attributes without value {{OOO_STRING_SVTOOLS_HTML_O_box}, HTML_O_BOX}, {{OOO_STRING_SVTOOLS_HTML_O_checked}, HTML_O_CHECKED}, {{OOO_STRING_SVTOOLS_HTML_O_compact}, HTML_O_COMPACT}, @@ -646,7 +629,7 @@ static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = { {{OOO_STRING_SVTOOLS_HTML_O_selected}, HTML_O_SELECTED}, {{OOO_STRING_SVTOOLS_HTML_O_shapes}, HTML_O_SHAPES}, -// Attribute mit einem String als Wert +// Attributes with a string value {{OOO_STRING_SVTOOLS_HTML_O_above}, HTML_O_ABOVE}, {{OOO_STRING_SVTOOLS_HTML_O_accept}, HTML_O_ACCEPT}, {{OOO_STRING_SVTOOLS_HTML_O_accesskey}, HTML_O_ACCESSKEY}, @@ -687,14 +670,14 @@ static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = { {{OOO_STRING_SVTOOLS_HTML_O_sdlibrary}, HTML_O_SDLIBRARY}, {{OOO_STRING_SVTOOLS_HTML_O_sdmodule}, HTML_O_SDMODULE}, -// Attribute mit einem SGML-Identifier als Wert +// Attributes with a SGML identifier value {{OOO_STRING_SVTOOLS_HTML_O_from}, HTML_O_FROM}, {{OOO_STRING_SVTOOLS_HTML_O_id}, HTML_O_ID}, {{OOO_STRING_SVTOOLS_HTML_O_target}, HTML_O_TARGET}, // Netscape 2.0 {{OOO_STRING_SVTOOLS_HTML_O_to}, HTML_O_TO}, {{OOO_STRING_SVTOOLS_HTML_O_until}, HTML_O_UNTIL}, -// Attribute mit einem URI als Wert +// Attributes with an URI value {{OOO_STRING_SVTOOLS_HTML_O_action}, HTML_O_ACTION}, {{OOO_STRING_SVTOOLS_HTML_O_archive}, HTML_O_ARCHIVE}, {{OOO_STRING_SVTOOLS_HTML_O_background}, HTML_O_BACKGROUND}, @@ -710,11 +693,11 @@ static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = { {{OOO_STRING_SVTOOLS_HTML_O_src}, HTML_O_SRC}, {{OOO_STRING_SVTOOLS_HTML_O_usemap}, HTML_O_USEMAP}, // Netscape 2.0 -// Attribute mit Entity-Namen als Wert +// Attributes with entity name value {{OOO_STRING_SVTOOLS_HTML_O_dingbat}, HTML_O_DINGBAT}, {{OOO_STRING_SVTOOLS_HTML_O_sym}, HTML_O_SYM}, -// Attribute mit einer Farbe als Wert (alle Netscape) +// Attributes with a color value (all Netscape versions) {{OOO_STRING_SVTOOLS_HTML_O_alink}, HTML_O_ALINK}, {{OOO_STRING_SVTOOLS_HTML_O_bgcolor}, HTML_O_BGCOLOR}, {{OOO_STRING_SVTOOLS_HTML_O_bordercolor}, HTML_O_BORDERCOLOR}, // IExplorer 2.0 @@ -725,7 +708,7 @@ static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = { {{OOO_STRING_SVTOOLS_HTML_O_text}, HTML_O_TEXT}, {{OOO_STRING_SVTOOLS_HTML_O_vlink}, HTML_O_VLINK}, -// Attribute mit einem numerischen Wert +// Attributes with a numerical value {{OOO_STRING_SVTOOLS_HTML_O_border}, HTML_O_BORDER}, {{OOO_STRING_SVTOOLS_HTML_O_cellspacing},HTML_O_CELLSPACING}, // HTML 3 Table Model Draft {{OOO_STRING_SVTOOLS_HTML_O_cellpadding},HTML_O_CELLPADDING}, // HTML 3 Table Model Draft @@ -763,7 +746,7 @@ static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = { {{OOO_STRING_SVTOOLS_HTML_O_y}, HTML_O_Y}, {{OOO_STRING_SVTOOLS_HTML_O_zindex}, HTML_O_ZINDEX}, -// Attribute mit Enum-Werten +// Attributes with enum values {{OOO_STRING_SVTOOLS_HTML_O_bgproperties}, HTML_O_BGPROPERTIES}, // IExplorer 2.0 {{OOO_STRING_SVTOOLS_HTML_O_behavior}, HTML_O_BEHAVIOR}, // IExplorer 2.0 {{OOO_STRING_SVTOOLS_HTML_O_clear}, HTML_O_CLEAR}, @@ -786,7 +769,7 @@ static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = { {{OOO_STRING_SVTOOLS_HTML_O_wrap}, HTML_O_WRAP}, {{OOO_STRING_SVTOOLS_HTML_O_visibility}, HTML_O_VISIBILITY}, -// Attribute mit Script-Code als Wert +// Attributes with script code value {{OOO_STRING_SVTOOLS_HTML_O_onblur}, HTML_O_ONBLUR}, // JavaScript {{OOO_STRING_SVTOOLS_HTML_O_onchange}, HTML_O_ONCHANGE}, // JavaScript {{OOO_STRING_SVTOOLS_HTML_O_onclick}, HTML_O_ONCLICK}, // JavaScript @@ -815,7 +798,7 @@ static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = { {{OOO_STRING_SVTOOLS_HTML_O_SDonerror}, HTML_O_SDONERROR}, // StarBasic {{OOO_STRING_SVTOOLS_HTML_O_SDonmouseout}, HTML_O_SDONMOUSEOUT}, // StarBasic -// Attribute mit Kontext-abhaengigen Werten +// Attributes with context sensitive values {{OOO_STRING_SVTOOLS_HTML_O_align}, HTML_O_ALIGN}, {{OOO_STRING_SVTOOLS_HTML_O_cols}, HTML_O_COLS}, // Netscape 2.0 vs HTML 2.0 {{OOO_STRING_SVTOOLS_HTML_O_rows}, HTML_O_ROWS}, // Netscape 2.0 vs HTML 2.0 @@ -832,7 +815,7 @@ int GetHTMLOption( const String& rName ) sizeof( aHTMLOptionTab ) / sizeof( HTML_TokenEntry ), sizeof( HTML_TokenEntry ), HTMLKeyCompare ); - bSortOptionKeyWords = sal_True; + bSortOptionKeyWords = true; } int nRet = HTML_O_UNKNOWN; @@ -850,9 +833,7 @@ int GetHTMLOption( const String& rName ) return nRet; } -/**/ -// Flag: Farb-Tabelle wurde schon sortiert struct HTML_ColorEntry { union @@ -860,19 +841,18 @@ struct HTML_ColorEntry const sal_Char* sName; const String *pUName; }; - sal_uLong nColor; + sal_uInt32 nColor; }; -static int __FAR_DATA bSortColorKeyWords = sal_False; +// Flag: color table has already been sorted +static bool bSortColorKeyWords = false; #define HTML_NO_COLOR 0xffffffffUL -// die Farbnamen werden nicht exportiert -// Sie stammen aus "http://www.uio.no/~mnbjerke/colors_w.html" -// und scheinen im Gegensatz zu denen aus -// "http://www.infi.net/wwwimages/colorindex.html" -// zu stimmen -static HTML_ColorEntry __FAR_DATA aHTMLColorNameTab[] = { +// Color names are not exported (source: +// "http://www.uio.no/~mnbjerke/colors_w.html") +// "http://www.infi.net/wwwimages/colorindex.html" seem to be buggy. +static HTML_ColorEntry aHTMLColorNameTab[] = { { { "ALICEBLUE" }, 0x00f0f8ffUL }, { { "ANTIQUEWHITE" }, 0x00faebd7UL }, { { "AQUA" }, 0x0000ffffUL }, @@ -1018,14 +998,7 @@ static HTML_ColorEntry __FAR_DATA aHTMLColorNameTab[] = { extern "C" { -static int -#if defined( WNT ) - __cdecl -#endif -#if defined( ICC ) && defined( OS2 ) - _Optlink -#endif - HTMLColorNameCompare( const void *pFirst, const void *pSecond) +static int SAL_CALL HTMLColorNameCompare( const void *pFirst, const void *pSecond) { int nRet = 0; if( HTML_NO_COLOR == ((HTML_ColorEntry*)pFirst)->nColor ) @@ -1052,7 +1025,7 @@ static int } -sal_uLong GetHTMLColor( const String& rName ) +sal_uInt32 GetHTMLColor( const String& rName ) { if( !bSortColorKeyWords ) { @@ -1060,10 +1033,10 @@ sal_uLong GetHTMLColor( const String& rName ) sizeof( aHTMLColorNameTab ) / sizeof( HTML_ColorEntry ), sizeof( HTML_ColorEntry ), HTMLColorNameCompare ); - bSortColorKeyWords = sal_True; + bSortColorKeyWords = true; } - sal_uLong nRet = ULONG_MAX; + sal_uInt32 nRet = HTML_NO_COLOR; void* pFound; HTML_ColorEntry aSrch; aSrch.pUName = &rName; @@ -1079,3 +1052,4 @@ sal_uLong GetHTMLColor( const String& rName ) return nRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 6fa096937e7b..31e60e1ab1a1 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -50,7 +51,7 @@ #if defined(UNX) const sal_Char HTMLOutFuncs::sNewLine = '\012'; #else -const sal_Char __FAR_DATA HTMLOutFuncs::sNewLine[] = "\015\012"; +const sal_Char HTMLOutFuncs::sNewLine[] = "\015\012"; #endif #define TXTCONV_BUFFER_SIZE 20 @@ -978,3 +979,4 @@ sal_Bool HTMLOutFuncs::PrivateURLToInternalImg( String& rURL ) } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx index 4b92214d7827..97867c1341bb 100644 --- a/svtools/source/svhtml/htmlsupp.cxx +++ b/svtools/source/svhtml/htmlsupp.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,19 +41,13 @@ #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> -/* */ - -// Tabellen zum Umwandeln von Options-Werten in Strings - -static HTMLOptionEnum __READONLY_DATA aScriptLangOptEnums[] = +// Table for converting option values into strings +static HTMLOptionEnum const aScriptLangOptEnums[] = { { OOO_STRING_SVTOOLS_HTML_LG_starbasic, HTML_SL_STARBASIC }, { OOO_STRING_SVTOOLS_HTML_LG_javascript, HTML_SL_JAVASCRIPT }, { OOO_STRING_SVTOOLS_HTML_LG_javascript11,HTML_SL_JAVASCRIPT }, { OOO_STRING_SVTOOLS_HTML_LG_livescript, HTML_SL_JAVASCRIPT }, -// { OOO_STRING_SVTOOLS_HTML_LG_unused_javascript, HTML_SL_UNUSEDJS }, -// { OOO_STRING_SVTOOLS_HTML_LG_vbscript, HTML_SL_VBSCRIPT }, -// { OOO_STRING_SVTOOLS_HTML_LG_starone, HTML_SL_STARONE }, { 0, 0 } }; @@ -115,14 +110,14 @@ void HTMLParser::RemoveSGMLComment( String &rString, sal_Bool bFull ) rString.Erase( rString.Len()-1 ); - // SGML-Kommentare entfernen + // remove SGML comments if( rString.Len() >= 4 && rString.CompareToAscii( "<!--", 4 ) == COMPARE_EQUAL ) { xub_StrLen nPos = 3; if( bFull ) { - // die gesamte Zeile ! + // the whole line nPos = 4; while( nPos < rString.Len() && ( ( c = rString.GetChar( nPos )) != '\r' && c != '\n' ) ) @@ -143,7 +138,7 @@ void HTMLParser::RemoveSGMLComment( String &rString, sal_Bool bFull ) rString.Erase( rString.Len()-3 ); if( bFull ) { - // auch noch ein "//" oder "'" und ggf CR/LF davor + // "//" or "'", maybe preceding CR/LF rString.EraseTrailingChars(); xub_StrLen nDel = 0, nLen = rString.Len(); if( nLen >= 2 && @@ -171,3 +166,4 @@ void HTMLParser::RemoveSGMLComment( String &rString, sal_Bool bFull ) } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index b31f7285b15c..8cf6f406e2bd 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -56,17 +57,15 @@ using namespace ::com::sun::star; const sal_Int32 MAX_LEN( 1024L ); -//static sal_Unicode sTmpBuffer[ MAX_LEN+1 ]; const sal_Int32 MAX_MACRO_LEN( 1024 ); const sal_Int32 MAX_ENTITY_LEN( 8L ); -/* */ -// Tabellen zum Umwandeln von Options-Werten in Strings +// Tables to convert option values into strings // <INPUT TYPE=xxx> -static HTMLOptionEnum __READONLY_DATA aInputTypeOptEnums[] = +static HTMLOptionEnum const aInputTypeOptEnums[] = { { OOO_STRING_SVTOOLS_HTML_IT_text, HTML_IT_TEXT }, { OOO_STRING_SVTOOLS_HTML_IT_password, HTML_IT_PASSWORD }, @@ -84,7 +83,7 @@ static HTMLOptionEnum __READONLY_DATA aInputTypeOptEnums[] = }; // <TABLE FRAME=xxx> -static HTMLOptionEnum __READONLY_DATA aTableFrameOptEnums[] = +static HTMLOptionEnum const aTableFrameOptEnums[] = { { OOO_STRING_SVTOOLS_HTML_TF_void, HTML_TF_VOID }, { OOO_STRING_SVTOOLS_HTML_TF_above, HTML_TF_ABOVE }, @@ -99,7 +98,7 @@ static HTMLOptionEnum __READONLY_DATA aTableFrameOptEnums[] = }; // <TABLE RULES=xxx> -static HTMLOptionEnum __READONLY_DATA aTableRulesOptEnums[] = +static HTMLOptionEnum const aTableRulesOptEnums[] = { { OOO_STRING_SVTOOLS_HTML_TR_none, HTML_TR_NONE }, { OOO_STRING_SVTOOLS_HTML_TR_groups, HTML_TR_GROUPS }, @@ -112,7 +111,6 @@ static HTMLOptionEnum __READONLY_DATA aTableRulesOptEnums[] = SV_IMPL_PTRARR(HTMLOptions,HTMLOptionPtr) -/* */ sal_uInt16 HTMLOption::GetEnum( const HTMLOptionEnum *pOptEnums, sal_uInt16 nDflt ) const { @@ -154,7 +152,7 @@ HTMLOption::HTMLOption( sal_uInt16 nTok, const String& rToken, , nToken( nTok ) { DBG_ASSERT( nToken>=HTML_OPTION_START && nToken<HTML_OPTION_END, - "HTMLOption: unbekanntes Token" ); + "HTMLOption: unknown token" ); } sal_uInt32 HTMLOption::GetNumber() const @@ -164,7 +162,7 @@ sal_uInt32 HTMLOption::GetNumber() const (nToken>=HTML_OPTION_CONTEXT_START && nToken<HTML_OPTION_CONTEXT_END) || nToken==HTML_O_VALUE, - "GetNumber: Option ist nicht numerisch" ); + "GetNumber: Option not numerical" ); String aTmp( aValue ); aTmp.EraseLeadingChars(); sal_Int32 nTmp = aTmp.ToInt32(); @@ -175,7 +173,7 @@ sal_Int32 HTMLOption::GetSNumber() const { DBG_ASSERT( (nToken>=HTML_OPTION_NUMBER_START && nToken<HTML_OPTION_NUMBER_END) || (nToken>=HTML_OPTION_CONTEXT_START && nToken<HTML_OPTION_CONTEXT_END), - "GetSNumber: Option ist nicht numerisch" ); + "GetSNumber: Option not numerical" ); String aTmp( aValue ); aTmp.EraseLeadingChars(); return aTmp.ToInt32(); @@ -188,8 +186,8 @@ void HTMLOption::GetNumbers( SvULongs &rLongs, sal_Bool bSpaceDelim ) const if( bSpaceDelim ) { - // das ist ein sehr stark vereinfachter Scanner. Er sucht einfach - // alle Tiffern aus dem String + // This is a very simplified scanner: it only searches all + // numerals in the string. sal_Bool bInNum = sal_False; sal_uLong nNum = 0; for( xub_StrLen i=0; i<aValue.Len(); i++ ) @@ -215,8 +213,8 @@ void HTMLOption::GetNumbers( SvULongs &rLongs, sal_Bool bSpaceDelim ) const } else { - // hier wird auf die korrekte Trennung der Zahlen durch ',' geachtet - // und auch mal eine 0 eingefuegt + // Check whether numbers are separated by ',' and + // insert 0 if necessary xub_StrLen nPos = 0; while( nPos < aValue.Len() ) { @@ -254,24 +252,22 @@ void HTMLOption::GetNumbers( SvULongs &rLongs, sal_Bool bSpaceDelim ) const void HTMLOption::GetColor( Color& rColor ) const { DBG_ASSERT( (nToken>=HTML_OPTION_COLOR_START && nToken<HTML_OPTION_COLOR_END) || nToken==HTML_O_SIZE, - "GetColor: Option spezifiziert keine Farbe" ); + "GetColor: Option is not a color." ); String aTmp( aValue ); aTmp.ToUpperAscii(); - sal_uLong nColor = ULONG_MAX; + sal_uInt32 nColor = SAL_MAX_UINT32; if( '#'!=aTmp.GetChar( 0 ) ) nColor = GetHTMLColor( aTmp ); - if( ULONG_MAX == nColor ) + if( SAL_MAX_UINT32 == nColor ) { nColor = 0; xub_StrLen nPos = 0; for( sal_uInt32 i=0; i<6; i++ ) { - // MIB 26.06.97: Wie auch immer Netscape Farbwerte ermittelt, - // maximal drei Zeichen, die kleiner als '0' sind werden - // ignoriert. Bug #40901# stimmt damit. Mal schauen, was sich - // irgendwelche HTML-Autoren noch so einfallen lassen... + // Whatever Netscape does to get color values, + // at maximum three characters < '0' are ignored. register sal_Unicode c = nPos<aTmp.Len() ? aTmp.GetChar( nPos++ ) : '0'; if( c < '0' ) @@ -295,24 +291,22 @@ void HTMLOption::GetColor( Color& rColor ) const HTMLInputType HTMLOption::GetInputType() const { - DBG_ASSERT( nToken==HTML_O_TYPE, "GetInputType: Option nicht TYPE" ); + DBG_ASSERT( nToken==HTML_O_TYPE, "GetInputType: Option not TYPE" ); return (HTMLInputType)GetEnum( aInputTypeOptEnums, HTML_IT_TEXT ); } HTMLTableFrame HTMLOption::GetTableFrame() const { - DBG_ASSERT( nToken==HTML_O_FRAME, "GetTableFrame: Option nicht FRAME" ); + DBG_ASSERT( nToken==HTML_O_FRAME, "GetTableFrame: Option not FRAME" ); return (HTMLTableFrame)GetEnum( aTableFrameOptEnums, HTML_TF_VOID ); } HTMLTableRules HTMLOption::GetTableRules() const { - DBG_ASSERT( nToken==HTML_O_RULES, "GetTableRules: Option nicht RULES" ); + DBG_ASSERT( nToken==HTML_O_RULES, "GetTableRules: Option not RULES" ); return (HTMLTableRules)GetEnum( aTableRulesOptEnums, HTML_TR_NONE ); } -/* */ - HTMLParser::HTMLParser( SvStream& rIn, int bReadNewDoc ) : SvParser( rIn ) { @@ -323,6 +317,9 @@ HTMLParser::HTMLParser( SvStream& rIn, int bReadNewDoc ) bReadComment = sal_False; bIsInHeader = sal_True; pOptions = new HTMLOptions; + + //#i76649, default to UTF-8 for HTML unless we know differently + SetSrcEncoding(RTL_TEXTENCODING_UTF8); } HTMLParser::~HTMLParser() @@ -332,7 +329,7 @@ HTMLParser::~HTMLParser() delete pOptions; } -SvParserState __EXPORT HTMLParser::CallParser() +SvParserState HTMLParser::CallParser() { eState = SVPAR_WORKING; nNextCh = GetNextChar(); @@ -344,7 +341,7 @@ SvParserState __EXPORT HTMLParser::CallParser() AddRef(); Continue( 0 ); if( SVPAR_PENDING != eState ) - ReleaseRef(); // dann brauchen wir den Parser nicht mehr! + ReleaseRef(); // Parser not needed anymore return eState; } @@ -363,8 +360,8 @@ void HTMLParser::Continue( int nToken ) NextToken( nToken ); if( IsParserWorking() ) - SaveState( 0 ); // bis hierhin abgearbeitet, - // weiter mit neuem Token! + SaveState( 0 ); // continue with new token + nToken = GetNextToken(); } } @@ -375,7 +372,7 @@ int HTMLParser::FilterToken( int nToken ) { case sal_Unicode(EOF): nToken = 0; - break; // nicht verschicken + break; // don't pass case HTML_HEAD_OFF: bIsInBody = sal_True; @@ -396,7 +393,7 @@ int HTMLParser::FilterToken( int nToken ) case HTML_HTML_OFF: nToken = 0; bReadPRE = bReadListing = bReadXMP = sal_False; - break; // HTML_ON wurde auch nicht verschickt ! + break; // HTML_ON hasn't been passed either ! case HTML_PREFORMTXT_ON: StartPRE(); @@ -441,18 +438,16 @@ int HTMLParser::FilterToken( int nToken ) #define HTML_ISALNUM( c ) ( HTML_ISALPHA(c) || HTML_ISDIGIT(c) ) #define HTML_ISSPACE( c ) ( ' ' == c || (c >= 0x09 && c <= 0x0d) ) #define HTML_ISPRINTABLE( c ) ( c >= 32 && c != 127) -// --> OD 2006-07-26 #138464# #define HTML_ISHEXDIGIT( c ) ( HTML_ISDIGIT(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') ) -// <-- int HTMLParser::ScanText( const sal_Unicode cBreak ) { ::rtl::OUStringBuffer sTmpBuffer( MAX_LEN ); - int bWeiter = sal_True; + int bContinue = sal_True; int bEqSignFound = sal_False; sal_Unicode cQuote = 0U; - while( bWeiter && IsParserWorking() ) + while( bContinue && IsParserWorking() ) { int bNextCh = sal_True; switch( nNextCh ) @@ -470,8 +465,6 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) if( '#' == (nNextCh = GetNextChar()) ) { nNextCh = GetNextChar(); - // --> OD 2006-07-26 #138464# - // consider hexadecimal digits const sal_Bool bIsHex( 'x' == nNextCh ); const sal_Bool bIsDecOrHex( bIsHex || HTML_ISDIGIT(nNextCh) ); if ( bIsDecOrHex ) @@ -510,14 +503,13 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) (sal_Char)cChar, eSrcEnc ); if( 0U == cChar ) { - // #73398#: If the character could not be + // If the character could not be // converted, because a conversion is not // available, do no conversion at all. cChar = cOrig; } } } - // <-- else nNextCh = 0U; } @@ -539,14 +531,13 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) String sEntity( sEntityBuffer.getStr(), nPos ); cChar = GetHTMLCharName( sEntity ); - // nicht gefunden ( == 0 ), dann Klartext - // oder ein Zeichen das als Attribut eingefuegt - // wird + // not found ( == 0 ): plain text + // or a character which is inserted as attribute if( 0U == cChar && ';' != nNextCh ) { DBG_ASSERT( rInput.Tell() - nStreamPos == (sal_uLong)(nPos+1L)*GetCharSize(), - "UTF-8 geht hier schief" ); + "UTF-8 is failing here" ); for( xub_StrLen i=nPos-1L; i>1L; i-- ) { nNextCh = sEntityBuffer[i]; @@ -565,21 +556,18 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) } } - if( !cChar ) // unbekanntes Zeichen? + if( !cChar ) // unknown character? { - // dann im Stream zurueck, das '&' als Zeichen - // einfuegen und mit dem nachfolgenden Zeichen - // wieder aufsetzen + // back in stream, insert '&' + // and restart with next character sTmpBuffer.append( (sal_Unicode)'&' ); -// rInput.SeekRel( -(long)(++nPos*GetCharSize()) ); -// nlLinePos -= nPos; DBG_ASSERT( rInput.Tell()-nStreamPos == (sal_uLong)(nPos+1)*GetCharSize(), - "Falsche Stream-Position" ); + "Wrong stream position" ); DBG_ASSERT( nlLinePos-nLinePos == (sal_uLong)(nPos+1), - "Falsche Zeilen-Position" ); + "Wrong line position" ); rInput.Seek( nStreamPos ); nlLinePos = nLinePos; ClearTxtConvContext(); @@ -593,46 +581,43 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) { if( '>' == cBreak ) { - // Wenn der Inhalt eines Tags gelesen wird, - // muessen wir ein Space bzw. - daraus machen + // When reading the content of a tag we have + // to change it to ' ' or '-' switch( cChar ) { case 1U: cChar = ' '; break; case 2U: cChar = '-'; break; default: DBG_ASSERT( cChar==1U, - "\0x00 sollte doch schon laengt abgefangen sein!" ); + "\0x00 should be handled already!" ); break; } } else { - // Wenn kein Tag gescannt wird, enstprechendes - // Token zurueckgeben + // If not scanning a tag return token aToken += String( sTmpBuffer.makeStringAndClear() ); if( cChar ) { if( aToken.Len() ) { - // mit dem Zeichen wieder aufsetzen + // restart with character nNextCh = '&'; -// rInput.SeekRel( -(long)(++nPos*GetCharSize()) ); -// nlLinePos -= nPos; DBG_ASSERT( rInput.Tell()-nStreamPos == (sal_uLong)(nPos+1)*GetCharSize(), - "Falsche Stream-Position" ); + "Wrong stream position" ); DBG_ASSERT( nlLinePos-nLinePos == (sal_uLong)(nPos+1), - "Falsche Zeilen-Position" ); + "Wrong line position" ); rInput.Seek( nStreamPos ); nlLinePos = nLinePos; ClearTxtConvContext(); return HTML_TEXTTOKEN; } - // Hack: _GetNextChar soll nicht das - // naechste Zeichen lesen + // Hack: _GetNextChar shall not read the + // next character if( ';' != nNextCh ) aToken += ' '; if( 1U == cChar ) @@ -650,8 +635,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) else nNextCh = 0U; } - // MIB 03/02/2000: &{...};-JavaScript-Macros are not - // supported any longer. + // &{...};-JavaScript-Macros are not supported any longer. else if( IsParserWorking() ) { sTmpBuffer.append( (sal_Unicode)'&' ); @@ -663,12 +647,11 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) if( cBreak=='>' && (cChar=='\\' || cChar=='\'' || cChar=='\"' || cChar==' ') ) { - // ' und " mussen innerhalb von Tags mit einem - // gekennzeichnet werden, um sie von ' und " als Klammern - // um Optionen zu unterscheiden. Logischerweise muss - // deshalb auch ein \ gekeenzeichnet werden. Ausserdem - // schuetzen wir ein Space, weil es kein Trennzeichen - // zwischen Optionen ist. + // ' and " have to be escaped withing tags to separate + // them from ' and " enclosing options. + // \ has to be escaped as well. + // Space is protected because it's not a delimiter between + // options. sTmpBuffer.append( (sal_Unicode)'\\' ); if( MAX_LEN == sTmpBuffer.getLength() ) aToken += String(sTmpBuffer.makeStringAndClear()); @@ -680,14 +663,13 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) } else if( SVPAR_PENDING==eState && '>'!=cBreak ) { - // Mit dem '&' Zeichen wieder aufsetzen, der Rest - // wird als Texttoken zurueckgegeben. + // Restart with '&', the remainder is returned as + // text token. if( aToken.Len() || sTmpBuffer.getLength() ) { - // Der bisherige Text wird von _GetNextChar() - // zurueckgegeben und beim naechsten Aufruf wird - // ein neues Zeichen gelesen. Also muessen wir uns - // noch vor das & stellen. + // _GetNextChar() returns the previous text and + // during the next execution a new character is read. + // Thus we have to position in front of the '&'. nNextCh = 0U; rInput.Seek( nStreamPos-(sal_uInt32)GetCharSize() ); nlLinePos = nLinePos-1; @@ -731,11 +713,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) case sal_Unicode(EOF): if( rInput.IsEof() ) { -// MIB 20.11.98: Das macht hier keinen Sinn, oder doch: Zumindest wird -// abcä<EOF> nicht angezeigt, also lassen wir das in Zukunft. -// if( '>' != cBreak ) -// eState = SVPAR_ACCEPTED; - bWeiter = sal_False; + bContinue = sal_False; } else { @@ -748,19 +726,19 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) if( '>'==cBreak ) sTmpBuffer.append( nNextCh ); else - bWeiter = sal_False; // Abbrechen, String zusammen + bContinue = sal_False; // break, String zusammen break; case '\f': if( '>' == cBreak ) { - // Beim Scannen von Optionen wie ein Space behandeln + // If scanning options treat it like a space, ... sTmpBuffer.append( (sal_Unicode)' ' ); } else { - // sonst wird es ein eigenes Token - bWeiter = sal_False; + // otherwise it's a separate token. + bContinue = sal_False; } break; @@ -768,26 +746,25 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) case '\n': if( '>'==cBreak ) { - // #26979# cr/lf in Tag wird in _GetNextToken() behandeln + // cr/lf in tag is handled in _GetNextToken() sTmpBuffer.append( nNextCh ); break; } else if( bReadListing || bReadXMP || bReadPRE || bReadTextArea ) { - bWeiter = sal_False; + bContinue = sal_False; break; } - // Bug 18984: CR-LF -> Blank - // Folge von CR/LF/BLANK/TAB nur in ein Blank wandeln - // kein break!! + // Reduce sequence of CR/LF/BLANK/TAB to a single blank + // no break!! case '\t': if( '\t'==nNextCh && bReadPRE && '>'!=cBreak ) { // In <PRE>: Tabs nach oben durchreichen - bWeiter = sal_False; + bContinue = sal_False; break; } - // kein break + // no break case '\x0b': if( '\x0b'==nNextCh && (bReadPRE || bReadXMP ||bReadListing) && '>'!=cBreak ) @@ -795,27 +772,26 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) break; } nNextCh = ' '; - // kein break; + // no break; case ' ': sTmpBuffer.append( nNextCh ); if( '>'!=cBreak && (!bReadListing && !bReadXMP && !bReadPRE && !bReadTextArea) ) { - // alle Folgen von Blanks/Tabs/CR/LF zu einem Blank umwandeln + // Reduce sequences of Blanks/Tabs/CR/LF to a single blank do { if( sal_Unicode(EOF) == (nNextCh = GetNextChar()) && rInput.IsEof() ) { if( aToken.Len() || sTmpBuffer.getLength() > 1L ) { - // ausser den Blanks wurde noch etwas geselen + // Have seen s.th. aside from blanks? aToken += String(sTmpBuffer.makeStringAndClear()); return HTML_TEXTTOKEN; } else - // nur Blanks gelesen: dann darf kein Text - // mehr zurueckgegeben werden und _GetNextToken - // muss auf EOF laufen + // Only read blanks: no text must be returned + // and _GetNextToken has to read until EOF return 0; } } while ( ' ' == nNextCh || '\t' == nNextCh || @@ -829,11 +805,11 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) bEqSignFound = sal_False; if( (nNextCh==cBreak && !cQuote) || (sal_uLong(aToken.Len()) + MAX_LEN) > sal_uLong(STRING_MAXLEN & ~1 )) - bWeiter = sal_False; + bContinue = sal_False; else { do { - // alle anderen Zeichen kommen in den Text + // All remaining characters make their way into the text. sTmpBuffer.append( nNextCh ); if( MAX_LEN == sTmpBuffer.getLength() ) { @@ -861,7 +837,7 @@ int HTMLParser::ScanText( const sal_Unicode cBreak ) if( MAX_LEN == sTmpBuffer.getLength() ) aToken += String(sTmpBuffer.makeStringAndClear()); - if( bWeiter && bNextCh ) + if( bContinue && bNextCh ) nNextCh = GetNextChar(); } @@ -877,8 +853,8 @@ int HTMLParser::_GetNextRawToken() if( bEndTokenFound ) { - // beim letzten Aufruf haben wir das End-Token bereits gefunden, - // deshalb muessen wir es nicht noch einmal suchen + // During the last execution we already found the end token, + // thus we don't have to search it again. bReadScript = sal_False; bReadStyle = sal_False; aEndToken.Erase(); @@ -887,28 +863,28 @@ int HTMLParser::_GetNextRawToken() return 0; } - // per default geben wir HTML_RAWDATA zurueck - int bWeiter = sal_True; + // Default return value: HTML_RAWDATA + int bContinue = sal_True; int nToken = HTML_RAWDATA; SaveState( 0 ); - while( bWeiter && IsParserWorking() ) + while( bContinue && IsParserWorking() ) { int bNextCh = sal_True; switch( nNextCh ) { case '<': { - // Vielleicht haben wir das Ende erreicht + // Maybe we've reached the end. - // das bisher gelesene erstmal retten + // Save what we have read previously... aToken += String(sTmpBuffer.makeStringAndClear()); - // und die Position im Stream merken + // and remember position in stream. sal_uLong nStreamPos = rInput.Tell(); sal_uLong nLineNr = GetLineNr(); sal_uLong nLinePos = GetLinePos(); - // Start eines End-Token? + // Start of an end token? int bOffState = sal_False; if( '/' == (nNextCh = GetNextChar()) ) { @@ -921,7 +897,7 @@ int HTMLParser::_GetNextRawToken() nNextCh = GetNextChar(); } - // jetzt die Buchstaben danach lesen + // Read following letters while( (HTML_ISALPHA(nNextCh) || '-'==nNextCh) && IsParserWorking() && sTmpBuffer.getLength() < MAX_LEN ) { @@ -945,10 +921,9 @@ int HTMLParser::_GetNextRawToken() } else { - // ein Script muss mit "</SCRIPT>" aufhoehren, wobei - // wir es mit dem ">" aus sicherheitsgruenden - // erstmal nicht so genau nehmen - bDone = bOffState && // '>'==nNextCh && + // A script has to end with "</SCRIPT>". But + // ">" is optional for security reasons + bDone = bOffState && COMPARE_EQUAL == ( bReadScript ? aTok.CompareToAscii(OOO_STRING_SVTOOLS_HTML_script) : aTok.CompareTo(aEndToken) ); @@ -957,14 +932,13 @@ int HTMLParser::_GetNextRawToken() if( bReadComment && '>'==nNextCh && aTok.Len() >= 2 && aTok.Copy( aTok.Len()-2 ).EqualsAscii( "--" ) ) { - // hier ist ein Kommentar der Art <!-----> zuende + // End of comment of style <!-----> bReadComment = sal_False; } } else { - // ein Style-Sheet kann mit </STYLE>, </HEAD> oder - // <BODY> aughoehren + // Style sheets can be closed by </STYLE>, </HEAD> or <BODY> if( bOffState ) bDone = aTok.CompareToAscii(OOO_STRING_SVTOOLS_HTML_style) == COMPARE_EQUAL || @@ -977,17 +951,16 @@ int HTMLParser::_GetNextRawToken() if( bDone ) { - // das war's, jetzt muessen wir gegebenenfalls den - // bisher gelesenen String zurueckgeben und dnach normal - // weitermachen + // Done! Return the previously read string (if requested) + // and continue. - bWeiter = sal_False; + bContinue = sal_False; - // nToken==0 heisst, dass _GetNextToken gleich weiterliest + // nToken==0 means, _GetNextToken continues to read if( !aToken.Len() && (bReadStyle || bReadScript) ) { - // wir koennen sofort die Umgebung beeden und - // das End-Token parsen + // Immediately close environment (or context?) + // and parse the end token bReadScript = sal_False; bReadStyle = sal_False; aEndToken.Erase(); @@ -995,25 +968,24 @@ int HTMLParser::_GetNextRawToken() } else { - // wir muessen bReadScript/bReadStyle noch am - // Leben lassen und koennen erst beim naechsten - // mal das End-Token Parsen + // Keep bReadScript/bReadStyle alive + // and parse end token during next execution bEndTokenFound = sal_True; } - // jetzt fahren wir im Stream auf das '<' zurueck + // Move backwards in stream to '<' rInput.Seek( nStreamPos ); SetLineNr( nLineNr ); SetLinePos( nLinePos ); ClearTxtConvContext(); nNextCh = '<'; - // den String wollen wir nicht an das Token haengen + // Don't append string to token. sTmpBuffer.setLength( 0L ); } else { - // "</" merken, alles andere steht noch im buffer + // remember "</" , everything else we find in the buffer aToken += (sal_Unicode)'<'; if( bOffState ) aToken += (sal_Unicode)'/'; @@ -1046,23 +1018,23 @@ int HTMLParser::_GetNextRawToken() break; case '\r': - // \r\n? beendet das aktuelle Text-Token (auch wenn es leer ist) + // \r\n? closes the current text token (even if it's empty) nNextCh = GetNextChar(); if( nNextCh=='\n' ) nNextCh = GetNextChar(); - bWeiter = sal_False; + bContinue = sal_False; break; case '\n': - // \n beendet das aktuelle Text-Token (auch wenn es leer ist) + // \n closes the current text token (even if it's empty) nNextCh = GetNextChar(); - bWeiter = sal_False; + bContinue = sal_False; break; case sal_Unicode(EOF): - // eof beendet das aktuelle Text-Token und tut so, als ob - // ein End-Token gelesen wurde + // eof closes the current text token and behaves like having read + // an end token if( rInput.IsEof() ) { - bWeiter = sal_False; + bContinue = sal_False; if( aToken.Len() || sTmpBuffer.getLength() ) { bEndTokenFound = sal_True; @@ -1076,18 +1048,18 @@ int HTMLParser::_GetNextRawToken() } break; } - // kein break + // no break default: - // alle anderen Zeichen landen im Buffer + // all remaining characters are appended to the buffer sTmpBuffer.append( nNextCh ); break; } - if( (!bWeiter && sTmpBuffer.getLength() > 0L) || + if( (!bContinue && sTmpBuffer.getLength() > 0L) || MAX_LEN == sTmpBuffer.getLength() ) aToken += String(sTmpBuffer.makeStringAndClear()); - if( bWeiter && bNextCh ) + if( bContinue && bNextCh ) nNextCh = GetNextChar(); } @@ -1099,26 +1071,26 @@ int HTMLParser::_GetNextRawToken() return nToken; } -// scanne das naechste Token, -int __EXPORT HTMLParser::_GetNextToken() +// Scan next token +int HTMLParser::_GetNextToken() { int nRet = 0; sSaveToken.Erase(); - // die Optionen loeschen + // Delete options if( pOptions->Count() ) pOptions->DeleteAndDestroy( 0, pOptions->Count() ); - if( !IsParserWorking() ) // wenn schon Fehler, dann nicht weiter! + if( !IsParserWorking() ) // Don't continue if already an error occured return 0; sal_Bool bReadNextCharSave = bReadNextChar; if( bReadNextChar ) { DBG_ASSERT( !bEndTokenFound, - "</SCRIPT> gelesen und trotzdem noch ein Zeichen lesen?" ); + "Read a character despite </SCRIPT> was read?" ); nNextCh = GetNextChar(); - if( !IsParserWorking() ) // wenn schon Fehler, dann nicht weiter! + if( !IsParserWorking() ) // Don't continue if already an error occured return 0; bReadNextChar = sal_False; } @@ -1146,7 +1118,7 @@ int __EXPORT HTMLParser::_GetNextToken() bOffState = sal_True; nNextCh = GetNextChar(); } - if( HTML_ISALPHA( nNextCh ) || '!'==nNextCh ) // fix #26984# + if( HTML_ISALPHA( nNextCh ) || '!'==nNextCh ) { ::rtl::OUStringBuffer sTmpBuffer; do { @@ -1160,7 +1132,7 @@ int __EXPORT HTMLParser::_GetNextToken() if( sTmpBuffer.getLength() ) aToken += String(sTmpBuffer.makeStringAndClear()); - // Blanks ueberlesen + // Skip blanks while( HTML_ISSPACE( nNextCh ) && IsParserWorking() ) nNextCh = GetNextChar(); @@ -1171,35 +1143,33 @@ int __EXPORT HTMLParser::_GetNextToken() break; } - // suche das Token in der Tabelle: + // Search token in table: sSaveToken = aToken; aToken.ToUpperAscii(); if( 0 == (nRet = GetHTMLToken( aToken )) ) - // Unknown Control + // Unknown control nRet = HTML_UNKNOWNCONTROL_ON; - // Wenn es ein Token zum ausschalten ist ... + // If it's a token which can be switched off... if( bOffState ) { if( HTML_TOKEN_ONOFF & nRet ) { - // und es ein Off-Token gibt, das daraus machen + // and there is an off token, return off token instead ++nRet; } else if( HTML_LINEBREAK!=nRet ) { - // und es kein Off-Token gibt, ein unbekanntes - // Token daraus machen (ausser </BR>, das wird - // wie <BR> behandelt + // and there is no off token, return unknown token. + // (except for </BR>, that is treated like <BR>) nRet = HTML_UNKNOWNCONTROL_OFF; } } if( nRet == HTML_COMMENT ) { - // fix: sSaveToken wegen Gross-/Kleinschreibung - // als Anfang des Kommentars benutzen und ein - // Space anhaengen. + // fix: due to being case sensitive use sSaveToken as start of comment + // and append a blank. aToken = sSaveToken; if( '>'!=nNextCh ) aToken += (sal_Unicode)' '; @@ -1209,8 +1179,7 @@ int __EXPORT HTMLParser::_GetNextToken() xub_StrLen nCStrLen = 0; sal_Bool bDone = sal_False; - // bis zum schliessenden --> lesen. wenn keins gefunden - // wurde beim der ersten > wieder aufsetzen + // Read until closing -->. If not found restart at first > while( !bDone && !rInput.IsEof() && IsParserWorking() ) { if( '>'==nNextCh ) @@ -1245,18 +1214,25 @@ int __EXPORT HTMLParser::_GetNextToken() } else { - // den TokenString koennen wir jetzt verwerfen + // TokenString not needed anymore aToken.Erase(); } - // dann lesen wir mal alles bis zur schliessenden '>' + // Read until closing '>' if( '>' != nNextCh && IsParserWorking() ) { ScanText( '>' ); + + // fdo#34666 fdo#36080 fdo#36390: closing "/>"?: + // return HTML_<TOKEN>_OFF instead of HTML_<TOKEN>_ON + if ((HTML_TOKEN_ONOFF & nRet) && (aToken.Len() >= 1) && + ('/' == aToken.GetChar(aToken.Len()-1))) { + ++nRet; // HTML_<TOKEN>_ON -> HTML_<TOKEN>_OFF; + } if( sal_Unicode(EOF) == nNextCh && rInput.IsEof() ) { - // zurueck hinter die < gehen und dort neu - // aufsetzen, das < als Text zurueckgeben + // Move back in front of < and restart there. + // Return < as text. rInput.Seek( nStreamPos ); SetLineNr( nLineNr ); SetLinePos( nLinePos ); @@ -1280,8 +1256,8 @@ int __EXPORT HTMLParser::_GetNextToken() ScanText( '>' ); if( sal_Unicode(EOF) == nNextCh && rInput.IsEof() ) { - // zurueck hinter die < gehen und dort neu - // aufsetzen, das < als Text zurueckgeben + // Move back in front of < and restart there. + // Return < as text. rInput.Seek( nStreamPos ); SetLineNr( nLineNr ); SetLinePos( nLinePos ); @@ -1305,8 +1281,7 @@ int __EXPORT HTMLParser::_GetNextToken() sal_uLong nCLineNr = GetLineNr(), nCLinePos = GetLinePos(); sal_Bool bDone = sal_False; - // bis zum schliessenden %> lesen. wenn keins gefunden - // wurde beim der ersten > wieder aufsetzen + // Read until closing %>. If not found restart at first >. while( !bDone && !rInput.IsEof() && IsParserWorking() ) { bDone = '>'==nNextCh && aToken.Len() >= 1 && @@ -1361,9 +1336,8 @@ int __EXPORT HTMLParser::_GetNextToken() if( !bReadTextArea ) { bReadScript = sal_False; - // JavaScript kann den Stream veraendern - // also muss das letzte Zeichen nochmals - // gelesen werden + // JavaScript might modify the stream, + // thus the last character has to be read again. bReadNextChar = sal_True; bNextCh = sal_False; } @@ -1376,7 +1350,6 @@ int __EXPORT HTMLParser::_GetNextToken() bReadStyle = sal_False; break; } - } } break; @@ -1389,14 +1362,14 @@ int __EXPORT HTMLParser::_GetNextToken() } else { - // normalen Text lesen + // Read normal text. goto scan_text; } break; case '\f': - // Form-Feeds werden jetzt extra nach oben gereicht - nRet = HTML_LINEFEEDCHAR; // !!! eigentlich FORMFEEDCHAR + // form feeds are passed upwards separately + nRet = HTML_LINEFEEDCHAR; // !!! should be FORMFEEDCHAR break; case '\n': @@ -1413,24 +1386,24 @@ int __EXPORT HTMLParser::_GetNextToken() nRet = HTML_NEWPARA; break; } - // kein break ! + // no break ! case '\t': if( bReadPRE ) { nRet = HTML_TABCHAR; break; } - // kein break ! + // no break ! case ' ': - // kein break ! + // no break ! default: scan_text: - // es folgt "normaler" Text + // "normal" text to come nRet = ScanText(); bNextCh = 0 == aToken.Len(); - // der Text sollte noch verarbeitet werden + // the text should be processed if( !bNextCh && eState == SVPAR_PENDING ) { eState = SVPAR_WORKING; @@ -1453,7 +1426,7 @@ scan_text: } while( !nRet && SVPAR_WORKING == eState ); if( SVPAR_PENDING == eState ) - nRet = -1; // irgendwas ungueltiges + nRet = -1; // s.th. invalid return nRet; } @@ -1479,18 +1452,17 @@ void HTMLParser::UnescapeToken() } } -// hole die Optionen const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const { - // wenn die Option fuer das aktuelle Token schon einmal - // geholt wurden, geben wir sie noch einmal zurueck + // If the options for the current token have already been returned, + // return them once again. if( pOptions->Count() ) return pOptions; xub_StrLen nPos = 0; while( nPos < aToken.Len() ) { - // ein Zeichen ? Dann faengt hier eine Option an + // A letter? Option beginning here. if( HTML_ISALPHA( aToken.GetChar(nPos) ) ) { int nToken; @@ -1498,26 +1470,22 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const xub_StrLen nStt = nPos; sal_Unicode cChar = 0; - // Eigentlich sind hier nur ganz bestimmte Zeichen erlaubt. - // Netscape achtet aber nur auf "=" und Leerzeichen (siehe - // Mozilla: PA_FetchRequestedNameValues in - // lipparse/pa_mdl.c -// while( nPos < aToken.Len() && -// ( '-'==(c=aToken[nPos]) || isalnum(c) || '.'==c || '_'==c) ) + // Actually only certain characters allowed. + // Netscape only looks for "=" and white space (c.f. + // Mozilla: PA_FetchRequestedNameValues in lipparse/pa_mdl.c) while( nPos < aToken.Len() && '=' != (cChar=aToken.GetChar(nPos)) && HTML_ISPRINTABLE(cChar) && !HTML_ISSPACE(cChar) ) nPos++; String sName( aToken.Copy( nStt, nPos-nStt ) ); -//JP 23.03.97: die PlugIns wollen die TokenName im "Original" haben -// also nur fuers Suchen in UpperCase wandeln + // PlugIns require original token name. Convert to upper case only for searching. String sNameUpperCase( sName ); sNameUpperCase.ToUpperAscii(); - nToken = GetHTMLOption( sNameUpperCase ); // der Name ist fertig + nToken = GetHTMLOption( sNameUpperCase ); // Name is ready DBG_ASSERTWARNING( nToken!=HTML_O_UNKNOWN, - "GetOption: unbekannte HTML-Option" ); + "GetOption: unknown HTML option" ); sal_Bool bStripCRLF = (nToken < HTML_OPTION_SCRIPT_START || nToken >= HTML_OPTION_SCRIPT_END) && (!pNoConvertToken || nToken != *pNoConvertToken); @@ -1527,7 +1495,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const HTML_ISSPACE(cChar) ) ) nPos++; - // hat die Option auch einen Wert? + // Option with value? if( nPos!=aToken.Len() && '='==cChar ) { nPos++; @@ -1588,8 +1556,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const } else { - // hier sind wir etwas laxer als der - // Standard und erlauben alles druckbare + // More liberal than the standard: allow all printable characters sal_Bool bEscape = sal_False; sal_Bool bDone = sal_False; while( nPos < aToken.Len() && !bDone ) @@ -1638,7 +1605,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const } } - // Wir kennen das Token und koennen es Speichern + // Token is known and can be saved HTMLOption *pOption = new HTMLOption( sal::static_int_cast< sal_uInt16 >(nToken), sName, aValue ); @@ -1647,7 +1614,7 @@ const HTMLOptions *HTMLParser::GetOptions( sal_uInt16 *pNoConvertToken ) const } else - // white space un unerwartete Zeichen ignorieren wie + // Ignore white space and unexpected characters nPos++; } @@ -1659,12 +1626,12 @@ int HTMLParser::FilterPRE( int nToken ) switch( nToken ) { #ifdef HTML_BEHAVIOUR - // diese werden laut Definition zu LFs + // These become LFs according to the definition case HTML_PARABREAK_ON: case HTML_LINEBREAK: nToken = HTML_NEWPARA; #else - // in Netscape zeigen sie aber nur in nicht-leeren Absaetzen Wirkung + // in Netscape they only have impact in not empty paragraphs case HTML_PARABREAK_ON: nToken = HTML_LINEBREAK; case HTML_LINEBREAK: @@ -1679,13 +1646,13 @@ int HTMLParser::FilterPRE( int nToken ) { xub_StrLen nSpaces = sal::static_int_cast< xub_StrLen >( 8 - (nPre_LinePos % 8)); - DBG_ASSERT( !aToken.Len(), "Wieso ist das Token nicht leer?" ); + DBG_ASSERT( !aToken.Len(), "Why is the token not empty?" ); aToken.Expand( nSpaces, ' ' ); nPre_LinePos += nSpaces; nToken = HTML_TEXTTOKEN; } break; - // diese bleiben erhalten + // Keep those case HTML_TEXTTOKEN: nPre_LinePos += aToken.Len(); break; @@ -1820,7 +1787,7 @@ int HTMLParser::FilterPRE( int nToken ) break; - // der Rest wird als unbekanntes Token behandelt + // The remainder is treated as an unknown token. default: if( nToken ) { @@ -1847,7 +1814,7 @@ int HTMLParser::FilterXMP( int nToken ) case HTML_TEXTTOKEN: case HTML_NONBREAKSPACE: case HTML_SOFTHYPH: - break; // bleiben erhalten + break; // kept default: if( nToken ) @@ -1888,7 +1855,7 @@ int HTMLParser::FilterListing( int nToken ) case HTML_TEXTTOKEN: case HTML_NONBREAKSPACE: case HTML_SOFTHYPH: - break; // bleiben erhalten + break; // kept default: if( nToken ) @@ -1906,20 +1873,18 @@ int HTMLParser::FilterListing( int nToken ) return nToken; } -FASTBOOL HTMLParser::IsHTMLFormat( const sal_Char* pHeader, - sal_Bool bSwitchToUCS2, - rtl_TextEncoding eEnc ) +bool HTMLParser::IsHTMLFormat( const sal_Char* pHeader, + sal_Bool bSwitchToUCS2, + rtl_TextEncoding eEnc ) { - // Einer der folgenden regulaeren Ausdrucke muss sich auf den String - // anwenden lassen, damit das Dok ein HTML-Dokument ist. + // If the string matches one of the following regular expressions then + // the document is a HTML document. // // ^[^<]*<[^ \t]*[> \t] // ------- // ^<! // - // wobei der unterstrichene Teilausdruck einem HTML-Token - // ensprechen muss - + // where the underlined subexpression has to be a HTML token ByteString sCmp; sal_Bool bUCS2B = sal_False; if( bSwitchToUCS2 ) @@ -1976,14 +1941,13 @@ FASTBOOL HTMLParser::IsHTMLFormat( const sal_Char* pHeader, sCmp.ToUpperAscii(); - // Ein HTML-Dokument muss in der ersten Zeile ein '<' besitzen + // A HTML document must have a '<' in the first line xub_StrLen nStart = sCmp.Search( '<' ); if( STRING_NOTFOUND == nStart ) return sal_False; nStart++; - // danach duerfen beliebige andere Zeichen bis zu einem blank oder - // '>' kommen + // followed by arbitrary characters followed by a blank or '>' sal_Char c; xub_StrLen nPos; for( nPos = nStart; nPos<sCmp.Len(); nPos++ ) @@ -1992,31 +1956,30 @@ FASTBOOL HTMLParser::IsHTMLFormat( const sal_Char* pHeader, break; } - // wenn das Dokeument hinter dem < aufhoert ist es wohl kein HTML + // If the document ends after < it's no HTML if( nPos==nStart ) return sal_False; - // die Zeichenkette nach dem '<' muss ausserdem ein bekanntes - // HTML Token sein. Damit die Ausgabe eines DOS-dir-Befehls nicht - // als HTML interpretiert wird, wird ein <DIR> jedoch nicht als HTML - // interpretiert. + // the string following '<' has to be a known HTML token. + // <DIR> is not interpreted as HTML. Otherwise the output of the DOS command "DIR" + // could be interpreted as HTML. String sTest( sCmp.Copy( nStart, nPos-nStart ), RTL_TEXTENCODING_ASCII_US ); int nTok = GetHTMLToken( sTest ); if( 0 != nTok && HTML_DIRLIST_ON != nTok ) return sal_True; - // oder es handelt sich um ein "<!" ganz am Anfang der Datei (fix #27092#) + // "<!" at the very beginning of the file? if( nStart == 1 && '!' == sCmp.GetChar( 1 ) ) return sal_True; - // oder wir finden irgendwo ein <HTML> in den ersten 80 Zeichen + // <HTML> somewhere in the first 80 characters of the document nStart = sCmp.Search( OOO_STRING_SVTOOLS_HTML_html ); if( nStart!=STRING_NOTFOUND && nStart>0 && '<'==sCmp.GetChar(nStart-1) && nStart+4 < sCmp.Len() && '>'==sCmp.GetChar(nStart+4) ) return sal_True; - // sonst ist es wohl doch eher kein HTML-Dokument + // Else it's rather not a HTML document return sal_False; } @@ -2088,19 +2051,6 @@ sal_Bool HTMLParser::InternalImgToPrivateURL( String& rURL ) return bFound; } -#ifdef USED -void HTMLParser::SaveState( int nToken ) -{ - SvParser::SaveState( nToken ); -} - -void HTMLParser::RestoreState() -{ - SvParser::RestoreState(); -} -#endif - - enum eHtmlMetas { HTML_META_NONE = 0, HTML_META_AUTHOR, @@ -2118,7 +2068,7 @@ enum eHtmlMetas { }; // <META NAME=xxx> -static HTMLOptionEnum __READONLY_DATA aHTMLMetaNameTable[] = +static HTMLOptionEnum const aHTMLMetaNameTable[] = { { OOO_STRING_SVTOOLS_HTML_META_author, HTML_META_AUTHOR }, { OOO_STRING_SVTOOLS_HTML_META_changed, HTML_META_CHANGED }, @@ -2188,7 +2138,7 @@ bool HTMLParser::ParseMetaOptionsImpl( if ( bHTTPEquiv && i_pHTTPHeader ) { - // #57232#: Netscape seems to just ignore a closing ", so we do too + // Netscape seems to just ignore a closing ", so we do too if ( aContent.Len() && '"' == aContent.GetChar( aContent.Len()-1 ) ) { aContent.Erase( aContent.Len() - 1 ); @@ -2307,7 +2257,7 @@ bool HTMLParser::ParseMetaOptions( rtl_isOctetTextEncoding( eEnc ) && rtl_isOctetTextEncoding( GetSrcEncoding() ) ) { - eEnc = GetExtendedCompatibilityTextEncoding( eEnc ); // #89973# + eEnc = GetExtendedCompatibilityTextEncoding( eEnc ); SetSrcEncoding( eEnc ); } @@ -2369,3 +2319,4 @@ sal_Bool HTMLParser::SetEncodingByHTTPHeader( } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index bd08a32942bf..a475343dcaac 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ - #include <stdio.h> // for EOF #include <rtl/tencinfo.h> #include <tools/stream.hxx> @@ -339,12 +338,6 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) case '\'': { -#if 0 - // #i35653 patch from cmc - ByteString aByteString(static_cast<char>(GetHexValue())); - if (aByteString.Len()) - aStrBuffer.Append(String(aByteString, GetSrcEncoding())); -#else ByteString aByteString; while (1) { @@ -395,7 +388,6 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) if (aByteString.Len()) aStrBuffer.Append(String(aByteString, GetSrcEncoding())); -#endif } break; case '\\': @@ -692,16 +684,4 @@ void SvRTFParser::SetEncoding( rtl_TextEncoding eEnc ) SetSrcEncoding(eEnc); } -#ifdef USED -void SvRTFParser::SaveState( int nToken ) -{ - SvParser::SaveState( nToken ); -} - -void SvRTFParser::RestoreState() -{ - SvParser::RestoreState(); -} -#endif - -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/svrtf/rtfkeywd.cxx b/svtools/source/svrtf/rtfkeywd.cxx index ac10c3982b6e..d3d5eedf6afd 100644 --- a/svtools/source/svrtf/rtfkeywd.cxx +++ b/svtools/source/svrtf/rtfkeywd.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,8 +29,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ - #include <svtools/rtfkeywd.hxx> #include <svtools/rtftoken.h> #include "tools/string.hxx" @@ -49,9 +48,9 @@ struct RTF_TokenEntry }; // Flag: RTF-Token Tabelle wurde schon sortiert -static int __FAR_DATA bSortKeyWords = sal_False; +static int bSortKeyWords = sal_False; -static RTF_TokenEntry __FAR_DATA aRTFTokenTab[] = { +static RTF_TokenEntry aRTFTokenTab[] = { {{OOO_STRING_SVTOOLS_RTF_IGNORE}, RTF_IGNOREFLAG}, {{OOO_STRING_SVTOOLS_RTF_RTF}, RTF_RTF}, {{OOO_STRING_SVTOOLS_RTF_ANSI}, RTF_ANSITYPE}, @@ -778,6 +777,8 @@ static RTF_TokenEntry __FAR_DATA aRTFTokenTab[] = { {{OOO_STRING_SVTOOLS_RTF_BRDRDASHDD}, RTF_BRDRDASHDD}, {{OOO_STRING_SVTOOLS_RTF_BRDRDASHDOTSTR},RTF_BRDRDASHDOTSTR}, {{OOO_STRING_SVTOOLS_RTF_BRDRDASHSM}, RTF_BRDRDASHSM}, +{{OOO_STRING_SVTOOLS_RTF_BRDRINSET}, RTF_BRDRINSET}, +{{OOO_STRING_SVTOOLS_RTF_BRDROUTSET}, RTF_BRDROUTSET}, {{OOO_STRING_SVTOOLS_RTF_BRDREMBOSS}, RTF_BRDREMBOSS}, {{OOO_STRING_SVTOOLS_RTF_BRDRENGRAVE}, RTF_BRDRENGRAVE}, {{OOO_STRING_SVTOOLS_RTF_BRDRFRAME}, RTF_BRDRFRAME}, @@ -1186,14 +1187,7 @@ static RTF_TokenEntry __FAR_DATA aRTFTokenTab[] = { extern "C" { -static int -#if defined( WNT ) - __cdecl -#endif -#if defined( ICC ) && defined( OS2 ) -_Optlink -#endif - RTFKeyCompare( const void *pFirst, const void *pSecond) +static int SAL_CALL RTFKeyCompare( const void *pFirst, const void *pSecond) { int nRet = 0; if( -1 == ((RTF_TokenEntry*)pFirst)->nToken ) @@ -1202,13 +1196,13 @@ _Optlink nRet = ((RTF_TokenEntry*)pFirst)->pUToken->CompareTo( *((RTF_TokenEntry*)pSecond)->pUToken ); else - nRet = ((RTF_TokenEntry*)pFirst)->pUToken->CompareToAscii( + nRet = ((RTF_TokenEntry*)pFirst)->pUToken->CompareIgnoreCaseToAscii( ((RTF_TokenEntry*)pSecond)->sToken ); } else { if( -1 == ((RTF_TokenEntry*)pSecond)->nToken ) - nRet = -1 * ((RTF_TokenEntry*)pSecond)->pUToken->CompareToAscii( + nRet = -1 * ((RTF_TokenEntry*)pSecond)->pUToken->CompareIgnoreCaseToAscii( ((RTF_TokenEntry*)pFirst)->sToken ); else nRet = strcmp( ((RTF_TokenEntry*)pFirst)->sToken, @@ -1246,4 +1240,4 @@ int GetRTFToken( const String& rSearch ) return nRet; } -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index 2f00fd896168..21368c0b14d3 100644 --- a/svtools/source/svrtf/rtfout.cxx +++ b/svtools/source/svrtf/rtfout.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -35,12 +36,13 @@ #include <svtools/rtfkeywd.hxx> #include <svtools/rtfout.hxx> -using namespace rtl; +using ::rtl::OUString; +using ::rtl::OString; #if defined(UNX) const sal_Char RTFOutFuncs::sNewLine = '\012'; #else -const sal_Char __FAR_DATA RTFOutFuncs::sNewLine[] = "\015\012"; +const sal_Char RTFOutFuncs::sNewLine[] = "\015\012"; #endif @@ -207,3 +209,4 @@ SvStream& RTFOutFuncs::Out_Hex( SvStream& rStream, sal_uLong nHex, sal_uInt8 nLe +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index fee520714493..11ecfe25bcef 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ #include <stdio.h> #include <svtools/svparser.hxx> @@ -723,4 +723,4 @@ void SvKeyValueIterator::Append (const SvKeyValue &rKeyVal) m_pList->C40_INSERT(SvKeyValue, pKeyVal, m_pList->Count()); } -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx index 286ca505bb30..286ca505bb30 100755..100644 --- a/svtools/source/table/cellvalueconversion.cxx +++ b/svtools/source/table/cellvalueconversion.cxx diff --git a/svtools/source/table/cellvalueconversion.hxx b/svtools/source/table/cellvalueconversion.hxx index 4d6b8c8d6aac..4d6b8c8d6aac 100755..100644 --- a/svtools/source/table/cellvalueconversion.hxx +++ b/svtools/source/table/cellvalueconversion.hxx diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx index 733366d16904..d0ecdb546837 100644 --- a/svtools/source/table/defaultinputhandler.cxx +++ b/svtools/source/table/defaultinputhandler.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -244,3 +245,5 @@ namespace svt { namespace table //...................................................................................................................... } } // namespace svt::table //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 1e230d372c24..e69ad5589087 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -617,3 +618,4 @@ namespace svt { namespace table } } // namespace svt::table //...................................................................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/mousefunction.cxx b/svtools/source/table/mousefunction.cxx index 20d505e911e9..20d505e911e9 100755..100644 --- a/svtools/source/table/mousefunction.cxx +++ b/svtools/source/table/mousefunction.cxx diff --git a/svtools/source/table/mousefunction.hxx b/svtools/source/table/mousefunction.hxx index 2149026a0923..2149026a0923 100755..100644 --- a/svtools/source/table/mousefunction.hxx +++ b/svtools/source/table/mousefunction.hxx diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index 01a9b667a8f7..6ec1ec5e7121 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -43,7 +44,6 @@ using ::com::sun::star::accessibility::XAccessible; using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::lang; using namespace utl; - //...................................................................................................................... namespace svt { namespace table { @@ -312,7 +312,7 @@ namespace svt { namespace table aRetText = GetColumnName(_nCol); break; default: - OSL_ENSURE(0,"GridControl::GetAccessibleName: invalid enum!"); + OSL_FAIL("GridControl::GetAccessibleName: invalid enum!"); } return aRetText; } @@ -594,6 +594,7 @@ namespace svt { namespace table { ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_pImpl->getSelectHandler(), this ); } +//........................................................................ //------------------------------------------------------------------------------------------------------------------ void TableControl::SetSelectHdl( const Link& i_selectHandler ) @@ -606,7 +607,7 @@ namespace svt { namespace table { return m_pImpl->getSelectHandler(); } - -//...................................................................................................................... }} // namespace svt::table + //...................................................................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 8e481d27d993..bbcdbfaddeb6 100755..100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -130,7 +131,7 @@ namespace svt { namespace table } virtual PColumnModel getColumnModel( ColPos column ) { - DBG_ERROR( "EmptyTableModel::getColumnModel: invalid call!" ); + OSL_FAIL( "EmptyTableModel::getColumnModel: invalid call!" ); (void)column; return PColumnModel(); } @@ -300,7 +301,7 @@ namespace svt { namespace table if ( m_pModel->getRowCount() != m_nRowCount ) return "row counts are inconsistent!"; - if ( ( m_nCurColumn != COL_INVALID ) && !m_aColumnWidths.empty() && ( m_nCurColumn < 0 ) || ( m_nCurColumn >= (ColPos)m_aColumnWidths.size() ) ) + if ( ( ( m_nCurColumn != COL_INVALID ) && !m_aColumnWidths.empty() && ( m_nCurColumn < 0 ) ) || ( m_nCurColumn >= (ColPos)m_aColumnWidths.size() ) ) return "current column is invalid!"; if ( !lcl_checkLimitsExclusive_OrDefault_OrFallback( m_nTopRow, (RowPos)-1, m_nRowCount, getModel(), (RowPos)0 ) ) @@ -1840,7 +1841,7 @@ namespace svt { namespace table } break; default: - DBG_ERROR( "TableControl_Impl::dispatchAction: unsupported action!" ); + OSL_FAIL( "TableControl_Impl::dispatchAction: unsupported action!" ); break; } @@ -2740,3 +2741,5 @@ namespace svt { namespace table //...................................................................................................................... } } // namespace svt::table //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index bc1ac55fbe51..2f9cffd3089b 100755..100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -483,3 +484,5 @@ namespace svt { namespace table //........................................................................ #endif // SVTOOLS_TABLECONTROL_IMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index 11605e36c8b2..7c546421555d 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -238,3 +239,5 @@ namespace svt { namespace table //...................................................................................................................... } } // namespace svt::table //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/tabledatawindow.hxx b/svtools/source/table/tabledatawindow.hxx index 6f78ac49c44d..c26cd6ccd596 100644 --- a/svtools/source/table/tabledatawindow.hxx +++ b/svtools/source/table/tabledatawindow.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -27,9 +28,7 @@ #ifndef SVTOOLS_SOURCE_TABLE_TABLEDATAWINDOW_HXX #define SVTOOLS_SOURCE_TABLE_TABLEDATAWINDOW_HXX -#ifndef _SV_WINDOW_HXX #include <vcl/window.hxx> -#endif #include <vcl/seleng.hxx> //........................................................................ @@ -89,3 +88,5 @@ namespace svt { namespace table //........................................................................ #endif // SVTOOLS_SOURCE_TABLE_TABLEDATAWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/tablegeometry.cxx b/svtools/source/table/tablegeometry.cxx index 661079775daa..e00e21c28911 100644 --- a/svtools/source/table/tablegeometry.cxx +++ b/svtools/source/table/tablegeometry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -163,3 +164,5 @@ namespace svt { namespace table //...................................................................................................................... } } // namespace svt::table //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/tablegeometry.hxx b/svtools/source/table/tablegeometry.hxx index fedc7cb2f24f..9520e4992411 100644 --- a/svtools/source/table/tablegeometry.hxx +++ b/svtools/source/table/tablegeometry.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -170,3 +171,5 @@ namespace svt { namespace table //........................................................................ #endif // SVTOOLS_TABLEGEOMETRY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx index 4de76107fd20..f6c36d673691 100644 --- a/svtools/source/toolpanel/drawerlayouter.cxx +++ b/svtools/source/toolpanel/drawerlayouter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -87,7 +88,7 @@ namespace svt const size_t nUpperBound = !!aActivePanel ? *aActivePanel : nPanelCount - 1; for ( size_t i=0; i<=nUpperBound; ++i ) { - sal_uInt32 nDrawerHeight = m_aDrawers[i]->GetPreferredHeightPixel(); + long nDrawerHeight = m_aDrawers[i]->GetPreferredHeightPixel(); m_aDrawers[i]->SetPosSizePixel( aUpperDrawerPos, Size( nWidth, nDrawerHeight ) ); aUpperDrawerPos.Move( 0, nDrawerHeight ); @@ -97,7 +98,7 @@ namespace svt Point aLowerDrawerPos( i_rDeckPlayground.BottomLeft() ); for ( size_t j = nPanelCount - 1; j > nUpperBound; --j ) { - sal_uInt32 nDrawerHeight = m_aDrawers[j]->GetPreferredHeightPixel(); + long nDrawerHeight = m_aDrawers[j]->GetPreferredHeightPixel(); m_aDrawers[j]->SetPosSizePixel( Point( aLowerDrawerPos.X(), aLowerDrawerPos.Y() - nDrawerHeight + 1 ), Size( nWidth, nDrawerHeight ) @@ -303,3 +304,5 @@ namespace svt //...................................................................................................................... } // namespace svt //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx index 4de38b7f4bb3..a9bb28a097e8 100644 --- a/svtools/source/toolpanel/dummypanel.cxx +++ b/svtools/source/toolpanel/dummypanel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -105,3 +106,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx index d2ca4480fce5..8a34f429d726 100644 --- a/svtools/source/toolpanel/dummypanel.hxx +++ b/svtools/source/toolpanel/dummypanel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -68,3 +69,5 @@ namespace svt //........................................................................ #endif // DUMMYPANEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx index 32ba9b5c6a24..39a649e49de8 100755..100644 --- a/svtools/source/toolpanel/paneldecklisteners.cxx +++ b/svtools/source/toolpanel/paneldecklisteners.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -135,3 +136,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneldecklisteners.hxx b/svtools/source/toolpanel/paneldecklisteners.hxx index bc7e2ae7db88..5e794d52a1c6 100755..100644 --- a/svtools/source/toolpanel/paneldecklisteners.hxx +++ b/svtools/source/toolpanel/paneldecklisteners.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -70,3 +71,5 @@ namespace svt //........................................................................ #endif // PANELDECKLISTENERS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 7888039d8c57..ae4c7b4e3a3a 100755..100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -443,14 +444,14 @@ namespace svt { if ( i_rImpl.m_rPanelDeck.GetPanelCount() != i_rImpl.m_aItems.size() ) { - OSL_ENSURE( false, "lcl_checkConsistency: inconsistent array sizes!" ); + OSL_FAIL( "lcl_checkConsistency: inconsistent array sizes!" ); return; } for ( size_t i = 0; i < i_rImpl.m_rPanelDeck.GetPanelCount(); ++i ) { if ( i_rImpl.m_rPanelDeck.GetPanel( i ).get() != i_rImpl.m_aItems[i].pPanel.get() ) { - OSL_ENSURE( false, "lcl_checkConsistency: array elements are inconsistent!" ); + OSL_FAIL( "lcl_checkConsistency: array elements are inconsistent!" ); return; } } @@ -1097,16 +1098,21 @@ namespace svt ::boost::optional< size_t > aNewItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) ); if ( i_rMouseEvent.IsLeaveWindow() ) - aNewItem.reset(); - - if ( aOldItem != aNewItem ) + aNewItem = ::boost::optional< size_t >(); + + bool const bChanged( + ( !aOldItem && aNewItem ) + || ( aOldItem && !aNewItem ) + || ( aOldItem && aNewItem && aOldItem != aNewItem ) ) + ; + if ( bChanged ) { - if ( !!aOldItem ) + if ( aOldItem ) m_pImpl->InvalidateItem( *aOldItem ); m_pImpl->m_aHoveredItem = aNewItem; - if ( !!aNewItem ) + if ( aNewItem ) m_pImpl->InvalidateItem( *aNewItem ); } } @@ -1352,3 +1358,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneltabbarpeer.cxx b/svtools/source/toolpanel/paneltabbarpeer.cxx index d8329109ffb4..82b94ad7b4d3 100644 --- a/svtools/source/toolpanel/paneltabbarpeer.cxx +++ b/svtools/source/toolpanel/paneltabbarpeer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -34,6 +35,7 @@ /** === end UNO includes === **/ #include <tools/diagnose_ex.h> +#include <vcl/svapp.hxx> //........................................................................ namespace svt @@ -74,7 +76,7 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ Reference< XAccessibleContext > PanelTabBarPeer::CreateAccessibleContext() { - ::vos::OGuard aSolarGuard( GetMutex() ); + SolarMutexGuard aSolarGuard; if ( m_pTabBar == NULL ) throw DisposedException( ::rtl::OUString(), *this ); @@ -90,7 +92,7 @@ namespace svt void SAL_CALL PanelTabBarPeer::dispose() throw(RuntimeException) { { - ::vos::OGuard aSolarGuard( GetMutex() ); + SolarMutexGuard aSolarGuard; m_pTabBar = NULL; } VCLXWindow::dispose(); @@ -99,3 +101,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneltabbarpeer.hxx b/svtools/source/toolpanel/paneltabbarpeer.hxx index 7c2e5188d994..9918756f9cc8 100644 --- a/svtools/source/toolpanel/paneltabbarpeer.hxx +++ b/svtools/source/toolpanel/paneltabbarpeer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -67,3 +68,5 @@ namespace svt //........................................................................ #endif // SVT_PANELTABBARPEER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/refbase.cxx b/svtools/source/toolpanel/refbase.cxx index f41aa2d9bb9c..3c1b0c502235 100644 --- a/svtools/source/toolpanel/refbase.cxx +++ b/svtools/source/toolpanel/refbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -54,3 +55,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx index 45c40cee6ef2..6dd90addd6a4 100644 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ b/svtools/source/toolpanel/tabbargeometry.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -326,3 +327,5 @@ namespace svt //...................................................................................................................... } // namespace svt //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx index 059d69a3e233..86fcc98e7947 100644 --- a/svtools/source/toolpanel/tabbargeometry.hxx +++ b/svtools/source/toolpanel/tabbargeometry.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -135,3 +136,5 @@ namespace svt //...................................................................................................................... #endif // TABBARGEOMETRY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/tabitemdescriptor.hxx b/svtools/source/toolpanel/tabitemdescriptor.hxx index 8005816b0fe2..f88b3a4a0f15 100644 --- a/svtools/source/toolpanel/tabitemdescriptor.hxx +++ b/svtools/source/toolpanel/tabitemdescriptor.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -88,3 +89,5 @@ namespace svt //........................................................................ #endif // TABITEMDESCRIPTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index e93fc9fc1357..b9615dffc774 100755..100644 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -77,7 +78,7 @@ namespace svt { if ( !i_rData.pTabBar.get() ) { - OSL_ENSURE( false, "lcl_checkDisposed: already disposed!" ); + OSL_FAIL( "lcl_checkDisposed: already disposed!" ); return true; } return false; @@ -260,3 +261,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpanel.cxx b/svtools/source/toolpanel/toolpanel.cxx index f7b999494563..b340eb7f7d51 100644 --- a/svtools/source/toolpanel/toolpanel.cxx +++ b/svtools/source/toolpanel/toolpanel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -52,3 +53,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpanel.src b/svtools/source/toolpanel/toolpanel.src index 5908a8fbcf98..6170c1eed42f 100644 --- a/svtools/source/toolpanel/toolpanel.src +++ b/svtools/source/toolpanel/toolpanel.src @@ -41,17 +41,7 @@ Image IMG_TRIANGLE_RIGHT ImageBitmap = Bitmap { File = "triangle_right.png"; }; }; -Image IMG_TRIANGLE_RIGHT_HC -{ - ImageBitmap = Bitmap { File = "triangle_right_hc.png"; }; -}; - Image IMG_TRIANGLE_DOWN { ImageBitmap = Bitmap { File = "triangle_down.png"; }; }; - -Image IMG_TRIANGLE_DOWN_HC -{ - ImageBitmap = Bitmap { File = "plus.png"; } ; -}; diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx index baefbd92400f..13f738f507a7 100644 --- a/svtools/source/toolpanel/toolpanelcollection.cxx +++ b/svtools/source/toolpanel/toolpanelcollection.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -191,3 +192,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx index 2bdba38546c9..02100f33cf2a 100644 --- a/svtools/source/toolpanel/toolpanelcollection.hxx +++ b/svtools/source/toolpanel/toolpanelcollection.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -67,3 +68,5 @@ namespace svt //........................................................................ #endif // TOOLPANELCOLLECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index ae69b85dfecd..ccf3df37a527 100755..100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -558,3 +559,5 @@ namespace svt //........................................................................ } // namespace svt //........................................................................ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.cxx b/svtools/source/toolpanel/toolpaneldeckpeer.cxx index 0a84a90b4fb3..8565b30f0e0a 100755..100644 --- a/svtools/source/toolpanel/toolpaneldeckpeer.cxx +++ b/svtools/source/toolpanel/toolpaneldeckpeer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -34,6 +35,7 @@ /** === end UNO includes === **/ #include <tools/diagnose_ex.h> +#include <vcl/svapp.hxx> //...................................................................................................................... namespace svt @@ -74,7 +76,7 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ Reference< XAccessibleContext > ToolPanelDeckPeer::CreateAccessibleContext() { - ::vos::OGuard aSolarGuard( GetMutex() ); + SolarMutexGuard aSolarGuard; if ( m_pDeck == NULL ) throw DisposedException( ::rtl::OUString(), *this ); @@ -88,7 +90,7 @@ namespace svt void SAL_CALL ToolPanelDeckPeer::dispose() throw(RuntimeException) { { - ::vos::OGuard aSolarGuard( GetMutex() ); + SolarMutexGuard aSolarGuard; m_pDeck = NULL; } VCLXWindow::dispose(); @@ -97,3 +99,5 @@ namespace svt //...................................................................................................................... } // namespace svt //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.hxx b/svtools/source/toolpanel/toolpaneldeckpeer.hxx index 4b6607ecbd05..ce9bb65d1d28 100755..100644 --- a/svtools/source/toolpanel/toolpaneldeckpeer.hxx +++ b/svtools/source/toolpanel/toolpaneldeckpeer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -67,3 +68,5 @@ namespace svt //...................................................................................................................... #endif // SVT_TOOLPANELDECKPEER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index 1e7f2358a125..06712deb2775 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -158,25 +159,18 @@ namespace svt return aExpansionIndicatorArea; } - //------------------------------------------------------------------------------------------------------------------ + Image ToolPanelDrawer::impl_getExpansionIndicator() const { - const bool bHighContrastMode( GetSettings().GetStyleSettings().GetHighContrastMode() != 0 ); sal_uInt16 nResourceId = 0; if ( m_bExpanded ) - if ( bHighContrastMode ) - nResourceId = IMG_TRIANGLE_DOWN_HC; - else - nResourceId = IMG_TRIANGLE_DOWN; + nResourceId = IMG_TRIANGLE_DOWN; else - if ( bHighContrastMode ) - nResourceId = IMG_TRIANGLE_RIGHT_HC; - else - nResourceId = IMG_TRIANGLE_RIGHT; + nResourceId = IMG_TRIANGLE_RIGHT; return Image( SvtResId( nResourceId ) ); } - //------------------------------------------------------------------------------------------------------------------ + sal_uInt16 ToolPanelDrawer::impl_getTextStyle() const { const sal_uInt16 nBasicStyle = TEXT_DRAW_LEFT @@ -371,3 +365,5 @@ namespace svt //...................................................................................................................... } // namespace svt //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx index 4baf49dd17c9..943228a63030 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.hxx +++ b/svtools/source/toolpanel/toolpaneldrawer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -111,3 +112,5 @@ namespace svt //...................................................................................................................... } // namespace svt //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx index 959527330897..1d264dc3228d 100644 --- a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -38,6 +39,7 @@ #include <toolkit/awt/vclxaccessiblecomponent.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <vcl/vclevent.hxx> +#include <vcl/svapp.hxx> //...................................................................................................................... namespace svt @@ -133,10 +135,12 @@ namespace svt //------------------------------------------------------------------------------------------------------------------ Reference< XAccessibleContext > ToolPanelDrawerPeer::CreateAccessibleContext() { - ::vos::OGuard aSolarGuard( GetMutex() ); + SolarMutexGuard aSolarGuard; return new ToolPanelDrawerContext( *this ); } //...................................................................................................................... } // namespace svt //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.hxx b/svtools/source/toolpanel/toolpaneldrawerpeer.hxx index 5fcf0ac0ae7c..f2a7336b7033 100644 --- a/svtools/source/toolpanel/toolpaneldrawerpeer.hxx +++ b/svtools/source/toolpanel/toolpaneldrawerpeer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -54,3 +55,5 @@ namespace svt //...................................................................................................................... #endif // SVT_TOOLPANELDRAWERPEER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index 706afe09202f..8cb5a4945e2e 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -112,7 +113,7 @@ namespace svt OAddressBookSourceDialogUno::OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB) :OGenericUnoDialog(_rxORB) { - registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_ALIASES), UNODIALOG_PROPERTY_ID_ALIASES, PropertyAttribute::READONLY, + registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNODIALOG_PROPERTY_ALIASES)), UNODIALOG_PROPERTY_ID_ALIASES, PropertyAttribute::READONLY, &m_aAliases, getCppuType(&m_aAliases)); } @@ -138,7 +139,7 @@ namespace svt //------------------------------------------------------------------------- ::rtl::OUString OAddressBookSourceDialogUno::getImplementationName_Static() throw(RuntimeException) { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.OAddressBookSourceDialogUno"); + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.OAddressBookSourceDialogUno" )); } //------------------------------------------------------------------------- @@ -151,7 +152,7 @@ namespace svt ::comphelper::StringSequence OAddressBookSourceDialogUno::getSupportedServiceNames_Static() throw(RuntimeException) { ::comphelper::StringSequence aSupported(1); - aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.ui.AddressBookSourceDialog"); + aSupported.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.AddressBookSourceDialog" )); return aSupported; } @@ -239,3 +240,4 @@ namespace svt } // namespace svt // ....................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx index 5b7d7c709509..82ae79fa2c92 100644 --- a/svtools/source/uno/contextmenuhelper.cxx +++ b/svtools/source/uno/contextmenuhelper.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,7 +47,7 @@ #include <osl/conditn.hxx> #include <cppuhelper/weak.hxx> #include <comphelper/processfactory.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <vcl/image.hxx> #include <toolkit/unohlp.hxx> @@ -138,7 +139,7 @@ void SAL_CALL StateEventHelper::disposing( const lang::EventObject& ) throw ( uno::RuntimeException ) { - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; m_xDispatchProvider.clear(); m_xURLTransformer.clear(); m_aCondition.set(); @@ -148,7 +149,7 @@ void SAL_CALL StateEventHelper::statusChanged( const frame::FeatureStateEvent& Event ) throw ( uno::RuntimeException ) { - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; m_bCurrentCommandEnabled = Event.IsEnabled; m_aCondition.set(); } @@ -162,7 +163,7 @@ bool StateEventHelper::isCommandEnabled() uno::Reference< frame::XDispatch > xDispatch; util::URL aTargetURL; { - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; if ( m_xDispatchProvider.is() && m_xURLTransformer.is() ) { ::rtl::OUString aSelf( RTL_CONSTASCII_USTRINGPARAM( "_self" )); @@ -204,7 +205,7 @@ bool StateEventHelper::isCommandEnabled() { } - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; bResult = m_bCurrentCommandEnabled; } @@ -276,7 +277,7 @@ ContextMenuHelper::completeAndExecute( const Point& aPos, PopupMenu& rPopupMenu ) { - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; associateUIConfigurationManagers(); completeMenuProperties( &rPopupMenu ); @@ -289,7 +290,7 @@ ContextMenuHelper::completeAndExecute( const Point& aPos, const uno::Reference< awt::XPopupMenu >& xPopupMenu ) { - vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; VCLXMenu* pXMenu = VCLXMenu::GetImplementation( xPopupMenu ); if ( pXMenu ) @@ -503,15 +504,11 @@ ContextMenuHelper::associateUIConfigurationManagers() } Image -ContextMenuHelper::getImageFromCommandURL( - const ::rtl::OUString& aCmdURL, - bool bHiContrast ) const +ContextMenuHelper::getImageFromCommandURL( const ::rtl::OUString& aCmdURL ) const { Image aImage; sal_Int16 nImageType( ui::ImageType::COLOR_NORMAL| ui::ImageType::SIZE_DEFAULT ); - if ( bHiContrast ) - nImageType |= ui::ImageType::COLOR_HIGHCONTRAST; uno::Sequence< uno::Reference< graphic::XGraphic > > aGraphicSeq; uno::Sequence< ::rtl::OUString > aImageCmdSeq( 1 ); @@ -543,7 +540,7 @@ ContextMenuHelper::getImageFromCommandURL( { aGraphicSeq = m_xModuleImageMgr->getImages( nImageType, aImageCmdSeq ); uno::Reference< ::com::sun::star::graphic::XGraphic > xGraphic = aGraphicSeq[0]; - aImage = Image( xGraphic ); + aImage = Image( xGraphic ); if ( !!aImage ) return aImage; @@ -579,7 +576,7 @@ ContextMenuHelper::getLabelFromCommandURL( { for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) { - if ( aPropSeq[i].Name.equalsAscii( "Label" )) + if ( aPropSeq[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Label")) ) { aPropSeq[i].Value >>= aStr; break; @@ -608,7 +605,6 @@ ContextMenuHelper::completeMenuProperties( // menu correctly. const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); bool bShowMenuImages( rSettings.GetUseImagesInMenus() ); - bool bIsHiContrast( rSettings.GetHighContrastMode() ); if ( pMenu ) { @@ -638,7 +634,7 @@ ContextMenuHelper::completeMenuProperties( { Image aImage; if ( aCmdURL.getLength() > 0 ) - aImage = getImageFromCommandURL( aCmdURL, bIsHiContrast ); + aImage = getImageFromCommandURL( aCmdURL ); pMenu->SetItemImage( nId, aImage ); } else @@ -685,3 +681,5 @@ IMPL_STATIC_LINK_NOINSTANCE( ContextMenuHelper, ExecuteHdl_Impl, ExecuteInfo*, p } } // namespace svt + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/framestatuslistener.cxx b/svtools/source/uno/framestatuslistener.cxx index f7a0540f6eb4..2c228f28e5e6 100644 --- a/svtools/source/uno/framestatuslistener.cxx +++ b/svtools/source/uno/framestatuslistener.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,7 +31,7 @@ #include <svtools/framestatuslistener.hxx> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/DisposedException.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> using namespace ::cppu; @@ -61,13 +62,13 @@ FrameStatusListener::~FrameStatusListener() Reference< XFrame > FrameStatusListener::getFrameInterface() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; return m_xFrame; } Reference< XMultiServiceFactory > FrameStatusListener::getServiceManager() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; return m_xServiceManager; } @@ -105,7 +106,7 @@ throw (::com::sun::star::uno::RuntimeException) { Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); @@ -155,7 +156,7 @@ throw ( RuntimeException ) { Reference< XInterface > xSource( Source.Source ); - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); while ( pIter != m_aListenerMap.end() ) @@ -192,7 +193,7 @@ void FrameStatusListener::addStatusListener( const rtl::OUString& aCommandURL ) com::sun::star::util::URL aTargetURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL ); // Already in the list of status listener. Do nothing. @@ -203,7 +204,7 @@ void FrameStatusListener::addStatusListener( const rtl::OUString& aCommandURL ) // intialize is called. if ( !m_bInitialized ) { - // Put into the hash_map of status listener. Will be activated when initialized is called + // Put into the boost::unordered_map of status listener. Will be activated when initialized is called m_aListenerMap.insert( URLToDispatchMap::value_type( aCommandURL, Reference< XDispatch >() )); return; } @@ -255,7 +256,7 @@ void FrameStatusListener::addStatusListener( const rtl::OUString& aCommandURL ) void FrameStatusListener::removeStatusListener( const rtl::OUString& aCommandURL ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL ); if ( pIter != m_aListenerMap.end() ) @@ -288,7 +289,7 @@ void FrameStatusListener::bindListener() Reference< XStatusListener > xStatusListener; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return; @@ -359,7 +360,7 @@ void FrameStatusListener::bindListener() void FrameStatusListener::unbindListener() { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return; @@ -405,7 +406,7 @@ void FrameStatusListener::updateStatus( const rtl::OUString aCommandURL ) com::sun::star::util::URL aTargetURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return; @@ -442,3 +443,5 @@ void FrameStatusListener::updateStatus( const rtl::OUString aCommandURL ) } } // svt + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx index 33ec21a189f8..0c3ef6129e5a 100644 --- a/svtools/source/uno/generictoolboxcontroller.cxx +++ b/svtools/source/uno/generictoolboxcontroller.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,7 +47,7 @@ //_________________________________________________________________________________________________________________ // other includes //_________________________________________________________________________________________________________________ -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> using namespace ::com::sun::star::awt; @@ -91,7 +92,7 @@ GenericToolboxController::~GenericToolboxController() void SAL_CALL GenericToolboxController::dispose() throw ( RuntimeException ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; svt::ToolboxController::dispose(); @@ -107,7 +108,7 @@ throw ( RuntimeException ) ::rtl::OUString aCommandURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); @@ -148,7 +149,7 @@ throw ( RuntimeException ) void GenericToolboxController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) return; @@ -206,3 +207,5 @@ IMPL_STATIC_LINK_NOINSTANCE( GenericToolboxController, ExecuteHdl_Impl, ExecuteI } } // namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx index a1fdc7840a55..065c6207317a 100644 --- a/svtools/source/uno/genericunodialog.cxx +++ b/svtools/source/uno/genericunodialog.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -40,7 +41,7 @@ #include <osl/diagnose.h> #include <tools/diagnose_ex.h> #include <vcl/msgbox.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> using namespace ::comphelper; @@ -66,9 +67,9 @@ OGenericUnoDialog::OGenericUnoDialog(const Reference< XMultiServiceFactory >& _r ,m_bNeedInitialization( false ) ,m_aContext( _rxORB ) { - registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_TITLE), UNODIALOG_PROPERTY_ID_TITLE, PropertyAttribute::TRANSIENT, + registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNODIALOG_PROPERTY_TITLE)), UNODIALOG_PROPERTY_ID_TITLE, PropertyAttribute::TRANSIENT, &m_sTitle, getCppuType(&m_sTitle)); - registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_PARENT), UNODIALOG_PROPERTY_ID_PARENT, PropertyAttribute::TRANSIENT, + registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNODIALOG_PROPERTY_PARENT)), UNODIALOG_PROPERTY_ID_PARENT, PropertyAttribute::TRANSIENT, &m_xParent, getCppuType(&m_xParent)); } @@ -83,9 +84,9 @@ OGenericUnoDialog::OGenericUnoDialog(const Reference< XComponentContext >& _rxCo ,m_bNeedInitialization( false ) ,m_aContext(_rxContext) { - registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_TITLE), UNODIALOG_PROPERTY_ID_TITLE, PropertyAttribute::TRANSIENT, + registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNODIALOG_PROPERTY_TITLE)), UNODIALOG_PROPERTY_ID_TITLE, PropertyAttribute::TRANSIENT, &m_sTitle, getCppuType(&m_sTitle)); - registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_PARENT), UNODIALOG_PROPERTY_ID_PARENT, PropertyAttribute::TRANSIENT, + registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNODIALOG_PROPERTY_PARENT)), UNODIALOG_PROPERTY_ID_PARENT, PropertyAttribute::TRANSIENT, &m_xParent, getCppuType(&m_xParent)); } @@ -94,7 +95,7 @@ OGenericUnoDialog::~OGenericUnoDialog() { if ( m_pDialog ) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); if ( m_pDialog ) destroyDialog(); @@ -188,7 +189,7 @@ void SAL_CALL OGenericUnoDialog::setTitle( const ::rtl::OUString& _rTitle ) thro try { - setPropertyValue(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_TITLE), makeAny(_rTitle)); + setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNODIALOG_PROPERTY_TITLE)), makeAny(_rTitle)); } catch(RuntimeException&) { @@ -241,7 +242,7 @@ bool OGenericUnoDialog::impl_ensureDialog_lck() sal_Int16 SAL_CALL OGenericUnoDialog::execute( ) throw(RuntimeException) { // both creation and execution of the dialog must be guarded with the SolarMutex, so be generous here - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; Dialog* pDialogToExecute = NULL; // create the dialog, if neccessary @@ -371,3 +372,4 @@ IMPL_LINK( OGenericUnoDialog, OnDialogDying, VclWindowEvent*, _pEvent ) } // namespace svt //......................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index 34984976bf07..c652b6028bf0 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -113,7 +114,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( { Sequence< OUString > aServiceNames(1); aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ); + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.AddressBookSourceDialog" )); xFactory = ::cppu::createSingleFactory ( reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), @@ -126,7 +127,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( { Sequence< OUString > aServiceNames(1); aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ); + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilterOptionsDialog" )); xFactory = ::cppu::createSingleFactory ( reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), @@ -168,3 +169,4 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( } // "C" +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index ac75a1b9a24b..1c1412193c06 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -48,13 +49,11 @@ // includes of other projects //_________________________________________________________________________________________________________________ -#ifndef _VCL_MENU_HXX_ #include <vcl/menu.hxx> -#endif #include <vcl/svapp.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/logfile.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -113,7 +112,7 @@ void PopupMenuControllerBase::resetPopupMenu( com::sun::star::uno::Reference< co pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu ); if ( pPopupMenu ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); pVCLPopupMenu->Clear(); @@ -372,9 +371,9 @@ void SAL_CALL PopupMenuControllerBase::initialize( const Sequence< Any >& aArgum { if ( aArguments[i] >>= aPropValue ) { - if ( aPropValue.Name.equalsAscii( "Frame" )) + if ( aPropValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Frame")) ) aPropValue.Value >>= xFrame; - else if ( aPropValue.Name.equalsAscii( "CommandURL" )) + else if ( aPropValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("CommandURL")) ) aPropValue.Value >>= aCommandURL; } } @@ -397,7 +396,7 @@ void SAL_CALL PopupMenuControllerBase::setPopupMenu( const Reference< awt::XPopu if ( m_xFrame.is() && !m_xPopupMenu.is() ) { // Create popup menu on demand - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; m_xPopupMenu = xPopupMenu; m_xPopupMenu->addMenuListener( Reference< awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY )); @@ -418,3 +417,5 @@ void PopupMenuControllerBase::impl_setPopupMenu() { } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index 4fbaff23714d..03368204401b 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -256,3 +257,4 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createItemWindow( cons } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx index 8dde75dc7fc3..a64117823c60 100644 --- a/svtools/source/uno/statusbarcontroller.cxx +++ b/svtools/source/uno/statusbarcontroller.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <vcl/status.hxx> @@ -84,19 +85,19 @@ StatusbarController::~StatusbarController() Reference< XFrame > StatusbarController::getFrameInterface() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; return m_xFrame; } Reference< XMultiServiceFactory > StatusbarController::getServiceManager() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; return m_xServiceManager; } Reference< XLayoutManager > StatusbarController::getLayoutManager() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; Reference< XLayoutManager > xLayoutManager; Reference< XPropertySet > xPropSet( m_xFrame, UNO_QUERY ); if ( xPropSet.is() ) @@ -117,7 +118,7 @@ Reference< XLayoutManager > StatusbarController::getLayoutManager() const Reference< XURLTransformer > StatusbarController::getURLTransformer() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_xURLTransformer.is() && m_xServiceManager.is() ) { m_xURLTransformer = Reference< XURLTransformer >( @@ -170,7 +171,7 @@ throw ( Exception, RuntimeException ) bool bInitialized( true ); { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); @@ -180,7 +181,7 @@ throw ( Exception, RuntimeException ) if ( !bInitialized ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; m_bInitialized = sal_True; PropertyValue aPropValue; @@ -188,15 +189,15 @@ throw ( Exception, RuntimeException ) { if ( aArguments[i] >>= aPropValue ) { - if ( aPropValue.Name.equalsAscii( "Frame" )) + if ( aPropValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Frame")) ) aPropValue.Value >>= m_xFrame; - else if ( aPropValue.Name.equalsAscii( "CommandURL" )) + else if ( aPropValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("CommandURL")) ) aPropValue.Value >>= m_aCommandURL; - else if ( aPropValue.Name.equalsAscii( "ServiceManager" )) + else if ( aPropValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ServiceManager")) ) aPropValue.Value >>= m_xServiceManager; - else if ( aPropValue.Name.equalsAscii( "ParentWindow" )) + else if ( aPropValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ParentWindow")) ) aPropValue.Value >>= m_xParentWindow; - else if ( aPropValue.Name.equalsAscii( "Identifier" )) + else if ( aPropValue.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Identifier")) ) aPropValue.Value >>= m_nID; } } @@ -210,7 +211,7 @@ void SAL_CALL StatusbarController::update() throw ( RuntimeException ) { { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); } @@ -226,7 +227,7 @@ throw (::com::sun::star::uno::RuntimeException) Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); } @@ -234,7 +235,7 @@ throw (::com::sun::star::uno::RuntimeException) com::sun::star::lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); Reference< XURLTransformer > xURLTransformer = getURLTransformer(); URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); @@ -287,7 +288,7 @@ throw ( RuntimeException ) { Reference< XInterface > xSource( Source.Source ); - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) return; @@ -299,7 +300,7 @@ throw ( RuntimeException ) Reference< XInterface > xIfac( pIter->second, UNO_QUERY ); if ( xSource == xIfac ) pIter->second.clear(); - pIter++; + ++pIter; } Reference< XInterface > xIfac( m_xFrame, UNO_QUERY ); @@ -311,7 +312,7 @@ throw ( RuntimeException ) void SAL_CALL StatusbarController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) return; @@ -376,7 +377,7 @@ throw (::com::sun::star::uno::RuntimeException) void SAL_CALL StatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) return; @@ -392,7 +393,7 @@ void StatusbarController::addStatusListener( const rtl::OUString& aCommandURL ) com::sun::star::util::URL aTargetURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL ); // Already in the list of status listener. Do nothing. @@ -403,7 +404,7 @@ void StatusbarController::addStatusListener( const rtl::OUString& aCommandURL ) // intialize is called. if ( !m_bInitialized ) { - // Put into the hash_map of status listener. Will be activated when initialized is called + // Put into the boost::unordered_map of status listener. Will be activated when initialized is called m_aListenerMap.insert( URLToDispatchMap::value_type( aCommandURL, Reference< XDispatch >() )); return; } @@ -453,7 +454,7 @@ void StatusbarController::addStatusListener( const rtl::OUString& aCommandURL ) void StatusbarController::removeStatusListener( const rtl::OUString& aCommandURL ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL ); if ( pIter != m_aListenerMap.end() ) @@ -484,7 +485,7 @@ void StatusbarController::bindListener() Reference< XStatusListener > xStatusListener; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return; @@ -573,7 +574,7 @@ void StatusbarController::bindListener() void StatusbarController::unbindListener() { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return; @@ -612,7 +613,7 @@ void StatusbarController::unbindListener() sal_Bool StatusbarController::isBound() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return sal_False; @@ -636,7 +637,7 @@ void StatusbarController::updateStatus( const rtl::OUString aCommandURL ) com::sun::star::util::URL aTargetURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return; @@ -675,7 +676,7 @@ void StatusbarController::updateStatus( const rtl::OUString aCommandURL ) ::Rectangle aRect; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); @@ -698,7 +699,7 @@ void StatusbarController::execute( const ::com::sun::star::uno::Sequence< ::com: rtl::OUString aCommandURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); @@ -740,7 +741,7 @@ void StatusbarController::execute( com::sun::star::util::URL aTargetURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); @@ -780,3 +781,5 @@ void StatusbarController::execute( } } // svt + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx index 0e826ef6bff3..778925a60c44 100644 --- a/svtools/source/uno/svtxgridcontrol.cxx +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,6 +47,8 @@ #include <com/sun/star/util/Color.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> +#include <vcl/svapp.hxx> + using namespace ::svt::table; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt::grid; @@ -80,7 +83,7 @@ void SVTXGridControl::SetWindow( Window* pWindow ) // --------------------------------------------------------------------------------------------------------------------- sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getRowAtPoint: no control (anymore)!", -1 ); @@ -92,7 +95,7 @@ sal_Int32 SAL_CALL SVTXGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) // --------------------------------------------------------------------------------------------------------------------- sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getColumnAtPoint: no control (anymore)!", -1 ); @@ -104,7 +107,7 @@ sal_Int32 SAL_CALL SVTXGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 // --------------------------------------------------------------------------------------------------------------------- sal_Int32 SAL_CALL SVTXGridControl::getCurrentColumn( ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentColumn: no control (anymore)!", -1 ); @@ -116,7 +119,7 @@ sal_Int32 SAL_CALL SVTXGridControl::getCurrentColumn( ) throw (RuntimeException // --------------------------------------------------------------------------------------------------------------------- sal_Int32 SAL_CALL SVTXGridControl::getCurrentRow( ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getCurrentRow: no control (anymore)!", -1 ); @@ -140,7 +143,7 @@ void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::u // --------------------------------------------------------------------------------------------------------------------- void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN_VOID( pTable != NULL, "SVTXGridControl::setProperty: no control (anymore)!" ); @@ -383,7 +386,7 @@ namespace Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getProperty: no control (anymore)!", Any() ); @@ -513,7 +516,7 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL SVTXGridControl::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; m_pTableModel->notifyRowsInserted( i_event ); } @@ -521,14 +524,14 @@ void SAL_CALL SVTXGridControl::rowsInserted( const GridDataEvent& i_event ) thro void SAL_CALL//---------------------------------------------------------------------------------------------------------------------- SVTXGridControl::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; m_pTableModel->notifyRowsRemoved( i_event ); } //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL SVTXGridControl::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; m_pTableModel->notifyDataChanged( i_event ); @@ -542,7 +545,7 @@ void SAL_CALL SVTXGridControl::dataChanged( const GridDataEvent& i_event ) throw //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL SVTXGridControl::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; OSL_UNUSED( i_event ); TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); @@ -555,7 +558,7 @@ void SAL_CALL SVTXGridControl::rowHeadingChanged( const GridDataEvent& i_event ) //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL SVTXGridControl::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; Reference< XGridColumn > const xGridColumn( i_event.Element, UNO_QUERY_THROW ); @@ -567,7 +570,7 @@ void SAL_CALL SVTXGridControl::elementInserted( const ContainerEvent& i_event ) //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL SVTXGridControl::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; sal_Int32 nIndex( -1 ); OSL_VERIFY( i_event.Accessor >>= nIndex ); @@ -593,7 +596,7 @@ void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObj //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectRow: no control (anymore)!" ); @@ -604,7 +607,7 @@ void SAL_CALL SVTXGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com: //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::selectAllRows: no control (anymore)!" ); @@ -615,7 +618,7 @@ void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::Run //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectRow: no control (anymore)!" ); @@ -626,7 +629,7 @@ void SAL_CALL SVTXGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::co //---------------------------------------------------------------------------------------------------------------------- void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN_VOID( pTable, "SVTXGridControl::deselectAllRows: no control (anymore)!" ); @@ -637,7 +640,7 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::R //---------------------------------------------------------------------------------------------------------------------- ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelection: no control (anymore)!", Sequence< sal_Int32 >() ); @@ -652,7 +655,7 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::R //---------------------------------------------------------------------------------------------------------------------- ::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN( pTable, "SVTXGridControl::getSelection: no control (anymore)!", sal_True ); @@ -663,7 +666,7 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::R //---------------------------------------------------------------------------------------------------------------------- ::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex( ::sal_Int32 index ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() ); ENSURE_OR_RETURN( pTable, "SVTXGridControl::isSelectedIndex: no control (anymore)!", sal_False ); @@ -683,7 +686,7 @@ void SVTXGridControl::dispose() throw(::com::sun::star::uno::RuntimeException) //---------------------------------------------------------------------------------------------------------------------- void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this ); switch ( rVclWindowEvent.GetId() ) @@ -778,3 +781,4 @@ void SVTXGridControl::impl_updateColumnsFromModel_nothrow() } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx index 525327b3c760..6e4eb807667e 100755..100644 --- a/svtools/source/uno/svtxgridcontrol.hxx +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -117,3 +118,5 @@ private: void impl_checkTableModelInit(); }; #endif // _SVT_GRIDCONTROL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 254dbae12f68..110a9d3f4ce5 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -33,7 +34,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <svtools/imgdef.hxx> #include <svtools/miscopt.hxx> @@ -136,13 +137,13 @@ ToolboxController::~ToolboxController() Reference< XFrame > ToolboxController::getFrameInterface() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; return m_xFrame; } Reference< XMultiServiceFactory > ToolboxController::getServiceManager() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; return m_xServiceManager; } @@ -151,7 +152,7 @@ Reference< XLayoutManager > ToolboxController::getLayoutManager() const Reference< XLayoutManager > xLayoutManager; Reference< XPropertySet > xPropSet; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; xPropSet = Reference< XPropertySet >( m_xFrame, UNO_QUERY ); } @@ -209,7 +210,7 @@ throw ( Exception, RuntimeException ) bool bInitialized( true ); { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); @@ -219,7 +220,7 @@ throw ( Exception, RuntimeException ) if ( !bInitialized ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; m_bInitialized = sal_True; //shizhoubo add m_bSupportVisiable = sal_False; @@ -261,7 +262,7 @@ void SAL_CALL ToolboxController::update() throw ( RuntimeException ) { { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); } @@ -277,7 +278,7 @@ throw (::com::sun::star::uno::RuntimeException) Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); } @@ -285,7 +286,7 @@ throw (::com::sun::star::uno::RuntimeException) com::sun::star::lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); while ( pIter != m_aListenerMap.end() ) @@ -330,7 +331,7 @@ throw ( RuntimeException ) { Reference< XInterface > xSource( Source.Source ); - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) return; @@ -365,7 +366,7 @@ throw (::com::sun::star::uno::RuntimeException) ::rtl::OUString aCommandURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( m_bDisposed ) throw DisposedException(); @@ -434,7 +435,7 @@ void ToolboxController::addStatusListener( const rtl::OUString& aCommandURL ) com::sun::star::util::URL aTargetURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL ); // Already in the list of status listener. Do nothing. @@ -445,7 +446,7 @@ void ToolboxController::addStatusListener( const rtl::OUString& aCommandURL ) // intialize is called. if ( !m_bInitialized ) { - // Put into the hash_map of status listener. Will be activated when initialized is called + // Put into the boost::unordered_map of status listener. Will be activated when initialized is called m_aListenerMap.insert( URLToDispatchMap::value_type( aCommandURL, Reference< XDispatch >() )); return; } @@ -495,7 +496,7 @@ void ToolboxController::addStatusListener( const rtl::OUString& aCommandURL ) void ToolboxController::removeStatusListener( const rtl::OUString& aCommandURL ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; URLToDispatchMap::iterator pIter = m_aListenerMap.find( aCommandURL ); if ( pIter != m_aListenerMap.end() ) @@ -526,7 +527,7 @@ void ToolboxController::bindListener() Reference< XStatusListener > xStatusListener; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return; @@ -615,7 +616,7 @@ void ToolboxController::bindListener() void ToolboxController::unbindListener() { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return; @@ -654,7 +655,7 @@ void ToolboxController::unbindListener() sal_Bool ToolboxController::isBound() const { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return sal_False; @@ -671,22 +672,6 @@ sal_Bool ToolboxController::hasBigImages() const return SvtMiscOptions().AreCurrentSymbolsLarge(); } -sal_Bool ToolboxController::isHighContrast() const -{ - sal_Bool bHighContrast( sal_False ); - - Reference< XWindow > xWindow = m_pImpl->m_xParentWindow; - if ( xWindow.is() ) - { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - bHighContrast = ( ((ToolBox *)pWindow)->GetSettings().GetStyleSettings().GetHighContrastMode() ); - } - - return bHighContrast; -} - void ToolboxController::updateStatus() { bindListener(); @@ -699,7 +684,7 @@ void ToolboxController::updateStatus( const rtl::OUString aCommandURL ) com::sun::star::util::URL aTargetURL; { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarMutexGuard; if ( !m_bInitialized ) return; @@ -881,3 +866,5 @@ bool ToolboxController::getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox ) //end } // svt + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index c36368023a22..83d419ee50bb 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,6 +43,7 @@ #include <rtl/ref.hxx> #include <vcl/graph.hxx> +#include <vcl/svapp.hxx> #include <svtools/svtreebx.hxx> #include <map> @@ -76,15 +78,6 @@ public: sal_Int32& mrLock; }; -// -------------------------------------------------------------------- - -class ImplGraphicItem : public SvLBoxBmp -{ -public: - ImplGraphicItem( SvLBoxEntry* pEntry, sal_uInt16 nFlags, Image& aImage ) : SvLBoxBmp( pEntry, nFlags, aImage ) {} - - OUString msGraphicURL; -}; // -------------------------------------------------------------------- @@ -123,7 +116,7 @@ private: // -------------------------------------------------------------------- -class SVT_DLLPUBLIC UnoTreeListItem : public SvLBoxItem +class UnoTreeListItem : public SvLBoxItem { public: UnoTreeListItem( SvLBoxEntry* ); @@ -486,7 +479,7 @@ UnoTreeListBoxImpl& TreeControlPeer::getTreeListBoxOrThrow() const throw (Runtim void TreeControlPeer::ChangeNodesSelection( const Any& rSelection, bool bSelect, bool bSetSelection ) throw( RuntimeException, IllegalArgumentException ) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); @@ -548,7 +541,7 @@ void TreeControlPeer::ChangeNodesSelection( const Any& rSelection, bool bSelect, sal_Bool SAL_CALL TreeControlPeer::select( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ChangeNodesSelection( rSelection, true, true ); return sal_True; } @@ -557,7 +550,7 @@ sal_Bool SAL_CALL TreeControlPeer::select( const Any& rSelection ) throw (Illega Any SAL_CALL TreeControlPeer::getSelection() throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); @@ -624,7 +617,7 @@ void SAL_CALL TreeControlPeer::removeSelection( const Any& rSelection ) throw (I void SAL_CALL TreeControlPeer::clearSelection() throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; getTreeListBoxOrThrow().SelectAll( sal_False ); } @@ -632,7 +625,7 @@ void SAL_CALL TreeControlPeer::clearSelection() throw (RuntimeException) sal_Int32 SAL_CALL TreeControlPeer::getSelectionCount() throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; return getTreeListBoxOrThrow().GetSelectionCount(); } @@ -678,7 +671,7 @@ Any SAL_CALL TreeSelectionEnumeration::nextElement() throw (NoSuchElementExcepti Reference< XEnumeration > SAL_CALL TreeControlPeer::createSelectionEnumeration() throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); @@ -702,7 +695,7 @@ Reference< XEnumeration > SAL_CALL TreeControlPeer::createSelectionEnumeration() Reference< XEnumeration > SAL_CALL TreeControlPeer::createReverseSelectionEnumeration() throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); @@ -728,7 +721,7 @@ Reference< XEnumeration > SAL_CALL TreeControlPeer::createReverseSelectionEnumer OUString SAL_CALL TreeControlPeer::getDefaultExpandedGraphicURL() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; return msDefaultExpandedGraphicURL; } @@ -736,7 +729,7 @@ OUString SAL_CALL TreeControlPeer::getDefaultExpandedGraphicURL() throw (::com:: void SAL_CALL TreeControlPeer::setDefaultExpandedGraphicURL( const ::rtl::OUString& sDefaultExpandedGraphicURL ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; if( msDefaultExpandedGraphicURL != sDefaultExpandedGraphicURL ) { if( sDefaultExpandedGraphicURL.getLength() ) @@ -766,7 +759,7 @@ void SAL_CALL TreeControlPeer::setDefaultExpandedGraphicURL( const ::rtl::OUStri OUString SAL_CALL TreeControlPeer::getDefaultCollapsedGraphicURL() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; return msDefaultCollapsedGraphicURL; } @@ -774,7 +767,7 @@ OUString SAL_CALL TreeControlPeer::getDefaultCollapsedGraphicURL() throw (::com: void SAL_CALL TreeControlPeer::setDefaultCollapsedGraphicURL( const ::rtl::OUString& sDefaultCollapsedGraphicURL ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; if( msDefaultCollapsedGraphicURL != sDefaultCollapsedGraphicURL ) { if( sDefaultCollapsedGraphicURL.getLength() ) @@ -804,7 +797,7 @@ void SAL_CALL TreeControlPeer::setDefaultCollapsedGraphicURL( const ::rtl::OUStr sal_Bool SAL_CALL TreeControlPeer::isNodeExpanded( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); UnoTreeListEntry* pEntry = getEntry( xNode ); @@ -815,7 +808,7 @@ sal_Bool SAL_CALL TreeControlPeer::isNodeExpanded( const Reference< XTreeNode >& sal_Bool SAL_CALL TreeControlPeer::isNodeCollapsed( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; return !isNodeExpanded( xNode ); } @@ -823,7 +816,7 @@ sal_Bool SAL_CALL TreeControlPeer::isNodeCollapsed( const Reference< XTreeNode > void SAL_CALL TreeControlPeer::makeNodeVisible( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); UnoTreeListEntry* pEntry = getEntry( xNode ); @@ -835,7 +828,7 @@ void SAL_CALL TreeControlPeer::makeNodeVisible( const Reference< XTreeNode >& xN sal_Bool SAL_CALL TreeControlPeer::isNodeVisible( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); UnoTreeListEntry* pEntry = getEntry( xNode ); @@ -846,7 +839,7 @@ sal_Bool SAL_CALL TreeControlPeer::isNodeVisible( const Reference< XTreeNode >& void SAL_CALL TreeControlPeer::expandNode( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); UnoTreeListEntry* pEntry = getEntry( xNode ); @@ -858,7 +851,7 @@ void SAL_CALL TreeControlPeer::expandNode( const Reference< XTreeNode >& xNode ) void SAL_CALL TreeControlPeer::collapseNode( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); UnoTreeListEntry* pEntry = getEntry( xNode ); @@ -884,7 +877,7 @@ void SAL_CALL TreeControlPeer::removeTreeExpansionListener( const Reference< XTr Reference< XTreeNode > SAL_CALL TreeControlPeer::getNodeForLocation( sal_Int32 x, sal_Int32 y ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); @@ -902,7 +895,7 @@ Reference< XTreeNode > SAL_CALL TreeControlPeer::getNodeForLocation( sal_Int32 x Reference< XTreeNode > SAL_CALL TreeControlPeer::getClosestNodeForLocation( sal_Int32 x, sal_Int32 y ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); @@ -920,7 +913,7 @@ Reference< XTreeNode > SAL_CALL TreeControlPeer::getClosestNodeForLocation( sal_ awt::Rectangle SAL_CALL TreeControlPeer::getNodeRect( const Reference< XTreeNode >& i_Node ) throw (IllegalArgumentException, RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); UnoTreeListEntry* pEntry = getEntry( i_Node, true ); @@ -933,7 +926,7 @@ awt::Rectangle SAL_CALL TreeControlPeer::getNodeRect( const Reference< XTreeNode sal_Bool SAL_CALL TreeControlPeer::isEditing( ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); return rTree.IsEditingActive() ? sal_True : sal_False; @@ -943,7 +936,7 @@ sal_Bool SAL_CALL TreeControlPeer::isEditing( ) throw (RuntimeException) sal_Bool SAL_CALL TreeControlPeer::stopEditing() throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); if( rTree.IsEditingActive() ) @@ -961,7 +954,7 @@ sal_Bool SAL_CALL TreeControlPeer::stopEditing() throw (RuntimeException) void SAL_CALL TreeControlPeer::cancelEditing( ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); rTree.EndEditing(sal_False); @@ -971,7 +964,7 @@ void SAL_CALL TreeControlPeer::cancelEditing( ) throw (RuntimeException) void SAL_CALL TreeControlPeer::startEditingAtNode( const Reference< XTreeNode >& xNode ) throw (IllegalArgumentException, RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); UnoTreeListEntry* pEntry = getEntry( xNode ); @@ -1041,7 +1034,7 @@ bool TreeControlPeer::onEditedEntry( UnoTreeListEntry* pEntry, const XubString& void SAL_CALL TreeControlPeer::treeNodesChanged( const ::com::sun::star::awt::tree::TreeDataModelEvent& rEvent ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; if( mnEditLock != 0 ) return; @@ -1051,7 +1044,7 @@ void SAL_CALL TreeControlPeer::treeNodesChanged( const ::com::sun::star::awt::tr void SAL_CALL TreeControlPeer::treeNodesInserted( const ::com::sun::star::awt::tree::TreeDataModelEvent& rEvent ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; if( mnEditLock != 0 ) return; @@ -1061,7 +1054,7 @@ void SAL_CALL TreeControlPeer::treeNodesInserted( const ::com::sun::star::awt::t void SAL_CALL TreeControlPeer::treeNodesRemoved( const ::com::sun::star::awt::tree::TreeDataModelEvent& rEvent ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; if( mnEditLock != 0 ) return; @@ -1071,7 +1064,7 @@ void SAL_CALL TreeControlPeer::treeNodesRemoved( const ::com::sun::star::awt::tr void SAL_CALL TreeControlPeer::treeStructureChanged( const ::com::sun::star::awt::tree::TreeDataModelEvent& rEvent ) throw (RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; if( mnEditLock != 0 ) return; @@ -1241,7 +1234,7 @@ OUString TreeControlPeer::getEntryString( const Any& rValue ) void SAL_CALL TreeControlPeer::disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException) { // model is disposed, so we clear our tree - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); rTree.Clear(); mxDataModel.clear(); @@ -1281,7 +1274,7 @@ void TreeControlPeer::onChangeDataModel( UnoTreeListBoxImpl& rTree, const Refere ::com::sun::star::awt::Size TreeControlPeer::getMinimumSize() throw(RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Size aSz; /* todo @@ -1299,7 +1292,7 @@ void TreeControlPeer::onChangeDataModel( UnoTreeListBoxImpl& rTree, const Refere ::com::sun::star::awt::Size TreeControlPeer::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Size aSz = rNewSize; /* todo @@ -1316,7 +1309,7 @@ void TreeControlPeer::onChangeDataModel( UnoTreeListBoxImpl& rTree, const Refere void TreeControlPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); @@ -1419,7 +1412,7 @@ void TreeControlPeer::setProperty( const ::rtl::OUString& PropertyName, const An Any TreeControlPeer::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; const sal_uInt16 nPropId = GetPropertyId( PropertyName ); if( (nPropId >= BASEPROPERTY_TREE_START) && (nPropId <= BASEPROPERTY_TREE_END) ) @@ -1763,3 +1756,5 @@ UnoTreeListEntry::~UnoTreeListEntry() if( mpPeer ) mpPeer->removeEntry( this ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx index 66ab96c60ff1..4c13acde8648 100644 --- a/svtools/source/uno/treecontrolpeer.hxx +++ b/svtools/source/uno/treecontrolpeer.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -37,7 +38,6 @@ #include <vcl/image.hxx> -//#include <comphelper/uno3.hxx> #include <cppuhelper/implbase2.hxx> @@ -172,3 +172,5 @@ private: }; #endif // _TREE_CONTROL_PEER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index 933363115810..73085561e542 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -46,7 +47,7 @@ #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> // ..................................................................................................................... namespace svt { namespace table @@ -891,3 +892,4 @@ namespace svt { namespace table // ..................................................................................................................... } } // svt::table // ..................................................................................................................... +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx index 537c3d9a5249..d804ca0f03b4 100644 --- a/svtools/source/uno/unocontroltablemodel.hxx +++ b/svtools/source/uno/unocontroltablemodel.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -165,3 +166,5 @@ namespace svt { namespace table // ..................................................................................................................... #endif // _UNOCONTROL_TABLEMODEL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx index 0f8bc91d9927..f06f809af319 100644 --- a/svtools/source/uno/unoevent.cxx +++ b/svtools/source/uno/unoevent.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -279,7 +280,7 @@ void SvBaseEventDescriptor::getAnyFromMacro(Any& rAny, } case JAVASCRIPT: default: - DBG_ERROR("not implemented"); + OSL_FAIL("not implemented"); } } // else: bRetValueOK not set @@ -604,3 +605,4 @@ void SvMacroTableEventDescriptor::copyMacrosIntoTable( +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/unogridcolumnfacade.cxx b/svtools/source/uno/unogridcolumnfacade.cxx index d2f5e7b565fd..5f1286b90ed6 100755..100644 --- a/svtools/source/uno/unogridcolumnfacade.cxx +++ b/svtools/source/uno/unogridcolumnfacade.cxx @@ -44,7 +44,7 @@ #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <vcl/svapp.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> // ..................................................................................................................... namespace svt { namespace table @@ -150,7 +150,7 @@ namespace svt { namespace table { if ( i_event.AttributeName.equalsAscii( "DataColumnIndex" ) ) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pColumnImplementation != NULL ) m_pColumnImplementation->dataColumnIndexChanged(); return; @@ -173,7 +173,7 @@ namespace svt { namespace table OSL_ENSURE( nChangedAttributes != COL_ATTRS_NONE, "ColumnChangeMultiplexer::columnChanged: unknown column attributed changed!" ); - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aGuard; if ( m_pColumnImplementation != NULL ) m_pColumnImplementation->columnChanged( nChangedAttributes ); } diff --git a/svtools/source/uno/unogridcolumnfacade.hxx b/svtools/source/uno/unogridcolumnfacade.hxx index 7499621ba8af..7499621ba8af 100755..100644 --- a/svtools/source/uno/unogridcolumnfacade.hxx +++ b/svtools/source/uno/unogridcolumnfacade.hxx diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 18af2c696a8c..d2cf9cbf12cf 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -224,7 +225,7 @@ void VCLXMultiLineEdit::removeTextListener( const ::com::sun::star::uno::Referen void VCLXMultiLineEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow(); if ( pEdit ) @@ -241,7 +242,7 @@ void VCLXMultiLineEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow(); if ( pEdit ) @@ -253,7 +254,7 @@ void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel ::rtl::OUString VCLXMultiLineEdit::getText() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::rtl::OUString aText; MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow(); @@ -264,7 +265,7 @@ void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel ::rtl::OUString VCLXMultiLineEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::rtl::OUString aText; MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow(); @@ -276,7 +277,7 @@ void VCLXMultiLineEdit::insertText( const ::com::sun::star::awt::Selection& rSel void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow(); if ( pMultiLineEdit ) @@ -287,7 +288,7 @@ void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aS ::com::sun::star::awt::Selection VCLXMultiLineEdit::getSelection() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Selection aSel; MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow(); @@ -301,7 +302,7 @@ void VCLXMultiLineEdit::setSelection( const ::com::sun::star::awt::Selection& aS sal_Bool VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow(); return ( pMultiLineEdit && !pMultiLineEdit->IsReadOnly() && pMultiLineEdit->IsEnabled() ) ? sal_True : sal_False; @@ -309,7 +310,7 @@ sal_Bool VCLXMultiLineEdit::isEditable() throw(::com::sun::star::uno::RuntimeExc void VCLXMultiLineEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow(); if ( pMultiLineEdit ) @@ -318,7 +319,7 @@ void VCLXMultiLineEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow(); if ( pMultiLineEdit ) @@ -327,7 +328,7 @@ void VCLXMultiLineEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star:: sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; MultiLineEdit* pMultiLineEdit = (MultiLineEdit*) GetWindow(); return pMultiLineEdit ? (sal_Int16)pMultiLineEdit->GetMaxTextLen() : (sal_Int16)0; @@ -335,7 +336,7 @@ sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::Runtim ::rtl::OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::rtl::OUString aText; MultiLineEdit* pEdit = (MultiLineEdit*)GetWindow(); @@ -346,7 +347,7 @@ sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::Runtim ::com::sun::star::awt::Size VCLXMultiLineEdit::getMinimumSize() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Size aSz; MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow(); @@ -362,7 +363,7 @@ sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::Runtim ::com::sun::star::awt::Size VCLXMultiLineEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Size aSz = rNewSize; MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow(); @@ -373,7 +374,7 @@ sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::Runtim ::com::sun::star::awt::Size VCLXMultiLineEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Size aSz; MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow(); @@ -384,7 +385,7 @@ sal_Int16 VCLXMultiLineEdit::getMaxTextLen() throw(::com::sun::star::uno::Runtim void VCLXMultiLineEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; nCols = nLines = 0; MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow(); @@ -421,7 +422,7 @@ void VCLXMultiLineEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEven void VCLXMultiLineEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; MultiLineEdit* pMultiLineEdit = (MultiLineEdit*)GetWindow(); if ( pMultiLineEdit ) @@ -438,7 +439,7 @@ void VCLXMultiLineEdit::setProperty( const ::rtl::OUString& PropertyName, const case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN: meLineEndType = LINEEND_CR; break; case ::com::sun::star::awt::LineEndFormat::LINE_FEED: meLineEndType = LINEEND_LF; break; case ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED: meLineEndType = LINEEND_CRLF; break; - default: DBG_ERROR( "VCLXMultiLineEdit::setProperty: invalid line end value!" ); break; + default: OSL_FAIL( "VCLXMultiLineEdit::setProperty: invalid line end value!" ); break; } } break; @@ -477,7 +478,7 @@ void VCLXMultiLineEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any VCLXMultiLineEdit::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::uno::Any aProp; MultiLineEdit* pMultiLineEdit = (MultiLineEdit*)GetWindow(); @@ -494,7 +495,7 @@ void VCLXMultiLineEdit::setProperty( const ::rtl::OUString& PropertyName, const case LINEEND_CR: nLineEndType = ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN; break; case LINEEND_LF: nLineEndType = ::com::sun::star::awt::LineEndFormat::LINE_FEED; break; case LINEEND_CRLF: nLineEndType = ::com::sun::star::awt::LineEndFormat::CARRIAGE_RETURN_LINE_FEED; break; - default: DBG_ERROR( "VCLXMultiLineEdit::getProperty: invalid line end value!" ); break; + default: OSL_FAIL( "VCLXMultiLineEdit::getProperty: invalid line end value!" ); break; } aProp <<= nLineEndType; } @@ -521,13 +522,13 @@ void VCLXMultiLineEdit::setProperty( const ::rtl::OUString& PropertyName, const void SAL_CALL VCLXMultiLineEdit::setFocus( ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; // don't grab the focus if we already have it. Reason is that the only thing which the edit // does is forwarding the focus to it's text window. This text window then does a "select all". // So if the text window already has the focus, and we give the focus to the multi line // edit, then all which happens is that everything is selected. - // #i27072# - 2004-04-25 - fs@openoffice.org + // #i27072# if ( GetWindow() && !GetWindow()->HasChildPathFocus() ) GetWindow()->GrabFocus(); } @@ -576,7 +577,7 @@ IMPL_XTYPEPROVIDER_END void SAL_CALL VCLXFileControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FileControl* pControl = (FileControl*)GetWindow(); if ( pControl ) @@ -626,7 +627,7 @@ void VCLXFileControl::removeTextListener( const ::com::sun::star::uno::Reference void VCLXFileControl::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; Window* pWindow = GetWindow(); if ( pWindow ) @@ -641,7 +642,7 @@ void VCLXFileControl::setText( const ::rtl::OUString& aText ) throw(::com::sun:: void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FileControl* pFileControl = (FileControl*) GetWindow(); if ( pFileControl ) @@ -653,7 +654,7 @@ void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel, ::rtl::OUString VCLXFileControl::getText() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::rtl::OUString aText; Window* pWindow = GetWindow(); @@ -664,7 +665,7 @@ void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel, ::rtl::OUString VCLXFileControl::getSelectedText() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::rtl::OUString aText; FileControl* pFileControl = (FileControl*) GetWindow(); @@ -676,7 +677,7 @@ void VCLXFileControl::insertText( const ::com::sun::star::awt::Selection& rSel, void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FileControl* pFileControl = (FileControl*) GetWindow(); if ( pFileControl ) @@ -685,7 +686,7 @@ void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSel ::com::sun::star::awt::Selection VCLXFileControl::getSelection() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Selection aSel; FileControl* pFileControl = (FileControl*) GetWindow(); @@ -699,7 +700,7 @@ void VCLXFileControl::setSelection( const ::com::sun::star::awt::Selection& aSel sal_Bool VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FileControl* pFileControl = (FileControl*) GetWindow(); return ( pFileControl && !pFileControl->GetEdit().IsReadOnly() && pFileControl->GetEdit().IsEnabled() ) ? sal_True : sal_False; @@ -707,7 +708,7 @@ sal_Bool VCLXFileControl::isEditable() throw(::com::sun::star::uno::RuntimeExcep void VCLXFileControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FileControl* pFileControl = (FileControl*) GetWindow(); if ( pFileControl ) @@ -716,7 +717,7 @@ void VCLXFileControl::setEditable( sal_Bool bEditable ) throw(::com::sun::star:: void VCLXFileControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FileControl* pFileControl = (FileControl*) GetWindow(); if ( pFileControl ) @@ -725,7 +726,7 @@ void VCLXFileControl::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::un sal_Int16 VCLXFileControl::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FileControl* pFileControl = (FileControl*) GetWindow(); return pFileControl ? pFileControl->GetEdit().GetMaxTextLen() : 0; @@ -743,7 +744,7 @@ IMPL_LINK( VCLXFileControl, ModifyHdl, Edit*, EMPTYARG ) ::com::sun::star::awt::Size VCLXFileControl::getMinimumSize() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Size aSz; FileControl* pControl = (FileControl*) GetWindow(); @@ -765,7 +766,7 @@ IMPL_LINK( VCLXFileControl, ModifyHdl, Edit*, EMPTYARG ) ::com::sun::star::awt::Size VCLXFileControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Size aSz =rNewSize; FileControl* pControl = (FileControl*) GetWindow(); @@ -780,7 +781,7 @@ IMPL_LINK( VCLXFileControl, ModifyHdl, Edit*, EMPTYARG ) ::com::sun::star::awt::Size VCLXFileControl::getMinimumSize( sal_Int16 nCols, sal_Int16 ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::awt::Size aSz; FileControl* pControl = (FileControl*) GetWindow(); @@ -794,7 +795,7 @@ IMPL_LINK( VCLXFileControl, ModifyHdl, Edit*, EMPTYARG ) void VCLXFileControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; nCols = 0; nLines = 1; @@ -845,7 +846,7 @@ void SVTXFormattedField::SetWindow( Window* _pWindow ) // -------------------------------------------------------------------------------------- void SVTXFormattedField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -970,7 +971,7 @@ void SVTXFormattedField::setProperty( const ::rtl::OUString& PropertyName, const // -------------------------------------------------------------------------------------- ::com::sun::star::uno::Any SVTXFormattedField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::uno::Any aReturn; @@ -1431,7 +1432,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { case VCLEVENT_ROADMAP_ITEMSELECTED: { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::svt::ORoadmap* pField = GetRoadmap(); if ( pField ) { @@ -1453,7 +1454,7 @@ void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::svt::ORoadmap* pField = GetRoadmap(); if ( pField ) { @@ -1461,25 +1462,25 @@ void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeE xRoadmapItem = evt.Source; sal_Int32 nID = 0; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropertySet( xRoadmapItem, ::com::sun::star::uno::UNO_QUERY ); - ::com::sun::star::uno::Any aValue = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii( "ID" )); + ::com::sun::star::uno::Any aValue = xPropertySet->getPropertyValue(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ))); aValue >>= nID; ::com::sun::star::uno::Any rVal = evt.NewValue; evt.NewValue >>= rVal; ::rtl::OUString sPropertyName = evt.PropertyName; - if ( sPropertyName.equals(::rtl::OUString::createFromAscii( "Enabled" ) ) ) + if ( sPropertyName.equals(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" )) ) ) { sal_Bool bEnable = false; evt.NewValue >>= bEnable; pField->EnableRoadmapItem( (RoadmapTypes::ItemId)nID , bEnable ); } - else if ( sPropertyName.equals(::rtl::OUString::createFromAscii( "Label" ) ) ) + else if ( sPropertyName.equals(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" )) ) ) { ::rtl::OUString sLabel; evt.NewValue >>= sLabel; pField->ChangeRoadmapItemLabel( (RoadmapTypes::ItemId)nID , sLabel ); } - else if ( sPropertyName.equals(::rtl::OUString::createFromAscii( "ID" ) ) ) + else if ( sPropertyName.equals(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" )) ) ) { sal_Int32 nNewID = 0; evt.NewValue >>= nNewID; @@ -1510,11 +1511,11 @@ RMItemData SVTXRoadmap::GetRMItemData( const ::com::sun::star::container::Contai ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropertySet( xRoadmapItem, ::com::sun::star::uno::UNO_QUERY ); if ( xPropertySet.is() ) { - ::com::sun::star::uno::Any aValue = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii( "Label" )); + ::com::sun::star::uno::Any aValue = xPropertySet->getPropertyValue(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" ))); aValue >>= aCurRMItemData.Label; - aValue = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii( "ID" )); + aValue = xPropertySet->getPropertyValue(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ))); aValue >>= aCurRMItemData.n_ID; - aValue = xPropertySet->getPropertyValue(::rtl::OUString::createFromAscii( "Enabled" )); + aValue = xPropertySet->getPropertyValue(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ))); aValue >>= aCurRMItemData.b_Enabled; } return aCurRMItemData;; @@ -1522,7 +1523,7 @@ RMItemData SVTXRoadmap::GetRMItemData( const ::com::sun::star::container::Contai void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::svt::ORoadmap* pField = GetRoadmap(); if ( pField ) { @@ -1535,21 +1536,19 @@ void SVTXRoadmap::elementInserted( const ::com::sun::star::container::ContainerE void SVTXRoadmap::elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::svt::ORoadmap* pField = GetRoadmap(); if ( pField ) { sal_Int32 DelIndex = 0; _rEvent.Accessor >>= DelIndex; pField->DeleteRoadmapItem(DelIndex); -// pField->GetCurrentRoadmapItem() -// setProperty(::rtl::OUString.createFromAscii( "CurrentItem" )aAny, } } void SVTXRoadmap::elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent )throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::svt::ORoadmap* pField = GetRoadmap(); if ( pField ) { @@ -1565,7 +1564,7 @@ void SVTXRoadmap::elementReplaced( const ::com::sun::star::container::ContainerE // -------------------------------------------------------------------------------------- void SVTXRoadmap::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::svt::ORoadmap* pField = GetRoadmap(); if ( pField ) @@ -1620,7 +1619,7 @@ void SVTXRoadmap::setProperty( const ::rtl::OUString& PropertyName, const ::com: // -------------------------------------------------------------------------------------- ::com::sun::star::uno::Any SVTXRoadmap::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::uno::Any aReturn; @@ -1694,7 +1693,7 @@ IMPL_XTYPEPROVIDER_END void SVTXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1703,7 +1702,7 @@ void SVTXNumericField::setValue( double Value ) throw(::com::sun::star::uno::Run double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetValue() : 0; @@ -1711,7 +1710,7 @@ double SVTXNumericField::getValue() throw(::com::sun::star::uno::RuntimeExceptio void SVTXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1720,7 +1719,7 @@ void SVTXNumericField::setMin( double Value ) throw(::com::sun::star::uno::Runti double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetMinValue() : 0; @@ -1728,7 +1727,7 @@ double SVTXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException) void SVTXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1737,7 +1736,7 @@ void SVTXNumericField::setMax( double Value ) throw(::com::sun::star::uno::Runti double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetMaxValue() : 0; @@ -1745,7 +1744,7 @@ double SVTXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException) void SVTXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1754,7 +1753,7 @@ void SVTXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::Run double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetSpinFirst() : 0; @@ -1762,7 +1761,7 @@ double SVTXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeExceptio void SVTXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1771,7 +1770,7 @@ void SVTXNumericField::setLast( double Value ) throw(::com::sun::star::uno::Runt double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetSpinLast() : 0; @@ -1779,7 +1778,7 @@ double SVTXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException void SVTXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1788,7 +1787,7 @@ void SVTXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno:: double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetSpinSize() : 0; @@ -1796,7 +1795,7 @@ double SVTXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeExcep void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1805,7 +1804,7 @@ void SVTXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::sta sal_Int16 SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetDecimalDigits() : 0; @@ -1813,7 +1812,7 @@ sal_Int16 SVTXNumericField::getDecimalDigits() throw(::com::sun::star::uno::Runt void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1822,7 +1821,7 @@ void SVTXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::sta sal_Bool SVTXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->IsStrictFormat() : sal_False; @@ -1860,7 +1859,7 @@ IMPL_XTYPEPROVIDER_END void SVTXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1869,7 +1868,7 @@ void SVTXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::Ru double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetValue() : 0; @@ -1877,7 +1876,7 @@ double SVTXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeExcepti void SVTXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1886,7 +1885,7 @@ void SVTXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::Runt double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetMinValue() : 0; @@ -1894,7 +1893,7 @@ double SVTXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException void SVTXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1903,7 +1902,7 @@ void SVTXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::Runt double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetMaxValue() : 0; @@ -1911,7 +1910,7 @@ double SVTXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException void SVTXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1920,7 +1919,7 @@ void SVTXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::Ru double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetSpinFirst() : 0; @@ -1928,7 +1927,7 @@ double SVTXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti void SVTXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1937,7 +1936,7 @@ void SVTXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::Run double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetSpinLast() : 0; @@ -1945,7 +1944,7 @@ double SVTXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeExceptio void SVTXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1954,7 +1953,7 @@ void SVTXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno: double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetSpinSize() : 0; @@ -1962,7 +1961,7 @@ double SVTXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeExce void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1971,7 +1970,7 @@ void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::st sal_Int16 SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->GetDecimalDigits() : 0; @@ -1979,7 +1978,7 @@ sal_Int16 SVTXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::Run void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); if ( pField ) @@ -1988,7 +1987,7 @@ void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::st sal_Bool SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; FormattedField* pField = GetFormattedField(); return pField ? pField->IsStrictFormat() : sal_False; @@ -1996,7 +1995,7 @@ sal_Bool SVTXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::Runtim void SVTXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::uno::Any aReturn; @@ -2036,7 +2035,7 @@ void SVTXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any SVTXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::uno::Any aReturn; @@ -2157,7 +2156,7 @@ IMPL_XTYPEPROVIDER_END // ::com::sun::star::awt::XProgressBar void VCLXProgressBar::setForegroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; Window* pWindow = GetWindow(); if ( pWindow ) @@ -2169,7 +2168,7 @@ void VCLXProgressBar::setForegroundColor( sal_Int32 nColor ) throw(::com::sun::s void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; Window* pWindow = GetWindow(); if ( pWindow ) @@ -2183,7 +2182,7 @@ void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor ) throw(::com::sun::s void VCLXProgressBar::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; m_nValue = nValue; ImplUpdateValue(); @@ -2191,7 +2190,7 @@ void VCLXProgressBar::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno:: void VCLXProgressBar::setRange( sal_Int32 nMin, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException ) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; if ( nMin < nMax ) { @@ -2211,7 +2210,7 @@ void VCLXProgressBar::setRange( sal_Int32 nMin, sal_Int32 nMax ) throw(::com::su sal_Int32 VCLXProgressBar::getValue() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; return m_nValue; } @@ -2219,7 +2218,7 @@ sal_Int32 VCLXProgressBar::getValue() throw(::com::sun::star::uno::RuntimeExcept // ::com::sun::star::awt::VclWindowPeer void VCLXProgressBar::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ProgressBar* pProgressBar = (ProgressBar*)GetWindow(); if ( pProgressBar ) @@ -2277,7 +2276,7 @@ void VCLXProgressBar::setProperty( const ::rtl::OUString& PropertyName, const :: ::com::sun::star::uno::Any VCLXProgressBar::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( GetMutex() ); + SolarMutexGuard aGuard; ::com::sun::star::uno::Any aProp; ProgressBar* pProgressBar = (ProgressBar*)GetWindow(); @@ -2364,3 +2363,5 @@ void SVTXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) 0); VCLXDateField::ImplGetPropertyIds( rIds ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index e6a7626b8f4a..6c8527ffedc7 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -42,8 +43,7 @@ #include <cppuhelper/weakagg.hxx> #include <cppuhelper/implbase3.hxx> #include <list> -#include <rtl/uuid.h> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <svtools/unoevent.hxx> #include <svtools/unoimap.hxx> @@ -382,18 +382,15 @@ uno::Sequence< uno::Type > SAL_CALL SvUnoImageMapObject::getTypes() return aTypes; } +namespace +{ + class theSvUnoImageMapObjectImplementationId : public rtl::Static< UnoTunnelIdInit, theSvUnoImageMapObjectImplementationId > {}; +} + uno::Sequence< sal_Int8 > SAL_CALL SvUnoImageMapObject::getImplementationId() throw (uno::RuntimeException) { - vos::OGuard aGuard( Application::GetSolarMutex() ); - - static uno::Sequence< sal_Int8 > aId; - if( aId.getLength() == 0 ) - { - aId.realloc( 16 ); - rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); - } - return aId; + return theSvUnoImageMapObjectImplementationId::get().getSeq(); } // XServiceInfo @@ -487,7 +484,7 @@ void SvUnoImageMapObject::_setPropertyValues( const PropertyMapEntry** ppEntries bOk = *pValues >>= maPolygon; break; default: - DBG_ERROR( "SvUnoImageMapObject::_setPropertyValues: unexpected property handle" ); + OSL_FAIL( "SvUnoImageMapObject::_setPropertyValues: unexpected property handle" ); break; } @@ -537,7 +534,7 @@ void SvUnoImageMapObject::_getPropertyValues( const PropertyMapEntry** ppEntries *pValues <<= maPolygon; break; default: - DBG_ERROR( "SvUnoImageMapObject::_getPropertyValues: unexpected property handle" ); + OSL_FAIL( "SvUnoImageMapObject::_getPropertyValues: unexpected property handle" ); break; } @@ -655,7 +652,7 @@ void SAL_CALL SvUnoImageMap::insertByIndex( sal_Int32 Index, const Any& Element { std::list< SvUnoImageMapObject* >::iterator aIter = maObjectList.begin(); for( sal_Int32 n = 0; n < Index; n++ ) - aIter++; + ++aIter; maObjectList.insert( aIter, pObject ); } @@ -676,7 +673,7 @@ void SAL_CALL SvUnoImageMap::removeByIndex( sal_Int32 Index ) throw(IndexOutOfBo { std::list< SvUnoImageMapObject* >::iterator aIter = maObjectList.begin(); for( sal_Int32 n = 0; n < Index; n++ ) - aIter++; + ++aIter; (*aIter)->release(); maObjectList.erase( aIter ); @@ -693,7 +690,7 @@ void SAL_CALL SvUnoImageMap::replaceByIndex( sal_Int32 Index, const Any& Element std::list< SvUnoImageMapObject* >::iterator aIter = maObjectList.begin(); for( sal_Int32 n = 0; n < Index; n++ ) - aIter++; + ++aIter; (*aIter)->release(); *aIter = pObject; @@ -714,7 +711,7 @@ Any SAL_CALL SvUnoImageMap::getByIndex( sal_Int32 Index ) throw(IndexOutOfBounds std::list< SvUnoImageMapObject* >::iterator aIter = maObjectList.begin(); for( sal_Int32 n = 0; n < Index; n++ ) - aIter++; + ++aIter; Reference< XPropertySet > xObj( *aIter ); return makeAny( xObj ); @@ -773,7 +770,7 @@ sal_Bool SvUnoImageMap::fillImageMap( ImageMap& rMap ) const rMap.InsertIMapObject( *pNewMapObject ); delete pNewMapObject; - aIter++; + ++aIter; } return sal_True; @@ -816,3 +813,5 @@ sal_Bool SvUnoImageMap_fillImageMap( Reference< XInterface > xImageMap, ImageMap return pUnoImageMap->fillImageMap( rMap ); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/unowizard.hxx b/svtools/source/uno/unowizard.hxx index ceb8fac14eb6..f56a23024f5c 100644 --- a/svtools/source/uno/unowizard.hxx +++ b/svtools/source/uno/unowizard.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -115,3 +116,5 @@ namespace svt { namespace uno //...................................................................................................................... #endif // SVT_UNO_WIZARD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index ea147c5979d3..e8d7adaf58a2 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -40,7 +41,7 @@ #include <tools/diagnose_ex.h> #include <rtl/strbuf.hxx> -#include <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <tools/urlobj.hxx> @@ -91,7 +92,7 @@ namespace svt { namespace uno case WizardButton::CANCEL: return WZB_CANCEL; case WizardButton::HELP: return WZB_HELP; } - OSL_ENSURE( false, "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" ); + OSL_FAIL( "lcl_convertWizardButtonToWZB: invalid WizardButton constant!" ); return WZB_NONE; } } @@ -295,7 +296,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL Wizard::getHelpURL() throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); if ( !m_pDialog ) @@ -307,7 +308,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::setHelpURL( const ::rtl::OUString& i_HelpURL ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); if ( !m_pDialog ) @@ -319,7 +320,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ Reference< XWindow > SAL_CALL Wizard::getDialogWindow() throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); ENSURE_OR_RETURN( m_pDialog, "Wizard::getDialogWindow: illegal call (execution did not start, yet)!", NULL ); @@ -329,7 +330,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::enableButton( ::sal_Int16 i_WizardButton, ::sal_Bool i_Enable ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); @@ -341,7 +342,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::setDefaultButton( ::sal_Int16 i_WizardButton ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); @@ -353,7 +354,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ sal_Bool SAL_CALL Wizard::travelNext( ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); @@ -365,7 +366,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ sal_Bool SAL_CALL Wizard::travelPrevious( ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); @@ -377,7 +378,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::enablePage( ::sal_Int16 i_PageID, ::sal_Bool i_Enable ) throw (NoSuchElementException, InvalidStateException, RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); @@ -395,7 +396,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::updateTravelUI( ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); @@ -407,7 +408,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ ::sal_Bool SAL_CALL Wizard::advanceTo( ::sal_Int16 i_PageId ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); @@ -419,7 +420,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ ::sal_Bool SAL_CALL Wizard::goBackTo( ::sal_Int16 i_PageId ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); @@ -431,7 +432,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ Reference< XWizardPage > SAL_CALL Wizard::getCurrentPage( ) throw (RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); @@ -443,7 +444,7 @@ namespace svt { namespace uno //------------------------------------------------------------------------------------------------------------------ void SAL_CALL Wizard::activatePath( ::sal_Int16 i_PathIndex, ::sal_Bool i_Final ) throw (NoSuchElementException, InvalidStateException, RuntimeException) { - ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); if ( ( i_PathIndex < 0 ) || ( i_PathIndex >= m_aWizardSteps.getLength() ) ) @@ -471,3 +472,5 @@ namespace svt { namespace uno //...................................................................................................................... } } // namespace svt::uno //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx index 6bc01c76da4a..eec2fe98dfde 100644 --- a/svtools/source/uno/wizard/wizardpagecontroller.cxx +++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -188,3 +189,5 @@ namespace svt { namespace uno //...................................................................................................................... } } // namespace svt::uno //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/wizard/wizardpagecontroller.hxx b/svtools/source/uno/wizard/wizardpagecontroller.hxx index 9de04d2f0dd4..7b8273ce43a9 100644 --- a/svtools/source/uno/wizard/wizardpagecontroller.hxx +++ b/svtools/source/uno/wizard/wizardpagecontroller.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -73,3 +74,5 @@ namespace svt { namespace uno //...................................................................................................................... #endif // SVT_UNOWIZ_WIZARDPAGECONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index 7737b214ac1f..7220091d7648 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -133,7 +134,7 @@ namespace svt { namespace uno default: break; } - OSL_ENSURE( false, "WizardShell::convertCommitReasonToTravelType: unsupported CommitPageReason!" ); + OSL_FAIL( "WizardShell::convertCommitReasonToTravelType: unsupported CommitPageReason!" ); return WizardTravelType::FINISH; } @@ -277,3 +278,5 @@ namespace svt { namespace uno //...................................................................................................................... } } // namespace svt::uno //...................................................................................................................... + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index 338b4f38dc4a..9697b71b36d2 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -145,3 +146,5 @@ namespace svt { namespace uno //...................................................................................................................... #endif // SVT_UNO_WIZARD_SHELL + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/urlobj/inetimg.cxx b/svtools/source/urlobj/inetimg.cxx index 87ff86afa7fc..1994acdf5ceb 100644 --- a/svtools/source/urlobj/inetimg.cxx +++ b/svtools/source/urlobj/inetimg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -144,3 +145,4 @@ sal_Bool INetImage::Read( SvStream& rIStm, sal_uLong nFormat ) return bRet; } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |