[ooo-build-commit] .: 8 commits - sw/inc sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Sep 13 07:36:09 PDT 2010


 sw/inc/swmodule.hxx             |    2 
 sw/source/ui/app/appopt.cxx     |   11 ++
 sw/source/ui/app/swmodul1.cxx   |   65 ++++++++++++
 sw/source/ui/config/optload.cxx |   28 +++++
 sw/source/ui/config/optload.hrc |    1 
 sw/source/ui/config/optload.src |   11 ++
 sw/source/ui/config/optpage.cxx |   23 +++-
 sw/source/ui/config/usrpref.cxx |   12 +-
 sw/source/ui/inc/conttree.hxx   |    5 
 sw/source/ui/inc/optload.hxx    |    1 
 sw/source/ui/inc/pggrid.hxx     |    7 +
 sw/source/ui/inc/uitool.hxx     |    3 
 sw/source/ui/inc/usrpref.hxx    |   12 ++
 sw/source/ui/misc/pggrid.cxx    |   63 +++++++++++-
 sw/source/ui/misc/pggrid.hrc    |    2 
 sw/source/ui/misc/pggrid.src    |   12 ++
 sw/source/ui/shells/textsh1.cxx |    4 
 sw/source/ui/uiview/view.cxx    |   39 +++++++
 sw/source/ui/utlui/content.cxx  |  202 ++++++++++++++++++++++++++++++++++------
 sw/source/ui/utlui/uitool.cxx   |   13 ++
 20 files changed, 469 insertions(+), 47 deletions(-)

New commits:
commit 934cea09a95d7d638d09f881629579c568a30621
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:46:36 2010 +0200

    cjk-character-units-in-pggrid-fix.diff: add a new character unit

diff --git a/sw/source/ui/inc/pggrid.hxx b/sw/source/ui/inc/pggrid.hxx
index 4a584a4..5317f48 100644
--- a/sw/source/ui/inc/pggrid.hxx
+++ b/sw/source/ui/inc/pggrid.hxx
@@ -93,6 +93,7 @@ class SwTextGridPage: public SfxTabPage
 
     void UpdatePageSize(const SfxItemSet& rSet);
     void PutGridItem(SfxItemSet& rSet);
+    void SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue );
 
     DECL_LINK(GridTypeHdl, RadioButton*);
     DECL_LINK(CharorLineChangedHdl, SpinField*);
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 17d2148..9fa8515 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -259,6 +259,7 @@ void    SwTextGridPage::Reset(const SfxItemSet &rSet)
         GridTypeHdl(pButton);
         aSnapToCharsCB.Check(rGridItem.IsSnapToChars());
         aLinesPerPageNF.SetValue(rGridItem.GetLines());
+        SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() );
         m_nRubyUserValue = rGridItem.GetBaseHeight();
         m_bRubyUserValue = sal_True;
         aTextSizeMF.SetValue(aTextSizeMF.Normalize(m_nRubyUserValue), FUNIT_TWIP);
@@ -384,6 +385,12 @@ void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
         if ( m_bSquaredMode )
         {
             aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextSize);
+        aCharsPerLineNF.SetMax( aCharsPerLineNF.GetValue() );
+            aLinesPerPageNF.SetMax( m_aPageSize.Height() /
+        (   aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) +
+                    aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))));
+            SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() );
+            SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() );
         }
         else
         {
@@ -393,9 +400,21 @@ void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
                 aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextWidth); 
             else
                 aCharsPerLineNF.SetValue( 45 );
+        SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() );
+        SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() );
         }
     }
 }
+/* -----------------------------30.05.2008 14:12------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwTextGridPage::SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue )
+{
+    String aFieldStr = String::CreateFromAscii("( 1 -");
+    aFieldStr += String::CreateFromInt32( nValue );
+    aFieldStr += String::CreateFromAscii(" )");
+    rField.SetText( aFieldStr );
+}
 /* -----------------------------06.02.2002 15:24------------------------------
 
  ---------------------------------------------------------------------------*/
@@ -430,6 +449,8 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField)
                     aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))));
             aLinesPerPageNF.SetMax(nMaxLines);
         }
+        SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() );
+    SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() );
     }
     else//in normal mode
     {
@@ -438,10 +459,7 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField)
             long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / aLinesPerPageNF.GetValue());
             aTextSizeMF.SetValue(aTextSizeMF.Normalize(nHeight), FUNIT_TWIP);
             aRubySizeMF.SetValue(0, FUNIT_TWIP);
-            String aMaxLinesFTStr = String::CreateFromAscii("( 1 - ");
-            aMaxLinesFTStr += String::CreateFromInt32(aLinesPerPageNF.GetValue());
-            aMaxLinesFTStr += String::CreateFromAscii(" )");
-            aLinesRangeFT.SetText( aMaxLinesFTStr );
+            SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() );
             
             m_nRubyUserValue = nHeight;
             m_bRubyUserValue = sal_True;
@@ -450,10 +468,7 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField)
         {
             long nWidth = static_cast< sal_Int32 >(m_aPageSize.Width() / aCharsPerLineNF.GetValue());
             aCharWidthMF.SetValue(aCharWidthMF.Normalize(nWidth), FUNIT_TWIP);
-            String aMaxCharsFTStr = String::CreateFromAscii("( 1 - ");
-            aMaxCharsFTStr += String::CreateFromInt32(aCharsPerLineNF.GetValue());
-            aMaxCharsFTStr += String::CreateFromAscii(" )");
-            aCharsRangeFT.SetText( aMaxCharsFTStr );
+            SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() );
         }
     }
     GridModifyHdl(0);
@@ -477,6 +492,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField)
                 (   aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) +
                     aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))));
             aLinesPerPageNF.SetMax(nMaxLines);
+            SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() );
         }
     }
     else
@@ -486,10 +502,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField)
             sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
             aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize);
             m_bRubyUserValue = sal_False;
-            String aRangesStr = String::CreateFromAscii("( 1 - ");
-            aRangesStr += String::CreateFromInt32( m_aPageSize.Height() / nTextSize );
-            aRangesStr += String::CreateFromAscii(" )");
-            aLinesRangeFT.SetText( aRangesStr );
+            SetLinesOrCharsRanges( aLinesRangeFT , aLinesPerPageNF.GetMax() );
         }
         else if (&aCharWidthMF == pField)
         {
@@ -498,10 +511,7 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField)
             if (nTextWidth)
                 nMaxChar = m_aPageSize.Width() / nTextWidth;
             aCharsPerLineNF.SetValue( nMaxChar );
-            String aCharRangeStr = String::CreateFromAscii("( 1 - ");
-            aCharRangeStr += String::CreateFromInt32( nMaxChar );
-            aCharRangeStr += String::CreateFromAscii(" )");
-            aCharsRangeFT.SetText( aCharRangeStr );
+            SetLinesOrCharsRanges( aCharsRangeFT , aCharsPerLineNF.GetMax() );
         }
         //rubySize is disabled
     }
commit dae07c66db3014b7f0eefada5e4ff8af8556e768
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:45:00 2010 +0200

    cjk-character-units-fix-376788.diff: add a new character unit
    
    i#376788

diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index 07430ed..1927c66 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -47,6 +47,7 @@
 #include <editeng/colritem.hxx>
 #include <editeng/brshitem.hxx>
 #include <vcl/msgbox.hxx>
+#include <svl/cjkoptions.hxx>
 #include <swmodule.hxx>
 #include <swtypes.hxx>
 #include <usrpref.hxx>
@@ -348,10 +349,15 @@ void SwModule::ApplyUserCharUnit(BOOL bApplyChar, BOOL bWeb)
     }
     else
     {
-        if ( eHScrollMetric == FUNIT_CHAR )
-            eHScrollMetric == FUNIT_CM;
-        if ( eVScrollMetric == FUNIT_LINE )
-            eVScrollMetric == FUNIT_CM;
+        SvtCJKOptions aCJKOptions;
+        if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eHScrollMetric == FUNIT_CHAR ))
+            eHScrollMetric = FUNIT_INCH;
+        else if ( eHScrollMetric == FUNIT_CHAR )
+            eHScrollMetric = FUNIT_CM;
+        if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eVScrollMetric == FUNIT_LINE ))
+            eVScrollMetric = FUNIT_INCH;
+        else if ( eVScrollMetric == FUNIT_LINE )
+            eVScrollMetric = FUNIT_CM;
     }
     SwView* pTmpView = SwModule::GetFirstView();
     // fuer alle MDI-Fenster das Lineal umschalten
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 9814626..8fe85c4 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -127,7 +127,6 @@ SwLoadOptPage::SwLoadOptPage( Window* pParent, const SfxItemSet& rSet ) :
             case FUNIT_POINT:
             case FUNIT_PICA:
             case FUNIT_INCH:
-            case FUNIT_CHAR:
             {
                 // nur diese Metriken benutzen
                 USHORT nPos = aMetricLB.InsertEntry( sMetric );
@@ -229,9 +228,12 @@ BOOL __EXPORT SwLoadOptPage::FillItemSet( SfxItemSet& rSet )
         bRet = TRUE;
     }
 
-    if(aUseCharUnit.IsChecked() != aUseCharUnit.GetSavedValue())
+    sal_Bool bIsUseCharUnitFlag = aUseCharUnit.IsChecked();
+    SvtCJKOptions aCJKOptions;
+        bIsUseCharUnitFlag = bIsUseCharUnitFlag && aCJKOptions.IsAsianTypographyEnabled();
+    if( bIsUseCharUnitFlag != aUseCharUnit.GetSavedValue())
     {
-        rSet.Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, aUseCharUnit.IsChecked()));
+        rSet.Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bIsUseCharUnitFlag ));
         bRet = TRUE;
     }
     
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index bcfc76d..17d2148 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -331,9 +331,9 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
                 m_bHRulerChanged = sal_True;
             }
             m_bVRulerChanged = sal_True;
+            pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7));
+            pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7));
         }
-        pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7));
-        pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7));
 }
 /* -----------------------------08.02.2002 10:54------------------------------
 
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 7887ed7..496e683 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -955,16 +955,40 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
 
     BOOL bApplyCharUnit = pUsrPref->IsApplyCharUnit();
     SvtCJKOptions aCJKOptions;
-    if ( aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
-        pHRuler->SetUnit( FUNIT_CHAR );
+    if ( aCJKOptions.IsAsianTypographyEnabled() )
+    {
+        if ( bApplyCharUnit )
+            eMetric = FUNIT_CHAR;
+        else
+        {
+            if ( eMetric == FUNIT_CHAR )
+                eMetric = FUNIT_CM;
+        }
+    }
     else
-        pHRuler->SetUnit( eMetric );
+    {
+        if ( eMetric == FUNIT_CHAR )
+            eMetric = FUNIT_INCH;
+    }
+    pHRuler->SetUnit( eMetric );
 
     eMetric = pUsrPref->GetVScrollMetric();
-    if ( aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
-        pVRuler->SetUnit(FUNIT_LINE);
+    if ( aCJKOptions.IsAsianTypographyEnabled() )
+    {
+        if ( bApplyCharUnit )
+            eMetric = FUNIT_LINE;
+        else
+        {
+            if ( eMetric == FUNIT_LINE )
+                eMetric = FUNIT_CM;
+        }
+    }
     else
-        pVRuler->SetUnit( eMetric );
+    {
+        if ( eMetric == FUNIT_LINE )
+            eMetric = FUNIT_INCH;
+    }
+    pVRuler->SetUnit( eMetric );
 
         pHRuler->SetCharWidth( 371 );  // default character width
         pVRuler->SetLineHeight( 551 );  // default line height
commit 6321ca557a2a188a3a3f8f6eeb2881f8e7eacce8
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:43:46 2010 +0200

    cjk-character-units-fix.diff: add a new unit 'character unit'
    
    i#356101

diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx
index 28d0163..9f3008c 100644
--- a/sw/source/ui/app/appopt.cxx
+++ b/sw/source/ui/app/appopt.cxx
@@ -230,6 +230,7 @@ SfxItemSet*	 SwModule::CreateItemSet( USHORT nId )
         pAppView->GetVLinealMetric(eUnit);
     pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< UINT16 >(eUnit) ));
     pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< UINT16 >(pPref->GetMetric()) ));
+    pRet->Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, pPref->IsApplyCharUnit()));
     if(bTextDialog)
     {
         if(pAppView)
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index 3cb1d4f..07430ed 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -348,8 +348,10 @@ void SwModule::ApplyUserCharUnit(BOOL bApplyChar, BOOL bWeb)
     }
     else
     {
-        eHScrollMetric = FUNIT_CM;
-        eVScrollMetric = FUNIT_CM;
+        if ( eHScrollMetric == FUNIT_CHAR )
+            eHScrollMetric == FUNIT_CM;
+        if ( eVScrollMetric == FUNIT_LINE )
+            eVScrollMetric == FUNIT_CM;
     }
     SwView* pTmpView = SwModule::GetFirstView();
     // fuer alle MDI-Fenster das Lineal umschalten
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 15f99c2..9814626 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -148,7 +148,10 @@ SwLoadOptPage::SwLoadOptPage( Window* pParent, const SfxItemSet& rSet ) :
     
     SvtCJKOptions aCJKOptions;
     if(!aCJKOptions.IsAsianTypographyEnabled())
+        {
         aUseSquaredPageMode.Hide();
+                aUseCharUnit.Hide();
+        }
 }
 
 /*-----------------18.01.97 12.43-------------------
diff --git a/sw/source/ui/config/optload.src b/sw/source/ui/config/optload.src
index 5e0c8c7..a20d578 100644
--- a/sw/source/ui/config/optload.src
+++ b/sw/source/ui/config/optload.src
@@ -144,8 +144,7 @@ TabPage TP_OPTLOAD_PAGE
     {
         Pos = MAP_APPFONT ( 12 , 130) ;
         Size = MAP_APPFONT ( 109 , 10 ) ;
-        Text [ de ] = "appy char unit" ;
-        Text [ en-US ] = "apply char unit";
+        Text [ en-US ] = "Enable char unit";
         Text [ x-comment ] = " ";
     };
 
diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx
index 22b2d37..c6be3b6 100644
--- a/sw/source/ui/config/usrpref.cxx
+++ b/sw/source/ui/config/usrpref.cxx
@@ -63,6 +63,7 @@ SwMasterUsrPref::SwMasterUsrPref(BOOL bWeb) :
     bIsVScrollMetricSet(sal_False),
     nDefTab( MM50 * 4 ),
     bIsSquaredPageMode(sal_False),
+    bApplyCharUnit(sal_False),
     aContentConfig(bWeb, *this),
     aLayoutConfig(bWeb, *this),
     aGridConfig(bWeb, *this),
@@ -333,7 +334,7 @@ void SwLayoutViewConfig::Commit()
             case 16: pValues[nProp] <<= (sal_Int32)rParent.GetViewLayoutColumns(); break;// "ViewLayout/Columns",
             case 17: bSet = rParent.IsViewLayoutBookMode(); break;// "ViewLayout/BookMode",
             case 18: bSet = rParent.IsSquaredPageMode(); break;// "Other/IsSquaredPageMode",
-            case 19: bSet = rParent.IsApplyCharUnit(); break;// "Other/IsApplyCharUnit",
+            case 19: bSet = rParent.IsApplyCharUnit(); break;// "Other/ApplyCharUnit",
         }
         if(nProp < 8 || nProp == 10 || nProp == 15 || nProp == 17 || nProp == 18 || nProp == 19 )
             pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index ee7ac77..bcfc76d 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -323,17 +323,17 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
         aGridItem.SetColor(aColorLB.GetSelectEntryColor());
         rSet.Put(aGridItem);
 /// Amelia
+            SwView * pView = ::GetActiveView();
         if ( aGridItem.GetGridType() != GRID_NONE )
         {
-            SwView * pView = ::GetActiveView();
             if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
             {
-                pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7));
                 m_bHRulerChanged = sal_True;
             }
-            pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7));
             m_bVRulerChanged = sal_True;
         }
+        pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7));
+        pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7));
 }
 /* -----------------------------08.02.2002 10:54------------------------------
 
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index ed9edc4..7887ed7 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -116,6 +116,7 @@
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 
+#include <svl/cjkoptions.hxx>
 
 
 using namespace ::com::sun::star;
@@ -953,13 +954,14 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     FieldUnit eMetric = pUsrPref->GetHScrollMetric();
 
     BOOL bApplyCharUnit = pUsrPref->IsApplyCharUnit();
-    if ( bApplyCharUnit )
+    SvtCJKOptions aCJKOptions;
+    if ( aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
         pHRuler->SetUnit( FUNIT_CHAR );
     else
         pHRuler->SetUnit( eMetric );
 
     eMetric = pUsrPref->GetVScrollMetric();
-    if ( bApplyCharUnit )
+    if ( aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
         pVRuler->SetUnit(FUNIT_LINE);
     else
         pVRuler->SetUnit( eMetric );
commit 723b3fc153061b39604a032d578409d7f22d708f
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:42:44 2010 +0200

    cjk-character-units-rulers-sync-with-pggrid-fix.diff:

diff --git a/sw/source/ui/inc/pggrid.hxx b/sw/source/ui/inc/pggrid.hxx
index a05adbd..4a584a4 100644
--- a/sw/source/ui/inc/pggrid.hxx
+++ b/sw/source/ui/inc/pggrid.hxx
@@ -85,6 +85,8 @@ class SwTextGridPage: public SfxTabPage
     Size            m_aPageSize;
     sal_Bool        m_bVertical;
     sal_Bool		m_bSquaredMode;
+    sal_Bool        m_bHRulerChanged;
+    sal_Bool        m_bVRulerChanged;
 
     SwTextGridPage(Window *pParent, const SfxItemSet &rSet);
     ~SwTextGridPage();
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 22e2472..ee7ac77 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -95,7 +95,9 @@ SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) :
     m_bRubyUserValue(sal_False),
     m_aPageSize(MM50, MM50),
     m_bVertical(sal_False),
-    m_bSquaredMode(sal_False)
+    m_bSquaredMode(sal_False),
+    m_bHRulerChanged( sal_False ),
+    m_bVRulerChanged( sal_False )
 {
     FreeResource();
 
@@ -229,6 +231,12 @@ BOOL    SwTextGridPage::FillItemSet(SfxItemSet &rSet)
         bRet = TRUE;
     }
 
+    // draw ticks of ruler
+    SwView * pView = ::GetActiveView();
+    if ( m_bHRulerChanged )
+        pView->GetHLineal().DrawTicks();
+    if ( m_bVRulerChanged )
+        pView->GetVLineal().DrawTicks();
     return bRet;
 }
 /*-- 06.02.2002 15:25:40---------------------------------------------------
@@ -315,9 +323,17 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
         aGridItem.SetColor(aColorLB.GetSelectEntryColor());
         rSet.Put(aGridItem);
 /// Amelia
-        SwView * pView = ::GetActiveView();
-        pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7));
-        pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7));
+        if ( aGridItem.GetGridType() != GRID_NONE )
+        {
+            SwView * pView = ::GetActiveView();
+            if ( aGridItem.GetGridType() == GRID_LINES_CHARS )
+            {
+                pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7));
+                m_bHRulerChanged = sal_True;
+            }
+            pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7));
+            m_bVRulerChanged = sal_True;
+        }
 }
 /* -----------------------------08.02.2002 10:54------------------------------
 
commit baf4316376191dce3a3d070a07e745e0286b7bac
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:40:57 2010 +0200

    cjk-character-units-ui.diff: add a new unit 'character unit'

diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 956e774..15f99c2 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -77,6 +77,10 @@
 
 using namespace ::com::sun::star;
 
+#ifndef _SFXENUMITEM_HXX //autogen
+#include <svl/eitem.hxx>
+#endif
+
 /* -----------------22.10.98 15:12-------------------
  *
  * --------------------------------------------------*/
@@ -100,6 +104,7 @@ SwLoadOptPage::SwLoadOptPage( Window* pParent, const SfxItemSet& rSet ) :
     aTabFT              ( this, SW_RES( FT_TAB ) ),
     aTabMF              ( this, SW_RES( MF_TAB ) ),
     aUseSquaredPageMode ( this, SW_RES( CB_USE_SQUARE_PAGE_MODE ) ),
+    aUseCharUnit             ( this , SW_RES( CB_USE_CHAR_UNIT ) ),
 
     pWrtShell	( NULL ),
     bHTMLMode   ( FALSE ),
@@ -122,6 +127,7 @@ SwLoadOptPage::SwLoadOptPage( Window* pParent, const SfxItemSet& rSet ) :
             case FUNIT_POINT:
             case FUNIT_PICA:
             case FUNIT_INCH:
+            case FUNIT_CHAR:
             {
                 // nur diese Metriken benutzen
                 USHORT nPos = aMetricLB.InsertEntry( sMetric );
diff --git a/sw/source/ui/config/optload.hrc b/sw/source/ui/config/optload.hrc
index 89aff72..12b7a3c 100644
--- a/sw/source/ui/config/optload.hrc
+++ b/sw/source/ui/config/optload.hrc
@@ -41,6 +41,7 @@
 #define FT_TAB					21
 #define MF_TAB					22
 #define CB_USE_SQUARE_PAGE_MODE 23
+#define CB_USE_CHAR_UNIT    			24
 
 // SwCaptionOptPage -----------------------------
 
diff --git a/sw/source/ui/config/optload.src b/sw/source/ui/config/optload.src
index 618c0db..5e0c8c7 100644
--- a/sw/source/ui/config/optload.src
+++ b/sw/source/ui/config/optload.src
@@ -139,6 +139,16 @@ TabPage TP_OPTLOAD_PAGE
         Text [ en-US ] = "Use square page mode for text grid";
         Text [ zh-CN ] = "使用稿纸模式";
     };
+
+    CheckBox CB_USE_CHAR_UNIT
+    {
+        Pos = MAP_APPFONT ( 12 , 130) ;
+        Size = MAP_APPFONT ( 109 , 10 ) ;
+        Text [ de ] = "appy char unit" ;
+        Text [ en-US ] = "apply char unit";
+        Text [ x-comment ] = " ";
+    };
+
 };
 /**************************************************************************/
 /*                                                                        */
@@ -394,6 +404,8 @@ StringArray STR_ARR_METRIC
         < "Miles" ; FUNIT_MILE ; > ;
         < "Pica" ; FUNIT_PICA ; > ;
         < "Point" ; FUNIT_POINT ; > ;
+        < "Char" ; FUNIT_CHAR ; >;
+        < "Line" ; FUNIT_LINE ; >;
     };
 };
 
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 8d39438..de4f359 100755
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -176,14 +176,25 @@ SwContentOptPage::SwContentOptPage( Window* pParent,
             case FUNIT_POINT:
             case FUNIT_PICA:
             case FUNIT_INCH:
+            case FUNIT_CHAR:    // add two units , 'character' and 'line' , their ticks are not fixed
+            case FUNIT_LINE:
             {
                 // nur diese Metriken benutzen
-                USHORT nPos = aMetricLB.InsertEntry( sMetric );
-                aMetricLB.SetEntryData( nPos, (void*)(long)eFUnit );
-                aVMetric.InsertEntry( sMetric );
-                aVMetric.SetEntryData( nPos, (void*)(long)eFUnit );
-                aHMetric.InsertEntry( sMetric );
-                aHMetric.SetEntryData( nPos, (void*)(long)eFUnit );
+                                // a horizontal ruler has not the 'line' unit
+                                // there isn't 'line' unit in HTML format
+                                if ( eFUnit != FUNIT_LINE )
+                                {
+                        USHORT nPos = aMetricLB.InsertEntry( sMetric );
+                        aMetricLB.SetEntryData( nPos, (void*)(long)eFUnit );
+                            aHMetric.InsertEntry( sMetric );
+                                    aHMetric.SetEntryData( nPos, (void*)(long)eFUnit );
+                                }
+                                // a vetical ruler has not the 'character' unit
+                if ( eFUnit != FUNIT_CHAR )
+                {
+                            USHORT nPos = aVMetric.InsertEntry( sMetric );
+                            aVMetric.SetEntryData( nPos, (void*)(long)eFUnit );
+                }
             }
             default:;//prevent warning
         }
diff --git a/sw/source/ui/inc/optload.hxx b/sw/source/ui/inc/optload.hxx
index 4adfb96..2e17cb6 100644
--- a/sw/source/ui/inc/optload.hxx
+++ b/sw/source/ui/inc/optload.hxx
@@ -68,6 +68,7 @@ private:
     FixedText   aTabFT;
     MetricField aTabMF;
     CheckBox    aUseSquaredPageMode;
+    CheckBox    aUseCharUnit;
 
     SwWrtShell*	pWrtShell;
     sal_Bool    bHTMLMode;
diff --git a/sw/source/ui/inc/pggrid.hxx b/sw/source/ui/inc/pggrid.hxx
index 7111d77..a05adbd 100644
--- a/sw/source/ui/inc/pggrid.hxx
+++ b/sw/source/ui/inc/pggrid.hxx
@@ -54,12 +54,14 @@ class SwTextGridPage: public SfxTabPage
 
     FixedText       aLinesPerPageFT;
     NumericField    aLinesPerPageNF;
+    FixedText       aLinesRangeFT;
 
     FixedText       aTextSizeFT;
     MetricField     aTextSizeMF;
 
     FixedText       aCharsPerLineFT;
     NumericField    aCharsPerLineNF;
+    FixedText       aCharsRangeFT;
 
     FixedText       aCharWidthFT;
     MetricField     aCharWidthMF;    
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index d054574..22e2472 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -51,6 +51,7 @@
 #include <editeng/ulspitem.hxx>
 #include <editeng/boxitem.hxx>
 #include <editeng/frmdiritem.hxx>
+#include <svx/ruler.hxx>
 #include <pggrid.hxx>
 #include <tgrditem.hxx>
 #include <pggrid.hrc>
@@ -74,10 +75,12 @@ SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) :
     aLayoutFL               (this, SW_RES(FL_LAYOUT          )),
     aLinesPerPageFT         (this, SW_RES(FT_LINESPERPAGE    )),
     aLinesPerPageNF         (this, SW_RES(NF_LINESPERPAGE    )),
+    aLinesRangeFT           (this, SW_RES(FT_LINERANGE    )),
     aTextSizeFT             (this, SW_RES(FT_TEXTSIZE        )),
     aTextSizeMF             (this, SW_RES(MF_TEXTSIZE        )),
     aCharsPerLineFT         (this, SW_RES(FT_CHARSPERLINE    )),
     aCharsPerLineNF         (this, SW_RES(NF_CHARSPERLINE    )),
+    aCharsRangeFT           (this, SW_RES(FT_CHARRANGE       )),
     aCharWidthFT            (this, SW_RES(FT_CHARWIDTH        )),
     aCharWidthMF            (this, SW_RES(MF_CHARWIDTH        )),
     aRubySizeFT             (this, SW_RES(FT_RUBYSIZE        )),
diff --git a/sw/source/ui/misc/pggrid.hrc b/sw/source/ui/misc/pggrid.hrc
index 695bad1..567a1df 100644
--- a/sw/source/ui/misc/pggrid.hrc
+++ b/sw/source/ui/misc/pggrid.hrc
@@ -50,3 +50,5 @@
 #define CB_SNAPTOCHARS      23
 #define FT_CHARWIDTH        24
 #define MF_CHARWIDTH        25
+#define FT_LINERANGE       26
+#define FT_CHARRANGE       27
diff --git a/sw/source/ui/misc/pggrid.src b/sw/source/ui/misc/pggrid.src
index 76bd702..a6377dd 100644
--- a/sw/source/ui/misc/pggrid.src
+++ b/sw/source/ui/misc/pggrid.src
@@ -97,6 +97,12 @@ TabPage TP_TEXTGRID_PAGE
         Last = 154 ;
         SpinSize = 1 ;
     };
+    FixedText       FT_LINERANGE
+    {
+        Pos = MAP_APPFONT ( 103 , 82 ) ;
+        Size = MAP_APPFONT ( 25 , 8 );
+        Text [ en-US ] = "( 1 - 48 )" ;
+    };
     FixedText       FT_TEXTSIZE
     {
         Pos = MAP_APPFONT ( 133 , 82 ) ;
@@ -166,6 +172,12 @@ TabPage TP_TEXTGRID_PAGE
         Last = 5600 ;
         SpinSize = 5 ;
     };
+    FixedText       FT_CHARRANGE
+    {
+        Pos = MAP_APPFONT ( 103 , 96 ) ;
+        Size = MAP_APPFONT ( 25 , 8 ) ;
+        Text [ en-US ] = "( 1 - 45 )" ;
+    };
     FixedText       FT_RUBYSIZE
     {
         Pos = MAP_APPFONT ( 133 , 98 ) ;
commit 4cd64c0c68b4c81406d0075ac9d846014538840b
Author: Amelia Wang <amwang at novell.com>
Date:   Mon Sep 13 14:37:51 2010 +0200

    cjk-character-units-imp.diff: add a new unit 'character unit'

diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index e0ee17f..bc836f8 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -169,6 +169,8 @@ public:
     //default page mode for text grid
     void ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode);
 
+    void ApplyUserCharUnit(BOOL bApplyChar, BOOL bWeb);  // apply_char_unit
+
     // ConfigItems erzeugen
     SwModuleOptions*    GetModuleConfig()		{ return pModuleConfig;}
     SwPrintOptions* 	GetPrtOptions(sal_Bool bWeb);
diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx
index a248ac8..28d0163 100644
--- a/sw/source/ui/app/appopt.cxx
+++ b/sw/source/ui/app/appopt.cxx
@@ -139,6 +139,7 @@ SfxItemSet*	 SwModule::CreateItemSet( USHORT nId )
                                     FN_PARAM_WRTSHELL,		FN_PARAM_WRTSHELL,
                                     FN_PARAM_ADDPRINTER, 	FN_PARAM_ADDPRINTER,
                                     SID_ATTR_METRIC,		SID_ATTR_METRIC,
+                                    SID_ATTR_APPLYCHARUNIT, SID_ATTR_APPLYCHARUNIT,
                                     SID_ATTR_DEFTABSTOP, 	SID_ATTR_DEFTABSTOP,
                                     RES_BACKGROUND,			RES_BACKGROUND,
                                     SID_HTML_MODE,			SID_HTML_MODE,
@@ -379,6 +380,15 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet )
         const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
         ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
     }
+
+    if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_APPLYCHARUNIT,
+                                                    FALSE, &pItem ) )
+    {
+        SFX_APP()->SetOptions(rSet);
+        const SfxBoolItem* pCharItem = (const SfxBoolItem*)pItem;
+        ::SetApplyCharUnit(pCharItem->GetValue(), !bTextDialog);
+    }
+
     if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC,
                                                     FALSE, &pItem ) )
     {
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index cc3be1a..3cb1d4f 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -308,6 +308,63 @@ void SwModule::ApplyRulerMetric( FieldUnit eMetric, BOOL bHorizontal, BOOL bWeb
         pTmpView = SwModule::GetNextView(pTmpView);
     }
 }
+
+/*-------------------------------------------------
+set the usrpref 's char unit attribute and set ruler
+'s unit as char if the "apply char unit" is checked
+--------------------------------------------------*/
+void SwModule::ApplyUserCharUnit(BOOL bApplyChar, BOOL bWeb)
+{
+    SwMasterUsrPref* pPref;
+    if(bWeb)
+    {
+        if(!pWebUsrPref)
+        GetUsrPref(sal_True);
+        pPref = pWebUsrPref;
+    }
+    else
+    {
+        if(!pUsrPref)
+        GetUsrPref(sal_False);
+        pPref = pUsrPref;
+    }
+    BOOL  bOldApplyCharUnit = pPref->IsApplyCharUnit();
+    BOOL    bHasChanged = FALSE;
+    if(bOldApplyCharUnit != bApplyChar)
+    {
+        pPref->SetApplyCharUnit(bApplyChar);
+        bHasChanged = TRUE;
+    }
+
+    if( !bHasChanged )
+        return;
+
+    FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : pPref->GetMetric();
+    FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : pPref->GetMetric();
+    if(bApplyChar)
+    {
+        eHScrollMetric = FUNIT_CHAR;
+        eVScrollMetric = FUNIT_LINE;
+    }
+    else
+    {
+        eHScrollMetric = FUNIT_CM;
+        eVScrollMetric = FUNIT_CM;
+    }
+    SwView* pTmpView = SwModule::GetFirstView();
+    // fuer alle MDI-Fenster das Lineal umschalten
+    while(pTmpView)
+    {
+        if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
+        {
+            pTmpView->ChangeVLinealMetric(eVScrollMetric);
+            pTmpView->ChangeTabMetric(eHScrollMetric);
+        }
+
+        pTmpView = SwModule::GetNextView(pTmpView);
+    }
+}
+
 /*-----------------13.11.96 11.57-------------------
 
 --------------------------------------------------*/
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 808ad95..956e774 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -219,6 +219,12 @@ BOOL __EXPORT SwLoadOptPage::FillItemSet( SfxItemSet& rSet )
                     (USHORT)aTabMF.Denormalize(aTabMF.GetValue(FUNIT_TWIP))));
         bRet = TRUE;
     }
+
+    if(aUseCharUnit.IsChecked() != aUseCharUnit.GetSavedValue())
+    {
+        rSet.Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, aUseCharUnit.IsChecked()));
+        bRet = TRUE;
+    }
     
     sal_Bool bIsSquaredPageModeFlag = aUseSquaredPageMode.IsChecked();
     if ( bIsSquaredPageModeFlag != aUseSquaredPageMode.GetSavedValue() )
@@ -306,6 +312,17 @@ void __EXPORT SwLoadOptPage::Reset( const SfxItemSet& rSet)
         aUseSquaredPageMode.Check( bSquaredPageMode );
             aUseSquaredPageMode.SaveValue();
     }
+
+    if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_APPLYCHARUNIT, FALSE, &pItem))
+    {
+        BOOL bUseCharUnit = ((const SfxBoolItem*)pItem)->GetValue();
+        aUseCharUnit.Check(bUseCharUnit);
+    }
+    else
+    {
+        aUseCharUnit.Check(pUsrPref->IsApplyCharUnit());
+    }
+    aUseCharUnit.SaveValue();
 }
 /*-----------------13.01.97 14.44-------------------
     Metric des Deftabstops umschalten
diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx
index 2571361..22b2d37 100644
--- a/sw/source/ui/config/usrpref.cxx
+++ b/sw/source/ui/config/usrpref.cxx
@@ -263,9 +263,10 @@ Sequence<OUString> SwLayoutViewConfig::GetPropertyNames()
         "Window/IsVerticalRulerRight",      //15
         "ViewLayout/Columns",               //16
         "ViewLayout/BookMode",              //17
-        "Other/IsSquaredPageMode"           //18
+        "Other/IsSquaredPageMode",        //18
+        "Other/ApplyCharUnit"               //19
     };
-    const int nCount = bWeb ? 14 : 19;
+    const int nCount = bWeb ? 14 : 20;
     Sequence<OUString> aNames(nCount);
     OUString* pNames = aNames.getArray();
     for(int i = 0; i < nCount; i++)
@@ -332,8 +333,9 @@ void SwLayoutViewConfig::Commit()
             case 16: pValues[nProp] <<= (sal_Int32)rParent.GetViewLayoutColumns(); break;// "ViewLayout/Columns",
             case 17: bSet = rParent.IsViewLayoutBookMode(); break;// "ViewLayout/BookMode",
             case 18: bSet = rParent.IsSquaredPageMode(); break;// "Other/IsSquaredPageMode",
+            case 19: bSet = rParent.IsApplyCharUnit(); break;// "Other/IsApplyCharUnit",
         }
-        if(nProp < 8 || nProp == 10 || nProp == 15 || nProp == 17 || nProp == 18 )
+        if(nProp < 8 || nProp == 10 || nProp == 15 || nProp == 17 || nProp == 18 || nProp == 19 )
             pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
     }
     PutProperties(aNames, aValues);
@@ -353,7 +355,7 @@ void SwLayoutViewConfig::Load()
         {
             if(pValues[nProp].hasValue())
             {
-                sal_Bool bSet = nProp < 8 || nProp == 10 || nProp == 17 || nProp == 18 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
+                sal_Bool bSet = nProp < 8 || nProp == 10 || nProp == 17 || nProp == 18 || nProp == 19 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
                 switch(nProp)
                 {
                     case  0: rParent.SetCrossHair(bSet); break;// "Line/Guide",
@@ -419,6 +421,7 @@ void SwLayoutViewConfig::Load()
                     break;// "ViewLayout/Columns",
                     case 17: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
                     case 18: rParent.SetDefaultPageMode(bSet,TRUE); break;// "Other/IsSquaredPageMode",
+                    case 19: rParent.SetApplyCharUnit(bSet); break;// "Other/ApplyUserChar"
                 }
             }
         }
diff --git a/sw/source/ui/inc/pggrid.hxx b/sw/source/ui/inc/pggrid.hxx
index 281009a..7111d77 100644
--- a/sw/source/ui/inc/pggrid.hxx
+++ b/sw/source/ui/inc/pggrid.hxx
@@ -76,7 +76,7 @@ class SwTextGridPage: public SfxTabPage
     FixedText       aColorFT;
     ColorListBox    aColorLB;
 
-    Window*         aControls[18];
+    Window*         aControls[20];
 
     sal_Int32       m_nRubyUserValue;
     sal_Bool        m_bRubyUserValue;
diff --git a/sw/source/ui/inc/uitool.hxx b/sw/source/ui/inc/uitool.hxx
index 65abd12..eaaf99f 100644
--- a/sw/source/ui/inc/uitool.hxx
+++ b/sw/source/ui/inc/uitool.hxx
@@ -73,6 +73,9 @@ void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet );
 SW_DLLPUBLIC FieldUnit	GetDfltMetric(BOOL bWeb);
 void		SetDfltMetric(FieldUnit	eMetric, BOOL bWeb);
 
+SW_DLLPUBLIC BOOL HasCharUnit( BOOL bWeb );
+void SetApplyCharUnit(BOOL bApplyChar, BOOL bWeb);
+
 // ListBox mit allen Zeichenvorlagen fuellen - ausser Standard!
 SW_DLLPUBLIC void FillCharStyleListBox(ListBox& rToFill, SwDocShell* pDocSh, BOOL bSorted = FALSE, BOOL bWithDefault = FALSE);
 
diff --git a/sw/source/ui/inc/usrpref.hxx b/sw/source/ui/inc/usrpref.hxx
index 9f3f3e4..c35db3a 100644
--- a/sw/source/ui/inc/usrpref.hxx
+++ b/sw/source/ui/inc/usrpref.hxx
@@ -153,6 +153,7 @@ class SwMasterUsrPref : public SwViewOption
     SwCursorConfig      aCursorConfig;
     SwWebColorConfig*   pWebColorConfig;
 
+    sal_Bool bApplyCharUnit; // apply_char_unit
 public:
     SwMasterUsrPref(BOOL bWeb);
     ~SwMasterUsrPref();
@@ -254,6 +255,17 @@ public:
                         aLayoutConfig.SetModified();
                 }
 
+    sal_Bool    IsApplyCharUnit() const
+    {
+        return bApplyCharUnit;
+    }
+    void   SetApplyCharUnit(BOOL bSet, sal_Bool bNoModify = sal_False)
+    {
+        bApplyCharUnit = bSet;
+        if(!bNoModify)
+            aLayoutConfig.SetModified();
+    }
+
     sal_Int32   GetDefTab() const { return nDefTab;}
     void        SetDefTab( sal_Int32  nSet, sal_Bool bNoModify = sal_False )
                 {
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 673f78b..d054574 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -113,7 +113,9 @@ SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) :
     aControls[14] =&aPrintCB;
     aControls[15] =&aColorFT;
     aControls[16] =&aColorLB;
-    aControls[17] =0;
+    aControls[17] =&aLinesRangeFT;
+    aControls[18] =&aCharsRangeFT;
+    aControls[19] =0;
 
     Link aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl);
     aCharsPerLineNF.SetUpHdl(aLink);
@@ -309,6 +311,10 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
         aGridItem.SetPrintGrid(aPrintCB.IsChecked());
         aGridItem.SetColor(aColorLB.GetSelectEntryColor());
         rSet.Put(aGridItem);
+/// Amelia
+        SwView * pView = ::GetActiveView();
+        pView->GetHLineal().SetCharWidth((long)(aCharWidthMF.GetValue(FUNIT_TWIP)/56.7));
+        pView->GetVLineal().SetLineHeight((long)(aTextSizeMF.GetValue(FUNIT_TWIP)/56.7));
 }
 /* -----------------------------08.02.2002 10:54------------------------------
 
@@ -413,6 +419,10 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField)
             long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / aLinesPerPageNF.GetValue());
             aTextSizeMF.SetValue(aTextSizeMF.Normalize(nHeight), FUNIT_TWIP);
             aRubySizeMF.SetValue(0, FUNIT_TWIP);
+            String aMaxLinesFTStr = String::CreateFromAscii("( 1 - ");
+            aMaxLinesFTStr += String::CreateFromInt32(aLinesPerPageNF.GetValue());
+            aMaxLinesFTStr += String::CreateFromAscii(" )");
+            aLinesRangeFT.SetText( aMaxLinesFTStr );
             
             m_nRubyUserValue = nHeight;
             m_bRubyUserValue = sal_True;
@@ -421,6 +431,10 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField)
         {
             long nWidth = static_cast< sal_Int32 >(m_aPageSize.Width() / aCharsPerLineNF.GetValue());
             aCharWidthMF.SetValue(aCharWidthMF.Normalize(nWidth), FUNIT_TWIP);
+            String aMaxCharsFTStr = String::CreateFromAscii("( 1 - ");
+            aMaxCharsFTStr += String::CreateFromInt32(aCharsPerLineNF.GetValue());
+            aMaxCharsFTStr += String::CreateFromAscii(" )");
+            aCharsRangeFT.SetText( aMaxCharsFTStr );
         }
     }
     GridModifyHdl(0);
@@ -436,7 +450,6 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField)
         if (&aTextSizeMF == pField)
         {
             sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
-            aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextSize);
             m_bRubyUserValue = sal_False;
         }
         //set maximum line per page
@@ -454,14 +467,22 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField)
             sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
             aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize);
             m_bRubyUserValue = sal_False;
+            String aRangesStr = String::CreateFromAscii("( 1 - ");
+            aRangesStr += String::CreateFromInt32( m_aPageSize.Height() / nTextSize );
+            aRangesStr += String::CreateFromAscii(" )");
+            aLinesRangeFT.SetText( aRangesStr );
         }
         else if (&aCharWidthMF == pField)
         {
             sal_Int32 nTextWidth = static_cast< sal_Int32 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP)));
+            sal_Int32 nMaxChar = 45 ;
             if (nTextWidth)
-                aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextWidth); 
-            else
-                aCharsPerLineNF.SetValue( 45 );
+                nMaxChar = m_aPageSize.Width() / nTextWidth;
+            aCharsPerLineNF.SetValue( nMaxChar );
+            String aCharRangeStr = String::CreateFromAscii("( 1 - ");
+            aCharRangeStr += String::CreateFromInt32( nMaxChar );
+            aCharRangeStr += String::CreateFromAscii(" )");
+            aCharsRangeFT.SetText( aCharRangeStr );
         }
         //rubySize is disabled
     }
@@ -489,6 +510,7 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, RadioButton*, pButton)
     {
         aCharsPerLineFT.Enable(sal_False);
         aCharsPerLineNF.Enable(sal_False);
+        aCharsRangeFT.Enable(sal_False);
         aCharWidthFT.Enable(sal_False);
         aCharWidthMF.Enable(sal_False);
     }
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index 8a02ce6..1e3b6ff 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -877,6 +877,10 @@ void SwTextShell::Execute(SfxRequest &rReq)
         {
             FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
             SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
+
+            BOOL bApplyCharUnit = ::HasCharUnit(0 != PTR_CAST(SwWebView, &GetView()));
+            SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit));
+
             SfxItemSet aCoreSet( GetPool(),
                             RES_PARATR_BEGIN,           RES_PARATR_END - 1,
                             // --> OD 2008-02-25 #refactorlists#
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 10b3c58..ed9edc4 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -117,6 +117,7 @@
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 
 
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -950,9 +951,21 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     pVRuler->SetZoom( aZoomFract );
     pHRuler->SetDoubleClickHdl(LINK( this, SwView, ExecRulerClick ));
     FieldUnit eMetric = pUsrPref->GetHScrollMetric();
-    pHRuler->SetUnit( eMetric );
+
+    BOOL bApplyCharUnit = pUsrPref->IsApplyCharUnit();
+    if ( bApplyCharUnit )
+        pHRuler->SetUnit( FUNIT_CHAR );
+    else
+        pHRuler->SetUnit( eMetric );
+
     eMetric = pUsrPref->GetVScrollMetric();
-    pVRuler->SetUnit( eMetric );
+    if ( bApplyCharUnit )
+        pVRuler->SetUnit(FUNIT_LINE);
+    else
+        pVRuler->SetUnit( eMetric );
+
+        pHRuler->SetCharWidth( 371 );  // default character width
+        pVRuler->SetLineHeight( 551 );  // default line height
 
     // DocShell setzen
     pDocSh->SetView( this );
diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx
index c9e10d6..08cae53 100644
--- a/sw/source/ui/utlui/uitool.cxx
+++ b/sw/source/ui/utlui/uitool.cxx
@@ -736,6 +736,19 @@ String GetAppLangDateTimeString( const DateTime& rDT )
     return sRet;
 }
 
+/*----------------------------------------------------------------------------
+ * add a new function which can get and set the current "SID_ATTR_APPLYCHARUNIT" value
+ *---------------------------------------------------------------------------*/
+BOOL HasCharUnit( BOOL bWeb)
+{
+    return SW_MOD()->GetUsrPref(bWeb)->IsApplyCharUnit();
+}
+
+void SetApplyCharUnit(BOOL bApplyChar, BOOL bWeb)
+{
+    SW_MOD()->ApplyUserCharUnit(bApplyChar, bWeb);
+}
+
 /*-- 26.01.2006 08:06:33---------------------------------------------------
 
   -----------------------------------------------------------------------*/
commit 825b1706ab0a71d86812cbb95ac056e78f6a5864
Author: Jiao Jianhua <jjiao at novell.com>
Date:   Mon Sep 13 14:07:35 2010 +0200

    plus-minus-sw-navigator2.diff: Folding for each heading in Navigator
    
    i#64886, n#129410i

diff --git a/sw/source/ui/inc/conttree.hxx b/sw/source/ui/inc/conttree.hxx
index 2e0d8e4..1b56866 100644
--- a/sw/source/ui/inc/conttree.hxx
+++ b/sw/source/ui/inc/conttree.hxx
@@ -30,6 +30,9 @@
 #include <svtools/svtreebx.hxx>
 #include "swcont.hxx"
 
+#include<map>
+//using namespace std;
+
 class SwWrtShell;
 class SwContentType;
 class SwNavigationPI;
@@ -74,6 +77,8 @@ class SwContentTree : public SvTreeListBox
     SwWrtShell* 		pActiveShell;   // die aktive oder eine konst. offene View
     SwNavigationConfig*	pConfig;
 
+    std::map< void*, sal_Bool > mOutLineNodeMap;
+
     sal_Int32           nActiveBlock;
     USHORT				nHiddenBlock;
     USHORT 				nRootType;
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index b15ee57..a59244a 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -968,7 +968,6 @@ SwContentTree::~SwContentTree()
 /***************************************************************************
     Drag&Drop methods
 ***************************************************************************/
-
 void SwContentTree::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
 {
     if( !bIsRoot || nRootType != CONTENT_TYPE_OUTLINE )
@@ -1018,8 +1017,45 @@ sal_Int8 SwContentTree::AcceptDrop( const AcceptDropEvent& rEvt )
 /***************************************************************************
     Beschreibung:	Drop wird im Navigator ausgefuehrt
 ***************************************************************************/
+void* lcl_GetOutlineKey( SwContentTree* pTree, SwOutlineContent* pContent)
+{
+    void* key = 0;
+    if( pTree && pContent )
+    {
+        SwWrtShell* pShell = pTree->GetWrtShell();
+        sal_Int32 nPos = pContent->GetYPos();
+        if( nPos )
+        {
+            key = (void*)pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos );
+        }
+    }
+    return key;
+}
+
 sal_Int8 SwContentTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
 {
+    SvLBoxEntry* pEntry = pTargetEntry;
+    if( pEntry && ( nRootType == CONTENT_TYPE_OUTLINE ) && lcl_IsContent( pEntry ) )
+    {
+        SwOutlineContent* pOutlineContent = ( SwOutlineContent* )( pEntry->GetUserData() );
+        if( pOutlineContent )
+        {
+            void* key = lcl_GetOutlineKey(this, pOutlineContent);
+            if( !mOutLineNodeMap[key] )
+            {
+                while( pEntry->HasChilds() )
+                {
+                    SvLBoxEntry* pChildEntry = FirstChild( pEntry );
+                    while( pChildEntry )
+                    {
+                        pEntry = pChildEntry;
+                        pChildEntry = NextSibling( pChildEntry );
+                    }
+                }
+                pTargetEntry = pEntry;
+            }
+        }
+    }
     if( bIsRoot )
         return SvTreeListBox::ExecuteDrop( rEvt );
     return bIsInDrag ? DND_ACTION_NONE : GetParentWindow()->ExecuteDrop(rEvt);
@@ -1308,7 +1344,8 @@ void  SwContentTree::RequestingChilds( SvLBoxEntry* pParent )
 
 sal_Bool  SwContentTree::Expand( SvLBoxEntry* pParent )
 {
-    if(!bIsRoot || ((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)
+    if(!bIsRoot || (((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE) ||
+            (nRootType == CONTENT_TYPE_OUTLINE))
     {
         if(lcl_IsContentType(pParent))
         {
@@ -1323,18 +1360,39 @@ sal_Bool  SwContentTree::Expand( SvLBoxEntry* pParent )
                 nHiddenBlock |= nOr;
             if((pCntType->GetType() == CONTENT_TYPE_OUTLINE))
             {
+                std::map< void*, sal_Bool > mCurrOutLineNodeMap;
+
+                SwWrtShell* pShell = GetWrtShell();
                 sal_Bool bBool = SvTreeListBox::Expand(pParent);
                 SvLBoxEntry* pChild = Next(pParent);
                 while(pChild && lcl_IsContent(pChild) && pParent->HasChilds())
                 {
                     if(pChild->HasChilds())
-                        SvTreeListBox::Expand(pChild);
+                    {
+                        sal_Int32 nPos = ((SwContent*)pChild->GetUserData())->GetYPos();
+                        void* key = (void*)pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos );
+                        mCurrOutLineNodeMap.insert(std::map<void*, sal_Bool>::value_type( key, sal_False ) );
+                        std::map<void*,sal_Bool>::iterator iter = mOutLineNodeMap.find( key );
+                        if( iter != mOutLineNodeMap.end() && mOutLineNodeMap[key])
+                        {
+                            mCurrOutLineNodeMap[key] = sal_True;
+                            SvTreeListBox::Expand(pChild);
+                        }
+                    }
                     pChild = Next(pChild);
                 }
+                mOutLineNodeMap = mCurrOutLineNodeMap;
                 return bBool;
             }
 
         }
+        else if( lcl_IsContent(pParent) )
+        {
+            SwWrtShell* pShell = GetWrtShell();
+            sal_Int32 nPos = ((SwContent*)pParent->GetUserData())->GetYPos();
+            void* key = (void*)pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos );
+            mOutLineNodeMap[key] = sal_True;
+        }
     }
     return SvTreeListBox::Expand(pParent);
 }
@@ -1346,7 +1404,8 @@ sal_Bool  SwContentTree::Expand( SvLBoxEntry* pParent )
 sal_Bool  SwContentTree::Collapse( SvLBoxEntry* pParent )
 {
     sal_Bool bRet;
-    if(!bIsRoot || ((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)
+    if(!bIsRoot || (((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE) ||
+            (nRootType == CONTENT_TYPE_OUTLINE))
     {
         if(lcl_IsContentType(pParent))
         {
@@ -1363,6 +1422,13 @@ sal_Bool  SwContentTree::Collapse( SvLBoxEntry* pParent )
             else
                 nHiddenBlock &= nAnd;
         }
+        else if( lcl_IsContent(pParent) )
+        {
+            SwWrtShell* pShell = GetWrtShell();
+            sal_Int32 nPos = ((SwContent*)pParent->GetUserData())->GetYPos();
+            void* key = (void*)pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos );
+            mOutLineNodeMap[key] = sal_False;
+        }
             bRet = SvTreeListBox::Collapse(pParent);
     }
     else
commit c2b6b1ab7a949fb80fd98f506486d45a1166fbc5
Author: Jiao Jianhua <jjiao at novell.com>
Date:   Mon Sep 13 14:06:16 2010 +0200

    plus-minus-sw-navigator.diff: folding for each heading in Navigator
    
    i#64886, n#129410

diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index 418d9ac..b15ee57 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -1240,18 +1240,63 @@ void  SwContentTree::RequestingChilds( SvLBoxEntry* pParent )
             SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
 
             sal_uInt16 nCount = pCntType->GetMemberCount();
-            for(sal_uInt16 i = 0; i < nCount; i++)
-            {
-                const SwContent* pCnt = pCntType->GetMember(i);
-                if(pCnt)
-                {
-                    String sEntry = pCnt->GetName();
-                    if(!sEntry.Len())
-                        sEntry = sSpace;
-                    InsertEntry(sEntry, pParent,
-                            sal_False, LIST_APPEND, (void*)pCnt);
-                }
-
+             /**************************************************************
+                 Add for outline plus/minus
+             ***************************************************************/
+             if(pCntType->GetType() == CONTENT_TYPE_OUTLINE)
+             {
+                 SvLBoxEntry* pChild = 0;
+                 for(sal_uInt16 i = 0; i < nCount; i++)
+                 {
+                     const SwContent* pCnt = pCntType->GetMember(i);
+                     if(pCnt)
+                     {
+                         sal_uInt16 nLevel = ((SwOutlineContent*)pCnt)->GetOutlineLevel();
+                         String sEntry = pCnt->GetName();
+                         if(!sEntry.Len())
+                             sEntry = sSpace;
+                         if(!pChild || (nLevel == 0))
+                             pChild = InsertEntry(sEntry, pParent,
+                                         sal_False, LIST_APPEND,(void*)pCnt);
+                         else
+                         {
+                             //back search parent.
+                             if(((SwOutlineContent*)pCntType->GetMember(i-1))->GetOutlineLevel() < nLevel)
+                                 pChild = InsertEntry(sEntry, pChild,
+                                         sal_False, LIST_APPEND, (void*)pCnt);
+                             else
+                             {
+                                 pChild = Prev(pChild);
+                                 while(pChild &&
+                                         lcl_IsContent(pChild) &&
+                                         !(((SwOutlineContent*)pChild->GetUserData())->GetOutlineLevel() < nLevel)
+                                      )
+                                 {
+                                     pChild = Prev(pChild);
+                                 }
+                                 if(pChild)
+                                     pChild = InsertEntry(sEntry, pChild,
+                                                 sal_False, LIST_APPEND, (void*)pCnt);
+                             }
+                        }
+                     }
+                 }
+             }
+             else
+             {
+                 for(sal_uInt16 i = 0; i < nCount; i++)
+                 {
+                     const SwContent* pCnt = pCntType->GetMember(i);
+                     if(pCnt)
+                     {
+                         String sEntry = pCnt->GetName();
+                         if(!sEntry.Len())
+                             sEntry = sSpace;
+                         InsertEntry(sEntry, pParent,
+                             sal_False, LIST_APPEND, (void*)pCnt);
+                     }
+
+                 }
             }
         }
     }
@@ -1263,7 +1308,7 @@ void  SwContentTree::RequestingChilds( SvLBoxEntry* pParent )
 
 sal_Bool  SwContentTree::Expand( SvLBoxEntry* pParent )
 {
-    if(!bIsRoot)
+    if(!bIsRoot || ((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)
     {
         if(lcl_IsContentType(pParent))
         {
@@ -1276,6 +1321,19 @@ sal_Bool  SwContentTree::Expand( SvLBoxEntry* pParent )
             }
             else
                 nHiddenBlock |= nOr;
+            if((pCntType->GetType() == CONTENT_TYPE_OUTLINE))
+            {
+                sal_Bool bBool = SvTreeListBox::Expand(pParent);
+                SvLBoxEntry* pChild = Next(pParent);
+                while(pChild && lcl_IsContent(pChild) && pParent->HasChilds())
+                {
+                    if(pChild->HasChilds())
+                        SvTreeListBox::Expand(pChild);
+                    pChild = Next(pChild);
+                }
+                return bBool;
+            }
+
         }
     }
     return SvTreeListBox::Expand(pParent);
@@ -1288,10 +1346,12 @@ sal_Bool  SwContentTree::Expand( SvLBoxEntry* pParent )
 sal_Bool  SwContentTree::Collapse( SvLBoxEntry* pParent )
 {
     sal_Bool bRet;
-    if(!bIsRoot)
+    if(!bIsRoot || ((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)
     {
         if(lcl_IsContentType(pParent))
         {
+            if(bIsRoot)
+                return bRet = sal_False;
             SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
             sal_uInt16 nAnd = 1 << pCntType->GetType();
             nAnd = ~nAnd;
@@ -1306,7 +1366,8 @@ sal_Bool  SwContentTree::Collapse( SvLBoxEntry* pParent )
             bRet = SvTreeListBox::Collapse(pParent);
     }
     else
-        bRet = sal_False;
+//		bRet = sal_False;
+        bRet = SvTreeListBox::Collapse(pParent);
     return bRet;
 }
 
@@ -1323,9 +1384,9 @@ IMPL_LINK( SwContentTree, ContentDoubleClickHdl, SwContentTree *, EMPTYARG )
     DBG_ASSERT(pEntry, "kein aktueller Eintrag!");
     if(pEntry)
     {
-        if(lcl_IsContentType(pEntry))
+        if(lcl_IsContentType(pEntry) && !pEntry->HasChilds())
             RequestingChilds(pEntry);
-        else if(bIsActive || bIsConstant)
+        else if(!lcl_IsContentType(pEntry) && (bIsActive || bIsConstant))
         {
             if(bIsConstant)
             {
@@ -1369,9 +1430,14 @@ void SwContentTree::Display( sal_Bool bActive )
             nOldScrollPos = pVScroll->GetThumbPos();
 
         sEntryName = GetEntryText(pOldSelEntry);
+        SvLBoxEntry* pParantEntry = pOldSelEntry;
+        while( GetParent(pParantEntry))
+        {
+            pParantEntry = GetParent(pParantEntry);
+        }
         if(GetParent(pOldSelEntry))
         {
-            nEntryRelPos = (sal_uInt16)(GetModel()->GetAbsPos(pOldSelEntry) - GetModel()->GetAbsPos(GetParent(pOldSelEntry)));
+            nEntryRelPos = (sal_uInt16)(GetModel()->GetAbsPos(pOldSelEntry) - GetModel()->GetAbsPos(pParantEntry));
         }
     }
     Clear();
@@ -1465,18 +1531,24 @@ void SwContentTree::Display( sal_Bool bActive )
                     (*ppRootContentT)->GetName(), rImage, rImage,
                         0, sal_False, LIST_APPEND, *ppRootContentT);
 
-            for(sal_uInt16 i = 0; i < (*ppRootContentT)->GetMemberCount(); i++ )
+            if(nRootType != CONTENT_TYPE_OUTLINE)
             {
-                const SwContent* pCnt = (*ppRootContentT)->GetMember(i);
-                if(pCnt)
+                SvLBoxEntry* pEntry;
+                for(sal_uInt16 i = 0; i < (*ppRootContentT)->GetMemberCount(); i++ )
                 {
-                    String sEntry = pCnt->GetName();
-                    if(!sEntry.Len())
-                        sEntry = sSpace;
-                    InsertEntry( sEntry, pParent,
-                                sal_False, LIST_APPEND, (void*)pCnt);
+                    const SwContent* pCnt = (*ppRootContentT)->GetMember(i);
+                    if(pCnt)
+                    {
+                        String sEntry = pCnt->GetName();
+                        if(!sEntry.Len())
+                            sEntry = sSpace;
+                        InsertEntry( sEntry, pParent,
+                            sal_False, LIST_APPEND, (void*)pCnt);
+                    }
                 }
-            }
+             }
+             else
+                 RequestingChilds(pParent);
             Expand(pParent);
             if( nRootType == CONTENT_TYPE_OUTLINE && bIsActive )
             {
@@ -1851,9 +1923,9 @@ sal_Bool SwContentTree::HasContentChanged()
                     // or if the visibility of objects (frames, sections, tables) has changed
                     // i.e. in header/footer
                     pArrType->FillMemberList(&bLevelOrVisibiblityChanged);
-                    if(bLevelOrVisibiblityChanged)
-                        bInvalidate = sal_True;
                     sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry);
+                    if((nType == CONTENT_TYPE_OUTLINE) && bLevelOrVisibiblityChanged)
+                        bRepaint = sal_True;
                     if(bLevelOrVisibiblityChanged)
                         bInvalidate = sal_True;
 
@@ -2760,6 +2832,10 @@ sal_Bool  SwContentTree::Select( SvLBoxEntry* pEntry, sal_Bool bSelect )
         return sal_False;
     sal_Bool bEnable = sal_False;
     SvLBoxEntry* pParentEntry = GetParent(pEntry);
+    while(pParentEntry && (!lcl_IsContentType(pParentEntry)))
+    {
+        pParentEntry = GetParent(pParentEntry);
+    }
     if(!bIsLastReadOnly && (!IsVisible() ||
         (bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry ||
             lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)))


More information about the ooo-build-commit mailing list