diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2010-05-21 12:35:59 +0200 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2010-05-21 12:35:59 +0200 |
commit | 7d4f5c86eb6337b1fc24146bb928d691b8c37341 (patch) | |
tree | 1b71d52db32bd6eaee8b805eb2713175957d43f8 | |
parent | e05d9629eee06dac22fbcdbd05617d1b41aa901a (diff) | |
parent | 98c23f0ef2290956347a93805dcc9af803e28466 (diff) |
CWS-TOOLING: integrate CWS sw33bf03ooo/DEV300_m79
-rw-r--r-- | sw/inc/ndtxt.hxx | 2 | ||||
-rw-r--r-- | sw/inc/shellio.hxx | 25 | ||||
-rw-r--r-- | sw/inc/unoflatpara.hxx | 12 | ||||
-rw-r--r-- | sw/source/core/bastyp/swrect.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/docnode/ndcopy.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/txtnode/atrfld.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 178 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndhints.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 304 | ||||
-rw-r--r-- | sw/source/core/unocore/unoflatpara.cxx | 48 | ||||
-rw-r--r-- | sw/source/filter/ascii/ascatr.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/rtf/rtfatr.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/writer/writer.cxx | 77 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/uno/unotxvw.cxx | 27 |
18 files changed, 398 insertions, 348 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index ccaab82beb..f288a8b5ce 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -199,6 +199,8 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable inline void TryDeleteSwpHints(); + SW_DLLPRIVATE void impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet); + public: bool IsWordCountDirty() const; bool IsWrongDirty() const; diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index a31daa325a..643cd847c5 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -24,8 +24,11 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _SHELLIO_HXX -#define _SHELLIO_HXX +#ifndef SW_SHELLIO_HXX +#define SW_SHELLIO_HXX + +#include <memory> +#include <boost/utility.hpp> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/embed/XStorage.hpp> @@ -431,7 +434,9 @@ extern BOOL SetHTMLTemplate( SwDoc &rDoc ); //Fuer Vorlagen aus HTML.vor laden s class IDocumentSettingAccess; class IDocumentStylePoolAccess; -class SW_DLLPUBLIC Writer : public SvRefBase +class SW_DLLPUBLIC Writer + : public SvRefBase + , private ::boost::noncopyable { SwAsciiOptions aAscOpts; String sBaseURL; @@ -439,10 +444,10 @@ class SW_DLLPUBLIC Writer : public SvRefBase void _AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont ); void _AddFontItems( SfxItemPool& rPool, USHORT nWhichId ); + ::std::auto_ptr<Writer_Impl> m_pImpl; + protected: - Writer_Impl* pImpl; - SvStream* pStrm; SwPaM* pOrigPam; // der letze zu bearbeitende Pam const String* pOrigFileName; @@ -534,12 +539,8 @@ public: inline SvStream& OutLong( long nVal ) { return OutLong( Strm(), nVal ); } inline SvStream& OutULong( ULONG nVal ) { return OutULong( Strm(), nVal ); } - void SetStrm( SvStream& rStrm ) { pStrm = &rStrm; } -#ifndef DBG_UTIL - SvStream& Strm() { return *pStrm; } -#else + void SetStream(SvStream *const pStream); SvStream& Strm(); -#endif void SetOrganizerMode( BOOL bSet ) { bOrganizerMode = bSet; } }; @@ -659,7 +660,7 @@ namespace SwReaderWriter { /// Return reader based on ReaderWriterEnum Reader* GetReader( ReaderWriterEnum eReader ); - + /// Return reader based on the name Reader* GetReader( const String& rFltName ); diff --git a/sw/inc/unoflatpara.hxx b/sw/inc/unoflatpara.hxx index 70cbf8b334..65877e6679 100644 --- a/sw/inc/unoflatpara.hxx +++ b/sw/inc/unoflatpara.hxx @@ -29,6 +29,7 @@ #define _UNOFLATPARA_HXX #include <cppuhelper/implbase1.hxx> +#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/text/XFlatParagraph.hpp> #include <com/sun/star/text/XFlatParagraphIterator.hpp> #include <calbck.hxx> @@ -51,9 +52,10 @@ class SwDoc; ******************************************************************************/ class SwXFlatParagraph: - public ::cppu::WeakImplHelper1 + public ::cppu::WeakImplHelper2 < - css::text::XFlatParagraph + css::text::XFlatParagraph, + css::lang::XUnoTunnel >, public SwXTextMarkup { @@ -85,6 +87,12 @@ public: const SwTxtNode* getTxtNode() const; + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId) + throw (css::uno::RuntimeException); + private: SwXFlatParagraph( const SwXFlatParagraph & ); // not defined SwXFlatParagraph & operator = ( const SwXFlatParagraph & ); // not defined diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx index 4593888ff4..c7f0bd70e7 100644 --- a/sw/source/core/bastyp/swrect.cxx +++ b/sw/source/core/bastyp/swrect.cxx @@ -242,7 +242,7 @@ void SwRect::Justify() } if ( m_Size.getWidth() < 0 ) { - m_Point.Y() += m_Size.getWidth() + 1; + m_Point.X() += m_Size.getWidth() + 1; m_Size.setWidth(-m_Size.getWidth()); } } diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index db13779ad4..68f0b8301c 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1109,8 +1109,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) case POS_EQUAL: case POS_INSIDE: - // TODO Check if there is any side effect - //delete pNewRedl, pNewRedl = 0; + delete pNewRedl, pNewRedl = 0; break; case POS_OUTSIDE: diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 4fcd2d9e4f..ef65d7dbfb 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -919,6 +919,12 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, bool bCopyBookmarks = true; BOOL bStartIsTxtNode = 0 != pSttTxtNd; + // #i104585# copy outline num rule to clipboard (for ASCII filter) + if (pDoc->IsClipBoard() && GetOutlineNumRule()) + { + pDoc->SetOutlineNumRule(*GetOutlineNumRule()); + } + // --> OD 2009-08-25 #i86492# // Correct the search for a previous list: // First search for non-outline numbering list. Then search for non-outline diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 4705655dfb..8840e69aac 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -235,10 +235,7 @@ BOOL SwFEShell::SelectObj( const Point& rPt, BYTE nFlag, SdrObject *pObj ) if( bForget ) { pDView->UnmarkAll(); - if ( pTmpObj ) - pDView->MarkObj( pTmpObj, Imp()->GetPageView(), bAddSelect, bEnterGroup ); - else - pDView->MarkObj( rPt, MINMOVE ); + pDView->MarkObj( pTmpObj, Imp()->GetPageView(), bAddSelect, bEnterGroup ); break; } } diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index ce1dd11493..b5fe2a2e8d 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -157,14 +157,16 @@ void SwFmtFld::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) if( !pTxtAttr ) return; + // don't do anything, especially not expand! + if( pNew && pNew->Which() == RES_OBJECTDYING ) + return; + SwTxtNode* pTxtNd = (SwTxtNode*)&pTxtAttr->GetTxtNode(); ASSERT( pTxtNd, "wo ist denn mein Node?" ); if( pNew ) { switch( pNew->Which() ) { - case RES_OBJECTDYING: - return; // don't do anything, especially not expand! case RES_TXTATR_FLDCHG: // "Farbe hat sich geaendert !" // this, this fuer "nur Painten" @@ -189,6 +191,8 @@ void SwFmtFld::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) case RES_FMT_CHG: pTxtNd->Modify( pOld, pNew ); return; + default: + break; } } @@ -265,6 +269,11 @@ SwTxtFld::SwTxtFld( SwFmtFld& rAttr, xub_StrLen nStartPos ) SwTxtFld::~SwTxtFld( ) { + SwFmtFld & rFmtFld( static_cast<SwFmtFld &>(GetAttr()) ); + if (this == rFmtFld.pTxtAttr) + { + rFmtFld.pTxtAttr = 0; // #i110140# invalidate! + } } /************************************************************************* diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 40b04898ba..f88df01a6d 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -444,8 +444,6 @@ USHORT SwFntObj::GetFontLeading( const ViewShell *pSh, const OutputDevice& rOut void SwFntObj::CreateScrFont( const ViewShell& rSh, const OutputDevice& rOut ) { -static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring"; - if ( pScrFont ) return; @@ -481,6 +479,10 @@ static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring"; pScrFont = pPrtFont; FontMetric aMet = pPrt->GetFontMetric( ); + //Don't loose "faked" properties of the logical font that don't truly + //exist in the physical font metrics which vcl which fake up for us + aMet.SetWeight(pScrFont->GetWeight()); + aMet.SetItalic(pScrFont->GetItalic()); bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet(); @@ -490,178 +492,6 @@ static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring"; if ( USHRT_MAX == nExtLeading ) nExtLeading = static_cast<USHORT>(aMet.GetExtLeading()); -#if OSL_DEBUG_LEVEL > 1 - const XubString aDbgTxt1( pPrtFont->GetName() ); - const XubString aDbgTxt2( aMet.GetName() ); -#endif - - if ( aMet.IsDeviceFont( ) ) - { - if ( (RTL_TEXTENCODING_DONTKNOW == pPrtFont->GetCharSet() || - FAMILY_DONTKNOW == pPrtFont->GetFamily() || - PITCH_DONTKNOW == pPrtFont->GetPitch() ) && - (RTL_TEXTENCODING_DONTKNOW == aMet.GetCharSet() || - FAMILY_DONTKNOW == aMet.GetFamily() || - PITCH_DONTKNOW == aMet.GetPitch() ) ) - { - // Das folgende ist teuer, aber selten: ein unbekannter Font - // kann vom Drucker nicht vernuenftig zugeordnet werden. Dann - // nehmen wir eben das Mapping des Bildschirms in Anspruch und - // setzen den Familyname, Charset und Pitch wie dort. Dieser - // Font wird nun nochmals auf dem Drucker eingestellt. - Font aFnt1 = pOut->GetFontMetric(); - Font aFnt2( *pPrtFont ); - - if (RTL_TEXTENCODING_DONTKNOW == pPrtFont->GetCharSet()) - aFnt2.SetCharSet( aFnt1.GetCharSet() ); - if (FAMILY_DONTKNOW == pPrtFont->GetFamily()) - aFnt2.SetFamily( aFnt1.GetFamily() ); - if (PITCH_DONTKNOW == pPrtFont->GetPitch()) - aFnt2.SetPitch( aFnt1.GetPitch() ); - - pPrt->SetFont( aFnt2 ); - aMet = pPrt->GetFontMetric( ); - } - - const XubString aStandardStr( sStandardString, - RTL_TEXTENCODING_MS_1252 ); - - // This is the reference width - const long nOWidth = pPrt->GetTextWidth( aStandardStr ); - - // Let's have a look what's the difference to the width - // calculated for the output device using the font set at the - // reference device - long nSWidth = nOWidth - pOut->GetTextWidth( aStandardStr ); - nScrHeight = (USHORT) pOut->GetTextHeight(); - - // Um Aerger mit dem Generic Printer aus dem Wege zu gehen. - if( aMet.GetSize().Height() ) - { - BOOL bScrSymbol = FALSE; - CharSet ePrtChSet = aMet.GetCharSet(); - // NoSymbol bedeutet, dass der Drucker sich fuer einen - // Nicht-Symbol-Font entschieden hat. - BOOL bNoSymbol = ( RTL_TEXTENCODING_DONTKNOW != ePrtChSet && - RTL_TEXTENCODING_SYMBOL != ePrtChSet ); - if ( bNoSymbol ) - bScrSymbol = RTL_TEXTENCODING_SYMBOL == - pOut->GetFontMetric().GetCharSet(); - Size aTmp( aMet.GetSize() ); - - if( aTmp.Width() && !pPrtFont->GetSize().Width() ) - { - aTmp.Width() = 0; - aMet.SetSize( aTmp ); - } - - // Now we set the metrics used at the reference device at the - // output device - pOut->SetFont( aMet ); - - if( bNoSymbol && ( bScrSymbol != ( RTL_TEXTENCODING_SYMBOL == - pOut->GetFontMetric().GetCharSet() ) ) ) - { - // Hier landen wir, wenn der Drucker keinen Symbolfont waehlt, - // aber genau einer der beiden Screenfonts ein Symbolfont ist. - // Wir nehmen dann eben den anderen. - if ( bScrSymbol ) - pScrFont = new Font( aMet ); // mit Abgleich - else - pOut->SetFont( *pPrtFont ); // ohne Abgleich - } - else - { - // Let's have a look what's the difference to the width - // calculated for the output device using the metrics set at - // the reference device - long nPWidth = nOWidth - pOut->GetTextWidth( aStandardStr ); - - // We prefer smaller fonts - BYTE nNeg = 0; - if ( nSWidth<0 ) { nSWidth *= -2; nNeg = 1; } - if ( nPWidth<0 ) { nPWidth *= -2; nNeg |= 2; } - - // nSWidth = Difference between string width on reference device - // and string width on output device with user font set. - // nPWidth = Difference between string width on reference device - // and string width on output device with metric obtained - // from reference device. - // We prefer to take the font with the smaller deviation, - // exception: keep the original font unless the deviation - // is really bad (at least 3%) - // Since the test string is neither localized nor has a high resemblance - // of the "real text for this font" a higher deviation is reasonable - - if ( (nSWidth <= nPWidth) - || (nSWidth * 32 <= nOWidth ) ) - { - // No adjustment, we take the same font for the output - // device like for the reference device - pOut->SetFont( *pPrtFont ); - pScrFont = pPrtFont; - nPWidth = nSWidth; - nNeg &= 1; - } - else - { - // The metrics give a better result. So we build - // a new font for the output device based on the - // metrics used at the reference device - pScrFont = new Font( aMet ); // mit Abgleich - nSWidth = nPWidth; - nNeg &= 2; - } - - // - // now pScrFont is set to the better font and this should - // be set at the output device - // - - // we still have to check if the choosed font is not to wide - if( nNeg && nOWidth ) - { - nPWidth *= 100; - nPWidth /= nOWidth; - - // if the screen font is too wide, we try to reduce - // the font height and get a smaller one - if( nPWidth > 25 ) - { - if( nPWidth > 80 ) - nPWidth = 80; - nPWidth = 100 - nPWidth/4; - Size aTmpSize = pScrFont->GetSize(); - aTmpSize.Height() *= nPWidth; - aTmpSize.Height() /= 100; - if( aTmpSize.Width() ) - { - aTmpSize.Width() *= nPWidth; - aTmpSize.Width() /= 100; - } - Font *pNew = new Font( *pScrFont ); - pNew->SetSize( aTmpSize ); - pOut->SetFont( *pNew ); - nPWidth = nOWidth - - pOut->GetTextWidth( aStandardStr ); - if( nPWidth < 0 ) { nPWidth *= -2; } - if( nPWidth < nSWidth ) - { - if( pScrFont != pPrtFont ) - delete pScrFont; - pScrFont = pNew; - } - else - { - delete pNew; - pOut->SetFont( *pScrFont ); - } - } - } - } - } - } - // reset the original reference device font pPrt->SetFont( aOldPrtFnt ); } diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx index 321e32de7e..edde529613 100644 --- a/sw/source/core/txtnode/ndhints.cxx +++ b/sw/source/core/txtnode/ndhints.cxx @@ -367,7 +367,7 @@ bool SwpHintsArray::Check() const CHECK_ERR( !isCHRATR(nWhich), "HintsCheck: Character attribute in end array" ); - // 8) portion check + // 8) style portion check #if OSL_DEBUG_LEVEL > 1 const SwTxtAttr* pHtThis = m_HintStarts[i]; const SwTxtAttr* pHtLast = i > 0 ? m_HintStarts[i-1] : 0; @@ -375,11 +375,19 @@ bool SwpHintsArray::Check() const ( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) || ( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) || ( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) || - ( *pHtThis->GetStart() == *pHtLast->GetStart() && *pHtThis->GetEnd() == *pHtLast->GetEnd() ) || - ( *pHtThis->GetStart() == *pHtThis->GetEnd() ), + ( ( ( (*pHtThis->GetStart() == *pHtLast->GetStart()) + && (*pHtThis->GetEnd() == *pHtLast->GetEnd()) + ) // same range + || (*pHtThis->GetStart() == *pHtThis->GetEnd()) + ) + && ( (pHtThis->Which() != RES_TXTATR_AUTOFMT) + || (pHtLast->Which() != RES_TXTATR_AUTOFMT) + ) // never two AUTOFMT on same range + ), "HintsCheck: Portion inconsistency. " "This can be temporarily ok during undo operations" ); + // 9) nesting portion check if (pHtThis->IsNesting()) { for ( USHORT j = 0; j < Count(); ++j ) @@ -397,7 +405,7 @@ bool SwpHintsArray::Check() const } } - // 9) dummy char check (unfortunately cannot check SwTxtNode::m_Text) + // 10) dummy char check (unfortunately cannot check SwTxtNode::m_Text) if (pHtThis->HasDummyChar()) { for ( USHORT j = 0; j < i; ++j ) diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index d5fbf01160..1cbbb61043 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -773,7 +773,8 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, // For each attribute in the automatic style check if it // is also set the the new character style: - SfxItemSet aNewSet( *pOldStyle->GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END ); + SfxItemSet aNewSet( *pOldStyle->GetPool(), + aCharAutoFmtSetRange); SfxItemIter aItemIter( *pOldStyle ); const SfxPoolItem* pItem = aItemIter.GetCurItem(); while( TRUE ) @@ -2059,25 +2060,202 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, return rSet.Count() ? TRUE : FALSE; } -int lcl_IsNewAttrInSet( const SwpHints& rHints, const SfxPoolItem& rItem, - const xub_StrLen nEnd ) + +namespace +{ + +typedef std::pair<USHORT, USHORT> AttrSpan_t; +typedef std::multimap<AttrSpan_t, const SwTxtAttr*> AttrSpanMap_t; + + +struct IsAutoStyle { - int bIns = TRUE; - for( USHORT i = 0; i < rHints.Count(); ++i ) + bool + operator()(const AttrSpanMap_t::value_type& i_rAttrSpan) + const { - const SwTxtAttr *pOther = rHints[ i ]; - if( *pOther->GetStart() ) - break; + return i_rAttrSpan.second && i_rAttrSpan.second->Which() == RES_TXTATR_AUTOFMT; + } +}; + + +/** Removes from io_rAttrSet all items that are set by style on the + given span. + */ +struct RemovePresentAttrs +{ + RemovePresentAttrs(SfxItemSet& io_rAttrSet) + : m_rAttrSet(io_rAttrSet) + { + } + + void + operator()(const AttrSpanMap_t::value_type& i_rAttrSpan) + const + { + if (!i_rAttrSpan.second) + { + return; + } - if( pOther->GetEnd() && - *pOther->GetEnd() == nEnd && - ( pOther->IsCharFmtAttr() || pOther->Which() == rItem.Which() ) ) + const SwTxtAttr* const pAutoStyle(i_rAttrSpan.second); + SfxItemIter aIter(m_rAttrSet); + const SfxPoolItem* pItem(aIter.GetCurItem()); + while (true) + { + const USHORT nWhich(pItem->Which()); + if (CharFmt::IsItemIncluded(nWhich, pAutoStyle)) + { + m_rAttrSet.ClearItem(nWhich); + } + + if (aIter.IsAtEnd()) + { + break; + } + pItem = aIter.NextItem(); + } + } + +private: + SfxItemSet& m_rAttrSet; +}; + + +/** Collects all style-covered spans from i_rHints to o_rSpanMap. In + addition inserts dummy spans with pointer to format equal to 0 for + all gaps (i.e. spans not covered by any style). This simplifies + creation of autostyles for all needed spans, but it means all code + that tries to access the pointer has to check if it's non-null! + */ +void +lcl_CollectHintSpans(const SwpHints& i_rHints, const USHORT nLength, + AttrSpanMap_t& o_rSpanMap) +{ + USHORT nLastEnd(0); + + for (USHORT i(0); i != i_rHints.Count(); ++i) + { + const SwTxtAttr* const pHint(i_rHints[i]); + const USHORT nWhich(pHint->Which()); + if (nWhich == RES_TXTATR_CHARFMT || nWhich == RES_TXTATR_AUTOFMT) + { + const AttrSpan_t aSpan(*pHint->GetStart(), *pHint->GetEnd()); + o_rSpanMap.insert(AttrSpanMap_t::value_type(aSpan, pHint)); + + if (aSpan.first != nLastEnd) + { + // insert dummy span covering the gap + o_rSpanMap.insert(AttrSpanMap_t::value_type( + AttrSpan_t(nLastEnd, aSpan.first), 0)); + } + + nLastEnd = aSpan.second; + } + } + + // no hints at the end (special case: no hints at all in i_rHints) + if (nLastEnd != nLength && nLength != 0) + { + o_rSpanMap.insert( + AttrSpanMap_t::value_type(AttrSpan_t(nLastEnd, nLength), 0)); + } +} + + +void +lcl_FillWhichIds(const SfxItemSet& i_rAttrSet, std::vector<USHORT>& o_rClearIds) +{ + o_rClearIds.reserve(i_rAttrSet.Count()); + SfxItemIter aIter(i_rAttrSet); + const SfxPoolItem* pItem(aIter.GetCurItem()); + while (true) + { + o_rClearIds.push_back(pItem->Which()); + + if (aIter.IsAtEnd()) { - bIns = FALSE; break; } + pItem = aIter.NextItem(); + } +} + +struct SfxItemSetClearer +{ + SfxItemSet & m_rItemSet; + SfxItemSetClearer(SfxItemSet & rItemSet) : m_rItemSet(rItemSet) { } + void operator()(USHORT const nWhich) { m_rItemSet.ClearItem(nWhich); } +}; + +} + + +/** Does the hard work of SwTxtNode::FmtToTxtAttr: the real conversion + of items to automatic styles. + */ +void +SwTxtNode::impl_FmtToTxtAttr(const SfxItemSet& i_rAttrSet) +{ + typedef AttrSpanMap_t::iterator AttrSpanMap_iterator_t; + AttrSpanMap_t aAttrSpanMap; + + if (i_rAttrSet.Count() == 0) + { + return; + } + + // 1. Identify all spans in hints' array + + lcl_CollectHintSpans(*m_pSwpHints, m_Text.Len(), aAttrSpanMap); + + // 2. Go through all spans and insert new attrs + + AttrSpanMap_iterator_t aCurRange(aAttrSpanMap.begin()); + const AttrSpanMap_iterator_t aEnd(aAttrSpanMap.end()); + while (aCurRange != aEnd) + { + typedef std::pair<AttrSpanMap_iterator_t, AttrSpanMap_iterator_t> + AttrSpanMapRange_t; + AttrSpanMapRange_t aRange(aAttrSpanMap.equal_range(aCurRange->first)); + + // 2a. Collect attributes to insert + + SfxItemSet aCurSet(i_rAttrSet); + std::for_each(aRange.first, aRange.second, RemovePresentAttrs(aCurSet)); + + // 2b. Insert automatic style containing the collected attributes + + if (aCurSet.Count() != 0) + { + AttrSpanMap_iterator_t aAutoStyleIt( + std::find_if(aRange.first, aRange.second, IsAutoStyle())); + if (aAutoStyleIt != aRange.second) + { + // there already is an automatic style on that span: + // create new one and remove the original one + SwTxtAttr* const pAutoStyle(const_cast<SwTxtAttr*>(aAutoStyleIt->second)); + const boost::shared_ptr<SfxItemSet> pOldStyle( + static_cast<const SwFmtAutoFmt&>( + pAutoStyle->GetAttr()).GetStyleHandle()); + aCurSet.Put(*pOldStyle); + + // remove the old hint + m_pSwpHints->Delete(pAutoStyle); + DestroyAttr(pAutoStyle); + } + m_pSwpHints->Insert( + MakeTxtAttr(*GetDoc(), aCurSet, + aCurRange->first.first, aCurRange->first.second)); + } + + aCurRange = aRange.second; } - return bIns; + + // 3. Clear items from the node + std::vector<USHORT> aClearedIds; + lcl_FillWhichIds(i_rAttrSet, aClearedIds); + ClearItemsFromAttrSet(aClearedIds); } void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd ) @@ -2090,91 +2268,79 @@ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd ) if( pNd == this ) { - if( aThisSet.Count() ) - { - SfxItemIter aIter( aThisSet ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - std::vector<USHORT> aClearWhichIds; - - while ( true ) - { - if (lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() )) - { - m_pSwpHints->SwpHintsArray::Insert( - MakeTxtAttr( *GetDoc(), - const_cast<SfxPoolItem&>(*pItem), - 0, GetTxt().Len() ) ); - aClearWhichIds.push_back( pItem->Which() ); - } - - if( aIter.IsAtEnd() ) - break; - pItem = aIter.NextItem(); - } - - ClearItemsFromAttrSet( aClearWhichIds ); - } + impl_FmtToTxtAttr(aThisSet); } else { + // There are five possible combinations of items from this and + // pNd (pNd is the 'main' node): + // + // case pNd this action + // ---------------------------------------------------- + // 1 - - do nothing + // 2 - a convert item to attr of this + // 3 a - convert item to attr of pNd + // 4 a a clear item in this + // 5 a b convert item to attr of this + SfxItemSet aNdSet( pNd->GetDoc()->GetAttrPool(), aCharFmtSetRange ); if( pNd->HasSwAttrSet() && pNd->GetpSwAttrSet()->Count() ) aNdSet.Put( *pNd->GetpSwAttrSet() ); pNd->GetOrCreateSwpHints(); + std::vector<USHORT> aProcessedIds; + if( aThisSet.Count() ) { SfxItemIter aIter( aThisSet ); - const SfxPoolItem* pItem = aIter.GetCurItem(), *pNdItem; + const SfxPoolItem* pItem = aIter.GetCurItem(), *pNdItem = 0; + SfxItemSet aConvertSet( GetDoc()->GetAttrPool(), aCharFmtSetRange ); std::vector<USHORT> aClearWhichIds; - while( TRUE ) + while( true ) { - if( ( SFX_ITEM_SET != aNdSet.GetItemState( pItem->Which(), FALSE, - &pNdItem ) || *pItem != *pNdItem ) && - lcl_IsNewAttrInSet( *m_pSwpHints, *pItem, GetTxt().Len() ) ) + if( SFX_ITEM_SET == aNdSet.GetItemState( pItem->Which(), FALSE, &pNdItem ) ) { - m_pSwpHints->SwpHintsArray::Insert( MakeTxtAttr( *GetDoc(), - const_cast<SfxPoolItem&>(*pItem), - 0, GetTxt().Len() ) ); - aClearWhichIds.push_back( pItem->Which() ); + if (*pItem == *pNdItem) // 4 + { + aClearWhichIds.push_back( pItem->Which() ); + } + else // 5 + { + aConvertSet.Put(*pItem); + } + aProcessedIds.push_back(pItem->Which()); + } + else // 2 + { + aConvertSet.Put(*pItem); } - aNdSet.ClearItem( pItem->Which() ); if( aIter.IsAtEnd() ) break; pItem = aIter.NextItem(); } + + // 4/ clear items of this that are set with the same value on pNd ClearItemsFromAttrSet( aClearWhichIds ); + + // 2, 5/ convert all other items to attrs + impl_FmtToTxtAttr(aConvertSet); } - if( aNdSet.Count() ) { - SfxItemIter aIter( aNdSet ); - const SfxPoolItem* pItem = aIter.GetCurItem(); - std::vector<USHORT> aClearWhichIds; + std::for_each(aProcessedIds.begin(), aProcessedIds.end(), + SfxItemSetClearer(aNdSet)); - while ( true ) - { - if ( lcl_IsNewAttrInSet( *pNd->m_pSwpHints, *pItem, - pNd->GetTxt().Len() ) ) - { - pNd->m_pSwpHints->SwpHintsArray::Insert( - MakeTxtAttr( *pNd->GetDoc(), - const_cast<SfxPoolItem&>(*pItem), - 0, pNd->GetTxt().Len() ) ); - } - aClearWhichIds.push_back( pItem->Which() ); + // 3/ convert items to attrs + pNd->impl_FmtToTxtAttr(aNdSet); - if( aIter.IsAtEnd() ) - break; - pItem = aIter.NextItem(); + if( aNdSet.Count() ) + { + SwFmtChg aTmp1( pNd->GetFmtColl() ); + pNd->SwModify::Modify( &aTmp1, &aTmp1 ); } - - pNd->ClearItemsFromAttrSet( aClearWhichIds ); - SwFmtChg aTmp1( pNd->GetFmtColl() ); - pNd->SwModify::Modify( &aTmp1, &aTmp1 ); } } diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 4abc8c152b..210ca1d7d7 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -30,6 +30,7 @@ #include <editeng/unolingu.hxx> +#include <unobaseclass.hxx> #include <unoflatpara.hxx> #include <vos/mutex.hxx> @@ -119,7 +120,7 @@ css::uno::Reference< css::container::XStringKeyMap > SAL_CALL SwXFlatParagraph:: { return SwXTextMarkup::getMarkupInfoContainer(); } - + void SAL_CALL SwXFlatParagraph::commitTextMarkup(::sal_Int32 nType, const ::rtl::OUString & rIdentifier, ::sal_Int32 nStart, ::sal_Int32 nLength, const css::uno::Reference< css::container::XStringKeyMap > & rxMarkupInfoContainer) throw (css::uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); @@ -136,7 +137,7 @@ void SAL_CALL SwXFlatParagraph::commitTextMarkup(::sal_Int32 nType, const ::rtl: void SAL_CALL SwXFlatParagraph::setChecked( ::sal_Int32 nType, ::sal_Bool bVal ) throw (uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - + if ( mpTxtNode ) { if ( text::TextMarkupType::SPELLCHECK == nType ) @@ -193,7 +194,7 @@ lang::Locale SAL_CALL SwXFlatParagraph::getPrimaryLanguageOfText(::sal_Int32 nPo throw (uno::RuntimeException, lang::IllegalArgumentException) { vos::OGuard aGuard(Application::GetSolarMutex()); - + if (!mpTxtNode) return SvxCreateLocale( LANGUAGE_NONE ); @@ -265,6 +266,24 @@ css::uno::Sequence< ::sal_Int32 > SAL_CALL SwXFlatParagraph::getLanguagePortions return css::uno::Sequence< ::sal_Int32>(); } + +const uno::Sequence< sal_Int8 >& +SwXFlatParagraph::getUnoTunnelId() +{ + static uno::Sequence<sal_Int8> aSeq(CreateUnoTunnelId()); + return aSeq; +} + + +sal_Int64 SAL_CALL +SwXFlatParagraph::getSomething( + const uno::Sequence< sal_Int8 >& rId) + throw (uno::RuntimeException) +{ + return sw::UnoTunnelImpl(rId, this); +} + + /****************************************************************************** * SwXFlatParagraphIterator ******************************************************************************/ @@ -279,7 +298,7 @@ SwXFlatParagraphIterator::SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType mbWrapped( sal_False ) { //mnStartNode = mnCurrentNode = get node from current cursor TODO! - + // register as listener and get notified when document is closed mpDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD )->Add(this); } @@ -287,7 +306,7 @@ SwXFlatParagraphIterator::SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType SwXFlatParagraphIterator::~SwXFlatParagraphIterator() { } - + void SwXFlatParagraphIterator::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) { @@ -299,7 +318,7 @@ void SwXFlatParagraphIterator::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) mpDoc = 0; } } - + uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getFirstPara() throw( uno::RuntimeException ) @@ -421,13 +440,14 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(co throw ( uno::RuntimeException, lang::IllegalArgumentException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - + uno::Reference< text::XFlatParagraph > xRet; if (!mpDoc) return xRet; - text::XFlatParagraph* pFP = xPara.get(); - SwXFlatParagraph* pFlatParagraph = static_cast<SwXFlatParagraph*>(pFP); + const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY); + OSL_ASSERT(xFPTunnel.is()); + SwXFlatParagraph* const pFlatParagraph(sw::UnoTunnelGetImplementation<SwXFlatParagraph>(xFPTunnel)); if ( !pFlatParagraph ) return xRet; @@ -467,13 +487,14 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c throw ( uno::RuntimeException, lang::IllegalArgumentException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - + uno::Reference< text::XFlatParagraph > xRet; if (!mpDoc) return xRet; - - text::XFlatParagraph* pFP = xPara.get(); - SwXFlatParagraph* pFlatParagraph = static_cast<SwXFlatParagraph*>(pFP); + + const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY); + OSL_ASSERT(xFPTunnel.is()); + SwXFlatParagraph* const pFlatParagraph(sw::UnoTunnelGetImplementation<SwXFlatParagraph>(xFPTunnel)); if ( !pFlatParagraph ) return xRet; @@ -508,4 +529,3 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c return xRet; } - diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 675c59c727..cc1513d9c1 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -169,7 +169,14 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) SwASC_AttrIter aAttrIter( (SwASCWriter&)rWrt, rNd, nStrPos ); if( !nStrPos && rWrt.bExportPargraphNumbering ) - rWrt.Strm().WriteUnicodeOrByteText( rNd.GetNumString() ); + { + String numString( rNd.GetNumString() ); + if (numString.Len()) + { + numString.Append(' '); + rWrt.Strm().WriteUnicodeOrByteText(numString); + } + } String aStr( rNd.GetTxt() ); if( rWrt.bASCII_ParaAsBlanc ) diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx index 528b0d82d1..fde66c4d2b 100644 --- a/sw/source/filter/rtf/rtfatr.cxx +++ b/sw/source/filter/rtf/rtfatr.cxx @@ -510,12 +510,12 @@ void OutRTF_SwFlyFrmFmt( SwRTFWriter& rRTFWrt ) // ueberhaupt eigene Attribute gibt ! SvMemoryStream aTmpStrm; SvStream* pSaveStrm = &rRTFWrt.Strm(); - rRTFWrt.SetStrm( aTmpStrm ); + rRTFWrt.SetStream( &aTmpStrm ); rRTFWrt.bRTFFlySyntax = false; OutRTF_SwFmt( rRTFWrt, *rRTFWrt.pFlyFmt ); - rRTFWrt.SetStrm( *pSaveStrm ); // Stream-Pointer wieder zurueck + rRTFWrt.SetStream( pSaveStrm ); // Stream-Pointer wieder zurueck if ( aTmpStrm.GetEndOfData() ) // gibt es SWG spezifische Attribute? { diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index 298711b23f..8e7f67997c 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -58,19 +58,22 @@ DECLARE_TABLE( SwBookmarkNodeTable, SvPtrarr* ) struct Writer_Impl { + SvStream * m_pStream; + SvStringsSortDtor *pSrcArr, *pDestArr; SvPtrarr* pFontRemoveLst, *pBkmkArr; SwBookmarkNodeTable* pBkmkNodePos; - Writer_Impl( const SwDoc& rDoc ); + Writer_Impl(); ~Writer_Impl(); void RemoveFontList( SwDoc& rDoc ); void InsertBkmk( const ::sw::mark::IMark& rBkmk ); }; -Writer_Impl::Writer_Impl( const SwDoc& /*rDoc*/ ) - : pSrcArr( 0 ), pDestArr( 0 ), pFontRemoveLst( 0 ), pBkmkNodePos( 0 ) +Writer_Impl::Writer_Impl() + : m_pStream(0) + , pSrcArr( 0 ), pDestArr( 0 ), pFontRemoveLst( 0 ), pBkmkNodePos( 0 ) { } @@ -141,7 +144,8 @@ void Writer_Impl::InsertBkmk(const ::sw::mark::IMark& rBkmk) */ Writer::Writer() - : pImpl(0), pStrm(0), pOrigPam(0), pOrigFileName(0), pDoc(0), pCurPam(0) + : m_pImpl(new Writer_Impl) + , pOrigPam(0), pOrigFileName(0), pDoc(0), pCurPam(0) { bWriteAll = bShowProgress = bUCS2_WithStartChar = true; bASCII_NoLastLineEnd = bASCII_ParaAsBlanc = bASCII_ParaAsCR = @@ -164,9 +168,11 @@ const IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() const { re void Writer::ResetWriter() { - if( pImpl && pImpl->pFontRemoveLst ) - pImpl->RemoveFontList( *pDoc ); - delete pImpl, pImpl = 0; + if (m_pImpl->pFontRemoveLst) + { + m_pImpl->RemoveFontList( *pDoc ); + } + m_pImpl.reset(new Writer_Impl); if( pCurPam ) { @@ -177,7 +183,6 @@ void Writer::ResetWriter() pCurPam = 0; pOrigFileName = 0; pDoc = 0; - pStrm = 0; bShowProgress = bUCS2_WithStartChar = TRUE; bASCII_NoLastLineEnd = bASCII_ParaAsBlanc = bASCII_ParaAsCR = @@ -246,13 +251,14 @@ SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx, ///////////////////////////////////////////////////////////////////////////// // Stream-spezifisches -#ifdef DBG_UTIL SvStream& Writer::Strm() { - ASSERT( pStrm, "Oh-oh. Dies ist ein Storage-Writer. Gleich knallts!" ); - return *pStrm; + ASSERT( m_pImpl->m_pStream, "Oh-oh. Writer with no Stream!" ); + return *m_pImpl->m_pStream; } -#endif + +void Writer::SetStream(SvStream *const pStream) +{ m_pImpl->m_pStream = pStream; } SvStream& Writer::OutHex( SvStream& rStrm, ULONG nHex, BYTE nLen ) @@ -314,10 +320,9 @@ ULONG Writer::Write( SwPaM& rPaM, SvStream& rStrm, const String* pFName ) return nResult; } - pStrm = &rStrm; pDoc = rPaM.GetDoc(); pOrigFileName = pFName; - pImpl = new Writer_Impl( *pDoc ); + m_pImpl->m_pStream = &rStrm; // PaM kopieren, damit er veraendert werden kann pCurPam = new SwPaM( *rPaM.End(), *rPaM.Start() ); @@ -368,20 +373,20 @@ BOOL Writer::CopyLocalFileToINet( String& rFileNm ) INET_PROT_NEWS >= aTargetUrl.GetProtocol() ) ) return bRet; - if( pImpl->pSrcArr ) + if (m_pImpl->pSrcArr) { // wurde die Datei schon verschoben USHORT nPos; - if( pImpl->pSrcArr->Seek_Entry( &rFileNm, &nPos )) + if (m_pImpl->pSrcArr->Seek_Entry( &rFileNm, &nPos )) { - rFileNm = *(*pImpl->pDestArr)[ nPos ]; + rFileNm = *(*m_pImpl->pDestArr)[ nPos ]; return TRUE; } } else { - pImpl->pSrcArr = new SvStringsSortDtor( 4, 4 ); - pImpl->pDestArr = new SvStringsSortDtor( 4, 4 ); + m_pImpl->pSrcArr = new SvStringsSortDtor( 4, 4 ); + m_pImpl->pDestArr = new SvStringsSortDtor( 4, 4 ); } String *pSrc = new String( rFileNm ); @@ -400,8 +405,8 @@ BOOL Writer::CopyLocalFileToINet( String& rFileNm ) if( bRet ) { - pImpl->pSrcArr->Insert( pSrc ); - pImpl->pDestArr->Insert( pDest ); + m_pImpl->pSrcArr->Insert( pSrc ); + m_pImpl->pDestArr->Insert( pDest ); rFileNm = *pDest; } else @@ -415,9 +420,6 @@ BOOL Writer::CopyLocalFileToINet( String& rFileNm ) void Writer::PutNumFmtFontsInAttrPool() { - if( !pImpl ) - pImpl = new Writer_Impl( *pDoc ); - // dann gibt es noch in den NumRules ein paar Fonts // Diese in den Pool putten. Haben sie danach einen RefCount > 1 // kann es wieder entfernt werden - ist schon im Pool @@ -457,9 +459,6 @@ void Writer::PutNumFmtFontsInAttrPool() void Writer::PutEditEngFontsInAttrPool( BOOL bIncl_CJK_CTL ) { - if( !pImpl ) - pImpl = new Writer_Impl( *pDoc ); - SfxItemPool& rPool = pDoc->GetAttrPool(); if( rPool.GetSecondaryPool() ) { @@ -474,9 +473,6 @@ void Writer::PutEditEngFontsInAttrPool( BOOL bIncl_CJK_CTL ) void Writer::PutCJKandCTLFontsInAttrPool() { - if( !pImpl ) - pImpl = new Writer_Impl( *pDoc ); - SfxItemPool& rPool = pDoc->GetAttrPool(); _AddFontItems( rPool, RES_CHRATR_CJK_FONT ); _AddFontItems( rPool, RES_CHRATR_CTL_FONT ); @@ -513,11 +509,13 @@ void Writer::_AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont ) rPool.Remove( *pItem ); else { - if( !pImpl->pFontRemoveLst ) - pImpl->pFontRemoveLst = new SvPtrarr( 0, 10 ); + if (!m_pImpl->pFontRemoveLst) + { + m_pImpl->pFontRemoveLst = new SvPtrarr( 0, 10 ); + } void* p = (void*)pItem; - pImpl->pFontRemoveLst->Insert( p, pImpl->pFontRemoveLst->Count() ); + m_pImpl->pFontRemoveLst->Insert( p, m_pImpl->pFontRemoveLst->Count() ); } } @@ -529,7 +527,9 @@ void Writer::CreateBookmarkTbl() for(IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getBookmarksBegin(); ppBkmk != pMarkAccess->getBookmarksEnd(); ++ppBkmk) - pImpl->InsertBkmk(**ppBkmk); + { + m_pImpl->InsertBkmk(**ppBkmk); + } } @@ -540,7 +540,8 @@ USHORT Writer::GetBookmarks(const SwCntntNode& rNd, xub_StrLen nStt, ASSERT( !rArr.Count(), "es sind noch Eintraege vorhanden" ); ULONG nNd = rNd.GetIndex(); - SvPtrarr* pArr = pImpl->pBkmkNodePos ? pImpl->pBkmkNodePos->Get( nNd ) : 0; + SvPtrarr* pArr = (m_pImpl->pBkmkNodePos) ? + m_pImpl->pBkmkNodePos->Get( nNd ) : 0; if( pArr ) { // there exist some bookmarks, search now all which is in the range @@ -586,11 +587,10 @@ ULONG StgWriter::WriteStream() ULONG StgWriter::Write( SwPaM& rPaM, SvStorage& rStg, const String* pFName ) { - pStrm = 0; + SetStream(0); pStg = &rStg; pDoc = rPaM.GetDoc(); pOrigFileName = pFName; - pImpl = new Writer_Impl( *pDoc ); // PaM kopieren, damit er veraendert werden kann pCurPam = new SwPaM( *rPaM.End(), *rPaM.Start() ); @@ -607,12 +607,11 @@ ULONG StgWriter::Write( SwPaM& rPaM, SvStorage& rStg, const String* pFName ) ULONG StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& rStg, const String* pFName, SfxMedium* pMedium ) { - pStrm = 0; + SetStream(0); pStg = 0; xStg = rStg; pDoc = rPaM.GetDoc(); pOrigFileName = pFName; - pImpl = new Writer_Impl( *pDoc ); // PaM kopieren, damit er veraendert werden kann pCurPam = new SwPaM( *rPaM.End(), *rPaM.Start() ); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 8f39cb61c9..f60d4eda6d 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -432,10 +432,11 @@ void MSWordStyles::WriteProperties( const SwFmt* pFmt, bool bParProp, USHORT nPo ASSERT( m_rExport.pCurrentStyle == NULL, "Current style not NULL" ); // set current style before calling out m_rExport.pCurrentStyle = pFmt; - + m_rExport.OutputFormat( *pFmt, bParProp, !bParProp ); - - ASSERT( m_rExport.pCurrentStyle != pFmt, "current style was changed" ); // reset current style... + + ASSERT( m_rExport.pCurrentStyle == pFmt, "current style was changed" ); + // reset current style... m_rExport.pCurrentStyle = NULL; if ( bInsDefCharSiz ) // nicht abgeleitet v. anderem Style diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 916ad970df..630ee29429 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2980,7 +2980,6 @@ void WW8Export::ExportDocument_Impl() pFib = new WW8Fib( bWrtWW8 ? 8 : 6 ); - SvStream* pOldStrm = &(Strm()); // JP 19.05.99: wozu das ??? SvStorageStreamRef xWwStrm( GetWriter().GetStorage().OpenSotStream( aMainStg ) ); SvStorageStreamRef xTableStrm( xWwStrm ), xDataStrm( xWwStrm ); xWwStrm->SetBufferSize( 32768 ); @@ -3000,7 +2999,7 @@ void WW8Export::ExportDocument_Impl() xDataStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); } - GetWriter().SetStrm( *xWwStrm ); + GetWriter().SetStream( & *xWwStrm ); pTableStrm = &xTableStrm; pDataStrm = &xDataStrm; @@ -3022,7 +3021,8 @@ void WW8Export::ExportDocument_Impl() { bEncrypt =true; - GetWriter().SetStrm( *aTempMain.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ) ); + GetWriter().SetStream( + aTempMain.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ) ); pTableStrm = aTempTable.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); @@ -3174,7 +3174,7 @@ void WW8Export::ExportDocument_Impl() delete pPiece; delete pDop; delete pFib; - GetWriter().SetStrm( *pOldStrm ); + GetWriter().SetStream( 0 ); xWwStrm->SetBufferSize( 0 ); diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index ef73263663..84b6e86e70 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -905,12 +905,12 @@ void SAL_CALL SwXTextView::setRubyList( -----------------------------------------------------------------------*/ SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/ ) { - SwWrtShell* pOldSh = &m_pView->GetWrtShell(); - SfxPrinter *pPrt = pOldSh->getIDocumentDeviceAccess()->getPrinter( false ); + SwWrtShell& rOldSh = m_pView->GetWrtShell(); + SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false ); SwDocShell* pDocSh; SfxObjectShellRef xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) ); xDocSh->DoInitNew( 0 ); - pOldSh->FillPrtDoc(pDocSh->GetDoc(), pPrt); + rOldSh.FillPrtDoc(pDocSh->GetDoc(), pPrt); SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); SwView* pDocView = (SwView*) pDocFrame->GetViewShell(); pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//Damit SelectShell gerufen wird. @@ -919,22 +919,19 @@ SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/ IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); SfxPrinter* pTempPrinter = pIDDA->getPrinter( true ); - if( pOldSh ) - { - const SwPageDesc& rCurPageDesc = pOldSh->GetPageDesc(pOldSh->GetCurPageDesc()); - - IDocumentDeviceAccess* pIDDA_old = pOldSh->getIDocumentDeviceAccess(); + const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc()); - if( pIDDA_old->getPrinter( false ) ) - { - pIDDA->setJobsetup( *pIDDA_old->getJobsetup() ); - //#69563# if it isn't the same printer then the pointer has been invalidated! - pTempPrinter = pIDDA->getPrinter( true ); - } + IDocumentDeviceAccess* pIDDA_old = rOldSh.getIDocumentDeviceAccess(); - pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue()); + if( pIDDA_old->getPrinter( false ) ) + { + pIDDA->setJobsetup( *pIDDA_old->getJobsetup() ); + //#69563# if it isn't the same printer then the pointer has been invalidated! + pTempPrinter = pIDDA->getPrinter( true ); } + pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue()); + return xDocSh; } |