summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2010-05-21 12:35:59 +0200
committerIvo Hinkelmann <ihi@openoffice.org>2010-05-21 12:35:59 +0200
commita572c2e12be5c2c40088269f3dc96e75e5912398 (patch)
tree95f4f67fe195134b8a06b7c889167237521ab426
parent4649fff17b9f7cab202f35592fdb8f04f256dc31 (diff)
parente1099108f621bb65a5376b103627fbf2635ea0a5 (diff)
CWS-TOOLING: integrate CWS sw33bf03
Notes
split repo tag: writer_ooo/DEV300_m79
-rw-r--r--sw/inc/ndtxt.hxx2
-rw-r--r--sw/inc/shellio.hxx21
-rw-r--r--sw/inc/unoflatpara.hxx12
-rw-r--r--sw/source/core/bastyp/swrect.cxx2
-rw-r--r--sw/source/core/doc/docredln.cxx3
-rw-r--r--sw/source/core/docnode/ndcopy.cxx6
-rw-r--r--sw/source/core/frmedt/feshview.cxx5
-rw-r--r--sw/source/core/txtnode/atrfld.cxx13
-rw-r--r--sw/source/core/txtnode/fntcache.cxx178
-rw-r--r--sw/source/core/txtnode/ndhints.cxx16
-rw-r--r--sw/source/core/txtnode/thints.cxx304
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx30
-rw-r--r--sw/source/filter/ascii/ascatr.cxx9
-rw-r--r--sw/source/filter/rtf/rtfatr.cxx4
-rw-r--r--sw/source/filter/writer/writer.cxx77
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx3
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx8
-rw-r--r--sw/source/ui/uno/unotxvw.cxx27
18 files changed, 385 insertions, 335 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 217ff06a8be1..cf3a4a779487 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 782161557753..0e52ce256754 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -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; }
};
diff --git a/sw/inc/unoflatpara.hxx b/sw/inc/unoflatpara.hxx
index caacec514174..acc004d473ab 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 fa06142ea627..1213bfaea896 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 000da4987cbf..71dc70106245 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 08b5038a5c0d..9c2ce7af3139 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 190cb5ecdf36..d6d13316a1e9 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 3ddd3189bf6c..4ad6c773db1d 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 7b08a0cb87e4..ff79d2266ba7 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 0cdf431ca2e6..c4c78fd6d59d 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 a2e326777383..ff2a40cdd9eb 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 ec04b3d3db8c..2923b4e46317 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>
@@ -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
******************************************************************************/
@@ -426,8 +445,9 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(co
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;
@@ -472,8 +492,9 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c
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 eadaea834d80..9249d4e5d11b 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 a569f91e5966..7dcb732df601 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 d37b8b6ff0a0..d70b6d6c754e 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 85fa45120ec4..0871325a2d43 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -435,7 +435,8 @@ void MSWordStyles::WriteProperties( const SwFmt* pFmt, bool bParProp, USHORT nPo
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 6bf7ecbb8cdf..dd6dd6d0d0e7 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 24049e571f60..0504fb1107ad 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;
}