[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/inc sw/source

2012-07-18 Thread Andras Timar
 sw/inc/expfld.hxx|2 
 sw/inc/reffld.hxx|   24 
 sw/source/core/fields/expfld.cxx |   19 --
 sw/source/core/fields/reffld.cxx |  117 +--
 4 files changed, 101 insertions(+), 61 deletions(-)

New commits:
commit cfa049ed525d18a922339d83fc5465fddb627c9a
Author: Uray M. János uray.ja...@gmail.com
Date:   Tue Jul 17 19:00:21 2012 +0200

fdo#50801 fix cross-reference text when Caption order is Numbering first

Change-Id: I7306f99c18d0f9cfb3b0ce147ecc200662d23b3d
Sigend-off-by: Andras Timar ati...@suse.com

diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index a565244..3a2b360 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -123,7 +123,7 @@ public:
 virtual boolQueryValue( com::sun::star::uno::Any rVal, sal_uInt16 
nWhich ) const;
 virtual boolPutValue( const com::sun::star::uno::Any rVal, 
sal_uInt16 nWhich );
 
-static sal_uInt16   GetReferenceTextPos( const SwFmtFld rFmt, SwDoc 
rDoc);
+static sal_uInt16   GetReferenceTextPos( const SwFmtFld rFmt, SwDoc 
rDoc, unsigned nHint = 0);
 // #i82544#
 voidSetLateInitialization() { bLateInitialization = true;}
 };
diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx
index 5db6268..85e4fd3 100644
--- a/sw/inc/reffld.hxx
+++ b/sw/inc/reffld.hxx
@@ -48,19 +48,19 @@ enum REFERENCESUBTYPE
 enum REFERENCEMARK
 {
 REF_BEGIN,
-REF_PAGE = REF_BEGIN,
-REF_CHAPTER,
-REF_CONTENT,
-REF_UPDOWN,
-REF_PAGE_PGDESC,
-REF_ONLYNUMBER,
-REF_ONLYCAPTION,
-REF_ONLYSEQNO,
+REF_PAGE = REF_BEGIN, // Page
+REF_CHAPTER,  // Chapter
+REF_CONTENT,  // Reference
+REF_UPDOWN,   // Above/Below
+REF_PAGE_PGDESC,  // As Page Style
+REF_ONLYNUMBER,   // Category and Number
+REF_ONLYCAPTION,  // Caption Text
+REF_ONLYSEQNO,// Numbering
 // -- #i81002#
 // new reference format types for referencing bookmarks and set references
-REF_NUMBER,
-REF_NUMBER_NO_CONTEXT,
-REF_NUMBER_FULL_CONTEXT,
+REF_NUMBER,  // Number
+REF_NUMBER_NO_CONTEXT,   // Number (no context)
+REF_NUMBER_FULL_CONTEXT, // Number (full context)
 REF_END
 };
 
@@ -72,7 +72,7 @@ class SwGetRefFieldType : public SwFieldType
 SwDoc* pDoc;
 protected:
 // Overlay in order to update all ref-fields.
-   virtual void Modify( const SfxPoolItem*, const SfxPoolItem * );
+virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
 public:
 SwGetRefFieldType(SwDoc* pDoc );
 virtual SwFieldType*Copy() const;
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index f38abcf..9c52556 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -896,19 +896,21 @@ void SwGetExpField::SetValue( const double rAny )
 /* --
 Description: Find the index of the reference text
 following the current field
+nHint: search starting position after the current
+field (or 0 if default)
  --*/
-xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld rFmt, SwDoc 
rDoc)
+xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld rFmt, SwDoc 
rDoc, unsigned nHint)
 {
 //
 const SwTxtFld* pTxtFld = rFmt.GetTxtFld();
 const SwTxtNode rTxtNode = pTxtFld-GetTxtNode();
 //
-xub_StrLen nRet = *pTxtFld-GetStart() + 1;
+xub_StrLen nRet = nHint ? nHint : *pTxtFld-GetStart() + 1;
 String sNodeText = rTxtNode.GetTxt();
 sNodeText.Erase(0, nRet);
 if(sNodeText.Len())
 {
-//now check if sNodeText starts with a non-alphanumeric character plus 
a blank
+// now check if sNodeText starts with a non-alphanumeric character 
plus blanks
 sal_uInt16 nSrcpt = pBreakIt-GetRealScriptOfText( sNodeText, 0 );
 
 static sal_uInt16 nIds[] =
@@ -935,11 +937,14 @@ xub_StrLen SwGetExpField::GetReferenceTextPos( const 
SwFmtFld rFmt, SwDoc rDoc
 if( !bIsAlphaNum ||
 (c0 == ' ' || c0 == '\t'))
 {
+// ignoring blanks
 nRet++;
-if( sNodeText.Len()  1 
-(sNodeText.GetChar(1) == ' ' ||
- sNodeText.GetChar(1) == '\t'))
-nRet++;
+unsigned i = 1;
+while (i  sNodeText.Len() 
+(sNodeText.GetChar(i) == ' ' ||
+ sNodeText.GetChar(i) == '\t')
+)
+nRet++, i++;
 }
 }
 }
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index ddf36b2..e762286 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -69,6 +69,7 @@
 
 #include set
 #include map
+#include algorithm // min, max
 
 #include 

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/inc sw/source

2012-07-11 Thread Michael Stahl
 sw/inc/fldbas.hxx|2 +-
 sw/source/core/fields/expfld.cxx |2 +-
 sw/source/core/fields/fldbas.cxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 7b139452515f90f536ecb2725c8c86343031bf76
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Tue Jul 10 13:44:33 2012 +0200

fdo#51793: FormatNumber can handle sal_uInt32 values after all...

Change-Id: I9d50bce0278a4aa65873aa816eb991473f556cee
(cherry picked from commit 32c7ba61a9ce620c1c9544ac469ccfd143e60bb9)

Signed-off-by: Michael Stahl mst...@redhat.com

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index f865175..243f611 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -231,7 +231,7 @@ extern sal_uInt16 aTypeTab[];
 // General tools.
 String  GetResult(double nVal, sal_uInt32 nNumFmt, sal_uInt16 nLang = 
LANGUAGE_SYSTEM);
 voidSetErrorStr(const String rStr);
-String  FormatNumber(sal_uInt16 nNum, sal_uInt32 nFormat);
+String  FormatNumber(sal_uInt32 nNum, sal_uInt32 nFormat);
 
 // Instances of SwFields and those derived from it occur 0 to n times.
 // For each class there is one instance of the associated type class.
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index ec54fe5..f38abcf 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -881,7 +881,7 @@ void SwSetExpField::SetValue( const double rAny )
 SwValueField::SetValue(rAny);
 
 if( IsSequenceFld() )
-sExpand = FormatNumber( (sal_uInt16)GetValue(), GetFormat() );
+sExpand = FormatNumber( (sal_uInt32)GetValue(), GetFormat() );
 else
 sExpand = ((SwValueFieldType*)GetTyp())-ExpandValue( rAny,
 GetFormat(), GetLanguage());
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 04c5b14..c2e6569 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -430,7 +430,7 @@ SwField * SwField::CopyField() const
 Beschreibung: Numerierung expandieren
  */
 
-String FormatNumber(sal_uInt16 nNum, sal_uInt32 nFormat)
+String FormatNumber(sal_uInt32 nNum, sal_uInt32 nFormat)
 {
 if(SVX_NUM_PAGEDESC == nFormat)
 return  String::CreateFromInt32( nNum );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/inc sw/source

2012-06-21 Thread Bjoern Michaelsen
 sw/inc/EnhancedPDFExportHelper.hxx  |9 +++
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   57 
 2 files changed, 37 insertions(+), 29 deletions(-)

New commits:
commit a1fd984c7cd4d97c8b039c75e8340e431554ed26
Author: Ivan Timofeev timofeev@gmail.com
Date:   Wed Jun 20 22:15:46 2012 +0400

fdo#34093: fix error in calculation of page number of SwRect

StringRangeEnumerator (i.e. user's input) contains page numbers in a 
different
page range (it excludes empty pages). So:
- first map page numbers to a common range, then compare
- user's input can't contain empty pages, remove this check

Change-Id: I4fce5215272fc90f39c9e05d3f3604734a8aebe3

diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index 2020d13..a5a5210 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -216,7 +216,14 @@ class SwEnhancedPDFExportHelper
 OutputDevice mrOut;
 
 StringRangeEnumerator* mpRangeEnum;
-std::vectorbool maIsPageEmpty;
+/** The problem is that numbers in StringRangeEnumerator aren't accordant
+ * to real page numbers if mbSkipEmptyPages is true, because in this case
+ * empty pages are excluded from a page range and numbers in
+ * StringRangeEnumerator are shifted.
+ *
+ * maPageNumberMap[real_page_number] is either a corresponding page number
+ * in a page range without empty pages, or -1 if this page is empty. */
+std::vector sal_Int32  maPageNumberMap;
 
 bool mbSkipEmptyPages;
 bool mbEditEngineOnly;
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 7ed062d..ea19d26 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1521,12 +1521,17 @@ SwEnhancedPDFExportHelper::SwEnhancedPDFExportHelper( 
SwEditShell rSh,
 
 if ( mbSkipEmptyPages )
 {
-maIsPageEmpty.resize( mrSh.GetPageCount() );
+maPageNumberMap.resize( mrSh.GetPageCount() );
 const SwPageFrm* pCurrPage =
 static_castconst SwPageFrm*( mrSh.GetLayout()-Lower() );
-for ( size_t i = 0, n = maIsPageEmpty.size(); i  n  pCurrPage; ++i )
+sal_Int32 nPageNumber = 0;
+for ( size_t i = 0, n = maPageNumberMap.size(); i  n  pCurrPage; 
++i )
 {
-maIsPageEmpty[i] = pCurrPage-IsEmptyPage();
+if ( pCurrPage-IsEmptyPage() )
+maPageNumberMap[i] = -1;
+else
+maPageNumberMap[i] = nPageNumber++;
+
 pCurrPage = static_castconst SwPageFrm*( pCurrPage-GetNext() );
 }
 }
@@ -2148,7 +2153,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
 sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( const SwRect rRect ) 
const
 {
 // Document page number.
-const sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, 
rRect );
+sal_Int32 nPageNumOfRect = mrSh.GetPageNumAndSetOffsetForPDF( mrOut, rRect 
);
 if ( nPageNumOfRect  0 )
 return -1;
 
@@ -2156,6 +2161,10 @@ sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( 
const SwRect rRect ) co
 sal_Int32 nRet = -1;
 if ( mpRangeEnum )
 {
+if ( mbSkipEmptyPages )
+// Map the page number to the range without empty pages.
+nPageNumOfRect = maPageNumberMap[ nPageNumOfRect ];
+
 if ( mpRangeEnum-hasValue( nPageNumOfRect ) )
 {
 sal_Int32 nOutputPageNum = 0;
@@ -2163,18 +2172,12 @@ sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( 
const SwRect rRect ) co
 StringRangeEnumerator::Iterator aEnd  = mpRangeEnum-end();
 for ( ; aIter != aEnd; ++aIter )
 {
-bool bSkipThisPage = mbSkipEmptyPages 
-static_castsize_t( *aIter )  maIsPageEmpty.size() 
-maIsPageEmpty[*aIter];
-if ( !bSkipThisPage )
+if ( *aIter == nPageNumOfRect )
 {
-if ( *aIter == nPageNumOfRect )
-{
-nRet = nOutputPageNum;
-break;
-}
-++nOutputPageNum;
+nRet = nOutputPageNum;
+break;
 }
+++nOutputPageNum;
 }
 }
 }
@@ -2183,9 +2186,9 @@ sal_Int32 SwEnhancedPDFExportHelper::CalcOutputPageNum( 
const SwRect rRect ) co
 if ( mbSkipEmptyPages )
 {
 sal_Int32 nOutputPageNum = 0;
-for ( size_t i = 0; i  maIsPageEmpty.size(); ++i )
+for ( size_t i = 0; i  maPageNumberMap.size(); ++i )
 {
-if ( !maIsPageEmpty[i] )
+if ( maPageNumberMap[i] = 0 ) // is not empty?
 {
 if ( i == static_castsize_t( 

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/inc sw/source

2012-05-14 Thread Michael Meeks
 sw/inc/doc.hxx|1 +
 sw/source/core/doc/docfld.cxx |   14 ++
 sw/source/ui/uiview/view.cxx  |   13 -
 3 files changed, 23 insertions(+), 5 deletions(-)

New commits:
commit 30f84257b34eb956027c21934ec9fa63cb25fcf4
Author: Caolán McNamara caol...@redhat.com
Date:   Mon May 14 16:07:05 2012 +0100

Resolves: fdo#49897 add+use SwDoc::containsUpdatableFields

Change-Id: I03ab6367a40ddc5748a499c4e2c7f108a3ef8a08
Signed-off-by: Michael Meeks michael.me...@suse.com

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 29be2a7..7943925 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -841,6 +841,7 @@ public:
@return pointer to field at the given position or NULL in case no field 
is found
 */
 static SwTxtFld* GetTxtFld(const SwPosition rPos);
+bool containsUpdatableFields();
 
 /** IDocumentContentOperations
 */
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 019e160..b7c6549 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -415,6 +415,20 @@ void SwDoc::UpdateRefFlds( SfxPoolItem* pHt )
 pFldType-ModifyNotification( 0, pHt );
 }
 
+//For simplicity assume that all field types have updatable contents so
+//optimization currently only available when no fields exist.
+bool SwDoc::containsUpdatableFields()
+{
+for (sal_uInt16 i = 0; i  pFldTypes-Count(); ++i)
+{
+SwFieldType* pFldType = (*pFldTypes)[i];
+SwIteratorSwFmtFld,SwFieldType aIter(*pFldType);
+if (aIter.First())
+return true;
+}
+return false;
+}
+
 void SwDoc::UpdateTblFlds( SfxPoolItem* pHt )
 {
 OSL_ENSURE( !pHt || RES_TABLEFML_UPDATE  == pHt-Which(),
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index e291c19..b387b34 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -966,11 +966,14 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* 
pOldSh )
 
 if( pWrtShell-GetDoc()-IsUpdateExpFld() )
 {
-SET_CURR_SHELL( pWrtShell );
-pWrtShell-StartAction();
-pWrtShell-CalcLayout();
-pWrtShell-GetDoc()-UpdateFlds(NULL, false);
-pWrtShell-EndAction();
+if (pWrtShell-GetDoc()-containsUpdatableFields())
+{
+SET_CURR_SHELL( pWrtShell );
+pWrtShell-StartAction();
+pWrtShell-CalcLayout();
+pWrtShell-GetDoc()-UpdateFlds(NULL, false);
+pWrtShell-EndAction();
+}
 pWrtShell-GetDoc()-SetUpdateExpFldStat( sal_False );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/inc sw/source

2012-03-21 Thread Michael Stahl
 sw/inc/swtable.hxx|2 ++
 sw/source/core/table/swtable.cxx  |7 +++
 sw/source/filter/ww8/WW8TableInfo.cxx |3 +--
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit ea92fb2b82a050c24a72c55a484163b07263ab4c
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Mar 21 17:15:06 2012 +0100

fdo#45522: WW8TableInfo::processSwTable: check that table has layout
(cherry picked from commit 5c3dd5af41bc801ee6023513399c01c632dc7779)

Signed-off-by: Michael Stahl mst...@redhat.com

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index fb1d253..73df08c 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -326,6 +326,8 @@ public:
 #ifdef DBG_UTIL
 void CheckConsistency() const;
 #endif
+
+bool HasLayout() const;
 };
 
 class SW_DLLPUBLIC SwTableLine: public SwClient // Client of FrmFmt.
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index ae36c31..d961289 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2804,6 +2804,13 @@ void SwTable::RegisterToFormat( SwFmt rFmt )
 rFmt.Add( this );
 }
 
+bool SwTable::HasLayout() const
+{
+const SwFrmFmt* pFrmFmt = GetFrmFmt();
+//a table in a clipboard document doesn't have any layout information
+return pFrmFmt  SwIteratorSwTabFrm,SwFmt::FirstElement(*pFrmFmt);
+}
+
 void SwTableLine::RegisterToFormat( SwFmt rFmt )
 {
 rFmt.Add( this );
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx 
b/sw/source/filter/ww8/WW8TableInfo.cxx
index 6171430..095c94b 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -631,8 +631,7 @@ void WW8TableInfo::processSwTable(const SwTable * pTable)
 
 WW8TableNodeInfo * pPrev = NULL;
 
-SwFrmFmt * pFrmFmt = pTable-GetFrmFmt();
-if (pFrmFmt != NULL  pTable-IsTblComplex())
+if (pTable-IsTblComplex()  pTable-HasLayout())
 {
 pPrev = processSwTableByLayout(pTable);
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/inc sw/source

2012-02-28 Thread Miklos Vajna
 sw/inc/doc.hxx   |2 -
 sw/source/core/doc/docfmt.cxx|   48 ---
 sw/source/ui/dochdl/swdtflvr.cxx |2 -
 3 files changed, 32 insertions(+), 20 deletions(-)

New commits:
commit 018fd9afa4659a791dd6e2a6c1d44185505ba4ec
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Feb 27 12:39:06 2012 +

Resolves: fdo#46038 don't copy page styles into temporary clipboard doc

writer rtf export has a nasty pgdsctbl extension
sd rtf import has nasty if its got a table keyword in it its a table
logic

Classically we never put our styles into the temporary clipboard, so fastest
and safest fix is to simply skip putting the page styles into it.

(cherry picked from commit 15547450bdba10959473c2cb5891f29ad5053b09)

Signed-off-by: Miklos Vajna vmik...@suse.cz

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8165a57..29be2a7 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1275,7 +1275,7 @@ public:
 SwGrfFmtColl* CopyGrfColl( const SwGrfFmtColl rColl );
 
 // Replace all styles with those from rSource.
-void ReplaceStyles( const SwDoc rSource );
+void ReplaceStyles( const SwDoc rSource, bool bIncludePageStyles = true );
 
 // Replace all property defaults with those from rSource.
 void ReplaceDefaults( const SwDoc rSource );
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 10cd5f7..54a9707 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -2135,7 +2135,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc rSrcDesc, 
SwPageDesc rDstDesc,
 }
 }
 
-void SwDoc::ReplaceStyles( const SwDoc rSource )
+void SwDoc::ReplaceStyles( const SwDoc rSource, bool bIncludePageStyles )
 {
 ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
 
@@ -2146,26 +2146,38 @@ void SwDoc::ReplaceStyles( const SwDoc rSource )
 CopyFmtArr( *rSource.pTxtFmtCollTbl, *pTxtFmtCollTbl,
 SwDoc::_MakeTxtFmtColl, *pDfltTxtFmtColl );
 
-// and now the page templates
-sal_uInt16 nCnt = rSource.aPageDescs.Count();
-if( nCnt )
-{
-// a different Doc - Number formatter needs to be merged
-SwTblNumFmtMerge aTNFM( rSource, *this );
+sal_uInt16 nCnt;
 
-// 1st step: Create all formats (skip the 0th - it's the default!)
-while( nCnt )
+//To-Do:
+//  a) in rtf export don't export our hideous pgdsctbl
+//  extension to rtf anymore
+//  b) in sd rtf import (View::InsertData) don't use
+//  a super-fragile test for mere presence of \trowd to
+//  indicate import of rtf into a table
+//  c) then drop use of bIncludePageStyles
+if (bIncludePageStyles)
+{
+// and now the page templates
+nCnt = rSource.aPageDescs.Count();
+if( nCnt )
 {
-SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ];
-if( 0 == ::lcl_FindPageDesc( aPageDescs, pSrc-GetName() ) )
-MakePageDesc( pSrc-GetName() );
-}
+// a different Doc - Number formatter needs to be merged
+SwTblNumFmtMerge aTNFM( rSource, *this );
 
-// 2nd step: Copy all attributes, set the right parents
-for( nCnt = rSource.aPageDescs.Count(); nCnt; )
-{
-SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ];
-CopyPageDesc( *pSrc, *::lcl_FindPageDesc( aPageDescs, 
pSrc-GetName() ));
+// 1st step: Create all formats (skip the 0th - it's the default!)
+while( nCnt )
+{
+SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ];
+if( 0 == ::lcl_FindPageDesc( aPageDescs, pSrc-GetName() ) )
+MakePageDesc( pSrc-GetName() );
+}
+
+// 2nd step: Copy all attributes, set the right parents
+for( nCnt = rSource.aPageDescs.Count(); nCnt; )
+{
+SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ];
+CopyPageDesc( *pSrc, *::lcl_FindPageDesc( aPageDescs, 
pSrc-GetName() ));
+}
 }
 }
 
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index e5fdd55..dfa85ed 100755
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -379,7 +379,7 @@ namespace
 
 //It would probably make most sense here to only insert the styles used
 //by the selection, e.g. apply SwDoc::IsUsed on styles ?
-rDest.ReplaceStyles(rSrc);
+rDest.ReplaceStyles(rSrc, false);
 
 rSrcWrtShell.Copy(rDest);
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/inc sw/source

2011-12-21 Thread Michael Stahl
 sw/inc/printdata.hxx  |   11 +--
 sw/inc/unotxdoc.hxx   |3 +--
 sw/source/core/view/printdata.cxx |   14 --
 sw/source/ui/inc/view.hxx |3 +--
 sw/source/ui/uiview/view.cxx  |   18 --
 sw/source/ui/uno/unotxdoc.cxx |   33 +
 sw/source/ui/uno/unotxvw.cxx  |8 
 7 files changed, 48 insertions(+), 42 deletions(-)

New commits:
commit 871ad55dccbd7121e005a66e3c51f55a236d2b04
Author: Michael Stahl mst...@redhat.com
Date:   Wed Dec 21 16:39:22 2011 +0100

sw: fdo#39159 fdo#40482: temp selection print doc:

Ensure that the printing temp selection document is not destroyed
prematurely by SwXTextView::NotifySelChanged, called via
ViewOptionAdjustStop, by retaining the temp doc object shell not
at the View but in SwRenderData.

Not restoring the view options for selections does not actually work,
because having a selection surprisingly does not imply printing a
temp document: the preview also uses a selection.
(view option regression from cd690d2e72be410058376c416a40ff5d918fb0f7)
(cherry picked from commit 89d2733e16ae6233deea6bef3193bd45c89b854c)

diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index 8d29336..02d56b8 100644
--- a/sw/inc/printdata.hxx
+++ b/sw/inc/printdata.hxx
@@ -28,10 +28,10 @@
 #ifndef SW_PRINTDATA_HXX
 #define SW_PRINTDATA_HXX
 
-
 #include sal/types.h
 #include rtl/ustring.hxx
 #include vcl/print.hxx
+#include sfx2/objsh.hxx
 
 #include boost/scoped_ptr.hpp
 
@@ -244,6 +244,10 @@ class SwRenderData
 
 rtl::OUString   m_aPageRange;
 
+// temp print document -- must live longer than m_pViewOptionAdjust!
+// also this is a Lock and not a Ref because Ref does not delete the doc
+SfxObjectShellLock m_xTempDocShell;
+
 // the view options to be applied for printing
 ::boost::scoped_ptrSwViewOptionAdjust_Impl m_pViewOptionAdjust;
 
@@ -266,9 +270,12 @@ public:
 void CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, 
OutputDevice *pOutDev );
 void DeletePostItData();
 
+SfxObjectShellLock const GetTempDocShell() const;
+void SetTempDocShell(SfxObjectShellLock const);
+
 bool IsViewOptionAdjust() const  { return m_pViewOptionAdjust != 0; }
 bool NeedNewViewOptionAdjust( const ViewShell ) const;
-void ViewOptionAdjustStart( ViewShell rSh, const SwViewOption 
rViewOptions, bool bIsTmpSelection );
+void ViewOptionAdjustStart( ViewShell rSh, const SwViewOption 
rViewOptions);
 void ViewOptionAdjust( SwPrintData const* const pPrtOptions );
 void ViewOptionAdjustStop();
 
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 5d61a9a..42d646f 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -589,10 +589,9 @@ class SwViewOptionAdjust_Impl
 {
 ViewShell m_rShell;
 SwViewOptionm_aOldViewOptions;
-bool m_bIsTmpSelection;
 
 public:
-SwViewOptionAdjust_Impl( ViewShell rSh, const SwViewOption rViewOptions, 
bool bIsTmpSelection );
+SwViewOptionAdjust_Impl( ViewShell rSh, const SwViewOption rViewOptions 
);
 ~SwViewOptionAdjust_Impl();
 void AdjustViewOptions( SwPrintData const* const pPrtOptions );
 bool checkShell( const ViewShell rCompare ) const
diff --git a/sw/source/core/view/printdata.cxx 
b/sw/source/core/view/printdata.cxx
index 47b1fa3..870ecbe 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -93,20 +93,30 @@ void SwRenderData::DeletePostItData()
 }
 }
 
+SfxObjectShellLock const SwRenderData::GetTempDocShell() const
+{
+return m_xTempDocShell;
+}
+void SwRenderData::SetTempDocShell(SfxObjectShellLock const xShell)
+{
+m_xTempDocShell = xShell;
+}
+
 bool SwRenderData::NeedNewViewOptionAdjust( const ViewShell rCompare ) const
 {
 return m_pViewOptionAdjust ? ! m_pViewOptionAdjust-checkShell( rCompare ) 
: true;
 }
 
 
-void SwRenderData::ViewOptionAdjustStart( ViewShell rSh, const SwViewOption 
rViewOptions, bool bIsTmpSelection )
+void SwRenderData::ViewOptionAdjustStart(
+ViewShell rSh, const SwViewOption rViewOptions)
 {
 if (m_pViewOptionAdjust)
 {
 OSL_FAIL(error: there should be no ViewOptionAdjust active when 
calling this function );
 }
 m_pViewOptionAdjust.reset(
-new SwViewOptionAdjust_Impl( rSh, rViewOptions, bIsTmpSelection ));
+new SwViewOptionAdjust_Impl( rSh, rViewOptions ));
 }
 
 
diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
index 45e4405..1290883 100755
--- a/sw/source/ui/inc/view.hxx
+++ b/sw/source/ui/inc/view.hxx
@@ -643,8 +643,7 @@ public:
 
 void NotifyDBChanged();
 
-SfxObjectShellLock  GetTmpSelectionDoc();
-SfxObjectShellLock  GetOrCreateTmpSelectionDoc();
+SfxObjectShellLock CreateTmpSelectionDoc();
 
 voidAddTransferable(SwTransferable rTransferable);
 
diff --git