summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rwxr-xr-x[-rw-r--r--]sw/source/core/crsr/swcrsr.cxx11
-rw-r--r--sw/source/core/doc/doclay.cxx18
-rwxr-xr-x[-rw-r--r--]sw/source/core/doc/tblafmt.cxx4
-rwxr-xr-x[-rw-r--r--]sw/source/core/edit/acorrect.cxx20
-rw-r--r--sw/source/core/edit/autofmt.cxx3
-rwxr-xr-x[-rw-r--r--]sw/source/core/inc/acorrect.hxx1
-rw-r--r--sw/source/core/text/txttab.cxx112
-rw-r--r--sw/source/core/txtnode/atrref.cxx2
-rw-r--r--sw/source/core/txtnode/atrtox.cxx2
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx85
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx26
-rw-r--r--sw/source/core/txtnode/thints.cxx9
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx18
-rwxr-xr-x[-rw-r--r--]sw/source/core/txtnode/txtedt.cxx10
-rw-r--r--sw/source/core/unocore/unorefmk.cxx2
-rw-r--r--sw/source/core/unocore/unotext.cxx55
-rwxr-xr-x[-rw-r--r--]sw/source/filter/ww8/rtfexport.cxx17
-rwxr-xr-x[-rw-r--r--]sw/source/filter/ww8/rtfexport.hxx2
-rwxr-xr-x[-rw-r--r--]sw/source/filter/ww8/wrtw8nds.cxx24
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx1
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx1
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx5
-rw-r--r--sw/source/filter/xml/XMLRedlineImportHelper.cxx52
-rw-r--r--sw/source/ui/app/apphdl.cxx23
-rw-r--r--sw/source/ui/app/swmodul1.cxx7
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx2
-rwxr-xr-x[-rw-r--r--]sw/source/ui/index/cnttab.src4
-rwxr-xr-x[-rw-r--r--]sw/source/ui/lingu/hhcwrp.cxx10
-rwxr-xr-x[-rw-r--r--]sw/source/ui/shells/textsh.cxx8
-rw-r--r--sw/source/ui/table/tabledlg.cxx10
-rwxr-xr-x[-rw-r--r--]sw/source/ui/uno/unotxdoc.cxx2
-rwxr-xr-x[-rw-r--r--]sw/source/ui/uno/unotxvw.cxx2
-rw-r--r--sw/source/ui/utlui/navipi.cxx4
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx6
35 files changed, 351 insertions, 209 deletions
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index b7106ade751c..63aae63019d3 100644..100755
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -973,7 +973,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
{
// Cursor als Kopie vom akt. und in den Ring aufnehmen
// Verkettung zeigt immer auf den zuerst erzeugten, also vorwaerts
- SwCursor* pSav = Create( this ); // sicher den aktuellen Crsr
+ std::auto_ptr< SwCursor > pSav( Create( this ) ); // save the current cursor
// wenn schon ausserhalb vom Bodytext, suche von der Position,
// ansonsten beginne mit der 1. GrundSection
@@ -1004,8 +1004,8 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
DeleteMark();
return 0;
}
+ pSav.release();
- delete pSav;
if( !( FND_IN_SELALL & eFndRngs ))
{
// es sollte nur einer gesucht werden, also fuege in dazu
@@ -1031,7 +1031,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
}
else if( FND_IN_SELALL & eFndRngs )
{
- SwCursor* pSav = Create( this ); // sicher den aktuellen Crsr
+ ::std::auto_ptr< SwCursor> pSav( Create( this ) ); // save the current cursor
const SwNode* pSttNd = ( FND_IN_BODYONLY & eFndRngs )
? rNds.GetEndOfContent().StartOfSectionNode()
@@ -1058,10 +1058,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas,
DeleteMark();
return 0;
}
- // es wurde ein- bis mehrmals gefunden. Das steht alles
- // im neuen Crsr-Ring. Darum hebe erstmal den alten Ring auf
- delete pSav;
-
+ pSav.release();
while( GetNext() != this )
delete GetNext();
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 98179bd1d8ea..d5e7354df745 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1312,6 +1312,17 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
//Erstmal das Format zum Fly besorgen und das Layout entkoppeln.
SwFrmFmt *pOldFmt = rDoc.GetNodes()[nNdIdx]->GetFlyFmt();
ASSERT( pOldFmt, "Format des Fly nicht gefunden." );
+ // --> OD #i115719#
+ // <title> and <description> attributes are lost when calling <DelFrms()>.
+ // Thus, keep them and restore them after the calling <MakeFrms()>
+ const bool bIsSwFlyFrmFmtInstance( dynamic_cast<SwFlyFrmFmt*>(pOldFmt) != 0 );
+ const String sTitle( bIsSwFlyFrmFmtInstance
+ ? static_cast<SwFlyFrmFmt*>(pOldFmt)->GetObjTitle()
+ : String() );
+ const String sDescription( bIsSwFlyFrmFmtInstance
+ ? static_cast<SwFlyFrmFmt*>(pOldFmt)->GetObjDescription()
+ : String() );
+ // <--
pOldFmt->DelFrms();
pNewFmt = rDoc.MakeFlyFrmFmt( rDoc.GetUniqueFrameName(),
@@ -1449,6 +1460,13 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
//Nun nur noch die Flys erzeugen lassen. Das ueberlassen
//wir vorhanden Methoden (insb. fuer InCntFlys etwas aufwendig).
pNewFmt->MakeFrms();
+ // --> OD #i115719#
+ if ( bIsSwFlyFrmFmtInstance )
+ {
+ static_cast<SwFlyFrmFmt*>(pOldFmt)->SetObjTitle( sTitle );
+ static_cast<SwFlyFrmFmt*>(pOldFmt)->SetObjDescription( sDescription );
+ }
+ // <--
}
break;
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 647acfe9d9a4..3d4a21584f9a 100644..100755
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -336,7 +336,7 @@ sal_Bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, s
READ( aFont, SvxFontItem , rVersions.nFontVersion)
if( rStream.GetStreamCharSet() == aFont.GetCharSet() )
- aFont.GetCharSet() = ::gsl_getSystemTextEncoding();
+ aFont.SetCharSet(::gsl_getSystemTextEncoding());
READ( aHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
READ( aWeight, SvxWeightItem , rVersions.nWeightVersion)
@@ -424,7 +424,7 @@ sal_Bool SwBoxAutoFmt::LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] )
READ( aFont, SvxFontItem , 0)
if( rStream.GetStreamCharSet() == aFont.GetCharSet() )
- aFont.GetCharSet() = ::gsl_getSystemTextEncoding();
+ aFont.SetCharSet(::gsl_getSystemTextEncoding());
READ( aHeight, SvxFontHeightItem , 1)
READ( aWeight, SvxWeightItem , 2)
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index dad951e3848a..d018b0731e43 100644..100755
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -157,6 +157,10 @@ sal_Bool SwAutoCorrDoc::Insert( xub_StrLen nPos, const String& rTxt )
sal_Bool SwAutoCorrDoc::Replace( xub_StrLen nPos, const String& rTxt )
{
+ return ReplaceRange( nPos, rTxt.Len(), rTxt );
+}
+sal_Bool SwAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength, const String& rTxt )
+{
SwPaM* pPam = &rCrsr;
if( pPam->GetPoint()->nContent.GetIndex() != nPos )
{
@@ -204,14 +208,26 @@ sal_Bool SwAutoCorrDoc::Replace( xub_StrLen nPos, const String& rTxt )
pPam->SetMark();
pPam->GetPoint()->nContent = Min( pNd->GetTxt().Len(),
- xub_StrLen( nPos + rTxt.Len() ));
+ xub_StrLen( nPos + nSourceLength ));
pDoc->ReplaceRange( *pPam, rTxt, false );
pPam->Exchange();
pPam->DeleteMark();
}
}
else
- pDoc->Overwrite( *pPam, rTxt );
+ {
+ if( nSourceLength != rTxt.Len() )
+ {
+ pPam->SetMark();
+ pPam->GetPoint()->nContent = Min( pNd->GetTxt().Len(),
+ xub_StrLen( nPos + nSourceLength ));
+ pDoc->ReplaceRange( *pPam, rTxt, false );
+ pPam->Exchange();
+ pPam->DeleteMark();
+ }
+ else
+ pDoc->Overwrite( *pPam, rTxt );
+ }
// pDoc->SetRedlineMode_intern( eOld );
if( bUndoIdInitialized )
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 828adb14ff10..0f9113445646 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1542,6 +1542,9 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel )
aFmt.SetBulletFont( pBullFnt );
aFmt.SetBulletChar( cBullChar );
aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ // #i93908# clear suffix for bullet lists
+ aFmt.SetPrefix(::rtl::OUString());
+ aFmt.SetSuffix(::rtl::OUString());
aFmt.SetFirstLineOffset( lBullFirstLineOffset );
aFmt.SetAbsLSpace( nAbsPos );
if( !aFmt.GetCharFmt() )
diff --git a/sw/source/core/inc/acorrect.hxx b/sw/source/core/inc/acorrect.hxx
index d52d3a70f4b5..d90b57b13b50 100644..100755
--- a/sw/source/core/inc/acorrect.hxx
+++ b/sw/source/core/inc/acorrect.hxx
@@ -68,6 +68,7 @@ public:
virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd );
virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt );
virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt );
+ virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt );
virtual sal_Bool SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId,
SfxPoolItem& );
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index a83fe42c265d..9e482a63f4b3 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -84,7 +84,6 @@ sal_uInt16 SwLineInfo::NumberOfTabStops() const
/*************************************************************************
* SwTxtFormatter::NewTabPortion()
*************************************************************************/
-
SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto ) const
{
SwTabPortion *pTabPor = 0;
@@ -216,63 +215,74 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto )
cFill = 0;
eAdj = SVX_TAB_ADJUST_LEFT;
}
- // --> OD 2008-02-07 #newlistlevelattrs#
- long nForced = 0;
- if ( !bTabsRelativeToIndent )
+
+ // --> OD #i115705# - correction and refactoring:
+ // overrule determined next tab stop position in order to apply
+ // a tab stop at the left margin under the following conditions:
+ // - the new tab portion is inside the hanging indent
+ // - a tab stop at the left margin is allowed
+ // - the determined next tab stop is a default tab stop position OR
+ // the determined next tab stop is beyond the left margin
{
- if ( bRTL )
+ long nLeftMarginTabPos = 0;
{
- Point aPoint( Left(), 0 );
- pFrm->SwitchLTRtoRTL( aPoint );
- nForced = pFrm->Frm().Right() - aPoint.X();
+ if ( !bTabsRelativeToIndent )
+ {
+ if ( bRTL )
+ {
+ Point aPoint( Left(), 0 );
+ pFrm->SwitchLTRtoRTL( aPoint );
+ nLeftMarginTabPos = pFrm->Frm().Right() - aPoint.X();
+ }
+ else
+ {
+ nLeftMarginTabPos = Left() - pFrm->Frm().Left();
+ }
+ }
+ if( pCurr->HasForcedLeftMargin() )
+ {
+ SwLinePortion* pPor = pCurr->GetPortion();
+ while( pPor && !pPor->IsFlyPortion() )
+ {
+ pPor = pPor->GetPortion();
+ }
+ if ( pPor )
+ {
+ nLeftMarginTabPos += pPor->Width();
+ }
+ }
}
- else
+ const bool bNewTabPortionInsideHangingIndent =
+ bRTL ? nCurrentAbsPos > nTabLeft - nLeftMarginTabPos
+ : nCurrentAbsPos < nTabLeft + nLeftMarginTabPos;
+ if ( bNewTabPortionInsideHangingIndent )
{
- nForced = Left() - pFrm->Frm().Left();
+ // If the paragraph is not inside a list having a list tab stop following
+ // the list label or no further tab stop found in such a paragraph or
+ // the next tab stop position does not equal the list tab stop,
+ // a tab stop at the left margin can be applied. If this condition is
+ // not hold, it is overruled by compatibility option TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST.
+ const bool bTabAtLeftMarginAllowed =
+ ( !aLineInf.IsListTabStopIncluded() ||
+ !pTabStop ||
+ nNextPos != aLineInf.GetListTabStopPosition() ) ||
+ // compatibility option TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
+ pFrm->GetTxtNode()->getIDocumentSettingAccess()->
+ get(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST);
+ if ( bTabAtLeftMarginAllowed )
+ {
+ if ( !pTabStop || eAdj == SVX_TAB_ADJUST_DEFAULT ||
+ ( nNextPos > nLeftMarginTabPos ) )
+ {
+ eAdj = SVX_TAB_ADJUST_DEFAULT;
+ cFill = 0;
+ nNextPos = nLeftMarginTabPos;
+ }
+ }
}
}
- if( pCurr->HasForcedLeftMargin() )
- {
- SwLinePortion* pPor = pCurr->GetPortion();
- while( pPor && !pPor->IsFlyPortion() )
- pPor = pPor->GetPortion();
- if( pPor )
- nForced += pPor->Width();
- }
-
// <--
- // --> OD 2009-04-03 #i100732#
- // correction of condition, when a tab stop at the left margin can
- // be applied:
- // If the paragraph is not inside a list having a list tab stop following
- // the list label or no further tab stop found in such a paragraph or
- // the next tab stop position does not equal the list tab stop,
- // a tab stop at the left margin can be applied. If this condition is
- // not hold, it is overruled by compatibility option TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST.
- const bool bTabAtLeftMargin =
- ( !aLineInf.IsListTabStopIncluded() ||
- !pTabStop ||
- nNextPos != aLineInf.GetListTabStopPosition() ) ||
- // compatibility option TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
- pFrm->GetTxtNode()->getIDocumentSettingAccess()->
- get(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST);
- if ( bTabAtLeftMargin &&
- // <--
- ( ( bRTL && nCurrentAbsPos > nTabLeft - nForced ) ||
- ( !bRTL && nCurrentAbsPos < nTabLeft + nForced ) ) &&
- // --> OD 2009-07-21 #i103685#
- // adjust condition:
- // - back to pre OOo 3.0 condition, if tab stops are relative to indent
- // - further checks needed, if tab stops are not relative to indent
- ( nNextPos > 0 &&
- ( bTabsRelativeToIndent ||
- ( !pTabStop || nNextPos > nForced ) ) ) )
- // <--
- {
- eAdj = SVX_TAB_ADJUST_DEFAULT;
- cFill = 0;
- nNextPos = nForced;
- }
+
nNextPos += bRTL ? nLinePos - nTabLeft : nTabLeft - nLinePos;
ASSERT( nNextPos >= 0, "GetTabStop: Don't go back!" );
nNewTabPos = KSHORT(nNextPos);
diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx
index 979a810b018b..ba2c3fce60c6 100644
--- a/sw/source/core/txtnode/atrref.cxx
+++ b/sw/source/core/txtnode/atrref.cxx
@@ -77,7 +77,7 @@ SfxPoolItem* SwFmtRefMark::Clone( SfxItemPool* ) const
// Attribut fuer Inhalts-/Positions-Referenzen im Text
SwTxtRefMark::SwTxtRefMark( SwFmtRefMark& rAttr,
- xub_StrLen nStartPos, xub_StrLen* pEnd )
+ xub_StrLen const nStartPos, xub_StrLen const*const pEnd)
: SwTxtAttrEnd( rAttr, nStartPos, nStartPos )
, m_pTxtNode( 0 )
, m_pEnd( 0 )
diff --git a/sw/source/core/txtnode/atrtox.cxx b/sw/source/core/txtnode/atrtox.cxx
index 8c64e4b2bd29..8b7e54813171 100644
--- a/sw/source/core/txtnode/atrtox.cxx
+++ b/sw/source/core/txtnode/atrtox.cxx
@@ -36,7 +36,7 @@
#include <ndtxt.hxx>
SwTxtTOXMark::SwTxtTOXMark( SwTOXMark& rAttr,
- xub_StrLen nStartPos, xub_StrLen* pEnd )
+ xub_StrLen const nStartPos, xub_StrLen const*const pEnd)
: SwTxtAttrEnd( rAttr, nStartPos, nStartPos )
, m_pTxtNode( 0 )
, m_pEnd( 0 )
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 236a0bab3d72..bf4116cc91f9 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -613,6 +613,7 @@ SwFmtMeta::~SwFmtMeta()
{
if (m_pMeta && (m_pMeta->GetFmtMeta() == this))
{
+ NotifyChangeTxtNode(0);
m_pMeta->SetFmtMeta(0);
}
}
@@ -633,16 +634,24 @@ SfxPoolItem * SwFmtMeta::Clone( SfxItemPool * /*pPool*/ ) const
void SwFmtMeta::SetTxtAttr(SwTxtMeta * const i_pTxtAttr)
{
- ASSERT(!(m_pTxtAttr && i_pTxtAttr),
+ OSL_ENSURE(!(m_pTxtAttr && i_pTxtAttr),
"SwFmtMeta::SetTxtAttr: already has text attribute?");
- ASSERT( m_pTxtAttr || i_pTxtAttr ,
+ OSL_ENSURE( m_pTxtAttr || i_pTxtAttr ,
"SwFmtMeta::SetTxtAttr: no attribute to remove?");
m_pTxtAttr = i_pTxtAttr;
- ASSERT(m_pMeta, "inserted SwFmtMeta has no sw::Meta?");
+ OSL_ENSURE(m_pMeta, "inserted SwFmtMeta has no sw::Meta?");
// the sw::Meta must be able to find the current text attribute!
- if (i_pTxtAttr && m_pMeta)
+ if (m_pMeta)
{
- m_pMeta->SetFmtMeta(this);
+ if (i_pTxtAttr)
+ {
+ m_pMeta->SetFmtMeta(this);
+ }
+ else if (m_pMeta->GetFmtMeta() == this)
+ { // text attribute gone => de-register from text node!
+ NotifyChangeTxtNode(0);
+ m_pMeta->SetFmtMeta(0);
+ }
}
}
@@ -650,36 +659,22 @@ void SwFmtMeta::NotifyChangeTxtNode(SwTxtNode *const pTxtNode)
{
// N.B.: do not reset m_pTxtAttr here: see call in nodes.cxx,
// where the hint is not deleted!
- ASSERT(m_pMeta, "NotifyRemoval: no meta ?");
- if (m_pMeta)
- {
- if (!pTxtNode)
- {
- SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
- &static_cast<SwModify&>(*m_pMeta) ); // cast to base class!
- m_pMeta->Modify(&aMsgHint, &aMsgHint);
- }
- else
- { // do not call Modify, that would call SwXMeta::Modify!
- m_pMeta->NotifyChangeTxtNode();
- }
+ OSL_ENSURE(m_pMeta, "SwFmtMeta::NotifyChangeTxtNode: no Meta?");
+ if (m_pMeta && (m_pMeta->GetFmtMeta() == this))
+ { // do not call Modify, that would call SwXMeta::Modify!
+ m_pMeta->NotifyChangeTxtNode(pTxtNode);
}
}
-// UGLY: this really awful method fixes up an inconsistent state,
-// and if it is not called when copying, total chaos will undoubtedly ensue
-void SwFmtMeta::DoCopy(SwFmtMeta & rOriginalMeta)
+// this SwFmtMeta has been cloned and points at the same sw::Meta as the source
+// this method copies the sw::Meta
+void SwFmtMeta::DoCopy(::sw::MetaFieldManager & i_rTargetDocManager,
+ SwTxtNode & i_rTargetTxtNode)
{
- ASSERT(m_pMeta, "DoCopy called for SwFmtMeta with no sw::Meta?");
+ OSL_ENSURE(m_pMeta, "DoCopy called for SwFmtMeta with no sw::Meta?");
if (m_pMeta)
{
const ::boost::shared_ptr< ::sw::Meta> pOriginal( m_pMeta );
- // UGLY: original sw::Meta now points at _this_ due to being already
- // inserted via MakeTxtAttr! so fix it up to point at the original item
- // (maybe would be better to tell MakeTxtAttr that it creates a copy?)
- pOriginal->SetFmtMeta(&rOriginalMeta);
- // force pOriginal to register in original text node!
- pOriginal->NotifyChangeTxtNode();
if (RES_TXTATR_META == Which())
{
m_pMeta.reset( new ::sw::Meta(this) );
@@ -688,14 +683,13 @@ void SwFmtMeta::DoCopy(SwFmtMeta & rOriginalMeta)
{
::sw::MetaField *const pMetaField(
static_cast< ::sw::MetaField* >(pOriginal.get()));
- SwDoc * const pTargetDoc( GetTxtAttr()->GetTxtNode()->GetDoc() );
- m_pMeta = pTargetDoc->GetMetaFieldManager().makeMetaField( this,
+ m_pMeta = i_rTargetDocManager.makeMetaField( this,
pMetaField->m_nNumberFormat, pMetaField->IsFixedLanguage() );
}
+ // Meta must have a text node before calling RegisterAsCopyOf
+ m_pMeta->NotifyChangeTxtNode(& i_rTargetTxtNode);
// this cannot be done in Clone: a Clone is not necessarily a copy!
m_pMeta->RegisterAsCopyOf(*pOriginal);
- // force copy Meta to register in target text node!
- m_pMeta->NotifyChangeTxtNode();
}
}
@@ -724,27 +718,36 @@ SwTxtMeta * Meta::GetTxtAttr() const
SwTxtNode * Meta::GetTxtNode() const
{
- SwTxtMeta * const pTxtAttr( GetTxtAttr() );
- return (pTxtAttr) ? pTxtAttr->GetTxtNode() : 0;
+ return m_pTxtNode;
}
-void Meta::NotifyChangeTxtNode()
+void Meta::NotifyChangeTxtNodeImpl()
{
- SwTxtNode * const pTxtNode( GetTxtNode() );
- if (pTxtNode && (GetRegisteredIn() != pTxtNode))
+ if (m_pTxtNode && (GetRegisteredIn() != m_pTxtNode))
{
- pTxtNode->Add(this);
+ m_pTxtNode->Add(this);
}
- else if (!pTxtNode && GetRegisteredIn())
+ else if (!m_pTxtNode && GetRegisteredIn())
{
const_cast<SwModify *>(GetRegisteredIn())->Remove(this);
}
}
+void Meta::NotifyChangeTxtNode(SwTxtNode *const pTxtNode)
+{
+ m_pTxtNode = pTxtNode;
+ NotifyChangeTxtNodeImpl();
+ if (!pTxtNode) // text node gone? invalidate UNO object!
+ {
+ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
+ &static_cast<SwModify&>(*this) ); // cast to base class!
+ this->Modify(&aMsgHint, &aMsgHint);
+ }
+}
+
// SwClient
void Meta::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
{
- NotifyChangeTxtNode();
SwModify::Modify(pOld, pNew);
if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
{ // invalidate cached uno object
@@ -752,7 +755,7 @@ void Meta::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
}
}
-// sw::Metadatable
+// sfx2::Metadatable
::sfx2::IXmlIdRegistry& Meta::GetRegistry()
{
SwTxtNode * const pTxtNode( GetTxtNode() );
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 9a2767977d84..fa7b72271826 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1435,15 +1435,10 @@ void lcl_CopyHint( const sal_uInt16 nWhich, const SwTxtAttr * const pHt,
}
case RES_TXTATR_META:
case RES_TXTATR_METAFIELD:
- ASSERT(pNewHt, "copying META should not fail! cannot call DoCopy");
- ASSERT(pDest && (CH_TXTATR_INWORD ==
+ OSL_ENSURE(pNewHt, "copying Meta should not fail!");
+ OSL_ENSURE(pDest && (CH_TXTATR_INWORD ==
pDest->GetTxt().GetChar(*pNewHt->GetStart())),
"missing CH_TXTATR?");
- if (pNewHt)
- {
- SwFmtMeta & rMeta(static_cast<SwFmtMeta&>(pNewHt->GetAttr()));
- rMeta.DoCopy( const_cast<SwFmtMeta&>(pHt->GetMeta()) );
- }
break;
}
}
@@ -1484,7 +1479,8 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
{
// attribute in the area => copy
SwTxtAttr *const pNewHt = pDest->InsertItem(
- pHt->GetAttr(), nOldPos, nOldPos );
+ pHt->GetAttr(), nOldPos, nOldPos,
+ nsSetAttrMode::SETATTR_IS_COPY);
if ( pNewHt )
{
lcl_CopyHint( nWhich, pHt, pNewHt,
@@ -1495,7 +1491,8 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
: 0 == pOtherDoc->GetRefMark(
pHt->GetRefMark().GetRefName() ) )
{
- pDest->InsertItem( pHt->GetAttr(), nOldPos, nOldPos );
+ pDest->InsertItem( pHt->GetAttr(), nOldPos, nOldPos,
+ nsSetAttrMode::SETATTR_IS_COPY);
}
}
}
@@ -1718,9 +1715,9 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
if( pDest == this )
{
- // die Daten kopieren
+ // copy the hint here, but insert it later
pNewHt = MakeTxtAttr( *GetDoc(), pHt->GetAttr(),
- nAttrStt, nAttrEnd );
+ nAttrStt, nAttrEnd, COPY, pDest );
lcl_CopyHint(nWhich, pHt, pNewHt, 0, pDest);
aArr.C40_INSERT( SwTxtAttr, pNewHt, aArr.Count() );
@@ -1728,7 +1725,9 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
else
{
pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt - nDeletedDummyChars,
- nAttrEnd - nDeletedDummyChars, nsSetAttrMode::SETATTR_NOTXTATRCHR );
+ nAttrEnd - nDeletedDummyChars,
+ nsSetAttrMode::SETATTR_NOTXTATRCHR
+ | nsSetAttrMode::SETATTR_IS_COPY);
if (pNewHt)
{
lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
@@ -2208,7 +2207,8 @@ void SwTxtNode::CutImpl( SwTxtNode * const pDest, const SwIndex & rDestStart,
{
const bool bSuccess( pDest->InsertHint( pNewHt,
nsSetAttrMode::SETATTR_NOTXTATRCHR
- | nsSetAttrMode::SETATTR_DONTREPLACE ) );
+ | nsSetAttrMode::SETATTR_DONTREPLACE
+ | nsSetAttrMode::SETATTR_IS_COPY) );
if (bSuccess)
{
lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index d0be32e61953..4d0dd116e5cd 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -996,7 +996,8 @@ SwTxtAttr* MakeRedlineTxtAttr( SwDoc & rDoc, SfxPoolItem & rAttr )
// create new text attribute
SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr,
- xub_StrLen nStt, xub_StrLen nEnd )
+ xub_StrLen const nStt, xub_StrLen const nEnd,
+ CopyOrNew_t const bIsCopy, SwTxtNode *const pTxtNode)
{
if ( isCHRATR(rAttr.Which()) )
{
@@ -1077,7 +1078,8 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr,
break;
case RES_TXTATR_META:
case RES_TXTATR_METAFIELD:
- pNew = new SwTxtMeta( static_cast<SwFmtMeta&>(rNew), nStt, nEnd );
+ pNew = SwTxtMeta::CreateTxtMeta( rDoc.GetMetaFieldManager(), pTxtNode,
+ static_cast<SwFmtMeta&>(rNew), nStt, nEnd, bIsCopy );
break;
default:
ASSERT(RES_TXTATR_AUTOFMT == rNew.Which(), "unknown attribute");
@@ -1211,7 +1213,8 @@ SwTxtNode::InsertItem( SfxPoolItem& rAttr,
ASSERT( !isCHRATR(rAttr.Which()), "AUTOSTYLES - "
"SwTxtNode::InsertItem should not be called with character attributes");
- SwTxtAttr* const pNew = MakeTxtAttr( *GetDoc(), rAttr, nStart, nEnd );
+ SwTxtAttr *const pNew = MakeTxtAttr( *GetDoc(), rAttr, nStart, nEnd,
+ (nMode & nsSetAttrMode::SETATTR_IS_COPY) ? COPY : NEW, this );
if ( pNew )
{
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index f6dcfc520eae..90b5b984a8d1 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -308,10 +308,25 @@ SwCharFmt* SwTxtRuby::GetCharFmt()
* class SwTxtMeta
*************************************************************************/
+SwTxtMeta *
+SwTxtMeta::CreateTxtMeta(
+ ::sw::MetaFieldManager & i_rTargetDocManager,
+ SwTxtNode *const i_pTargetTxtNode,
+ SwFmtMeta & i_rAttr,
+ xub_StrLen const i_nStart, xub_StrLen const i_nEnd, bool const i_bIsCopy)
+{
+ if (COPY == i_bIsCopy)
+ { // i_rAttr is already cloned, now call DoCopy to copy the sw::Meta
+ OSL_ENSURE(i_pTargetTxtNode, "cannot copy Meta without target node");
+ i_rAttr.DoCopy(i_rTargetDocManager, *i_pTargetTxtNode);
+ }
+ SwTxtMeta *const pTxtMeta(new SwTxtMeta(i_rAttr, i_nStart, i_nEnd));
+ return pTxtMeta;
+}
+
SwTxtMeta::SwTxtMeta( SwFmtMeta & i_rAttr,
const xub_StrLen i_nStart, const xub_StrLen i_nEnd )
: SwTxtAttrNesting( i_rAttr, i_nStart, i_nEnd )
- , m_pTxtNode( 0 )
{
i_rAttr.SetTxtAttr( this );
SetHasDummyChar(true);
@@ -328,7 +343,6 @@ SwTxtMeta::~SwTxtMeta()
void SwTxtMeta::ChgTxtNode(SwTxtNode * const pNode)
{
- m_pTxtNode = pNode; // before Notify!
SwFmtMeta & rFmtMeta( static_cast<SwFmtMeta &>(GetAttr()) );
if (rFmtMeta.GetTxtAttr() == this)
{
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 4b99670b865c..b3d93e8eb0a7 100644..100755
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -966,11 +966,11 @@ void SwTxtNode::SetLanguageAndFont( const SwPaM &rPaM,
if (pFont)
{
SvxFontItem aFontItem = (SvxFontItem&) aSet.Get( nFontWhichId );
- aFontItem.GetFamilyName() = pFont->GetName();
- aFontItem.GetFamily() = pFont->GetFamily();
- aFontItem.GetStyleName() = pFont->GetStyleName();
- aFontItem.GetPitch() = pFont->GetPitch();
- aFontItem.GetCharSet() = pFont->GetCharSet();
+ aFontItem.SetFamilyName( pFont->GetName());
+ aFontItem.SetFamily( pFont->GetFamily());
+ aFontItem.SetStyleName( pFont->GetStyleName());
+ aFontItem.SetPitch( pFont->GetPitch());
+ aFontItem.SetCharSet( pFont->GetCharSet() );
aSet.Put( aFontItem );
}
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 1bb59d0eee65..90d5dac1c315 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -886,7 +886,7 @@ bool SwXMeta::SetContentRange(
SwTxtMeta const * const pTxtAttr( pMeta->GetTxtAttr() );
if (pTxtAttr)
{
- rpNode = pTxtAttr->GetTxtNode();
+ rpNode = pMeta->GetTxtNode();
if (rpNode)
{
// rStart points at the first position _within_ the meta!
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 875d0e23235d..323eedffc9b0 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1857,32 +1857,6 @@ static bool lcl_SimilarPosition( const sal_Int32 nPos1, const sal_Int32 nPos2 )
return abs( nPos1 - nPos2 ) < COL_POS_FUZZY;
}
-void SwXText::copyText(
- const uno::Reference< text::XTextCopy >& xSource )
- throw ( uno::RuntimeException )
-{
- uno::Reference< lang::XUnoTunnel > xTTunnel( xSource, uno::UNO_QUERY_THROW );
- SwXText* pText = 0;
- pText = reinterpret_cast< SwXText* >(
- sal::static_int_cast< sal_IntPtr >( xTTunnel->getSomething( SwXText::getUnoTunnelId()) ));
-
- uno::Reference< text::XText > xText( xSource, uno::UNO_QUERY_THROW );
- uno::Reference< text::XTextCursor > xCursor = xText->createTextCursor( );
- xCursor->gotoEnd( sal_True );
-
- uno::Reference< lang::XUnoTunnel > xTunnel( xCursor, uno::UNO_QUERY_THROW );
-
- OTextCursorHelper* pCursor = 0;
- pCursor = reinterpret_cast< OTextCursorHelper* >(
- sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
- if ( pCursor )
- {
- SwNodeIndex rNdIndex( *GetStartNode( ), 1 );
- SwPosition rPos( rNdIndex );
- m_pImpl->m_pDoc->CopyRange( *pCursor->GetPaM( ), rPos, false );
- }
-}
-
void SwXText::Impl::ConvertCell(
const bool bFirstCell,
const uno::Sequence< uno::Reference< text::XTextRange > > & rCell,
@@ -2387,6 +2361,35 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
return xRet;
}
+
+void SAL_CALL
+SwXText::copyText(
+ const uno::Reference< text::XTextCopy >& xSource )
+throw (uno::RuntimeException)
+{
+ vos::OGuard g(Application::GetSolarMutex());
+
+ uno::Reference< text::XText > const xText(xSource, uno::UNO_QUERY_THROW);
+ uno::Reference< text::XTextCursor > const xCursor =
+ xText->createTextCursor();
+ xCursor->gotoEnd( sal_True );
+
+ uno::Reference< lang::XUnoTunnel > const xCursorTunnel(xCursor,
+ uno::UNO_QUERY_THROW);
+
+ OTextCursorHelper *const pCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xCursorTunnel);
+ if (!pCursor)
+ {
+ throw uno::RuntimeException();
+ }
+
+ SwNodeIndex rNdIndex( *GetStartNode( ), 1 );
+ SwPosition rPos( rNdIndex );
+ m_pImpl->m_pDoc->CopyRange( *pCursor->GetPaM(), rPos, false );
+}
+
+
/******************************************************************
* SwXBodyText
******************************************************************/
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 357a7aff1e57..74d400a17796 100644..100755
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -118,6 +118,11 @@ RtfSdrExport& RtfExport::SdrExporter() const
return *m_pSdrExport;
}
+bool RtfExport::HackIsWW8OrHigher() const
+{
+ return true;
+}
+
bool RtfExport::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich )
{
// FIXME is this actually true for rtf? - this is copied from DOCX
@@ -480,6 +485,10 @@ void RtfExport::WritePageDescTable()
}
Strm() << '}' << sNewLine;
bOutPageDescs = sal_False;
+
+ // reset table infos, otherwise the depth of the cells will be incorrect,
+ // in case the page style (header or footer) had tables
+ mpTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo());
}
void RtfExport::ExportDocument_Impl()
@@ -1243,16 +1252,19 @@ void RtfExport::WriteHeaderFooter(const SwFrmFmt& rFmt, bool bHeader, const sal_
class SwRTFWriter : public Writer
{
- public:
+ bool m_bOutOutlineOnly;
+ public:
SwRTFWriter( const String& rFilterName, const String& rBaseURL );
virtual ~SwRTFWriter();
virtual sal_uLong WriteStream();
};
-SwRTFWriter::SwRTFWriter( const String& /*rFltName*/, const String & rBaseURL )
+SwRTFWriter::SwRTFWriter( const String& rFltName, const String & rBaseURL )
{
OSL_TRACE("%s", OSL_THIS_FUNC);
SetBaseURL( rBaseURL );
+ // export outline nodes, only (send outline to clipboard/presentation)
+ m_bOutOutlineOnly = 'O' == rFltName.GetChar( 0 );
}
SwRTFWriter::~SwRTFWriter()
@@ -1262,6 +1274,7 @@ sal_uLong SwRTFWriter::WriteStream()
{
OSL_TRACE("%s", OSL_THIS_FUNC);
RtfExport aExport( NULL, pDoc, new SwPaM( *pCurPam->End(), *pCurPam->Start() ), pCurPam, this );
+ aExport.mbOutOutlineOnly = m_bOutOutlineOnly;
aExport.ExportDocument( true );
return 0;
}
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index e73cd9b822c5..a6f018cddb7e 100644..100755
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -82,7 +82,7 @@ public:
virtual RtfSdrExport& SdrExporter() const;
/// Hack, unfortunately necessary at some places for now.
- virtual bool HackIsWW8OrHigher() const { return false; }
+ virtual bool HackIsWW8OrHigher() const;
/// Guess the script (asian/western).
virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich );
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 7f5e0eaae54e..7f6fe64a5eea 100644..100755
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -107,6 +107,7 @@
#include <ndgrf.hxx>
#include <ndole.hxx>
+
#include <cstdio>
using namespace ::com::sun::star;
@@ -575,7 +576,7 @@ void SwAttrIter::OutAttr( xub_StrLen nSwPos )
characters.
*/
if ( !m_rExport.HackIsWW8OrHigher() )
- aFont.GetCharSet() = GetCharSet();
+ aFont.SetCharSet( GetCharSet() );
if ( rParentFont != aFont )
m_rExport.AttrOutput().OutputItem( aFont );
@@ -1650,12 +1651,13 @@ xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode&
{
// Get the bookmarks for the normal run
xub_StrLen nNextPos = aAttrIter->WhereNext();
-
- GetSortedBookmarks( rNode, nAktPos, nNextPos - nAktPos );
-
xub_StrLen nNextBookmark = nNextPos;
- NearestBookmark( nNextPos, nAktPos, false );
+ if( nNextBookmark > nAktPos )//no need to search for bookmarks otherwise
+ {
+ GetSortedBookmarks( rNode, nAktPos, nNextBookmark - nAktPos );
+ NearestBookmark( nNextBookmark, nAktPos, false );
+ }
return std::min( nNextPos, nNextBookmark );
}
@@ -1663,9 +1665,9 @@ void MSWordExportBase::UpdatePosition( SwAttrIter* aAttrIter, xub_StrLen nAktPos
{
xub_StrLen nNextPos;
- // go to next attribute if no bookmark is found of if the bookmark is behind the next attribute position
+ // go to next attribute if no bookmark is found and if the next attribute position if at the current position
bool bNextBookmark = NearestBookmark( nNextPos, nAktPos, true );
- if( !bNextBookmark || nNextPos < aAttrIter->WhereNext() )
+ if( !bNextBookmark && nAktPos >= aAttrIter->WhereNext() )
aAttrIter->NextPos();
}
@@ -2837,8 +2839,12 @@ void MSWordExportBase::OutputContentNode( const SwCntntNode& rNode )
switch ( rNode.GetNodeType() )
{
case ND_TEXTNODE:
- OutputTextNode( *rNode.GetTxtNode() );
- break;
+ {
+ const SwTxtNode& rTextNode = *rNode.GetTxtNode();
+ if( !mbOutOutlineOnly || rTextNode.IsOutline() )
+ OutputTextNode( rTextNode );
+ }
+ break;
case ND_GRFNODE:
OutputGrfNode( *rNode.GetGrfNode() );
break;
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index c40ce759b3f2..3ec0aeea4d0c 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3389,6 +3389,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM
pStyles( NULL ),
bHasHdr(false), bHasFtr(false), bSubstituteBullets(true),
mbExportModeRTF( false ),
+ mbOutOutlineOnly( false ),
pDoc( pDocument ),
pCurPam( pCurrentPam ),
pOrigPam( pOriginalPam )
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 6350fb9f5512..129822af0640 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -554,6 +554,7 @@ public:
sal_uInt8 bSubstituteBullets : 1; // true: SubstituteBullet() gets called
bool mbExportModeRTF;
+ bool mbOutOutlineOnly; // export outline nodes, only (send outline to clipboard/presentation)
SwDoc *pDoc;
SwPaM *pCurPam, *pOrigPam;
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index fcaf4e07a293..0fe904e8a092 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -79,6 +79,8 @@
#include "docsh.hxx"
#include <cstdio>
+#include <stdio.h>
+
using namespace ::com::sun::star;
using namespace nsFieldFlags;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index c2e9c8789d55..8bd86b4bbe05 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2573,7 +2573,10 @@ void WW8TabDesc::CreateSwTable()
else
{
if (nPreferredWidth)
- nLeft = pIo->maSectionManager.GetTextAreaWidth() - nPreferredWidth - nOrgDxaLeft;
+ {
+ nLeft = pIo->maSectionManager.GetTextAreaWidth();
+ nLeft = nLeft - nPreferredWidth - nOrgDxaLeft;
+ }
else
nLeft = -GetMinLeft();
}
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 21c9a3b93c75..75251c8c1531 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -70,21 +70,22 @@ using ::com::sun::star::beans::XPropertySetInfo;
SwDoc* lcl_GetDocViaTunnel( Reference<XTextCursor> & rCursor )
{
Reference<XUnoTunnel> xTunnel( rCursor, UNO_QUERY);
- DBG_ASSERT( xTunnel.is(), "missing XUnoTunnel for Cursor" );
- OTextCursorHelper* pSwXCursor = reinterpret_cast< OTextCursorHelper * >(
- sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(OTextCursorHelper::getUnoTunnelId())) );
- DBG_ASSERT( NULL != pSwXCursor, "OTextCursorHelper missing" );
- return pSwXCursor->GetDoc();
+ OSL_ENSURE(xTunnel.is(), "missing XUnoTunnel for XTextCursor");
+ OTextCursorHelper *const pXCursor =
+ ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xTunnel);
+ OSL_ENSURE( pXCursor, "OTextCursorHelper missing" );
+ return (pXCursor) ? pXCursor->GetDoc() : 0;
}
SwDoc* lcl_GetDocViaTunnel( Reference<XTextRange> & rRange )
{
Reference<XUnoTunnel> xTunnel(rRange, UNO_QUERY);
- DBG_ASSERT(xTunnel.is(), "Can't tunnel XTextRange");
- SwXTextRange *pRange = reinterpret_cast< SwXTextRange *>(
- sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextRange::getUnoTunnelId())) );
- DBG_ASSERT( NULL != pRange, "SwXTextRange missing" );
- return pRange->GetDoc();
+ OSL_ENSURE(xTunnel.is(), "missing XUnoTunnel for XTextRange");
+ SwXTextRange *const pXRange =
+ ::sw::UnoTunnelGetImplementation<SwXTextRange>(xTunnel);
+ // #i115174#: this may be a SvxUnoTextRange
+// OSL_ENSURE( pXRange, "SwXTextRange missing" );
+ return (pXRange) ? pXRange->GetDoc() : 0;
}
@@ -111,7 +112,7 @@ public:
void Set( SwNodeIndex& rIndex );
void SetAsNodeIndex( Reference<XTextRange> & rRange );
- void CopyPositionInto(SwPosition& rPos);
+ void CopyPositionInto(SwPosition& rPos, SwDoc & rDoc);
SwDoc* GetDoc();
sal_Bool IsValid();
@@ -154,6 +155,12 @@ void XTextRangeOrNodeIndexPosition::SetAsNodeIndex(
// XTextRange -> XTunnel -> SwXTextRange
SwDoc* pDoc = lcl_GetDocViaTunnel(rRange);
+ if (!pDoc)
+ {
+ OSL_TRACE("SetAsNodeIndex: no SwDoc");
+ return;
+ }
+
// SwXTextRange -> PaM
SwUnoInternalPaM aPaM(*pDoc);
#ifdef DBG_UTIL
@@ -166,14 +173,15 @@ void XTextRangeOrNodeIndexPosition::SetAsNodeIndex(
Set(aPaM.GetPoint()->nNode);
}
-void XTextRangeOrNodeIndexPosition::CopyPositionInto(SwPosition& rPos)
+void
+XTextRangeOrNodeIndexPosition::CopyPositionInto(SwPosition& rPos, SwDoc & rDoc)
{
DBG_ASSERT(IsValid(), "Can't get Position");
// create PAM from start cursor (if no node index is present)
if (NULL == pIndex)
{
- SwUnoInternalPaM aUnoPaM(*GetDoc());
+ SwUnoInternalPaM aUnoPaM(rDoc);
#ifdef DBG_UTIL
sal_Bool bSuccess =
#endif
@@ -479,6 +487,13 @@ Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection(
// get document from old cursor (via tunnel)
SwDoc* pDoc = lcl_GetDocViaTunnel(xOldCursor);
+ if (!pDoc)
+ {
+ OSL_TRACE("XMLRedlineImportHelper::CreateRedlineTextSection: "
+ "no SwDoc => cannot create section.");
+ return 0;
+ }
+
// create text section for redline
SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool
(RES_POOLCOLL_STANDARD, false );
@@ -611,11 +626,18 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo)
// get the document (from one of the positions)
SwDoc* pDoc = pRedlineInfo->aAnchorStart.GetDoc();
+ if (!pDoc)
+ {
+ OSL_TRACE("XMLRedlineImportHelper::InsertIntoDocument: "
+ "no SwDoc => cannot insert redline.");
+ return;
+ }
+
// now create the PaM for the redline
SwPaM aPaM(pDoc->GetNodes().GetEndOfContent());
- pRedlineInfo->aAnchorStart.CopyPositionInto(*aPaM.GetPoint());
+ pRedlineInfo->aAnchorStart.CopyPositionInto(*aPaM.GetPoint(), *pDoc);
aPaM.SetMark();
- pRedlineInfo->aAnchorEnd.CopyPositionInto(*aPaM.GetPoint());
+ pRedlineInfo->aAnchorEnd.CopyPositionInto(*aPaM.GetPoint(), *pDoc);
// collapse PaM if (start == end)
if (*aPaM.GetPoint() == *aPaM.GetMark())
diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx
index 012f08ff9684..2b3b4b345dbc 100644
--- a/sw/source/ui/app/apphdl.cxx
+++ b/sw/source/ui/app/apphdl.cxx
@@ -698,23 +698,28 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
SwWrtShell* pWrtSh = pDocSh ? pDocSh->GetWrtShell() : 0;
switch( rEvHint.GetEventId() )
{
-/* MA 07. Mar. 96: UpdateInputFlds() nur noch bei Dokument neu.
- (Und bei Einfuegen Textbaust.)
- case SFX_EVENT_OPENDOC:
- // dann am aktuellen Dokument die Input-Fedler updaten
- if( pWrtSh )
- pWrtSh->UpdateInputFlds();
+ case SFX_EVENT_LOADFINISHED:
+ OSL_ASSERT(!pWrtSh);
+ // if it is a new document created from a template,
+ // update fixed fields
+ if (pDocSh->GetMedium())
+ {
+ SFX_ITEMSET_ARG( pDocSh->GetMedium()->GetItemSet(),
+ pTemplateItem, SfxBoolItem,
+ SID_TEMPLATE, sal_False);
+ if (pTemplateItem && pTemplateItem->GetValue())
+ {
+ pDocSh->GetDoc()->SetFixFields(false, 0);
+ }
+ }
break;
-*/
case SFX_EVENT_CREATEDOC:
- // alle FIX-Date/Time Felder auf akt. setzen
if( pWrtSh )
{
SFX_ITEMSET_ARG( pDocSh->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
sal_Bool bUpdateFields = sal_True;
if( pUpdateDocItem && pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE)
bUpdateFields = sal_False;
- pWrtSh->SetFixFields();
if(bUpdateFields)
{
pWrtSh->UpdateInputFlds();
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index f5e79b9da72f..4359ca16f9d9 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -209,7 +209,12 @@ void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
return;
// Weitergabe an die CORE
- const sal_Bool bReadonly = pCurrView->GetDocShell()->IsReadOnly();
+ sal_Bool bReadonly;
+ const SwDocShell* pDocSh = pCurrView->GetDocShell();
+ if (pDocSh)
+ bReadonly = pDocSh->IsReadOnly();
+ else //Use existing option if DocShell missing
+ bReadonly = pSh->GetViewOptions()->IsReadonly();
SwViewOption* pViewOpt;
if(!bViewOnly)
pViewOpt = new SwViewOption( *pPref );
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index e64ec62f6c3a..99ba59d9d852 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1321,7 +1321,7 @@ void SwFrmPage::InitPos(RndStdIds eId,
aAtHorzPosFT.Enable( bEnable );
aAtHorzPosED.Enable( bEnable );
- bEnable = nV == text::VertOrientation::NONE && !bFormat;
+ bEnable = nV == text::VertOrientation::NONE;
if ( !bEnable )
{
aAtVertPosED.SetValue( 0, FUNIT_TWIP );
diff --git a/sw/source/ui/index/cnttab.src b/sw/source/ui/index/cnttab.src
index a21d8920c78d..98e40aa4f9aa 100644..100755
--- a/sw/source/ui/index/cnttab.src
+++ b/sw/source/ui/index/cnttab.src
@@ -575,8 +575,8 @@ TabPage TP_TOX_ENTRY
};
Window WIN_TOKEN
{
- Pos = MAP_APPFONT ( 70, 16 ) ;
- Size = MAP_APPFONT ( 136, 12 ) ;
+ Pos = MAP_APPFONT ( 70, 15 ) ;
+ Size = MAP_APPFONT ( 136, 14 ) ;
ImageButton WIN_LEFT_SCROLL
{
HelpID = "sw:ImageButton:TP_TOX_ENTRY:WIN_LEFT_SCROLL";
diff --git a/sw/source/ui/lingu/hhcwrp.cxx b/sw/source/ui/lingu/hhcwrp.cxx
index 98280db3f63e..ae84d4b1872f 100644..100755
--- a/sw/source/ui/lingu/hhcwrp.cxx
+++ b/sw/source/ui/lingu/hhcwrp.cxx
@@ -560,11 +560,11 @@ void SwHHCWrapper::ReplaceUnit(
if (pTargetFont && pNewUnitLanguage)
{
SvxFontItem aFontItem = (SvxFontItem&) aSet.Get( RES_CHRATR_CJK_FONT );
- aFontItem.GetFamilyName() = pTargetFont->GetName();
- aFontItem.GetFamily() = pTargetFont->GetFamily();
- aFontItem.GetStyleName() = pTargetFont->GetStyleName();
- aFontItem.GetPitch() = pTargetFont->GetPitch();
- aFontItem.GetCharSet() = pTargetFont->GetCharSet();
+ aFontItem.SetFamilyName( pTargetFont->GetName());
+ aFontItem.SetFamily( pTargetFont->GetFamily());
+ aFontItem.SetStyleName( pTargetFont->GetStyleName());
+ aFontItem.SetPitch( pTargetFont->GetPitch());
+ aFontItem.SetCharSet( pTargetFont->GetCharSet() );
aSet.Put( aFontItem );
}
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index 6ed0e3050f26..d4c309cf2a2d 100644..100755
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -1161,10 +1161,10 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
{
bFontChanged = sal_True;
SvxFontItem aNewFontItem( aFont );
- aNewFontItem.GetFamilyName() = aNewFont.GetName();
- aNewFontItem.GetFamily() = aNewFont.GetFamily();
- aNewFontItem.GetPitch() = aNewFont.GetPitch();
- aNewFontItem.GetCharSet() = aNewFont.GetCharSet();
+ aNewFontItem.SetFamilyName( aNewFont.GetName());
+ aNewFontItem.SetFamily( aNewFont.GetFamily());
+ aNewFontItem.SetPitch( aNewFont.GetPitch());
+ aNewFontItem.SetCharSet( aNewFont.GetCharSet() );
SfxItemSet aRestoreSet( GetPool(), RES_CHRATR_FONT, RES_CHRATR_FONT,
RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 45eab49d553d..9fe0b570cc6f 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -1111,12 +1111,18 @@ void SwTableColumnPage::UpdateCols( sal_uInt16 nAktPos )
if(!bModifyTable && !bProp )
{
-// Tabellenbreite bleibt, Differenz wird mit der/den
-// naechsten Zellen ausgeglichen
+// the table width is constant, the difference is balanced with the other columns
+ sal_uInt16 nLoopCount = 0;
while( nDiff )
{
if( ++nAktPos == nNoOfVisibleCols)
+ {
nAktPos = 0;
+ ++nLoopCount;
+ //#i101353# in small tables it might not be possible to balance column width
+ if( nLoopCount > 1 )
+ break;
+ }
if( nDiff < 0 )
{
SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 35f3c0e8e172..7b2409152372 100644..100755
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -4123,6 +4123,8 @@ SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwViewO
SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl()
{
m_rShell.ApplyViewOptions( m_aOldViewOptions );
+ //#i115062# invalidate meta character slot
+ m_rShell.GetView().GetViewFrame()->GetBindings().Invalidate( FN_VIEW_META_CHARS );
}
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
index 788fd4cce9cb..b895fd418170 100644..100755
--- a/sw/source/ui/uno/unotxvw.cxx
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -421,8 +421,8 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArg
{
rSh.EnterStdMode();
rSh.GotoMark(pMark);
+ return sal_True;
}
- return sal_True;
}
// IndexMark, Index, TextField, Draw, Section, Footnote, Paragraph
//
diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx
index d88ecdf6be73..7ad513ed479e 100644
--- a/sw/source/ui/utlui/navipi.cxx
+++ b/sw/source/ui/utlui/navipi.cxx
@@ -809,8 +809,10 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
&aContentToolBox, SW_RES(NF_PAGE ));
pEdit->SetActionHdl(LINK(this, SwNavigationPI, EditAction));
pEdit->SetGetFocusHdl(LINK(this, SwNavigationPI, EditGetFocus));
- pEdit->SetModifyHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
pEdit->SetAccessibleName(pEdit->GetQuickHelpText());
+ pEdit->SetUpHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
+ pEdit->SetDownHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
+
bPageCtrlsVisible = sal_True;
// Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SHOW_ROOT);
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index 2d0bcc433be1..465277890a28 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -1307,6 +1307,9 @@ void SwWrtShell::NumOrBulletOn(sal_Bool bNum)
// <--
aFmt.SetBulletChar( numfunc::GetBulletChar(static_cast<sal_uInt8>(nLevel)));
aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ // #i93908# clear suffix for bullet lists
+ aFmt.SetPrefix(::rtl::OUString());
+ aFmt.SetSuffix(::rtl::OUString());
}
aNumRule.Set(static_cast<sal_uInt16>(nLevel), aFmt);
}
@@ -1370,6 +1373,9 @@ void SwWrtShell::NumOrBulletOn(sal_Bool bNum)
}
aFmt.SetBulletChar( numfunc::GetBulletChar(nLvl) );
aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ // #i93908# clear suffix for bullet lists
+ aFmt.SetPrefix(::rtl::OUString());
+ aFmt.SetSuffix(::rtl::OUString());
}
// --> OD 2009-08-26 #i95907#