View | Details | Raw Unified | Return to issue 24363
Collapse All | Expand All

(-)inc/svx/ruler.hxx (+3 lines)
Lines 281-286 Link Here
281
	BOOL IsActive() const { return bActive; }
281
	BOOL IsActive() const { return bActive; }
282
282
283
	void ForceUpdate() { Update(); }
283
	void ForceUpdate() { Update(); }
284
285
    //#i24363# tab stops relative to indent
286
    void SetTabsRelativeToIndent( BOOL bRel = TRUE );
284
};
287
};
285
288
286
#endif
289
#endif
(-)source/dialog/svxruler.cxx (-9 / +48 lines)
Lines 244-249 Link Here
244
									  // Muesste vielleicht fuer weitere Werte
244
									  // Muesste vielleicht fuer weitere Werte
245
									  // aufgebohrt werden
245
									  // aufgebohrt werden
246
    BOOL bIsTableRows : 1;      // pColumnItem contains table rows instead of columns
246
    BOOL bIsTableRows : 1;      // pColumnItem contains table rows instead of columns
247
    //#i24363# tab stops relative to indent
248
    BOOL bIsTabsRelativeToIndent : 1; // Tab stops relative to paragraph indent?
247
    SvxRuler_Impl() :
249
    SvxRuler_Impl() :
248
    pPercBuf(0), pBlockBuf(0),
250
    pPercBuf(0), pBlockBuf(0),
249
    nPercSize(0), nTotalDist(0),
251
    nPercSize(0), nTotalDist(0),
Lines 255-261 Link Here
255
    nIdx(0),
257
    nIdx(0),
256
    nColLeftPix(0), nColRightPix(0),
258
    nColLeftPix(0), nColRightPix(0),
257
259
258
    bIsTableRows(FALSE)
260
    bIsTableRows(FALSE),
261
    bIsTabsRelativeToIndent(TRUE)
259
	{
262
	{
260
	}
263
	}
261
	~SvxRuler_Impl()
264
	~SvxRuler_Impl()
Lines 1229-1236 Link Here
1229
        long nLeftFrameMargin = GetLeftFrameMargin();
1232
        long nLeftFrameMargin = GetLeftFrameMargin();
1230
        long nRightFrameMargin = GetRightFrameMargin();
1233
        long nRightFrameMargin = GetRightFrameMargin();
1231
1234
1232
		const long lParaIndent =
1235
    //#i24363# tab stops relative to indent
1233
			nLeftFrameMargin + pParaItem->GetTxtLeft();
1236
        const long nParaItemTxtLeft = pRuler_Imp->bIsTabsRelativeToIndent ?
1237
                                      pParaItem->GetTxtLeft() :
1238
                                      0;
1239
1240
        const long lParaIndent = nLeftFrameMargin + nParaItemTxtLeft;
1241
1234
		const long lLastTab =
1242
		const long lLastTab =
1235
			 pTabStopItem->Count()?
1243
			 pTabStopItem->Count()?
1236
			  ConvertHPosPixel((*pTabStopItem)[pTabStopItem->Count()-1].GetTabPos()): 0;
1244
			  ConvertHPosPixel((*pTabStopItem)[pTabStopItem->Count()-1].GetTabPos()): 0;
Lines 1256-1262 Link Here
1256
1264
1257
		nTabCount = 0;
1265
		nTabCount = 0;
1258
		USHORT j;
1266
		USHORT j;
1259
		const long lRightPixMargin = ConvertSizePixel(nRightFrameMargin - pParaItem->GetTxtLeft());
1267
        //#i24363# tab stops relative to indent
1268
        const long lRightPixMargin = ConvertSizePixel(nRightFrameMargin - nParaItemTxtLeft );
1260
		const long lParaIndentPix = ConvertSizePixel(lParaIndent);
1269
		const long lParaIndentPix = ConvertSizePixel(lParaIndent);
1261
		for(j = 0; j < pTabStopItem->Count(); ++j)
1270
		for(j = 0; j < pTabStopItem->Count(); ++j)
1262
		{
1271
		{
Lines 2496-2507 Link Here
2496
		else
2505
		else
2497
		{
2506
		{
2498
			if(bRTL)
2507
			if(bRTL)
2508
            {
2509
                //#i24363# tab stops relative to indent
2510
                const long nTmpLeftIndent = pRuler_Imp->bIsTabsRelativeToIndent ?
2511
                                            GetLeftIndent() :
2512
                                            ConvertHPosPixel( GetRightFrameMargin() + lAppNullOffset );
2513
2499
				aTabStop.GetTabPos() = PixelHAdjust(
2514
				aTabStop.GetTabPos() = PixelHAdjust(
2500
					ConvertHPosLogic(GetLeftIndent() - pTabs[nCoreIdx+TAB_GAP].nPos) - lAppNullOffset,
2515
                    ConvertHPosLogic( nTmpLeftIndent - pTabs[nCoreIdx+TAB_GAP].nPos) - lAppNullOffset,
2501
																						aTabStop.GetTabPos());
2516
																						aTabStop.GetTabPos());
2517
            }
2502
			else
2518
			else
2519
            {
2520
                //#i24363# tab stops relative to indent
2521
                const long nTmpLeftIndent = pRuler_Imp->bIsTabsRelativeToIndent ?
2522
                                            GetLeftIndent() :
2523
                                            0;
2524
2503
				aTabStop.GetTabPos() = PixelHAdjust(
2525
				aTabStop.GetTabPos() = PixelHAdjust(
2504
					ConvertHPosLogic(pTabs[nCoreIdx+TAB_GAP].nPos - GetLeftIndent()) - lAppNullOffset, aTabStop.GetTabPos());
2526
                    ConvertHPosLogic( pTabs[nCoreIdx+TAB_GAP].nPos - nTmpLeftIndent ) - lAppNullOffset,
2527
                                                                                         aTabStop.GetTabPos() );
2528
            }
2505
		}
2529
		}
2506
		pTabStopItem->Remove(nCoreIdx);
2530
		pTabStopItem->Remove(nCoreIdx);
2507
		pTabStopItem->Insert(aTabStop);
2531
		pTabStopItem->Insert(aTabStop);
Lines 2805-2814 Link Here
2805
		{
2829
		{
2806
			//convert position in left-to-right text
2830
			//convert position in left-to-right text
2807
			long nTabPos;
2831
			long nTabPos;
2832
    //#i24363# tab stops relative to indent
2808
			if(bRTL)
2833
			if(bRTL)
2809
				nTabPos = GetLeftIndent() - lPos;
2834
                nTabPos = ( pRuler_Imp->bIsTabsRelativeToIndent ?
2810
			else
2835
                            GetLeftIndent() :
2811
				nTabPos = lPos - GetLeftIndent();
2836
                            ConvertHPosPixel( GetRightFrameMargin() + lAppNullOffset ) ) -
2837
                          lPos;
2838
            else
2839
                nTabPos = lPos -
2840
                          ( pRuler_Imp->bIsTabsRelativeToIndent ?
2841
                            GetLeftIndent() :
2842
                            0 );
2843
2812
			SvxTabStop aTabStop(ConvertHPosLogic(nTabPos),
2844
			SvxTabStop aTabStop(ConvertHPosLogic(nTabPos),
2813
								ToAttrTab_Impl(nDefTabType));
2845
								ToAttrTab_Impl(nDefTabType));
2814
			pTabStopItem->Insert(aTabStop);
2846
			pTabStopItem->Insert(aTabStop);
Lines 3906-3909 Link Here
3906
		}
3938
		}
3907
	}
3939
	}
3908
}
3940
}
3941
/*-- 29.11.2007 08:24:23---------------------------------------------------
3942
    //#i24363# tab stops relative to indent
3943
  -----------------------------------------------------------------------*/
3944
void SvxRuler::SetTabsRelativeToIndent( BOOL bRel )
3945
{
3946
    pRuler_Imp->bIsTabsRelativeToIndent = bRel;
3947
}
(-)inc/IDocumentSettingAccess.hxx (+1 lines)
Lines 90-95 Link Here
90
90
91
         UNIX_FORCE_ZERO_EXT_LEADING,
91
         UNIX_FORCE_ZERO_EXT_LEADING,
92
         USE_OLD_PRINTER_METRICS,
92
         USE_OLD_PRINTER_METRICS,
93
         TABS_RELATIVE_TO_INDENT,
93
         // COMPATIBILITY FLAGS END
94
         // COMPATIBILITY FLAGS END
94
95
95
         BROWSE_MODE,
96
         BROWSE_MODE,
(-)inc/doc.hxx (+4 lines)
Lines 584-589 Link Here
584
    // SO8pu8
584
    // SO8pu8
585
    // mbOldPrinterMetrics                      def = FALSE, hidden
585
    // mbOldPrinterMetrics                      def = FALSE, hidden
586
    //
586
    //
587
    // SO9
588
    // #i24363# tab stops relative to indent
589
    // mbTabRelativeToIndent                    def = TRUE, hidden
587
590
588
    bool mbParaSpaceMax                     : 1;
591
    bool mbParaSpaceMax                     : 1;
589
    bool mbParaSpaceMaxAtPages              : 1;
592
    bool mbParaSpaceMaxAtPages              : 1;
Lines 611-616 Link Here
611
    bool mbClipAsCharacterAnchoredWriterFlyFrames   : 1;   // OD 2006-04-13 #b6402800#
614
    bool mbClipAsCharacterAnchoredWriterFlyFrames   : 1;   // OD 2006-04-13 #b6402800#
612
    bool mbUnixForceZeroExtLeading                  : 1;   // FME 2006-10-09 #i60945#
615
    bool mbUnixForceZeroExtLeading                  : 1;   // FME 2006-10-09 #i60945#
613
    bool mbOldPrinterMetrics                        : 1;   // FME 2007-05-14 #147385#
616
    bool mbOldPrinterMetrics                        : 1;   // FME 2007-05-14 #147385#
617
    bool mbTabRelativeToIndent;                            // #i24363# tab stops relative to indent
614
618
615
       // #i78591#
619
       // #i78591#
616
       sal_uInt32  n32DummyCompatabilityOptions1;
620
       sal_uInt32  n32DummyCompatabilityOptions1;
(-)inc/viewsh.hxx (+3 lines)
Lines 408-413 Link Here
408
    // compatible behaviour of tabs
408
    // compatible behaviour of tabs
409
    void SetTabCompat( bool bNew );
409
    void SetTabCompat( bool bNew );
410
410
411
    //#i24363# tab stops relative to indent
412
    void SetTabsRelativeToIndent( bool bNew );
413
411
    // font metric attribute "External Leading" should be considered
414
    // font metric attribute "External Leading" should be considered
412
    void SetAddExtLeading( bool bNew );
415
    void SetAddExtLeading( bool bNew );
413
416
(-)source/core/doc/doc.cxx (-1 / +4 lines)
Lines 299-304 Link Here
299
        // <--
299
        // <--
300
        case UNIX_FORCE_ZERO_EXT_LEADING: return mbUnixForceZeroExtLeading;
300
        case UNIX_FORCE_ZERO_EXT_LEADING: return mbUnixForceZeroExtLeading;
301
        case USE_OLD_PRINTER_METRICS: return mbOldPrinterMetrics;
301
        case USE_OLD_PRINTER_METRICS: return mbOldPrinterMetrics;
302
        case TABS_RELATIVE_TO_INDENT : return mbTabRelativeToIndent;
302
         // COMPATIBILITY FLAGS END
303
         // COMPATIBILITY FLAGS END
303
304
304
        case BROWSE_MODE: return mbBrowseMode;
305
        case BROWSE_MODE: return mbBrowseMode;
Lines 411-417 Link Here
411
        case USE_OLD_PRINTER_METRICS:            
412
        case USE_OLD_PRINTER_METRICS:            
412
            mbOldPrinterMetrics = value;
413
            mbOldPrinterMetrics = value;
413
            break;
414
            break;
414
415
        case TABS_RELATIVE_TO_INDENT: 
416
            mbTabRelativeToIndent = value;
417
        break;
415
         // COMPATIBILITY FLAGS END
418
         // COMPATIBILITY FLAGS END
416
419
417
        case BROWSE_MODE:
420
        case BROWSE_MODE:
(-)source/core/doc/docnew.cxx (+1 lines)
Lines 416-421 Link Here
416
    mbClipAsCharacterAnchoredWriterFlyFrames= false;        // hidden
416
    mbClipAsCharacterAnchoredWriterFlyFrames= false;        // hidden
417
    mbUnixForceZeroExtLeading               = false;        // hidden
417
    mbUnixForceZeroExtLeading               = false;        // hidden
418
    mbOldPrinterMetrics                     = false;        // hidden
418
    mbOldPrinterMetrics                     = false;        // hidden
419
    mbTabRelativeToIndent                   = true;         // hidden
419
420
420
    //
421
    //
421
    // COMPATIBILITY FLAGS END
422
    // COMPATIBILITY FLAGS END
(-)source/core/text/inftxt.hxx (-3 / +2 lines)
Lines 118-126 Link Here
118
public:
118
public:
119
       inline SwLineInfo( const SwAttrSet& rAttrSet )
119
       inline SwLineInfo( const SwAttrSet& rAttrSet )
120
                  { CtorInitLineInfo( rAttrSet ); }
120
                  { CtorInitLineInfo( rAttrSet ); }
121
       // Liefert den Tabstop, der auf LinePos folgt, oder 0.
121
    // #i24363# tab stops relative to indent - returns the tab stop following nSearchPos or NULL
122
       const SvxTabStop *GetTabStop( const SwTwips nLinePos,
122
    const SvxTabStop *GetTabStop( const SwTwips nSearchPos,
123
                                                                const SwTwips nLeft,
124
                                                                const SwTwips nRight ) const;
123
                                                                const SwTwips nRight ) const;
125
       inline const SvxLineSpacingItem *GetLineSpacing() const { return pSpace; }
124
       inline const SvxLineSpacingItem *GetLineSpacing() const { return pSpace; }
126
       inline KSHORT GetDefTabStop() const { return nDefTabStop; }
125
       inline KSHORT GetDefTabStop() const { return nDefTabStop; }
(-)source/core/text/txttab.cxx (-45 / +63 lines)
Lines 67-97 Link Here
67
 *                    SwLineInfo::GetTabStop()
67
 *                    SwLineInfo::GetTabStop()
68
 *************************************************************************/
68
 *************************************************************************/
69
69
70
/* Die Werte in SvxTabStop::nTabPos liegen immer relativ zum linken PrtRand
70
//#i24363# tab stops relative to indent
71
 * vor. Tabs, die im Bereich des Erstzeileneinzugs liegen, sind also negativ.
71
/* Return the first tab stop that is > nSearchPos.
72
 * nLeft  ist der linke PrtRand
72
 * If the tab stop is outside the print area, we
73
 * nRight ist der rechte PrtRand
73
 * return 0 if it is not the first tab stop.*/
74
 * nLinePos die aktuelle Position.
74
const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nSearchPos,
75
 * Es wird der erste Tabstop returnt, der groesser ist als nLinePos.
75
                                         const SwTwips nRight ) const
76
 */
77
78
const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nLinePos,
79
       const SwTwips nLeft, const SwTwips nRight ) const
80
{
76
{
81
       // Mit den KSHORTs aufpassen, falls nLinePos < nLeft
77
       // Mit den KSHORTs aufpassen, falls nLinePos < nLeft
82
       SwTwips nPos = nLinePos;
83
       nPos -= nLeft;
84
       for( MSHORT i = 0; i < pRuler->Count(); ++i )
78
       for( MSHORT i = 0; i < pRuler->Count(); ++i )
85
       {
79
       {
86
               const SvxTabStop &rTabStop = pRuler->operator[](i);
80
               const SvxTabStop &rTabStop = pRuler->operator[](i);
87
               if( rTabStop.GetTabPos() > SwTwips(nRight) )
81
               if( rTabStop.GetTabPos() > SwTwips(nRight) )
88
               {
82
            return i ? 0 : &rTabStop;
89
                       if ( i )
83
90
                               return 0;
84
        if( rTabStop.GetTabPos() > nSearchPos )
91
                       else
92
                               return &rTabStop;
93
               }
94
               if( rTabStop.GetTabPos() > nPos )
95
                       return &rTabStop;
85
                       return &rTabStop;
96
       }
86
       }
97
       return 0;
87
       return 0;
Lines 118-149 Link Here
118
               if( pLastTab->PostFormat( rInf ) )
108
               if( pLastTab->PostFormat( rInf ) )
119
                       return 0;
109
                       return 0;
120
110
121
       // Wir suchen den naechsten Tab. Wenn gerade ein rechts-Tab unterwegs
122
       // ist, so koennen wir uns nicht auf rInf.X() beziehen.
123
    SwTwips nTabPos = rInf.GetLastTab() ? rInf.GetLastTab()->GetTabPos() : 0;
124
       if( nTabPos < rInf.X() )
125
               nTabPos = rInf.X();
126
127
    xub_Unicode cFill = 0;
111
    xub_Unicode cFill = 0;
128
    xub_Unicode cDec = 0;
112
    xub_Unicode cDec = 0;
129
       SvxTabAdjust eAdj;
113
       SvxTabAdjust eAdj;
130
114
131
       KSHORT nNewTabPos;
115
       KSHORT nNewTabPos;
132
       {
116
       {
133
          /*
117
        const bool bRTL = pFrm->IsRightToLeft();
134
               nPos ist der Offset in der Zeile.
118
        // #i24363# tab stops relative to indent
135
               Die Tabulatoren haben ihren 0-Punkt bei Frm().Left().
119
        // nTabLeft: The absolute value, the tab stops are relative to: Tabs origin.
136
               Die Zeilen beginnen ab Frm.Left() + Prt.Left().
120
        //
137
               In dieser Methode wird zwischen beiden Koordinatensystemen
121
        const SwTwips nTmpIndent = pFrm->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ?
138
               konvertiert (vgl. rInf.GetTabPos).
122
                                   pFrm->GetAttrSet()->GetLRSpace().GetTxtLeft() : 0;
139
          */
123
140
               const SwTwips nTabLeft = pFrm->Frm().Left() +
124
        const SwTwips nTabLeft = bRTL ?
141
                                 ( pFrm->IsRightToLeft() ?
125
                                 pFrm->Frm().Right() - 
142
                                   pFrm->GetAttrSet()->GetLRSpace().GetRight() :
126
                                 nTmpIndent :
143
                                   pFrm->GetAttrSet()->GetLRSpace().GetTxtLeft() );
127
                                 pFrm->Frm().Left() + 
128
                                 nTmpIndent;
129
                                   
130
        //
131
        // nLinePos: The absolute position, where we started the line formatting.
132
        //
133
        SwTwips nLinePos = GetLeftMargin();
134
        if ( bRTL )
135
        {
136
            Point aPoint( nLinePos, 0 );
137
            pFrm->SwitchLTRtoRTL( aPoint );
138
            nLinePos = aPoint.X();
139
        }
140
141
        //
142
        // nTabPos: The current position, relative to the line start.
143
        //
144
        SwTwips nTabPos = rInf.GetLastTab() ? rInf.GetLastTab()->GetTabPos() : 0;
145
       if( nTabPos < rInf.X() )
146
           nTabPos = rInf.X();
147
148
        //
149
        // nCurrentAbsPos: The current position in absolute coordinates.
150
        //
151
        const SwTwips nCurrentAbsPos = bRTL ?
152
                                       nLinePos - nTabPos :                    
153
                                       nLinePos + nTabPos;
144
154
145
               const SwTwips nLinePos = GetLeftMargin();
146
               const SwTwips nLineTab = nLinePos + nTabPos;
147
        SwTwips nMyRight = Right();
155
        SwTwips nMyRight = Right();
148
156
149
        if ( pFrm->IsVertical() )
157
        if ( pFrm->IsVertical() )
Lines 154-159 Link Here
154
        }
162
        }
155
163
156
               SwTwips nNextPos;
164
               SwTwips nNextPos;
165
166
        // #i24363# tab stops relative to indent
167
        // nSearchPos: The current position relative to the tabs origin.
168
        //
169
       const SwTwips nSearchPos = bRTL ?
170
                                   nTabLeft - nCurrentAbsPos :
171
                                   nCurrentAbsPos - nTabLeft;
172
157
        //
173
        //
158
        // First, we examine the tab stops set at the paragraph style or
174
        // First, we examine the tab stops set at the paragraph style or
159
        // any hard set tab stops:
175
        // any hard set tab stops:
Lines 161-167 Link Here
161
        // default tab stop.
177
        // default tab stop.
162
        //
178
        //
163
               const SvxTabStop* pTabStop =
179
               const SvxTabStop* pTabStop =
164
            aLineInf.GetTabStop( nLineTab, nTabLeft, nMyRight );
180
            aLineInf.GetTabStop( nSearchPos, nMyRight );
165
               if( pTabStop )
181
               if( pTabStop )
166
               {
182
               {
167
                       cFill = ' ' != pTabStop->GetFill() ? pTabStop->GetFill() : 0;
183
                       cFill = ' ' != pTabStop->GetFill() ? pTabStop->GetFill() : 0;
Lines 183-190 Link Here
183
                                       nDefTabDist = SVX_TAB_DEFDIST;
199
                                       nDefTabDist = SVX_TAB_DEFDIST;
184
                               aLineInf.SetDefTabStop( nDefTabDist );
200
                               aLineInf.SetDefTabStop( nDefTabDist );
185
                       }
201
                       }
186
                       SwTwips nCount = nLineTab;
202
            SwTwips nCount = nSearchPos;
187
                       nCount -= nTabLeft;
188
203
189
                       // Bei negativen Werten rundet "/" auf, "%" liefert negative Reste,
204
                       // Bei negativen Werten rundet "/" auf, "%" liefert negative Reste,
190
                       // bei positiven Werten rundet "/" ab, "%" liefert positvie Reste!
205
                       // bei positiven Werten rundet "/" ab, "%" liefert positvie Reste!
Lines 196-202 Link Here
196
            // --> FME 2004-09-21 #117919 Minimum tab stop width is 1 or 51 twips:
211
            // --> FME 2004-09-21 #117919 Minimum tab stop width is 1 or 51 twips:
197
            const SwTwips nMinimumTabWidth = pFrm->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT) ? 0 : 50;
212
            const SwTwips nMinimumTabWidth = pFrm->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_COMPAT) ? 0 : 50;
198
            // <--
213
            // <--
199
                       if( nNextPos + nTabLeft <= nLineTab + nMinimumTabWidth )
214
           if( (  bRTL && nTabLeft - nNextPos >= nCurrentAbsPos - nMinimumTabWidth ) ||
215
                ( !bRTL && nNextPos + nTabLeft <= nCurrentAbsPos + nMinimumTabWidth  ) )
200
                               nNextPos += nDefTabDist;
216
                               nNextPos += nDefTabDist;
201
                       cFill = 0;
217
                       cFill = 0;
202
                       eAdj = SVX_TAB_ADJUST_LEFT;
218
                       eAdj = SVX_TAB_ADJUST_LEFT;
Lines 210-223 Link Here
210
                       if( pPor )
226
                       if( pPor )
211
                               nForced = pPor->Width();
227
                               nForced = pPor->Width();
212
               }
228
               }
213
               if( nTabLeft + nForced > nLineTab && nNextPos > 0 )
229
       
230
        if( nNextPos > 0 &&
231
             (  bRTL && nTabLeft - nForced < nCurrentAbsPos ||
232
               !bRTL && nTabLeft + nForced > nCurrentAbsPos ) )
214
               {
233
               {
215
                       eAdj = SVX_TAB_ADJUST_DEFAULT;
234
                       eAdj = SVX_TAB_ADJUST_DEFAULT;
216
                       cFill = 0;
235
                       cFill = 0;
217
                       nNextPos = nForced;
236
                       nNextPos = nForced;
218
               }
237
               }
219
               nNextPos += nTabLeft;
238
        nNextPos += bRTL ? nLinePos - nTabLeft : nTabLeft - nLinePos;
220
               nNextPos -= nLinePos;
221
               ASSERT( nNextPos >= 0, "GetTabStop: Don't go back!" );
239
               ASSERT( nNextPos >= 0, "GetTabStop: Don't go back!" );
222
               nNewTabPos = KSHORT(nNextPos);
240
               nNewTabPos = KSHORT(nNextPos);
223
       }
241
       }
(-)source/core/view/viewsh.cxx (+15 lines)
Lines 914-919 Link Here
914
    }
914
    }
915
}
915
}
916
916
917
/*-- 29.11.2007 09:03:18---------------------------------------------------
918
    //#i24363# tab stops relative to indent
919
  -----------------------------------------------------------------------*/
920
void ViewShell::SetTabsRelativeToIndent(bool bNew)
921
{
922
    IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
923
    if( pIDSA->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) != bNew  )
924
    {
925
        SwWait aWait( *GetDoc()->GetDocShell(), TRUE );
926
        pIDSA->set(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT, bNew );
927
        const BYTE nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
928
        lcl_InvalidateAllCntnt( *this, nInv );
929
    }
930
}
931
917
void ViewShell::SetAddExtLeading( bool bNew )
932
void ViewShell::SetAddExtLeading( bool bNew )
918
{
933
{
919
    IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
934
    IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
(-)source/filter/ww8/writerhelper.cxx (-20 lines)
Lines 721-746 Link Here
721
            return false;
721
            return false;
722
        }
722
        }
723
723
724
        bool AdjustTabs(SvxTabStopItem &rTStop, long nSrcLeft, long nDestLeft)
725
        {
726
            bool bChanged = false;
727
            if (nDestLeft != nSrcLeft)
728
            {
729
                USHORT nCount = rTStop.Count();
730
                for (USHORT nCnt = 0; nCnt < nCount; ++nCnt)
731
                {
732
                    SvxTabStop& rTab = const_cast<SvxTabStop&>(rTStop[nCnt]);
733
                    if (SVX_TAB_ADJUST_DEFAULT != rTab.GetAdjustment())
734
                    {
735
                        rTab.GetTabPos() += nSrcLeft;
736
                        rTab.GetTabPos() -= nDestLeft;
737
                        bChanged = true;
738
                    }
739
                }
740
            }
741
            return bChanged;
742
        }
743
744
        Polygon PolygonFromPolyPolygon(const PolyPolygon &rPolyPoly)
724
        Polygon PolygonFromPolyPolygon(const PolyPolygon &rPolyPoly)
745
        {
725
        {
746
                       if(1 == rPolyPoly.Count())
726
                       if(1 == rPolyPoly.Count())
(-)source/filter/ww8/writerhelper.hxx (-29 lines)
Lines 794-828 Link Here
794
        */
794
        */
795
        bool HasPageBreak(const SwNode &rNode);
795
        bool HasPageBreak(const SwNode &rNode);
796
796
797
        /** Shift tabstops from a given start position to a new start position
798
799
            For no good reason except to complicate my life writer tabs are
800
            relative to the left of the paragraph text body indent. More
801
            reasonably word's are absolute.
802
803
            AdjustTabs converts the tabs in rTabs originally relative from
804
            nScrLeft to be relative to nDestLeft. For example nSrcLeft would be
805
            0 when converting from word to writer, and vice versa when
806
            converting to word, and both values are set when moving writer tabs
807
            after an indent change
808
809
            @param rTabs
810
            The SvxTabStopItem whose tabs we want to change
811
812
            @param nSrcLeft
813
            The original offset that rTabs are relative to
814
815
            @param nDestLeft
816
            The new offset to change rTabs to be relative to
817
818
            @return true if there was any tabs changed, false otherwise
819
820
            @author
821
            <a href="mailto:cmc@openoffice.org">Caol&aacute;n McNamara</a>
822
823
       */
824
        bool AdjustTabs(SvxTabStopItem &rTabs, long nSrcLeft, long nDestLeft);
825
826
797
827
        /** Make a best fit Polygon from a PolyPolygon
798
        /** Make a best fit Polygon from a PolyPolygon
828
799
(-)source/filter/ww8/ww8par.cxx (-52 / +2 lines)
Lines 1037-1072 Link Here
1037
void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
1037
void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
1038
    SwFltStackEntry* pEntry)
1038
    SwFltStackEntry* pEntry)
1039
{
1039
{
1040
    using sw::util::AdjustTabs;
1041
    switch( pEntry->pAttr->Which() )
1040
    switch( pEntry->pAttr->Which() )
1042
    {
1041
    {
1043
        case RES_PARATR_TABSTOP:
1044
            {
1045
                /*
1046
                Loop over the affected nodes and adjust the 0 based word style
1047
                tabstops to writer style tabstops relative to the paragraph
1048
                indent
1049
                */
1050
                SwPaM aRegion(rTmpPos);
1051
                if (pEntry->MakeRegion(pDoc, aRegion, false))
1052
                {
1053
                    SvxTabStopItem aTabStops(*(SvxTabStopItem*)pEntry->pAttr);
1054
                    ULONG nStart = aRegion.Start()->nNode.GetIndex();
1055
                    ULONG nEnd = aRegion.End()->nNode.GetIndex();
1056
                    for(; nStart <= nEnd; ++nStart)
1057
                    {
1058
                        SwCntntNode *pNd =
1059
                            pDoc->GetNodes()[nStart]->GetCntntNode();
1060
                        if (!pNd)
1061
                            continue;
1062
                        const SvxLRSpaceItem &rLR = (const SvxLRSpaceItem&)
1063
                            pNd->GetAttr(RES_LR_SPACE);
1064
                        AdjustTabs(aTabStops, 0, rLR.GetTxtLeft());
1065
                        pNd->SetAttr(aTabStops);
1066
                    }
1067
                }
1068
            }
1069
        break;
1070
        case RES_LR_SPACE:
1042
        case RES_LR_SPACE:
1071
            {
1043
            {
1072
                /*
1044
                /*
Lines 1109-1121 Link Here
1109
1081
1110
                        pNd->SetAttr(aNewLR);
1082
                        pNd->SetAttr(aNewLR);
1111
1083
1112
                        SvxTabStopItem aTabs = (const SvxTabStopItem&)
1113
                            pNd->GetAttr(RES_PARATR_TABSTOP);
1114
                        if (AdjustTabs(aTabs, aOldLR.GetTxtLeft(),
1115
                            aNewLR.GetTxtLeft()))
1116
                        {
1117
                            pNd->SetAttr(aTabs);
1118
                        }
1119
                    }
1084
                    }
1120
                }
1085
                }
1121
            }
1086
            }
Lines 1439-1461 Link Here
1439
        }
1404
        }
1440
    }
1405
    }
1441
1406
1442
    //Now turn back into 0 based word-style index, during style import
1443
    //we're already in word based 0 index, we only move into crackpot
1444
    //writer style when we're finished importing the styles. For
1445
    //explicit tabstops we'll have to adjust on setting into the
1446
    //document
1447
    long nLeftPMgn(0);
1448
    if (pAktColl)
1449
        nLeftPMgn = 0;  //During style import we are always 0 based (word style)
1450
    else if (nAktColl < nColls && pCollA[nAktColl].pFmt)
1451
    {
1452
        //otherwise we are writer x based, so turn back into 0 based word style
1453
        const SvxLRSpaceItem &rLR = pCollA[nAktColl].pFmt->GetLRSpace();
1454
        nLeftPMgn = rLR.GetTxtLeft();
1455
    }
1456
1457
    sw::util::AdjustTabs(aAttr, nLeftPMgn, 0);
1458
1459
    SvxTabStop aTabStop;
1407
    SvxTabStop aTabStop;
1460
    for (i=0; i < nDel; ++i)
1408
    for (i=0; i < nDel; ++i)
1461
    {
1409
    {
Lines 1564-1569 Link Here
1564
    maTracer.Log(sw::log::eDontUseHTMLAutoSpacing);
1512
    maTracer.Log(sw::log::eDontUseHTMLAutoSpacing);
1565
    // move tabs on alignment
1513
    // move tabs on alignment
1566
    rDoc.set(IDocumentSettingAccess::TAB_COMPAT, true);
1514
    rDoc.set(IDocumentSettingAccess::TAB_COMPAT, true);
1515
    // #i24363# tab stops relative to indent
1516
    rDoc.set(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT, true);
1567
    maTracer.Log(sw::log::eTabStopDistance);
1517
    maTracer.Log(sw::log::eTabStopDistance);
1568
    // OD 14.10.2003 #i18732# - adjust default of option 'FollowTextFlow'
1518
    // OD 14.10.2003 #i18732# - adjust default of option 'FollowTextFlow'
1569
    rDoc.SetDefault( SwFmtFollowTextFlow( FALSE ) );
1519
    rDoc.SetDefault( SwFmtFollowTextFlow( FALSE ) );
(-)source/filter/ww8/ww8par.hxx (-1 lines)
Lines 1436-1442 Link Here
1436
    void Read_NoLineNumb(       USHORT nId, const BYTE* pData, short nLen );
1436
    void Read_NoLineNumb(       USHORT nId, const BYTE* pData, short nLen );
1437
1437
1438
    void Read_LR(               USHORT nId, const BYTE*, short nLen );
1438
    void Read_LR(               USHORT nId, const BYTE*, short nLen );
1439
    void AdjustStyleTabStops(long nLeft, SwWW8StyInf &rSty);
1440
    void Read_UL(               USHORT nId, const BYTE*, short nLen );
1439
    void Read_UL(               USHORT nId, const BYTE*, short nLen );
1441
    void Read_ParaAutoBefore(USHORT , const BYTE *pData, short nLen);
1440
    void Read_ParaAutoBefore(USHORT , const BYTE *pData, short nLen);
1442
    void Read_ParaAutoAfter(USHORT , const BYTE *pData, short nLen);
1441
    void Read_ParaAutoAfter(USHORT , const BYTE *pData, short nLen);
(-)source/filter/ww8/ww8par2.cxx (-7 lines)
Lines 4236-4248 Link Here
4236
4236
4237
    pIo->RegisterNumFmtOnStyle(nNr);
4237
    pIo->RegisterNumFmtOnStyle(nNr);
4238
4238
4239
    long nTabPosStart = 0;
4240
    if (pIo->pCollA[nNr].pFmt)
4241
    {
4242
        const SvxLRSpaceItem &rLR = pIo->pCollA[nNr].pFmt->GetLRSpace();
4243
        nTabPosStart = rLR.GetTxtLeft();
4244
    }
4245
    pIo->AdjustStyleTabStops(nTabPosStart, rSI);
4246
}
4239
}
4247
4240
4248
/*
4241
/*
(-)source/filter/ww8/ww8par6.cxx (-46 lines)
Lines 3937-3988 Link Here
3937
    NewAttr( aLN );
3937
    NewAttr( aLN );
3938
}
3938
}
3939
3939
3940
void SwWW8ImplReader::AdjustStyleTabStops(long nLeft, SwWW8StyInf &rWWSty)
3941
{
3942
    const SfxPoolItem* pTabs=0;
3943
    bool bOnMarginStyle(false);
3944
    if (rWWSty.pFmt)
3945
    {
3946
        bOnMarginStyle = rWWSty.pFmt->GetAttrSet().GetItemState(
3947
                RES_PARATR_TABSTOP, false, &pTabs ) == SFX_ITEM_SET;
3948
    }
3949
3950
    if (pTabs)
3951
    {
3952
        SvxTabStopItem aTStop(*(const SvxTabStopItem*)pTabs);
3953
        long nOldLeft = 0;
3954
3955
        const SwTxtFmtColl* pSty = 0;
3956
        USHORT nTabBase = rWWSty.nBase;
3957
        if (nTabBase < nColls)              // Based On
3958
            pSty = (const SwTxtFmtColl*)pCollA[nTabBase].pFmt;
3959
3960
        while (pSty && !bOnMarginStyle)
3961
        {
3962
            bOnMarginStyle = pSty->GetAttrSet().GetItemState(RES_PARATR_TABSTOP,
3963
                false, &pTabs ) == SFX_ITEM_SET;
3964
            if (bOnMarginStyle)
3965
            {
3966
                const SvxLRSpaceItem &rLR =
3967
                    ItemGet<SvxLRSpaceItem>(*pSty, RES_LR_SPACE);
3968
                nOldLeft = rLR.GetTxtLeft();
3969
            }
3970
            else
3971
            {
3972
                // If based on another
3973
                if( nTabBase < nColls &&
3974
                    (nTabBase = pCollA[nTabBase].nBase) < nColls )
3975
                    pSty = (const SwTxtFmtColl*)pCollA[nTabBase].pFmt;
3976
                else
3977
                    pSty = 0;                           // gib die Suche auf
3978
            }
3979
        }
3980
3981
        if (sw::util::AdjustTabs(aTStop, nOldLeft, nLeft))
3982
            rWWSty.pFmt->SetAttr(aTStop);
3983
    }
3984
}
3985
3986
// Sprm 16, 17
3940
// Sprm 16, 17
3987
void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen )
3941
void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen )
3988
{
3942
{
(-)source/ui/shells/textsh1.cxx (-3 / +4 lines)
Lines 108-113 Link Here
108
#ifndef _SVTOOLS_CTLOPTIONS_HXX
108
#ifndef _SVTOOLS_CTLOPTIONS_HXX
109
#include <svtools/ctloptions.hxx>
109
#include <svtools/ctloptions.hxx>
110
#endif
110
#endif
111
#include <IDocumentSettingAccess.hxx>
111
112
112
#ifndef _CHARFMT_HXX
113
#ifndef _CHARFMT_HXX
113
#include <charfmt.hxx>
114
#include <charfmt.hxx>
Lines 837-848 Link Here
837
            aCoreSet.Put( aTabPos );
838
            aCoreSet.Put( aTabPos );
838
839
839
            // linker Rand als Offset
840
            // linker Rand als Offset
840
            const long nOff = ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).
841
            //#i24363# tab stops relative to indent
841
                                                                GetTxtLeft();
842
            const long nOff = rWrtSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ?  
843
                ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0;
842
            SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
844
            SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
843
            aCoreSet.Put( aOff );
845
            aCoreSet.Put( aOff );
844
846
845
846
            // BoxInfo setzen
847
            // BoxInfo setzen
847
            ::PrepareBoxInfo( aCoreSet, rWrtSh );
848
            ::PrepareBoxInfo( aCoreSet, rWrtSh );
848
849
(-)source/ui/uiview/viewtab.cxx (-1 / +5 lines)
Lines 988-997 Link Here
988
    //enable tab stop display on the rulers depending on the writing direction
988
    //enable tab stop display on the rulers depending on the writing direction
989
    WinBits nRulerStyle = pHRuler->GetStyle() & ~WB_EXTRAFIELD;
989
    WinBits nRulerStyle = pHRuler->GetStyle() & ~WB_EXTRAFIELD;
990
    pHRuler->SetStyle(bVerticalWriting||bBrowse ? nRulerStyle : nRulerStyle|WB_EXTRAFIELD);
990
    pHRuler->SetStyle(bVerticalWriting||bBrowse ? nRulerStyle : nRulerStyle|WB_EXTRAFIELD);
991
992
    nRulerStyle = pVRuler->GetStyle() & ~WB_EXTRAFIELD;
991
    nRulerStyle = pVRuler->GetStyle() & ~WB_EXTRAFIELD;
993
    pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle);
992
    pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle);
994
993
994
    //#i24363# tab stops relative to indent
995
    bool bRelative = rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT);
996
    pHRuler->SetTabsRelativeToIndent( bRelative );
997
    pVRuler->SetTabsRelativeToIndent( bRelative );
998
    
995
    SvxLRSpaceItem aPageLRSpace( rDesc.GetMaster().GetLRSpace() );
999
    SvxLRSpaceItem aPageLRSpace( rDesc.GetMaster().GetLRSpace() );
996
       SwapPageMargin( rDesc, aPageLRSpace );
1000
       SwapPageMargin( rDesc, aPageLRSpace );
997
1001
(-)source/ui/uno/SwXDocumentSettings.cxx (-2 / +15 lines)
Lines 159-165 Link Here
159
    HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
159
    HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
160
    HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES,
160
    HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES,
161
    HANDLE_UNIX_FORCE_ZERO_EXT_LEADING,
161
    HANDLE_UNIX_FORCE_ZERO_EXT_LEADING,
162
    HANDLE_USE_OLD_PRINTER_METRICS
162
    HANDLE_USE_OLD_PRINTER_METRICS,
163
    HANDLE_TABS_RELATIVE_TO_INDENT
163
};
164
};
164
165
165
MasterPropertySetInfo * lcl_createSettingsInfo()
166
MasterPropertySetInfo * lcl_createSettingsInfo()
Lines 209-214 Link Here
209
        { RTL_CONSTASCII_STRINGPARAM("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, CPPUTYPE_BOOLEAN, 0, 0},
210
        { RTL_CONSTASCII_STRINGPARAM("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, CPPUTYPE_BOOLEAN, 0, 0},
210
        { RTL_CONSTASCII_STRINGPARAM("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, CPPUTYPE_BOOLEAN, 0, 0},
211
        { RTL_CONSTASCII_STRINGPARAM("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, CPPUTYPE_BOOLEAN, 0, 0},
211
        { RTL_CONSTASCII_STRINGPARAM("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, CPPUTYPE_BOOLEAN, 0, 0},
212
        { RTL_CONSTASCII_STRINGPARAM("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, CPPUTYPE_BOOLEAN, 0, 0},
213
        { RTL_CONSTASCII_STRINGPARAM("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, CPPUTYPE_BOOLEAN, 0, 0},
212
214
213
/*
215
/*
214
 * As OS said, we don't have a view when we need to set this, so I have to
216
 * As OS said, we don't have a view when we need to set this, so I have to
Lines 683-689 Link Here
683
            mpDoc->set(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS, bTmp);
685
            mpDoc->set(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS, bTmp);
684
        }
686
        }
685
        break;
687
        break;
686
688
        case HANDLE_TABS_RELATIVE_TO_INDENT:
689
        {
690
            sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
691
            mpDoc->set(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT, bTmp);
692
        }
693
        break;
687
        default:
694
        default:
688
                       throw UnknownPropertyException();
695
                       throw UnknownPropertyException();
689
       }
696
       }
Lines 977-982 Link Here
977
            rValue.setValue( &bTmp, ::getBooleanCppuType() );
984
            rValue.setValue( &bTmp, ::getBooleanCppuType() );
978
        }
985
        }
979
        break;
986
        break;
987
        case HANDLE_TABS_RELATIVE_TO_INDENT:
988
        {
989
            sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT);
990
            rValue.setValue( &bTmp, ::getBooleanCppuType() );
991
        }
992
        break;
980
993
981
        default:
994
        default:
982
                       throw UnknownPropertyException();
995
                       throw UnknownPropertyException();

Return to issue 24363