[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/inc sw/source writerfilter/source

2014-05-30 Thread Luboš Luňák
 sw/inc/IDocumentSettingAccess.hxx|3 +-
 sw/inc/doc.hxx   |1 
 sw/source/core/doc/doc.cxx   |4 +++
 sw/source/core/doc/docnew.cxx|1 
 sw/source/core/text/txtfld.cxx   |   31 +++
 sw/source/ui/uno/SwXDocumentSettings.cxx |   16 +
 writerfilter/source/dmapper/DomainMapper.cxx |3 ++
 writerfilter/source/dmapper/PropertyIds.cxx  |1 
 writerfilter/source/dmapper/PropertyIds.hxx  |1 
 9 files changed, 59 insertions(+), 2 deletions(-)

New commits:
commit 2d89b1a029514935b60fbd3f7f7c5341a329bfc8
Author: Luboš Luňák 
Date:   Thu May 29 14:31:20 2014 +0200

handle direct formatting for numbering in .docx (bnc#875717)

Change-Id: I3ed0f926e79f3878c5702c2becae97d99d00e201
(cherry picked from commit c2ac2ced0d51200a62f7436144f0d89cfcd15eed)
Signed-off-by: Andras Timar 

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index 6e66fd0..4e94a1e 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -92,7 +92,8 @@ namespace com { namespace sun { namespace star { namespace 
i18n { struct Forbidd
  STYLES_NODEFAULT,
  FLOATTABLE_NOMARGINS,
  EMBED_FONTS,
- EMBED_SYSTEM_FONTS
+ EMBED_SYSTEM_FONTS,
+ APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
  };
 
  public:
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 987d0ab..b872119 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -581,6 +581,7 @@ private:
 bool mbBackgroundParaOverDrawings;
 bool mbTabOverMargin;
 bool mbSurroundTextWrapSmall;
+bool mApplyParagraphMarkFormatToNumbering;
 
 bool mbLastBrowseMode   : 1;
 
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index e1d84f3..d3c74e9 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -206,6 +206,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const
 case FLOATTABLE_NOMARGINS: return mbFloattableNomargins;
 case EMBED_FONTS: return mEmbedFonts;
 case EMBED_SYSTEM_FONTS: return mEmbedSystemFonts;
+case APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING: return 
mApplyParagraphMarkFormatToNumbering;
 default:
 OSL_FAIL("Invalid setting id");
 }
@@ -400,6 +401,9 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ 
bool value)
 case EMBED_SYSTEM_FONTS:
 mEmbedSystemFonts = value;
 break;
+case APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
+mApplyParagraphMarkFormatToNumbering = value;
+break;
 default:
 OSL_FAIL("Invalid setting id");
 }
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 5385509..a97e616 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -313,6 +313,7 @@ SwDoc::SwDoc()
 mbBackgroundParaOverDrawings(false),
 mbTabOverMargin(false),
 mbSurroundTextWrapSmall(false),
+mApplyParagraphMarkFormatToNumbering(false),
 mbLastBrowseMode( false ),
 mn32DummyCompatabilityOptions1(0),
 mn32DummyCompatabilityOptions2(0),
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 22058c3..35471f41 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -48,6 +48,7 @@
 #include "pagedesc.hxx"
 #include 
 #include "fmtmeta.hxx"
+#include "fmtautofmt.hxx"
 
 
 /*
@@ -382,6 +383,32 @@ SwLinePortion *SwTxtFormatter::NewExtraPortion( 
SwTxtFormatInfo &rInf )
  */
 
 
+// OOXML spec says that w:rPr inside w:pPr specifies formatting for the 
paragraph mark symbol (i.e. the control
+// character than can be configured to be shown). However, in practice MSO 
also uses it as direct formatting
+// for numbering in that paragraph. I don't know if the problem is in the spec 
or in MSWord.
+static void checkApplyParagraphMarkFormatToNumbering( SwFont* pNumFnt, 
SwTxtFormatInfo& rInf, const IDocumentSettingAccess* pIDSA )
+{
+SwTxtNode* node = rInf.GetTxtFrm()->GetTxtNode();
+if( 
!pIDSA->get(IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING ))
+return;
+if( SwpHints* hints = node->GetpSwpHints())
+{
+for( int i = 0; i < hints->Count(); ++i )
+{
+SwTxtAttr* hint = hints->GetTextHint( i );
+// Formatting for the paragraph mark is set to apply only to the 
(non-existent) extra character
+// the at end of the txt node.
+if( hint->Which() == RES_TXTATR_AUTOFMT && hint->GetStart() != 
NULL && hint->GetEnd() != NULL
+&& *hint->GetStart() == *hint->GetEnd() && *hint->GetStart() 
== node->Len())
+{
+boost::share

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/inc sw/source

2014-05-08 Thread Michael Stahl
 sw/inc/ndtxt.hxx |3 +++
 sw/source/core/doc/doccomp.cxx   |   13 +
 sw/source/core/txtnode/ndtxt.cxx |   11 ---
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 8fb7fa143cca628654933459135eee6c3f1450d4
Author: Michael Stahl 
Date:   Wed May 7 17:52:16 2014 +0200

fdo#74790: sw: Compare Document: fix assertions about RSID-only hints

For ordinary documents the SwTxtNode::MakeFrm() would set the
m_bFormatIgnoreStart/End flags of the RSID-only hints, but the document
loaded by Compare Document (and Merge Document) is special because it
is loaded, there are editing operations on it, but it has no layout,
so the assertions about these flags trigger.

(regression from 6db39dbd7378351f6476f6db25eb7110c9cfb291)

Change-Id: I8a6e02b68f22e609640adbe93ff194e4081d9856
(cherry picked from commit 80b131038d2375c9855ee5fbe225e75bdad2645e)
Reviewed-on: https://gerrit.libreoffice.org/9274
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index d8e1fbb..072aecb 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -280,6 +280,9 @@ public:
 // delete all attributes from SwpHintsArray.
 voidClearSwpHintsArr( bool bDelFields );
 
+/// initialize the hints after file loading (which takes shortcuts)
+voidFileLoadedInitHints();
+
 /// Insert pAttr into hints array. @return true iff inserted successfully
 boolInsertHint( SwTxtAttr * const pAttr,
   const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index aaefd2a..ac06f62 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1756,12 +1756,23 @@ void SwCompareData::SetRedlinesToDoc( sal_Bool 
bUseDocInfo )
 }
 }
 
+static bool lcl_MergePortions(SwNode *const& pNode, void *)
+{
+if (pNode->IsTxtNode())
+{
+pNode->GetTxtNode()->FileLoadedInitHints();
+}
+return true;
+}
+
 // Returns (the difference count?) if something is different
 long SwDoc::CompareDoc( const SwDoc& rDoc )
 {
 if( &rDoc == this )
 return 0;
 
+const_cast(rDoc).GetNodes().ForEach(&lcl_MergePortions);
+
 long nRet = 0;
 
 // Get comparison options
@@ -2005,6 +2016,8 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
 
 long nRet = 0;
 
+const_cast(rDoc).GetNodes().ForEach(&lcl_MergePortions);
+
 GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
 
 SwDoc& rSrcDoc = (SwDoc&)rDoc;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 2be6fbb9..f6bf93d 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -257,14 +257,19 @@ SwTxtNode::~SwTxtNode()
 InitSwParaStatistics( false );
 }
 
-SwCntntFrm *SwTxtNode::MakeFrm( SwFrm* pSib )
+void SwTxtNode::FileLoadedInitHints()
 {
-// fdo#52028: ODF file import does not result in MergePortions being called
-// for every attribute, since that would be inefficient.  So call it here.
 if (m_pSwpHints)
 {
 m_pSwpHints->MergePortions(*this);
 }
+}
+
+SwCntntFrm *SwTxtNode::MakeFrm( SwFrm* pSib )
+{
+// fdo#52028: ODF file import does not result in MergePortions being called
+// for every attribute, since that would be inefficient.  So call it here.
+FileLoadedInitHints();
 SwCntntFrm *pFrm = new SwTxtFrm( this, pSib );
 return pFrm;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/inc sw/source

2014-04-30 Thread Luboš Luňák
 sw/inc/docary.hxx|9 +
 sw/inc/editsh.hxx|2 +
 sw/source/core/doc/docredln.cxx  |   66 +++
 sw/source/core/edit/edredln.cxx  |   18 ++
 sw/source/ui/uiview/view2.cxx|   31 +++---
 sw/source/ui/uiview/viewstat.cxx |   37 +++--
 6 files changed, 115 insertions(+), 48 deletions(-)

New commits:
commit 68dfe73d209091455c79e1f746ca84cf8743629d
Author: Luboš Luňák 
Date:   Mon Apr 28 18:03:49 2014 +0200

allow accepting/rejecting changes in a selection (bnc#874790)

More convenient than handling them one by one.

(cherry picked from commit 160e93607f6c2c3981823b30ee981ca23d4e1a0d)
(cherry picked from commit 4a60f9387ddd832f7c164102b76351e5e520d920)
(cherry picked from commit 94fc0b4752599601ddf9ff3c9b49da15cffb4882)
(cherry picked from commit d46e7dabd3090697c46e24a350cc75f35c28a8f7)

Change-Id: Iee02d12d595ee41cff7a31e2bda61425c9f53d6d
Reviewed-on: https://gerrit.libreoffice.org/9198
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 4525763..0f69048 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -175,6 +175,15 @@ public:
 sal_uInt16 FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
 sal_uInt16 nLookahead = 20 ) const;
 
+/**
+ Find the redline at the given position.
+
+ @param tableIndex position in SwRedlineTbl to start searching at, will be 
updated with the index of the returned
+   redline (or the next redline after the given position 
if not found)
+ @param next true: redline starts at position and ends after, false: 
redline starts before position and ends at or after
+*/
+const SwRedline* FindAtPosition( const SwPosition& startPosition, 
sal_uInt16& tableIndex, bool next = true ) const;
+
 using _SwRedlineTbl::size;
 using _SwRedlineTbl::operator[];
 using _SwRedlineTbl::empty;
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 9991fd0..159a9da 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -894,6 +894,8 @@ public:
 const SwRedline& GetRedline( sal_uInt16 nPos ) const;
 sal_Bool AcceptRedline( sal_uInt16 nPos );
 sal_Bool RejectRedline( sal_uInt16 nPos );
+bool AcceptRedlinesInSelection();
+bool RejectRedlinesInSelection();
 
 
 /** Search Redline for this Data and @return position in array.
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index ee4db26..a6e6367 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1914,35 +1914,6 @@ static sal_Bool lcl_RejectRedline( SwRedlineTbl& rArr, 
sal_uInt16& rPos,
 return bRet;
 }
 
-static const SwRedline* lcl_FindCurrRedline( const SwPosition& rSttPos,
-sal_uInt16& rPos,
-bool bNext = true )
-{
-const SwRedline* pFnd = 0;
-const SwRedlineTbl& rArr = 
rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl();
-for( ; rPos < rArr.size() ; ++rPos )
-{
-const SwRedline* pTmp = rArr[ rPos ];
-if( pTmp->HasMark() && pTmp->IsVisible() )
-{
-const SwPosition* pRStt = pTmp->Start(),
-  * pREnd = pRStt == pTmp->GetPoint() ? pTmp->GetMark()
-  : pTmp->GetPoint();
-if( bNext ? *pRStt <= rSttPos : *pRStt < rSttPos )
-{
-if( bNext ? *pREnd > rSttPos : *pREnd >= rSttPos )
-{
-pFnd = pTmp;
-break;
-}
-}
-else
-break;
-}
-}
-return pFnd;
-}
-
 static int lcl_AcceptRejectRedl( Fn_AcceptReject fn_AcceptReject,
 SwRedlineTbl& rArr, sal_Bool bCallDelete,
 const SwPaM& rPam)
@@ -1953,7 +1924,7 @@ static int lcl_AcceptRejectRedl( Fn_AcceptReject 
fn_AcceptReject,
 const SwPosition* pStt = rPam.Start(),
 * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
  : rPam.GetPoint();
-const SwRedline* pFnd = lcl_FindCurrRedline( *pStt, n, true );
+const SwRedline* pFnd = rArr.FindAtPosition( *pStt, n, true );
 if( pFnd && // Is new a part of it?
 ( *pFnd->Start() != *pStt || *pFnd->End() > *pEnd ))
 {
@@ -2257,7 +2228,7 @@ const SwRedline* SwDoc::SelNextRedline( SwPaM& rPam ) 
const
 // If the starting positon points to the last valid ContentNode,
 // we take the next Redline in any case.
 sal_uInt16 n = 0;
-const SwRedline* pFnd = lcl_FindCurrRedline( rSttPos, n, true );
+const SwRedline* pFnd = GetRedlineTbl().FindAtPosition( rSttPos, n, true );
 if( pFnd )
 {
 const SwPosition* pEnd = pFnd->E

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/inc sw/source

2014-02-12 Thread Oliver-Rainer Wittmann
 sw/inc/expfld.hxx |3 +++
 sw/inc/txtfld.hxx |4 
 sw/source/core/fields/expfld.cxx  |   32 +++-
 sw/source/core/fields/usrfld.cxx  |8 +++-
 sw/source/core/txtnode/atrfld.cxx |   24 ++--
 5 files changed, 67 insertions(+), 4 deletions(-)

New commits:
commit 4cf1ab04f7fb0ccd546240f40e024872827c997f
Author: Oliver-Rainer Wittmann 
Date:   Tue Feb 11 13:25:08 2014 +

Resolves: #i124179# trigger update User Fields...

and related Input Fields when user directly edits a User Field Input Field

- assure that no recursive updates occur

(cherry picked from commit 3c2b5242e81575ec4b6c110afd88894670bd2283)

Conflicts:
sw/inc/txtfld.hxx
sw/source/core/fields/expfld.cxx
sw/source/core/fields/usrfld.cxx

Change-Id: I36af4d5e8008f16737e3ec14c1ec737a5f43d3b1
(cherry picked from commit 50f0bb85b7e18001886fdf8bb03eb1d138838b90)

diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index 2944589..076569a 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -308,6 +308,9 @@ class SW_DLLPUBLIC SwInputField : public SwField
 // Accessing Input Field's content
 const OUString& getContent() const;
 
+void LockNotifyContentChange();
+void UnlockNotifyContentChange();
+
 public:
 /// Direct input via dialog; delete old value.
 SwInputField(
diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx
index cfab932..b973aaa 100644
--- a/sw/inc/txtfld.hxx
+++ b/sw/inc/txtfld.hxx
@@ -83,6 +83,8 @@ public:
 
 virtual sal_Int32* GetEnd();
 
+void LockNotifyContentChange();
+void UnlockNotifyContentChange();
 virtual void NotifyContentChange( SwFmtFld& rFmtFld );
 
 void UpdateTextNodeContent( const OUString& rNewContent );
@@ -92,6 +94,8 @@ public:
 
 private:
 sal_Int32 m_nEnd;
+
+bool m_bLockNotifyContentChange;
 };
 
 #endif
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index e25dd31..6cdd6e7 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -1145,12 +1145,35 @@ SwFmtFld* SwInputField::GetFmtFld()
 return mpFmtFld;
 }
 
-
 const OUString& SwInputField::getContent() const
 {
 return aContent;
 }
 
+void SwInputField::LockNotifyContentChange()
+{
+if ( GetFmtFld() != NULL )
+{
+SwTxtInputFld* pTxtInputFld = dynamic_cast< SwTxtInputFld* 
>(GetFmtFld()->GetTxtFld());
+if ( pTxtInputFld != NULL )
+{
+pTxtInputFld->LockNotifyContentChange();
+}
+}
+}
+
+void SwInputField::UnlockNotifyContentChange()
+{
+if ( GetFmtFld() != NULL )
+{
+SwTxtInputFld* pTxtInputFld = dynamic_cast< SwTxtInputFld* 
>(GetFmtFld()->GetTxtFld());
+if ( pTxtInputFld != NULL )
+{
+pTxtInputFld->UnlockNotifyContentChange();
+}
+}
+}
+
 void SwInputField::applyFieldContent( const OUString& rNewFieldContent )
 {
 if ( (nSubType & 0x00ff) == INP_TXT )
@@ -1164,6 +1187,13 @@ void SwInputField::applyFieldContent( const OUString& 
rNewFieldContent )
 if( pUserTyp )
 {
 pUserTyp->SetContent( rNewFieldContent );
+
+// trigger update of the corresponding User Fields and other 
related Input Fields
+{
+LockNotifyContentChange();
+pUserTyp->UpdateFlds();
+UnlockNotifyContentChange();
+}
 }
 }
 }
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 35b7261..9cd6baa 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -202,8 +202,14 @@ void SwUserFieldType::Modify( const SfxPoolItem* pOld, 
const SfxPoolItem* pNew )
 ChgValid( sal_False );
 
 NotifyClients( pOld, pNew );
+
 // update input fields that might be connected to the user field
-GetDoc()->GetSysFldType( RES_INPUTFLD )->UpdateFlds();
+if ( !IsModifyLocked() )
+{
+LockModify();
+GetDoc()->GetSysFldType( RES_INPUTFLD )->UpdateFlds();
+UnlockModify();
+}
 }
 
 double SwUserFieldType::GetValue( SwCalc& rCalc )
diff --git a/sw/source/core/txtnode/atrfld.cxx 
b/sw/source/core/txtnode/atrfld.cxx
index 5810067..1107c1c 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -440,6 +440,7 @@ SwTxtInputFld::SwTxtInputFld(
 
 : SwTxtFld( rAttr, nStart, bInClipboard )
 , m_nEnd( nEnd )
+, m_bLockNotifyContentChange( false )
 {
 SetHasDummyChar( false );
 SetHasContent( true );
@@ -460,11 +461,30 @@ sal_Int32* SwTxtInputFld::GetEnd()
 return &m_nEnd;
 }
 
+
+void SwTxtInputFld::LockNotifyContentChange()
+{
+m_bLockNotifyContentChange = true;
+}
+
+
+void SwTxtInputFld::UnlockNotifyContentChange()
+{
+m_bLockNotifyContentChange = false;
+}
+
+
 void SwTxtInputFld::NotifyContentChange( SwFmtFld& rFmtFld )
 {
-Sw

[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/inc sw/source

2013-12-21 Thread Michael Stahl
 sw/inc/doc.hxx |4 -
 sw/inc/pagedesc.hxx|   10 ++-
 sw/source/core/doc/docdesc.cxx |   98 +
 sw/source/core/doc/docfmt.cxx  |   20 +-
 sw/source/core/doc/poolfmt.cxx |5 +
 sw/source/core/layout/frmtool.cxx  |   13 ++--
 sw/source/core/layout/pagedesc.cxx |   23 +--
 sw/source/core/undo/SwUndoPageDesc.cxx |4 -
 sw/source/core/unocore/unostyle.cxx|4 +
 sw/source/filter/ww8/wrtw8sty.cxx  |2 
 sw/source/filter/ww8/ww8atr.cxx|2 
 sw/source/filter/ww8/ww8par.cxx|8 +-
 sw/source/filter/ww8/ww8par6.cxx   |8 +-
 13 files changed, 143 insertions(+), 58 deletions(-)

New commits:
commit 0eafb69609d58798a9e00e93dd9ea39e9189db8b
Author: Michael Stahl 
Date:   Fri Dec 20 17:58:12 2013 +0100

fdo#69065: sw: fix mirrored page style with first-page

If a mirrored page style is used with first-page on both a right page
and a left page the current design cannot work because the margins in
the SwPageDesc::aFirst cannot be right for both cases.

So split that up so we get a first-master and first-left format and
copy the headers/footers and margins as appropriate... which is really
adding epicycles to a flawed design; probably this would be better with
just a single SwFrmFmt that has different items for master/left/first
headers.

Change-Id: I0889a4ab5959b5a71172203bb64d185960a07d73
(cherry picked from commit e936ecc92a7e362f57ce72a955697840920636b8)
Reviewed-on: https://gerrit.libreoffice.org/7156
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 5898077..987d0ab 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -2077,9 +2077,9 @@ public:
 
 private:
 /// Copies master header to left / first one, if necessary - used by 
ChgPageDesc().
-void CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, 
SwPageDesc *pDesc, bool bLeft);
+void CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, 
SwPageDesc *pDesc, bool bLeft, bool bFirst);
 /// Copies master footer to left / first one, if necessary - used by 
ChgPageDesc().
-void CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, 
SwPageDesc *pDesc, bool bLeft);
+void CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot, 
SwPageDesc *pDesc, bool bLeft, bool bFirst);
 
 /** continue computing a chunk of document statistics
   * \param nChars  number of characters to count before exiting
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 4fa0449..b0bccec 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -135,7 +135,9 @@ class SW_DLLPUBLIC SwPageDesc : public SwModify
 SvxNumberType   aNumType;
 SwFrmFmtaMaster;
 SwFrmFmtaLeft;
-SwFrmFmtaFirst;
+// FIXME epicycles growing here - page margins need to be stored 
differently
+SwFrmFmtm_FirstMaster;
+SwFrmFmtm_FirstLeft;
 SwDependaDepend;///< Because of grid alignment 
(Registerhaltigkeit).
 SwPageDesc *pFollow;
 sal_uInt16  nRegHeight; ///< Sentence spacing and fontascent of style.
@@ -190,10 +192,12 @@ public:
 
   SwFrmFmt &GetMaster() { return aMaster; }
   SwFrmFmt &GetLeft()   { return aLeft; }
-  SwFrmFmt &GetFirst()   { return aFirst; }
+  SwFrmFmt &GetFirstMaster()   { return m_FirstMaster; }
+  SwFrmFmt &GetFirstLeft()   { return m_FirstLeft; }
 const SwFrmFmt &GetMaster() const { return aMaster; }
 const SwFrmFmt &GetLeft()   const { return aLeft; }
-const SwFrmFmt &GetFirst()   const { return aFirst; }
+const SwFrmFmt &GetFirstMaster()   const { return m_FirstMaster; }
+const SwFrmFmt &GetFirstLeft()   const { return m_FirstLeft; }
 
 /** Reset all attrs of the format but keep the ones a pagedesc
cannot live without. */
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 3f1d636..c84a5d2 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -58,7 +58,8 @@ using namespace com::sun::star;
 static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId,
 SwFrmFmt &rFmt1,
 SwFrmFmt &rFmt2,
-SwFrmFmt &rFmt3 )
+SwFrmFmt &rFmt3,
+SwFrmFmt &rFmt4)
 {
 // --> #i41075# Printer on demand
 // This function does not require a printer anymore.
@@ -114,6 +115,10 @@ static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId,
 rFmt3.SetFmtAttr( aFrmSize );
 rFmt3.SetFmtAttr( aLR );
 rFmt3.SetFmtAttr( aUL );
+
+rFmt4.SetFmtAttr( aFrmSize );
+rFmt4.SetFmtAttr( aLR );
+rFmt4.SetFmtAttr( aUL );
 }
 
 static void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest,