xref: /trunk/main/cui/source/tabpages/paragrph.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*2ee96f1cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2ee96f1cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2ee96f1cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2ee96f1cSAndrew Rist  * distributed with this work for additional information
6*2ee96f1cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2ee96f1cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2ee96f1cSAndrew Rist  * "License"); you may not use this file except in compliance
9*2ee96f1cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*2ee96f1cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*2ee96f1cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2ee96f1cSAndrew Rist  * software distributed under the License is distributed on an
15*2ee96f1cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2ee96f1cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2ee96f1cSAndrew Rist  * specific language governing permissions and limitations
18*2ee96f1cSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*2ee96f1cSAndrew Rist  *************************************************************/
21*2ee96f1cSAndrew Rist 
22*2ee96f1cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cui.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svl/style.hxx>
28cdf0e10cSrcweir #include <sfx2/app.hxx>
29cdf0e10cSrcweir #include <sfx2/objsh.hxx>
30cdf0e10cSrcweir #include <sfx2/module.hxx>
31cdf0e10cSrcweir #include <vcl/mnemonic.hxx>
32cdf0e10cSrcweir #include <svx/dialogs.hrc>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #define _SVX_PARAGRPH_CXX   0
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <svl/languageoptions.hxx>
37cdf0e10cSrcweir #include <editeng/pgrditem.hxx>
38cdf0e10cSrcweir #include <cuires.hrc>
39cdf0e10cSrcweir #include "paragrph.hrc"
40cdf0e10cSrcweir #include "paragrph.hxx"
41cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
42cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
43cdf0e10cSrcweir #include <editeng/adjitem.hxx>
44cdf0e10cSrcweir #include <editeng/orphitem.hxx>
45cdf0e10cSrcweir #include <editeng/widwitem.hxx>
46cdf0e10cSrcweir #include <editeng/tstpitem.hxx>
47cdf0e10cSrcweir #include <editeng/pmdlitem.hxx>
48cdf0e10cSrcweir #include <editeng/spltitem.hxx>
49cdf0e10cSrcweir #include <editeng/hyznitem.hxx>
50cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
51cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
52cdf0e10cSrcweir #include <editeng/brkitem.hxx>
53cdf0e10cSrcweir #include <editeng/keepitem.hxx>
54cdf0e10cSrcweir #include "svx/dlgutil.hxx"
55cdf0e10cSrcweir #include <dialmgr.hxx>
56cdf0e10cSrcweir #include "svx/htmlmode.hxx"
57cdf0e10cSrcweir #include <editeng/paravertalignitem.hxx>
58cdf0e10cSrcweir #include <svl/eitem.hxx> //add CHINA001
59cdf0e10cSrcweir #include <sfx2/request.hxx> //add CHINA001
60cdf0e10cSrcweir #include <svl/intitem.hxx> //add CHINA001
61cdf0e10cSrcweir 
62cdf0e10cSrcweir // static ----------------------------------------------------------------
63cdf0e10cSrcweir 
64cdf0e10cSrcweir static sal_uInt16 pStdRanges[] =
65cdf0e10cSrcweir {
66cdf0e10cSrcweir     SID_ATTR_PARA_LINESPACE,        // 10033
67cdf0e10cSrcweir     SID_ATTR_PARA_LINESPACE,
68cdf0e10cSrcweir     SID_ATTR_LRSPACE,               // 10048 -
69cdf0e10cSrcweir     SID_ATTR_ULSPACE,               // 10049
70cdf0e10cSrcweir     SID_ATTR_PARA_REGISTER,         // 10413
71cdf0e10cSrcweir     SID_ATTR_PARA_REGISTER,
72cdf0e10cSrcweir     0
73cdf0e10cSrcweir };
74cdf0e10cSrcweir 
75cdf0e10cSrcweir static sal_uInt16 pAlignRanges[] =
76cdf0e10cSrcweir {
77cdf0e10cSrcweir     SID_ATTR_PARA_ADJUST,           // 10027
78cdf0e10cSrcweir     SID_ATTR_PARA_ADJUST,
79cdf0e10cSrcweir     0
80cdf0e10cSrcweir };
81cdf0e10cSrcweir 
82cdf0e10cSrcweir static sal_uInt16 pExtRanges[] =
83cdf0e10cSrcweir {
84cdf0e10cSrcweir     SID_ATTR_PARA_PAGEBREAK,        // 10037 -
85cdf0e10cSrcweir     SID_ATTR_PARA_WIDOWS,           // 10041
86cdf0e10cSrcweir     SID_ATTR_PARA_MODEL,            // 10065 -
87cdf0e10cSrcweir     SID_ATTR_PARA_KEEP,             // 10066
88cdf0e10cSrcweir     0
89cdf0e10cSrcweir };
90cdf0e10cSrcweir 
91cdf0e10cSrcweir // define ----------------------------------------------------------------
92cdf0e10cSrcweir 
93cdf0e10cSrcweir #define MAX_DURCH 5670      // 10 cm ist sinnvoll als maximaler Durchschuss
94cdf0e10cSrcweir                             // laut BP
95cdf0e10cSrcweir #define FIX_DIST_DEF 283    // Standard-Fix-Abstand 0,5cm
96cdf0e10cSrcweir 
97cdf0e10cSrcweir // enum ------------------------------------------------------------------
98cdf0e10cSrcweir 
99cdf0e10cSrcweir enum LineSpaceList
100cdf0e10cSrcweir {
101cdf0e10cSrcweir     LLINESPACE_1    = 0,
102cdf0e10cSrcweir     LLINESPACE_15   = 1,
103cdf0e10cSrcweir     LLINESPACE_2    = 2,
104cdf0e10cSrcweir     LLINESPACE_PROP = 3,
105cdf0e10cSrcweir     LLINESPACE_MIN  = 4,
106cdf0e10cSrcweir     LLINESPACE_DURCH= 5,
107cdf0e10cSrcweir     LLINESPACE_FIX  = 6,
108cdf0e10cSrcweir     LLINESPACE_END
109cdf0e10cSrcweir };
110cdf0e10cSrcweir 
111cdf0e10cSrcweir // C-Funktion ------------------------------------------------------------
112cdf0e10cSrcweir 
113cdf0e10cSrcweir void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 );
114cdf0e10cSrcweir 
SetLineSpace_Impl(SvxLineSpacingItem & rLineSpace,int eSpace,long lValue)115cdf0e10cSrcweir void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace,
116cdf0e10cSrcweir                         int eSpace, long lValue )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir     switch ( eSpace )
119cdf0e10cSrcweir     {
120cdf0e10cSrcweir         case LLINESPACE_1:
121cdf0e10cSrcweir             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
122cdf0e10cSrcweir             rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
123cdf0e10cSrcweir             break;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir         case LLINESPACE_15:
126cdf0e10cSrcweir             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
127cdf0e10cSrcweir             rLineSpace.SetPropLineSpace( 150 );
128cdf0e10cSrcweir             break;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir         case LLINESPACE_2:
131cdf0e10cSrcweir             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
132cdf0e10cSrcweir             rLineSpace.SetPropLineSpace( 200 );
133cdf0e10cSrcweir             break;
134cdf0e10cSrcweir 
135cdf0e10cSrcweir         case LLINESPACE_PROP:
136cdf0e10cSrcweir             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
137cdf0e10cSrcweir             rLineSpace.SetPropLineSpace( (sal_uInt8)lValue );
138cdf0e10cSrcweir             break;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir         case LLINESPACE_MIN:
141cdf0e10cSrcweir             rLineSpace.SetLineHeight( (sal_uInt16)lValue );
142cdf0e10cSrcweir             rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
143cdf0e10cSrcweir             break;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir         case LLINESPACE_DURCH:
146cdf0e10cSrcweir             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
147cdf0e10cSrcweir             rLineSpace.SetInterLineSpace( (sal_uInt16)lValue );
148cdf0e10cSrcweir             break;
149cdf0e10cSrcweir 
150cdf0e10cSrcweir         case LLINESPACE_FIX:
151cdf0e10cSrcweir             rLineSpace.SetLineHeight((sal_uInt16)lValue);
152cdf0e10cSrcweir             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX;
153cdf0e10cSrcweir             rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
154cdf0e10cSrcweir         break;
155cdf0e10cSrcweir     }
156cdf0e10cSrcweir }
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 
GetHtmlMode_Impl(const SfxItemSet & rSet)159cdf0e10cSrcweir sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir     sal_uInt16 nHtmlMode = 0;
162cdf0e10cSrcweir     const SfxPoolItem* pItem = 0;
163cdf0e10cSrcweir     SfxObjectShell* pShell;
164cdf0e10cSrcweir     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
165cdf0e10cSrcweir         ( 0 != (pShell = SfxObjectShell::Current()) &&
166cdf0e10cSrcweir                     0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
167cdf0e10cSrcweir     {
168cdf0e10cSrcweir         nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
169cdf0e10cSrcweir     }
170cdf0e10cSrcweir     return nHtmlMode;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir // class SvxStdParagraphTabPage ------------------------------------------
175cdf0e10cSrcweir 
IMPL_LINK(SvxStdParagraphTabPage,ELRLoseFocusHdl,Edit *,EMPTYARG)176cdf0e10cSrcweir IMPL_LINK( SvxStdParagraphTabPage, ELRLoseFocusHdl, Edit *, EMPTYARG )
177cdf0e10cSrcweir {
178cdf0e10cSrcweir //! if ( aLeftIndent.IsRelativeMode() )
179cdf0e10cSrcweir //!     return 0; //!!!
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     SfxItemPool* pPool = GetItemSet().GetPool();
182cdf0e10cSrcweir     DBG_ASSERT( pPool, "Wo ist der Pool" );
183cdf0e10cSrcweir     FieldUnit eUnit =
184cdf0e10cSrcweir         MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     sal_Int64 nL = aLeftIndent.Denormalize( aLeftIndent.GetValue( eUnit ) );
187cdf0e10cSrcweir     sal_Int64 nR = aRightIndent.Denormalize( aRightIndent.GetValue( eUnit ) );
188cdf0e10cSrcweir     String aTmp = aFLineIndent.GetText();
189cdf0e10cSrcweir 
190cdf0e10cSrcweir     // Erstzeilen Einzug
191cdf0e10cSrcweir     if( aLeftIndent.GetMin() < 0 )
192cdf0e10cSrcweir         aFLineIndent.SetMin( -99999, FUNIT_MM );
193cdf0e10cSrcweir     else
194cdf0e10cSrcweir         aFLineIndent.SetMin( aFLineIndent.Normalize( -nL ), eUnit );
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     // Check nur fuer konkrete Breite (Shell)
197cdf0e10cSrcweir     sal_Int64 nTmp = nWidth - nL - nR - MM50;
198cdf0e10cSrcweir     aFLineIndent.SetMax( aFLineIndent.Normalize( nTmp ), eUnit );
199cdf0e10cSrcweir 
200cdf0e10cSrcweir     if ( !aTmp.Len() )
201cdf0e10cSrcweir         aFLineIndent.SetEmptyFieldValue();
202cdf0e10cSrcweir     // Maximum Links Rechts
203cdf0e10cSrcweir     aTmp = aLeftIndent.GetText();
204cdf0e10cSrcweir     nTmp = nWidth - nR - MM50;
205cdf0e10cSrcweir     aLeftIndent.SetMax( aLeftIndent.Normalize( nTmp ), eUnit );
206cdf0e10cSrcweir 
207cdf0e10cSrcweir     if ( !aTmp.Len() )
208cdf0e10cSrcweir         aLeftIndent.SetEmptyFieldValue();
209cdf0e10cSrcweir     aTmp = aRightIndent.GetText();
210cdf0e10cSrcweir     nTmp = nWidth - nL - MM50;
211cdf0e10cSrcweir     aRightIndent.SetMax( aRightIndent.Normalize( nTmp ), eUnit );
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     if ( !aTmp.Len() )
214cdf0e10cSrcweir         aRightIndent.SetEmptyFieldValue();
215cdf0e10cSrcweir     return 0;
216cdf0e10cSrcweir }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir // -----------------------------------------------------------------------
219cdf0e10cSrcweir 
Create(Window * pParent,const SfxItemSet & rSet)220cdf0e10cSrcweir SfxTabPage* SvxStdParagraphTabPage::Create( Window* pParent,
221cdf0e10cSrcweir                                             const SfxItemSet& rSet)
222cdf0e10cSrcweir {
223cdf0e10cSrcweir     return new SvxStdParagraphTabPage( pParent, rSet );
224cdf0e10cSrcweir }
225cdf0e10cSrcweir 
226cdf0e10cSrcweir // -----------------------------------------------------------------------
227cdf0e10cSrcweir 
FillItemSet(SfxItemSet & rOutSet)228cdf0e10cSrcweir sal_Bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir     SfxItemState eState = SFX_ITEM_UNKNOWN;
231cdf0e10cSrcweir     const SfxPoolItem* pOld = 0;
232cdf0e10cSrcweir     SfxItemPool* pPool = rOutSet.GetPool();
233cdf0e10cSrcweir     DBG_ASSERT( pPool, "Wo ist der Pool" );
234cdf0e10cSrcweir 
235cdf0e10cSrcweir     sal_Bool bModified = sal_False;
236cdf0e10cSrcweir     sal_uInt16 nWhich;
237cdf0e10cSrcweir     sal_uInt16 nPos = aLineDist.GetSelectEntryPos();
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     if ( LISTBOX_ENTRY_NOTFOUND != nPos &&
240cdf0e10cSrcweir          ( nPos != aLineDist.GetSavedValue() ||
241cdf0e10cSrcweir            aLineDistAtPercentBox.IsValueModified() ||
242cdf0e10cSrcweir            aLineDistAtMetricBox.IsValueModified() ) )
243cdf0e10cSrcweir     {
244cdf0e10cSrcweir         nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
245cdf0e10cSrcweir         SfxMapUnit eUnit = pPool->GetMetric( nWhich );
246cdf0e10cSrcweir         SvxLineSpacingItem aSpacing(
247cdf0e10cSrcweir             (const SvxLineSpacingItem&)GetItemSet().Get( nWhich ) );
248cdf0e10cSrcweir 
249cdf0e10cSrcweir         switch ( nPos )
250cdf0e10cSrcweir         {
251cdf0e10cSrcweir             case LLINESPACE_1:
252cdf0e10cSrcweir             case LLINESPACE_15:
253cdf0e10cSrcweir             case LLINESPACE_2:
254cdf0e10cSrcweir                 SetLineSpace_Impl( aSpacing, nPos );
255cdf0e10cSrcweir                 break;
256cdf0e10cSrcweir 
257cdf0e10cSrcweir             case LLINESPACE_PROP:
258cdf0e10cSrcweir                 SetLineSpace_Impl( aSpacing, nPos,
259cdf0e10cSrcweir                                    static_cast<long>(aLineDistAtPercentBox.Denormalize(
260cdf0e10cSrcweir                                    aLineDistAtPercentBox.GetValue() )) );
261cdf0e10cSrcweir                 break;
262cdf0e10cSrcweir 
263cdf0e10cSrcweir             case LLINESPACE_MIN:
264cdf0e10cSrcweir             case LLINESPACE_DURCH:
265cdf0e10cSrcweir             case LLINESPACE_FIX:
266cdf0e10cSrcweir                 SetLineSpace_Impl( aSpacing, nPos,
267cdf0e10cSrcweir                     GetCoreValue( aLineDistAtMetricBox, eUnit ) );
268cdf0e10cSrcweir             break;
269cdf0e10cSrcweir 
270cdf0e10cSrcweir             default:
271cdf0e10cSrcweir                 DBG_ERROR( "unbekannter Type fuer Zeilenabstand." );
272cdf0e10cSrcweir                 break;
273cdf0e10cSrcweir         }
274cdf0e10cSrcweir         eState = GetItemSet().GetItemState( nWhich );
275cdf0e10cSrcweir         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_LINESPACE );
276cdf0e10cSrcweir 
277cdf0e10cSrcweir         if ( !pOld || !( *(const SvxLineSpacingItem*)pOld == aSpacing ) ||
278cdf0e10cSrcweir              SFX_ITEM_DONTCARE == eState )
279cdf0e10cSrcweir         {
280cdf0e10cSrcweir             rOutSet.Put( aSpacing );
281cdf0e10cSrcweir             bModified |= sal_True;
282cdf0e10cSrcweir         }
283cdf0e10cSrcweir     }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir     if ( aTopDist.IsValueModified() || aBottomDist.IsValueModified() )
286cdf0e10cSrcweir     {
287cdf0e10cSrcweir         nWhich = GetWhich( SID_ATTR_ULSPACE );
288cdf0e10cSrcweir         SfxMapUnit eUnit = pPool->GetMetric( nWhich );
289cdf0e10cSrcweir         pOld = GetOldItem( rOutSet, SID_ATTR_ULSPACE );
290cdf0e10cSrcweir         SvxULSpaceItem aMargin( nWhich );
291cdf0e10cSrcweir 
292cdf0e10cSrcweir         if ( bRelativeMode )
293cdf0e10cSrcweir         {
294cdf0e10cSrcweir             DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
295cdf0e10cSrcweir 
296cdf0e10cSrcweir             const SvxULSpaceItem& rOldItem =
297cdf0e10cSrcweir                 (const SvxULSpaceItem&)GetItemSet().GetParent()->Get( nWhich );
298cdf0e10cSrcweir 
299cdf0e10cSrcweir             if ( aTopDist.IsRelative() )
300cdf0e10cSrcweir                 aMargin.SetUpper( rOldItem.GetUpper(),
301cdf0e10cSrcweir                                   (sal_uInt16)aTopDist.GetValue() );
302cdf0e10cSrcweir             else
303cdf0e10cSrcweir                 aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) );
304cdf0e10cSrcweir 
305cdf0e10cSrcweir             if ( aBottomDist.IsRelative() )
306cdf0e10cSrcweir                 aMargin.SetLower( rOldItem.GetLower(),
307cdf0e10cSrcweir                                   (sal_uInt16)aBottomDist.GetValue() );
308cdf0e10cSrcweir             else
309cdf0e10cSrcweir                 aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) );
310cdf0e10cSrcweir 
311cdf0e10cSrcweir         }
312cdf0e10cSrcweir         else
313cdf0e10cSrcweir         {
314cdf0e10cSrcweir             aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) );
315cdf0e10cSrcweir             aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) );
316cdf0e10cSrcweir         }
317cdf0e10cSrcweir         eState = GetItemSet().GetItemState( nWhich );
318cdf0e10cSrcweir 
319cdf0e10cSrcweir         if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aMargin ) ||
320cdf0e10cSrcweir              SFX_ITEM_DONTCARE == eState )
321cdf0e10cSrcweir         {
322cdf0e10cSrcweir             rOutSet.Put( aMargin );
323cdf0e10cSrcweir             bModified |= sal_True;
324cdf0e10cSrcweir         }
325cdf0e10cSrcweir     }
326cdf0e10cSrcweir     FASTBOOL bNullTab = sal_False;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir     if ( aLeftIndent.IsValueModified() ||
329cdf0e10cSrcweir          aFLineIndent.IsValueModified() ||
330cdf0e10cSrcweir          aRightIndent.IsValueModified()
331cdf0e10cSrcweir          ||  aAutoCB.GetSavedValue() != aAutoCB.IsChecked() )
332cdf0e10cSrcweir     {
333cdf0e10cSrcweir         nWhich = GetWhich( SID_ATTR_LRSPACE );
334cdf0e10cSrcweir         SfxMapUnit eUnit = pPool->GetMetric( nWhich );
335cdf0e10cSrcweir         SvxLRSpaceItem aMargin( nWhich );
336cdf0e10cSrcweir         pOld = GetOldItem( rOutSet, SID_ATTR_LRSPACE );
337cdf0e10cSrcweir 
338cdf0e10cSrcweir         if ( bRelativeMode )
339cdf0e10cSrcweir         {
340cdf0e10cSrcweir             DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
341cdf0e10cSrcweir 
342cdf0e10cSrcweir             const SvxLRSpaceItem& rOldItem =
343cdf0e10cSrcweir                 (const SvxLRSpaceItem&)GetItemSet().GetParent()->Get( nWhich );
344cdf0e10cSrcweir 
345cdf0e10cSrcweir             if ( aLeftIndent.IsRelative() )
346cdf0e10cSrcweir                 aMargin.SetTxtLeft( rOldItem.GetTxtLeft(),
347cdf0e10cSrcweir                                     (sal_uInt16)aLeftIndent.GetValue() );
348cdf0e10cSrcweir             else
349cdf0e10cSrcweir                 aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) );
350cdf0e10cSrcweir 
351cdf0e10cSrcweir             if ( aRightIndent.IsRelative() )
352cdf0e10cSrcweir                 aMargin.SetRight( rOldItem.GetRight(),
353cdf0e10cSrcweir                                   (sal_uInt16)aRightIndent.GetValue() );
354cdf0e10cSrcweir             else
355cdf0e10cSrcweir                 aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) );
356cdf0e10cSrcweir 
357cdf0e10cSrcweir             if ( aFLineIndent.IsRelative() )
358cdf0e10cSrcweir                 aMargin.SetTxtFirstLineOfst( rOldItem.GetTxtFirstLineOfst(),
359cdf0e10cSrcweir                                              (sal_uInt16)aFLineIndent.GetValue() );
360cdf0e10cSrcweir             else
361cdf0e10cSrcweir                 aMargin.SetTxtFirstLineOfst(
362cdf0e10cSrcweir                     (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) );
363cdf0e10cSrcweir         }
364cdf0e10cSrcweir         else
365cdf0e10cSrcweir         {
366cdf0e10cSrcweir             aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) );
367cdf0e10cSrcweir             aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) );
368cdf0e10cSrcweir             aMargin.SetTxtFirstLineOfst(
369cdf0e10cSrcweir                 (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) );
370cdf0e10cSrcweir         }
371cdf0e10cSrcweir         aMargin.SetAutoFirst(aAutoCB.IsChecked());
372cdf0e10cSrcweir         if ( aMargin.GetTxtFirstLineOfst() < 0 )
373cdf0e10cSrcweir             bNullTab = sal_True;
374cdf0e10cSrcweir         eState = GetItemSet().GetItemState( nWhich );
375cdf0e10cSrcweir 
376cdf0e10cSrcweir         if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) ||
377cdf0e10cSrcweir              SFX_ITEM_DONTCARE == eState )
378cdf0e10cSrcweir         {
379cdf0e10cSrcweir             rOutSet.Put( aMargin );
380cdf0e10cSrcweir             bModified |= sal_True;
381cdf0e10cSrcweir         }
382cdf0e10cSrcweir     }
383cdf0e10cSrcweir 
384cdf0e10cSrcweir     if ( bNullTab )
385cdf0e10cSrcweir     {
386cdf0e10cSrcweir         MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
387cdf0e10cSrcweir         if ( MAP_100TH_MM != eUnit )
388cdf0e10cSrcweir         {
389cdf0e10cSrcweir 
390cdf0e10cSrcweir             // negativer Erstzeileneinzug -> ggf. Null Default-Tabstop setzen
391cdf0e10cSrcweir             sal_uInt16 _nWhich = GetWhich( SID_ATTR_TABSTOP );
392cdf0e10cSrcweir             const SfxItemSet& rInSet = GetItemSet();
393cdf0e10cSrcweir 
394cdf0e10cSrcweir             if ( rInSet.GetItemState( _nWhich ) >= SFX_ITEM_AVAILABLE )
395cdf0e10cSrcweir             {
396cdf0e10cSrcweir                 const SvxTabStopItem& rTabItem =
397cdf0e10cSrcweir                     (const SvxTabStopItem&)rInSet.Get( _nWhich );
398cdf0e10cSrcweir                 SvxTabStopItem aNullTab( rTabItem );
399cdf0e10cSrcweir                 SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT );
400cdf0e10cSrcweir                 aNullTab.Insert( aNull );
401cdf0e10cSrcweir                 rOutSet.Put( aNullTab );
402cdf0e10cSrcweir             }
403cdf0e10cSrcweir         }
404cdf0e10cSrcweir     }
405cdf0e10cSrcweir     if( aRegisterCB.IsVisible())
406cdf0e10cSrcweir     {
407cdf0e10cSrcweir         const SfxBoolItem* pBoolItem = (SfxBoolItem*)GetOldItem(
408cdf0e10cSrcweir                             rOutSet, SID_ATTR_PARA_REGISTER);
409cdf0e10cSrcweir         SfxBoolItem* pRegItem = (SfxBoolItem*)pBoolItem->Clone();
410cdf0e10cSrcweir         sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
411cdf0e10cSrcweir         sal_Bool bSet = pRegItem->GetValue();
412cdf0e10cSrcweir 
413cdf0e10cSrcweir         if(aRegisterCB.IsChecked() != bSet )
414cdf0e10cSrcweir         {
415cdf0e10cSrcweir             pRegItem->SetValue(!bSet);
416cdf0e10cSrcweir             rOutSet.Put(*pRegItem);
417cdf0e10cSrcweir             bModified |= sal_True;
418cdf0e10cSrcweir         }
419cdf0e10cSrcweir         else if ( SFX_ITEM_DEFAULT == GetItemSet().GetItemState( _nWhich, sal_False ) )
420cdf0e10cSrcweir             rOutSet.ClearItem(_nWhich);
421cdf0e10cSrcweir         delete pRegItem;
422cdf0e10cSrcweir     }
423cdf0e10cSrcweir 
424cdf0e10cSrcweir     return bModified;
425cdf0e10cSrcweir }
426cdf0e10cSrcweir 
427cdf0e10cSrcweir // -----------------------------------------------------------------------
428cdf0e10cSrcweir 
Reset(const SfxItemSet & rSet)429cdf0e10cSrcweir void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet )
430cdf0e10cSrcweir {
431cdf0e10cSrcweir     SfxItemPool* pPool = rSet.GetPool();
432cdf0e10cSrcweir     DBG_ASSERT( pPool, "Wo ist der Pool?" );
433cdf0e10cSrcweir     String aEmpty;
434cdf0e10cSrcweir 
435cdf0e10cSrcweir     // Metrik einstellen
436cdf0e10cSrcweir     FieldUnit eFUnit = GetModuleFieldUnit( rSet );
437cdf0e10cSrcweir     SetFieldUnit( aLeftIndent, eFUnit );
438cdf0e10cSrcweir     SetFieldUnit( aRightIndent, eFUnit );
439cdf0e10cSrcweir     SetFieldUnit( aFLineIndent, eFUnit );
440cdf0e10cSrcweir     SetFieldUnit( aTopDist, eFUnit );
441cdf0e10cSrcweir     SetFieldUnit( aBottomDist, eFUnit );
442cdf0e10cSrcweir     SetFieldUnit( aLineDistAtMetricBox, eFUnit );
443cdf0e10cSrcweir 
444cdf0e10cSrcweir     sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE );
445cdf0e10cSrcweir     SfxItemState eItemState = rSet.GetItemState( _nWhich );
446cdf0e10cSrcweir 
447cdf0e10cSrcweir     if ( eItemState >= SFX_ITEM_AVAILABLE )
448cdf0e10cSrcweir     {
449cdf0e10cSrcweir         SfxMapUnit eUnit = pPool->GetMetric( _nWhich );
450cdf0e10cSrcweir 
451cdf0e10cSrcweir         if ( bRelativeMode )
452cdf0e10cSrcweir         {
453cdf0e10cSrcweir             const SvxLRSpaceItem& rOldItem =
454cdf0e10cSrcweir                 (const SvxLRSpaceItem&)rSet.Get( _nWhich );
455cdf0e10cSrcweir 
456cdf0e10cSrcweir             if ( rOldItem.GetPropLeft() != 100 )
457cdf0e10cSrcweir             {
458cdf0e10cSrcweir                 aLeftIndent.SetRelative( sal_True );
459cdf0e10cSrcweir                 aLeftIndent.SetValue( rOldItem.GetPropLeft() );
460cdf0e10cSrcweir             }
461cdf0e10cSrcweir             else
462cdf0e10cSrcweir             {
463cdf0e10cSrcweir                 aLeftIndent.SetRelative();
464cdf0e10cSrcweir                 SetFieldUnit( aLeftIndent, eFUnit );
465cdf0e10cSrcweir                 SetMetricValue( aLeftIndent, rOldItem.GetTxtLeft(), eUnit );
466cdf0e10cSrcweir             }
467cdf0e10cSrcweir 
468cdf0e10cSrcweir             if ( rOldItem.GetPropRight() != 100 )
469cdf0e10cSrcweir             {
470cdf0e10cSrcweir                 aRightIndent.SetRelative( sal_True );
471cdf0e10cSrcweir                 aRightIndent.SetValue( rOldItem.GetPropRight() );
472cdf0e10cSrcweir             }
473cdf0e10cSrcweir             else
474cdf0e10cSrcweir             {
475cdf0e10cSrcweir                 aRightIndent.SetRelative();
476cdf0e10cSrcweir                 SetFieldUnit( aRightIndent, eFUnit );
477cdf0e10cSrcweir                 SetMetricValue( aRightIndent, rOldItem.GetRight(), eUnit );
478cdf0e10cSrcweir             }
479cdf0e10cSrcweir 
480cdf0e10cSrcweir             if ( rOldItem.GetPropTxtFirstLineOfst() != 100 )
481cdf0e10cSrcweir             {
482cdf0e10cSrcweir                 aFLineIndent.SetRelative( sal_True );
483cdf0e10cSrcweir                 aFLineIndent.SetValue( rOldItem.GetPropTxtFirstLineOfst() );
484cdf0e10cSrcweir             }
485cdf0e10cSrcweir             else
486cdf0e10cSrcweir             {
487cdf0e10cSrcweir                 aFLineIndent.SetRelative();
488cdf0e10cSrcweir                 aFLineIndent.SetMin(-9999);
489cdf0e10cSrcweir                 SetFieldUnit( aFLineIndent, eFUnit );
490cdf0e10cSrcweir                 SetMetricValue( aFLineIndent, rOldItem.GetTxtFirstLineOfst(),
491cdf0e10cSrcweir                                 eUnit );
492cdf0e10cSrcweir             }
493cdf0e10cSrcweir             aAutoCB.Check(rOldItem.IsAutoFirst());
494cdf0e10cSrcweir         }
495cdf0e10cSrcweir         else
496cdf0e10cSrcweir         {
497cdf0e10cSrcweir             const SvxLRSpaceItem& rSpace =
498cdf0e10cSrcweir                 (const SvxLRSpaceItem&)rSet.Get( _nWhich );
499cdf0e10cSrcweir 
500cdf0e10cSrcweir             SetMetricValue( aLeftIndent, rSpace.GetTxtLeft(), eUnit );
501cdf0e10cSrcweir             SetMetricValue( aRightIndent, rSpace.GetRight(), eUnit );
502cdf0e10cSrcweir             SetMetricValue( aFLineIndent, rSpace.GetTxtFirstLineOfst(), eUnit );
503cdf0e10cSrcweir             aAutoCB.Check(rSpace.IsAutoFirst());
504cdf0e10cSrcweir         }
505cdf0e10cSrcweir         AutoHdl_Impl(&aAutoCB);
506cdf0e10cSrcweir     }
507cdf0e10cSrcweir     else
508cdf0e10cSrcweir     {
509cdf0e10cSrcweir         aLeftIndent.SetEmptyFieldValue();
510cdf0e10cSrcweir         aRightIndent.SetEmptyFieldValue();
511cdf0e10cSrcweir         aFLineIndent.SetEmptyFieldValue();
512cdf0e10cSrcweir     }
513cdf0e10cSrcweir 
514cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_ULSPACE );
515cdf0e10cSrcweir     eItemState = rSet.GetItemState( _nWhich );
516cdf0e10cSrcweir 
517cdf0e10cSrcweir     if ( eItemState >= SFX_ITEM_AVAILABLE )
518cdf0e10cSrcweir     {
519cdf0e10cSrcweir         SfxMapUnit eUnit = pPool->GetMetric( _nWhich );
520cdf0e10cSrcweir 
521cdf0e10cSrcweir         if ( bRelativeMode )
522cdf0e10cSrcweir         {
523cdf0e10cSrcweir             const SvxULSpaceItem& rOldItem =
524cdf0e10cSrcweir                 (const SvxULSpaceItem&)rSet.Get( _nWhich );
525cdf0e10cSrcweir 
526cdf0e10cSrcweir             if ( rOldItem.GetPropUpper() != 100 )
527cdf0e10cSrcweir             {
528cdf0e10cSrcweir                 aTopDist.SetRelative( sal_True );
529cdf0e10cSrcweir                 aTopDist.SetValue( rOldItem.GetPropUpper() );
530cdf0e10cSrcweir             }
531cdf0e10cSrcweir             else
532cdf0e10cSrcweir             {
533cdf0e10cSrcweir                 aTopDist.SetRelative();
534cdf0e10cSrcweir                 SetFieldUnit( aTopDist, eFUnit );
535cdf0e10cSrcweir                 SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit );
536cdf0e10cSrcweir             }
537cdf0e10cSrcweir 
538cdf0e10cSrcweir             if ( rOldItem.GetPropLower() != 100 )
539cdf0e10cSrcweir             {
540cdf0e10cSrcweir                 aBottomDist.SetRelative( sal_True );
541cdf0e10cSrcweir                 aBottomDist.SetValue( rOldItem.GetPropLower() );
542cdf0e10cSrcweir             }
543cdf0e10cSrcweir             else
544cdf0e10cSrcweir             {
545cdf0e10cSrcweir                 aBottomDist.SetRelative();
546cdf0e10cSrcweir                 SetFieldUnit( aBottomDist, eFUnit );
547cdf0e10cSrcweir                 SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit );
548cdf0e10cSrcweir             }
549cdf0e10cSrcweir         }
550cdf0e10cSrcweir         else
551cdf0e10cSrcweir         {
552cdf0e10cSrcweir             const SvxULSpaceItem& rTopMargin =
553cdf0e10cSrcweir                 (const SvxULSpaceItem&)rSet.Get( _nWhich );
554cdf0e10cSrcweir             SetMetricValue( aTopDist, rTopMargin.GetUpper(), eUnit );
555cdf0e10cSrcweir             SetMetricValue( aBottomDist, rTopMargin.GetLower(), eUnit );
556cdf0e10cSrcweir         }
557cdf0e10cSrcweir     }
558cdf0e10cSrcweir     else
559cdf0e10cSrcweir     {
560cdf0e10cSrcweir         aTopDist.SetEmptyFieldValue();
561cdf0e10cSrcweir         aBottomDist.SetEmptyFieldValue();
562cdf0e10cSrcweir     }
563cdf0e10cSrcweir 
564cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
565cdf0e10cSrcweir     eItemState = rSet.GetItemState( _nWhich );
566cdf0e10cSrcweir 
567cdf0e10cSrcweir     if ( eItemState >= SFX_ITEM_AVAILABLE )
568cdf0e10cSrcweir         SetLineSpacing_Impl( (const SvxLineSpacingItem &)rSet.Get( _nWhich ) );
569cdf0e10cSrcweir     else
570cdf0e10cSrcweir         aLineDist.SetNoSelection();
571cdf0e10cSrcweir 
572cdf0e10cSrcweir 
573cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
574cdf0e10cSrcweir     eItemState = rSet.GetItemState( _nWhich );
575cdf0e10cSrcweir 
576cdf0e10cSrcweir     if ( eItemState >= SFX_ITEM_AVAILABLE )
577cdf0e10cSrcweir         aRegisterCB.Check( ((const SfxBoolItem &)rSet.Get( _nWhich )).GetValue());
578cdf0e10cSrcweir     aRegisterCB.SaveValue();
579cdf0e10cSrcweir     sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet);
580cdf0e10cSrcweir     if(nHtmlMode & HTMLMODE_ON)
581cdf0e10cSrcweir     {
582cdf0e10cSrcweir         aRegisterCB.Hide();
583cdf0e10cSrcweir         aRegisterFL.Hide();
584cdf0e10cSrcweir         aAutoCB.Hide();
585cdf0e10cSrcweir         if(!(nHtmlMode & HTMLMODE_SOME_STYLES)) // IE oder SW
586cdf0e10cSrcweir         {
587cdf0e10cSrcweir             aRightLabel.Disable();
588cdf0e10cSrcweir             aRightIndent.Disable();
589cdf0e10cSrcweir             aTopDist.Disable();  //HTML3.2 und NS 3.0
590cdf0e10cSrcweir             aBottomDist.Disable();
591cdf0e10cSrcweir             if(!(nHtmlMode & HTMLMODE_FIRSTLINE)) //NS 3.0
592cdf0e10cSrcweir             {
593cdf0e10cSrcweir                 aFLineIndent.Disable();
594cdf0e10cSrcweir                 aFLineLabel.Disable();
595cdf0e10cSrcweir             }
596cdf0e10cSrcweir         }
597cdf0e10cSrcweir     }
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     ELRLoseFocusHdl( NULL );
600cdf0e10cSrcweir     aAutoCB.SaveValue();
601cdf0e10cSrcweir     aLineDist.SaveValue();
602cdf0e10cSrcweir }
603cdf0e10cSrcweir 
604cdf0e10cSrcweir // -----------------------------------------------------------------------
605cdf0e10cSrcweir 
EnableRelativeMode()606cdf0e10cSrcweir void SvxStdParagraphTabPage::EnableRelativeMode()
607cdf0e10cSrcweir {
608cdf0e10cSrcweir     DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
609cdf0e10cSrcweir 
610cdf0e10cSrcweir     aLeftIndent.EnableRelativeMode( 0, 999 );
611cdf0e10cSrcweir     aFLineIndent.EnableRelativeMode( 0, 999 );
612cdf0e10cSrcweir     aRightIndent.EnableRelativeMode( 0, 999 );
613cdf0e10cSrcweir     aTopDist.EnableRelativeMode( 0, 999 );
614cdf0e10cSrcweir     aBottomDist.EnableRelativeMode( 0, 999 );
615cdf0e10cSrcweir     bRelativeMode = sal_True;
616cdf0e10cSrcweir }
617cdf0e10cSrcweir 
618cdf0e10cSrcweir // -----------------------------------------------------------------------
619cdf0e10cSrcweir 
DeactivatePage(SfxItemSet * _pSet)620cdf0e10cSrcweir int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
621cdf0e10cSrcweir {
622cdf0e10cSrcweir     ELRLoseFocusHdl( NULL );
623cdf0e10cSrcweir 
624cdf0e10cSrcweir     if ( _pSet )
625cdf0e10cSrcweir         FillItemSet( *_pSet );
626cdf0e10cSrcweir     return LEAVE_PAGE;
627cdf0e10cSrcweir }
628cdf0e10cSrcweir 
629cdf0e10cSrcweir // -----------------------------------------------------------------------
630cdf0e10cSrcweir 
SvxStdParagraphTabPage(Window * pParent,const SfxItemSet & rAttr)631cdf0e10cSrcweir SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window* pParent,
632cdf0e10cSrcweir                                                 const SfxItemSet& rAttr ) :
633cdf0e10cSrcweir 
634cdf0e10cSrcweir     SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr ),
635cdf0e10cSrcweir 
636cdf0e10cSrcweir     aIndentFrm              ( this, CUI_RES( FL_INDENT ) ),
637cdf0e10cSrcweir     aLeftLabel              ( this, CUI_RES( FT_LEFTINDENT ) ),
638cdf0e10cSrcweir     aLeftIndent             ( this, CUI_RES( ED_LEFTINDENT ) ),
639cdf0e10cSrcweir     aRightLabel             ( this, CUI_RES( FT_RIGHTINDENT ) ),
640cdf0e10cSrcweir     aRightIndent            ( this, CUI_RES( ED_RIGHTINDENT ) ),
641cdf0e10cSrcweir 
642cdf0e10cSrcweir     aFLineLabel             ( this, CUI_RES( FT_FLINEINDENT ) ),
643cdf0e10cSrcweir     aFLineIndent            ( this, CUI_RES( ED_FLINEINDENT ) ),
644cdf0e10cSrcweir     aAutoCB                 ( this, CUI_RES( CB_AUTO ) ),
645cdf0e10cSrcweir     aDistFrm                ( this, CUI_RES( FL_DIST ) ),
646cdf0e10cSrcweir     aTopLabel               ( this, CUI_RES( FT_TOPDIST ) ),
647cdf0e10cSrcweir     aTopDist                ( this, CUI_RES( ED_TOPDIST ) ),
648cdf0e10cSrcweir     aBottomLabel            ( this, CUI_RES( FT_BOTTOMDIST ) ),
649cdf0e10cSrcweir     aBottomDist             ( this, CUI_RES( ED_BOTTOMDIST ) ),
650cdf0e10cSrcweir 
651cdf0e10cSrcweir     aLineDistFrm            ( this, CUI_RES( FL_LINEDIST ) ),
652cdf0e10cSrcweir     aLineDist               ( this, CUI_RES( LB_LINEDIST ) ),
653cdf0e10cSrcweir     aLineDistAtLabel        ( this, CUI_RES( FT_LINEDIST ) ),
654cdf0e10cSrcweir     aLineDistAtPercentBox   ( this, CUI_RES( ED_LINEDISTPERCENT ) ),
655cdf0e10cSrcweir     aLineDistAtMetricBox    ( this, CUI_RES( ED_LINEDISTMETRIC ) ),
656cdf0e10cSrcweir     sAbsDist                ( CUI_RES(ST_LINEDIST_ABS) ),
657cdf0e10cSrcweir     aExampleWin             ( this, CUI_RES( WN_EXAMPLE ) ),
658cdf0e10cSrcweir     aRegisterFL             ( this, CUI_RES( FL_REGISTER ) ),
659cdf0e10cSrcweir     aRegisterCB             ( this, CUI_RES( CB_REGISTER ) ),
660cdf0e10cSrcweir     pActLineDistFld ( &aLineDistAtPercentBox ),
661cdf0e10cSrcweir     nAbst           ( MAX_DURCH ),
662cdf0e10cSrcweir     nWidth          ( 11905 /*567 * 50*/ ),
663cdf0e10cSrcweir     nMinFixDist(0L),
664cdf0e10cSrcweir 
665cdf0e10cSrcweir     bRelativeMode   ( sal_False ),
666cdf0e10cSrcweir     bNegativeIndents(sal_False)
667cdf0e10cSrcweir 
668cdf0e10cSrcweir {
669cdf0e10cSrcweir     // diese Page braucht ExchangeSupport
670cdf0e10cSrcweir     SetExchangeSupport();
671cdf0e10cSrcweir 
672cdf0e10cSrcweir     aLineDistAtMetricBox.Hide();
673cdf0e10cSrcweir     FreeResource();
674cdf0e10cSrcweir     Init_Impl();
675cdf0e10cSrcweir     aFLineIndent.SetMin(-9999);    // wird default auf 0 gesetzt
676cdf0e10cSrcweir 
677cdf0e10cSrcweir     aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
678cdf0e10cSrcweir 
679cdf0e10cSrcweir }
680cdf0e10cSrcweir 
681cdf0e10cSrcweir 
682cdf0e10cSrcweir // -----------------------------------------------------------------------
683cdf0e10cSrcweir 
EnableNegativeMode()684cdf0e10cSrcweir void SvxStdParagraphTabPage::EnableNegativeMode()
685cdf0e10cSrcweir {
686cdf0e10cSrcweir     aLeftIndent.SetMin(-9999);
687cdf0e10cSrcweir     aRightIndent.SetMin(-9999);
688cdf0e10cSrcweir     aRightIndent.EnableNegativeMode();
689cdf0e10cSrcweir     aLeftIndent.EnableNegativeMode();
690cdf0e10cSrcweir     bNegativeIndents = sal_True;
691cdf0e10cSrcweir }
692cdf0e10cSrcweir 
693cdf0e10cSrcweir // -----------------------------------------------------------------------
694cdf0e10cSrcweir 
GetRanges()695cdf0e10cSrcweir sal_uInt16* SvxStdParagraphTabPage::GetRanges()
696cdf0e10cSrcweir {
697cdf0e10cSrcweir     return pStdRanges;
698cdf0e10cSrcweir }
699cdf0e10cSrcweir 
700cdf0e10cSrcweir // -----------------------------------------------------------------------
701cdf0e10cSrcweir 
SetLineSpacing_Impl(const SvxLineSpacingItem & rAttr)702cdf0e10cSrcweir void SvxStdParagraphTabPage::SetLineSpacing_Impl
703cdf0e10cSrcweir (
704cdf0e10cSrcweir     const SvxLineSpacingItem &rAttr
705cdf0e10cSrcweir )
706cdf0e10cSrcweir {
707cdf0e10cSrcweir     SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( rAttr.Which() );
708cdf0e10cSrcweir 
709cdf0e10cSrcweir     switch( rAttr.GetLineSpaceRule() )
710cdf0e10cSrcweir     {
711cdf0e10cSrcweir         case SVX_LINE_SPACE_AUTO:
712cdf0e10cSrcweir         {
713cdf0e10cSrcweir             SvxInterLineSpace eInter = rAttr.GetInterLineSpaceRule();
714cdf0e10cSrcweir 
715cdf0e10cSrcweir             switch( eInter )
716cdf0e10cSrcweir             {
717cdf0e10cSrcweir                 // Default einzeilig
718cdf0e10cSrcweir                 case SVX_INTER_LINE_SPACE_OFF:
719cdf0e10cSrcweir                     aLineDist.SelectEntryPos( LLINESPACE_1 );
720cdf0e10cSrcweir                     break;
721cdf0e10cSrcweir 
722cdf0e10cSrcweir                 // Default einzeilig
723cdf0e10cSrcweir                 case SVX_INTER_LINE_SPACE_PROP:
724cdf0e10cSrcweir                     if ( 100 == rAttr.GetPropLineSpace() )
725cdf0e10cSrcweir                     {
726cdf0e10cSrcweir                         aLineDist.SelectEntryPos( LLINESPACE_1 );
727cdf0e10cSrcweir                         break;
728cdf0e10cSrcweir                     }
729cdf0e10cSrcweir                     // 1.5zeilig
730cdf0e10cSrcweir                     if ( 150 == rAttr.GetPropLineSpace() )
731cdf0e10cSrcweir                     {
732cdf0e10cSrcweir                         aLineDist.SelectEntryPos( LLINESPACE_15 );
733cdf0e10cSrcweir                         break;
734cdf0e10cSrcweir                     }
735cdf0e10cSrcweir                     // 2zeilig
736cdf0e10cSrcweir                     if ( 200 == rAttr.GetPropLineSpace() )
737cdf0e10cSrcweir                     {
738cdf0e10cSrcweir                         aLineDist.SelectEntryPos( LLINESPACE_2 );
739cdf0e10cSrcweir                         break;
740cdf0e10cSrcweir                     }
741cdf0e10cSrcweir                     // eingestellter Prozentwert
742cdf0e10cSrcweir                     aLineDistAtPercentBox.
743cdf0e10cSrcweir                         SetValue( aLineDistAtPercentBox.Normalize(
744cdf0e10cSrcweir                                         rAttr.GetPropLineSpace() ) );
745cdf0e10cSrcweir                     aLineDist.SelectEntryPos( LLINESPACE_PROP );
746cdf0e10cSrcweir                     break;
747cdf0e10cSrcweir 
748cdf0e10cSrcweir                 case SVX_INTER_LINE_SPACE_FIX:
749cdf0e10cSrcweir                     SetMetricValue( aLineDistAtMetricBox,
750cdf0e10cSrcweir                                     rAttr.GetInterLineSpace(), eUnit );
751cdf0e10cSrcweir                     aLineDist.SelectEntryPos( LLINESPACE_DURCH );
752cdf0e10cSrcweir                     break;
753cdf0e10cSrcweir                 default: ;//prevent warning
754cdf0e10cSrcweir             }
755cdf0e10cSrcweir         }
756cdf0e10cSrcweir         break;
757cdf0e10cSrcweir         case SVX_LINE_SPACE_FIX:
758cdf0e10cSrcweir             SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
759cdf0e10cSrcweir             aLineDist.SelectEntryPos( LLINESPACE_FIX );
760cdf0e10cSrcweir         break;
761cdf0e10cSrcweir 
762cdf0e10cSrcweir         case SVX_LINE_SPACE_MIN:
763cdf0e10cSrcweir             SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
764cdf0e10cSrcweir             aLineDist.SelectEntryPos( LLINESPACE_MIN );
765cdf0e10cSrcweir             break;
766cdf0e10cSrcweir         default: ;//prevent warning
767cdf0e10cSrcweir     }
768cdf0e10cSrcweir     LineDistHdl_Impl( &aLineDist );
769cdf0e10cSrcweir }
770cdf0e10cSrcweir 
771cdf0e10cSrcweir // -----------------------------------------------------------------------
772cdf0e10cSrcweir 
IMPL_LINK(SvxStdParagraphTabPage,LineDistHdl_Impl,ListBox *,pBox)773cdf0e10cSrcweir IMPL_LINK( SvxStdParagraphTabPage, LineDistHdl_Impl, ListBox *, pBox )
774cdf0e10cSrcweir {
775cdf0e10cSrcweir     switch( pBox->GetSelectEntryPos() )
776cdf0e10cSrcweir     {
777cdf0e10cSrcweir         case LLINESPACE_1:
778cdf0e10cSrcweir         case LLINESPACE_15:
779cdf0e10cSrcweir         case LLINESPACE_2:
780cdf0e10cSrcweir             aLineDistAtLabel.Enable(sal_False);
781cdf0e10cSrcweir             pActLineDistFld->Enable(sal_False);
782cdf0e10cSrcweir             pActLineDistFld->SetText( String() );
783cdf0e10cSrcweir             break;
784cdf0e10cSrcweir 
785cdf0e10cSrcweir         case LLINESPACE_DURCH:
786cdf0e10cSrcweir             // Setzen eines sinnvollen Defaults?
787cdf0e10cSrcweir             // MS Begrenzen min(10, aPageSize)
788cdf0e10cSrcweir             aLineDistAtPercentBox.Hide();
789cdf0e10cSrcweir             pActLineDistFld = &aLineDistAtMetricBox;
790cdf0e10cSrcweir             aLineDistAtMetricBox.SetMin(0);
791cdf0e10cSrcweir 
792cdf0e10cSrcweir 
793cdf0e10cSrcweir             if ( !aLineDistAtMetricBox.GetText().Len() )
794cdf0e10cSrcweir                 aLineDistAtMetricBox.SetValue(
795cdf0e10cSrcweir                     aLineDistAtMetricBox.Normalize( 1 ) );
796cdf0e10cSrcweir             aLineDistAtPercentBox.Hide();
797cdf0e10cSrcweir             pActLineDistFld->Show();
798cdf0e10cSrcweir             pActLineDistFld->Enable();
799cdf0e10cSrcweir             aLineDistAtLabel.Enable();
800cdf0e10cSrcweir             break;
801cdf0e10cSrcweir 
802cdf0e10cSrcweir         case LLINESPACE_MIN:
803cdf0e10cSrcweir             aLineDistAtPercentBox.Hide();
804cdf0e10cSrcweir             pActLineDistFld = &aLineDistAtMetricBox;
805cdf0e10cSrcweir             aLineDistAtMetricBox.SetMin(0);
806cdf0e10cSrcweir 
807cdf0e10cSrcweir             if ( !aLineDistAtMetricBox.GetText().Len() )
808cdf0e10cSrcweir                 aLineDistAtMetricBox.SetValue(
809cdf0e10cSrcweir                     aLineDistAtMetricBox.Normalize( 10 ), FUNIT_TWIP );
810cdf0e10cSrcweir             aLineDistAtPercentBox.Hide();
811cdf0e10cSrcweir             pActLineDistFld->Show();
812cdf0e10cSrcweir             pActLineDistFld->Enable();
813cdf0e10cSrcweir             aLineDistAtLabel.Enable();
814cdf0e10cSrcweir             break;
815cdf0e10cSrcweir 
816cdf0e10cSrcweir         case LLINESPACE_PROP:
817cdf0e10cSrcweir             aLineDistAtMetricBox.Hide();
818cdf0e10cSrcweir             pActLineDistFld = &aLineDistAtPercentBox;
819cdf0e10cSrcweir 
820cdf0e10cSrcweir             if ( !aLineDistAtPercentBox.GetText().Len() )
821cdf0e10cSrcweir                 aLineDistAtPercentBox.SetValue(
822cdf0e10cSrcweir                     aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP );
823cdf0e10cSrcweir             aLineDistAtMetricBox.Hide();
824cdf0e10cSrcweir             pActLineDistFld->Show();
825cdf0e10cSrcweir             pActLineDistFld->Enable();
826cdf0e10cSrcweir             aLineDistAtLabel.Enable();
827cdf0e10cSrcweir             break;
828cdf0e10cSrcweir         case LLINESPACE_FIX:
829cdf0e10cSrcweir         {
830cdf0e10cSrcweir             aLineDistAtPercentBox.Hide();
831cdf0e10cSrcweir             pActLineDistFld = &aLineDistAtMetricBox;
832cdf0e10cSrcweir             sal_Int64 nTemp = aLineDistAtMetricBox.GetValue();
833cdf0e10cSrcweir             aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP);
834cdf0e10cSrcweir 
835cdf0e10cSrcweir             // wurde der Wert beim SetMin veraendert, dann ist es Zeit
836cdf0e10cSrcweir             // fuer den default
837cdf0e10cSrcweir             if ( aLineDistAtMetricBox.GetValue() != nTemp )
838cdf0e10cSrcweir                 SetMetricValue( aLineDistAtMetricBox,
839cdf0e10cSrcweir                                     FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); // fix gibt's nur im Writer
840cdf0e10cSrcweir             aLineDistAtPercentBox.Hide();
841cdf0e10cSrcweir             pActLineDistFld->Show();
842cdf0e10cSrcweir             pActLineDistFld->Enable();
843cdf0e10cSrcweir             aLineDistAtLabel.Enable();
844cdf0e10cSrcweir         }
845cdf0e10cSrcweir         break;
846cdf0e10cSrcweir     }
847cdf0e10cSrcweir     UpdateExample_Impl( sal_True );
848cdf0e10cSrcweir     return 0;
849cdf0e10cSrcweir }
850cdf0e10cSrcweir 
851cdf0e10cSrcweir // -----------------------------------------------------------------------
852cdf0e10cSrcweir 
IMPL_LINK_INLINE_START(SvxStdParagraphTabPage,ModifyHdl_Impl,SvxRelativeField *,EMPTYARG)853cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG )
854cdf0e10cSrcweir {
855cdf0e10cSrcweir     UpdateExample_Impl();
856cdf0e10cSrcweir     return 0;
857cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(SvxStdParagraphTabPage,ModifyHdl_Impl,SvxRelativeField *,EMPTYARG)858cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxStdParagraphTabPage, ModifyHdl_Impl, SvxRelativeField *, EMPTYARG )
859cdf0e10cSrcweir 
860cdf0e10cSrcweir // -----------------------------------------------------------------------
861cdf0e10cSrcweir 
862cdf0e10cSrcweir void SvxStdParagraphTabPage::Init_Impl()
863cdf0e10cSrcweir {
864cdf0e10cSrcweir     aLineDist.SetSelectHdl(
865cdf0e10cSrcweir         LINK( this, SvxStdParagraphTabPage, LineDistHdl_Impl ) );
866cdf0e10cSrcweir 
867cdf0e10cSrcweir     Link aLink = LINK( this, SvxStdParagraphTabPage, ELRLoseFocusHdl );
868cdf0e10cSrcweir     aFLineIndent.SetLoseFocusHdl( aLink );
869cdf0e10cSrcweir     aLeftIndent.SetLoseFocusHdl( aLink );
870cdf0e10cSrcweir     aRightIndent.SetLoseFocusHdl( aLink );
871cdf0e10cSrcweir 
872cdf0e10cSrcweir     aLink = LINK( this, SvxStdParagraphTabPage, ModifyHdl_Impl );
873cdf0e10cSrcweir     aFLineIndent.SetModifyHdl( aLink );
874cdf0e10cSrcweir     aLeftIndent.SetModifyHdl( aLink );
875cdf0e10cSrcweir     aRightIndent.SetModifyHdl( aLink );
876cdf0e10cSrcweir     aTopDist.SetModifyHdl( aLink );
877cdf0e10cSrcweir     aBottomDist.SetModifyHdl( aLink );
878cdf0e10cSrcweir 
879cdf0e10cSrcweir     aAutoCB.SetClickHdl( LINK( this, SvxStdParagraphTabPage, AutoHdl_Impl ));
880cdf0e10cSrcweir     SfxItemPool* pPool = GetItemSet().GetPool();
881cdf0e10cSrcweir     DBG_ASSERT( pPool, "Wo ist der Pool" );
882cdf0e10cSrcweir     FieldUnit eUnit =
883cdf0e10cSrcweir         MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
884cdf0e10cSrcweir 
885cdf0e10cSrcweir     aTopDist.SetMax( aTopDist.Normalize( nAbst ), eUnit );
886cdf0e10cSrcweir     aBottomDist.SetMax( aBottomDist.Normalize( nAbst ), eUnit );
887cdf0e10cSrcweir     aLineDistAtMetricBox.SetMax(
888cdf0e10cSrcweir         aLineDistAtMetricBox.Normalize( nAbst ), eUnit );
889cdf0e10cSrcweir }
890cdf0e10cSrcweir 
891cdf0e10cSrcweir // -----------------------------------------------------------------------
892cdf0e10cSrcweir 
UpdateExample_Impl(sal_Bool bAll)893cdf0e10cSrcweir void SvxStdParagraphTabPage::UpdateExample_Impl( sal_Bool bAll )
894cdf0e10cSrcweir {
895cdf0e10cSrcweir     aExampleWin.SetFirstLineOfst(
896cdf0e10cSrcweir         (short)aFLineIndent.Denormalize( aFLineIndent.GetValue( FUNIT_TWIP ) ) );
897cdf0e10cSrcweir     aExampleWin.SetLeftMargin(
898cdf0e10cSrcweir         static_cast<long>(aLeftIndent.Denormalize( aLeftIndent.GetValue( FUNIT_TWIP ) ) ) );
899cdf0e10cSrcweir     aExampleWin.SetRightMargin(
900cdf0e10cSrcweir         static_cast<long>(aRightIndent.Denormalize( aRightIndent.GetValue( FUNIT_TWIP ) ) ) );
901cdf0e10cSrcweir     aExampleWin.SetUpper(
902cdf0e10cSrcweir         (sal_uInt16)aTopDist.Denormalize( aTopDist.GetValue( FUNIT_TWIP ) ) );
903cdf0e10cSrcweir     aExampleWin.SetLower(
904cdf0e10cSrcweir         (sal_uInt16)aBottomDist.Denormalize( aBottomDist.GetValue( FUNIT_TWIP ) ) );
905cdf0e10cSrcweir 
906cdf0e10cSrcweir 
907cdf0e10cSrcweir 
908cdf0e10cSrcweir     sal_uInt16 nPos = aLineDist.GetSelectEntryPos();
909cdf0e10cSrcweir 
910cdf0e10cSrcweir     switch ( nPos )
911cdf0e10cSrcweir     {
912cdf0e10cSrcweir         case LLINESPACE_1:
913cdf0e10cSrcweir         case LLINESPACE_15:
914cdf0e10cSrcweir         case LLINESPACE_2:
915cdf0e10cSrcweir             aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos );
916cdf0e10cSrcweir             break;
917cdf0e10cSrcweir 
918cdf0e10cSrcweir         case LLINESPACE_PROP:
919cdf0e10cSrcweir             aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos,
920cdf0e10cSrcweir                 (sal_uInt16)aLineDistAtPercentBox.Denormalize(
921cdf0e10cSrcweir                 aLineDistAtPercentBox.GetValue() ) );
922cdf0e10cSrcweir             break;
923cdf0e10cSrcweir 
924cdf0e10cSrcweir         case LLINESPACE_MIN:
925cdf0e10cSrcweir         case LLINESPACE_DURCH:
926cdf0e10cSrcweir         case LLINESPACE_FIX:
927cdf0e10cSrcweir             aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos,
928cdf0e10cSrcweir                 (sal_uInt16)GetCoreValue( aLineDistAtMetricBox, SFX_MAPUNIT_TWIP ) );
929cdf0e10cSrcweir             break;
930cdf0e10cSrcweir     }
931cdf0e10cSrcweir     aExampleWin.Draw( bAll );
932cdf0e10cSrcweir }
933cdf0e10cSrcweir 
934cdf0e10cSrcweir // -----------------------------------------------------------------------
935cdf0e10cSrcweir 
EnableRegisterMode()936cdf0e10cSrcweir void SvxStdParagraphTabPage::EnableRegisterMode()
937cdf0e10cSrcweir {
938cdf0e10cSrcweir     aRegisterCB.Show();
939cdf0e10cSrcweir     aRegisterFL.Show();
940cdf0e10cSrcweir }
941cdf0e10cSrcweir 
942cdf0e10cSrcweir /*-----------------16.01.97 19.54-------------------
943cdf0e10cSrcweir 
944cdf0e10cSrcweir --------------------------------------------------*/
IMPL_LINK(SvxStdParagraphTabPage,AutoHdl_Impl,CheckBox *,pBox)945cdf0e10cSrcweir IMPL_LINK( SvxStdParagraphTabPage, AutoHdl_Impl, CheckBox*, pBox )
946cdf0e10cSrcweir {
947cdf0e10cSrcweir     sal_Bool bEnable = !pBox->IsChecked();
948cdf0e10cSrcweir     aFLineLabel .Enable(bEnable);
949cdf0e10cSrcweir     aFLineIndent.Enable(bEnable);
950cdf0e10cSrcweir     return 0;
951cdf0e10cSrcweir }
952cdf0e10cSrcweir 
953cdf0e10cSrcweir /*-----------------16.01.97 18.00-------------------
954cdf0e10cSrcweir 
955cdf0e10cSrcweir --------------------------------------------------*/
SetPageWidth(sal_uInt16 nPageWidth)956cdf0e10cSrcweir void SvxStdParagraphTabPage::SetPageWidth( sal_uInt16 nPageWidth )
957cdf0e10cSrcweir {
958cdf0e10cSrcweir     nWidth = nPageWidth;
959cdf0e10cSrcweir }
960cdf0e10cSrcweir 
961cdf0e10cSrcweir /*-----------------17.01.97 08.11-------------------
962cdf0e10cSrcweir 
963cdf0e10cSrcweir --------------------------------------------------*/
EnableAutoFirstLine()964cdf0e10cSrcweir void SvxStdParagraphTabPage::EnableAutoFirstLine()
965cdf0e10cSrcweir {
966cdf0e10cSrcweir     aAutoCB.Show();
967cdf0e10cSrcweir }
968cdf0e10cSrcweir 
969cdf0e10cSrcweir /*-----------------11.06.97 11.48-------------------
970cdf0e10cSrcweir     absoluter Zeilenabstand
971cdf0e10cSrcweir --------------------------------------------------*/
EnableAbsLineDist(long nMinTwip)972cdf0e10cSrcweir void    SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip)
973cdf0e10cSrcweir {
974cdf0e10cSrcweir     aLineDist.InsertEntry(sAbsDist);
975cdf0e10cSrcweir     nMinFixDist = nMinTwip;
976cdf0e10cSrcweir }
977cdf0e10cSrcweir 
978cdf0e10cSrcweir //addd CHINA001 begin
PageCreated(SfxAllItemSet aSet)979cdf0e10cSrcweir void    SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet)
980cdf0e10cSrcweir {
981cdf0e10cSrcweir 
982cdf0e10cSrcweir /* CHINA001 different bit represent call to different method of SvxStdParagraphTabPage
983cdf0e10cSrcweir                         0x0001 --->EnableRelativeMode()
984cdf0e10cSrcweir                         0x0002 --->EnableRegisterMode()
985cdf0e10cSrcweir                         0x0004 --->EnableAutoFirstLine()
986cdf0e10cSrcweir                         0x0008 --->EnableNegativeMode()
987cdf0e10cSrcweir 
988cdf0e10cSrcweir 
989cdf0e10cSrcweir             */
990cdf0e10cSrcweir     SFX_ITEMSET_ARG (&aSet,pPageWidthItem,SfxUInt16Item,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,sal_False);
991cdf0e10cSrcweir     SFX_ITEMSET_ARG (&aSet,pFlagSetItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,sal_False);
992cdf0e10cSrcweir     SFX_ITEMSET_ARG (&aSet,pLineDistItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,sal_False);
993cdf0e10cSrcweir 
994cdf0e10cSrcweir     if (pPageWidthItem)
995cdf0e10cSrcweir         SetPageWidth(pPageWidthItem->GetValue());
996cdf0e10cSrcweir 
997cdf0e10cSrcweir     if (pFlagSetItem )
998cdf0e10cSrcweir         if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 )
999cdf0e10cSrcweir             EnableRelativeMode();
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir     if (pFlagSetItem)
1002cdf0e10cSrcweir         if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 )
1003cdf0e10cSrcweir                 EnableRegisterMode();
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir     if (pFlagSetItem)
1006cdf0e10cSrcweir         if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 )
1007cdf0e10cSrcweir             EnableAutoFirstLine();
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir     if(pLineDistItem)
1010cdf0e10cSrcweir         EnableAbsLineDist(pLineDistItem->GetValue());
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir     if (pFlagSetItem)
1013cdf0e10cSrcweir         if  (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
1014cdf0e10cSrcweir                 EnableNegativeMode();
1015cdf0e10cSrcweir 
1016cdf0e10cSrcweir }
1017cdf0e10cSrcweir //end of CHINA001
1018cdf0e10cSrcweir 
1019cdf0e10cSrcweir #define LASTLINEPOS_DEFAULT     0
1020cdf0e10cSrcweir #define LASTLINEPOS_LEFT        1
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir #define LASTLINECOUNT_OLD       3
1023cdf0e10cSrcweir #define LASTLINECOUNT_NEW       4
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir // class SvxParaAlignTabPage ------------------------------------------------
1026cdf0e10cSrcweir 
1027cdf0e10cSrcweir /*-----------------16.01.97 19.34-------------------
1028cdf0e10cSrcweir 
1029cdf0e10cSrcweir --------------------------------------------------*/
SvxParaAlignTabPage(Window * pParent,const SfxItemSet & rSet)1030cdf0e10cSrcweir SvxParaAlignTabPage::SvxParaAlignTabPage( Window* pParent, const SfxItemSet& rSet )
1031cdf0e10cSrcweir     : SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ALIGN_PARAGRAPH ),rSet),
1032cdf0e10cSrcweir     aAlignFrm           ( this, CUI_RES( FL_ALIGN ) ),
1033cdf0e10cSrcweir     aLeft               ( this, CUI_RES( BTN_LEFTALIGN ) ),
1034cdf0e10cSrcweir     aRight              ( this, CUI_RES( BTN_RIGHTALIGN ) ),
1035cdf0e10cSrcweir     aCenter             ( this, CUI_RES( BTN_CENTERALIGN ) ),
1036cdf0e10cSrcweir     aJustify            ( this, CUI_RES( BTN_JUSTIFYALIGN ) ),
1037cdf0e10cSrcweir     aLastLineFT         ( this, CUI_RES( FT_LASTLINE ) ),
1038cdf0e10cSrcweir     aLastLineLB         ( this, CUI_RES( LB_LASTLINE ) ),
1039cdf0e10cSrcweir     aExpandCB           ( this, CUI_RES( CB_EXPAND ) ),
1040cdf0e10cSrcweir     aSnapToGridCB       ( this, CUI_RES( CB_SNAP ) ),
1041cdf0e10cSrcweir     aExampleWin         ( this, CUI_RES( WN_EXAMPLE ) ),
1042cdf0e10cSrcweir 
1043cdf0e10cSrcweir     aVertAlignFL        ( this, CUI_RES( FL_VERTALIGN ) ),
1044cdf0e10cSrcweir     aVertAlignFT        ( this, CUI_RES( FT_VERTALIGN ) ),
1045cdf0e10cSrcweir     aVertAlignLB        ( this, CUI_RES( LB_VERTALIGN ) ),
1046cdf0e10cSrcweir 
1047cdf0e10cSrcweir     aPropertiesFL       ( this, CUI_RES( FL_PROPERTIES    )),
1048cdf0e10cSrcweir     aTextDirectionFT    ( this, CUI_RES( FT_TEXTDIRECTION )),
1049cdf0e10cSrcweir     aTextDirectionLB    ( this, CUI_RES( LB_TEXTDIRECTION ))
1050cdf0e10cSrcweir {
1051cdf0e10cSrcweir     SvtLanguageOptions aLangOptions;
1052cdf0e10cSrcweir     sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT;
1053cdf0e10cSrcweir 
1054cdf0e10cSrcweir     if ( aLangOptions.IsAsianTypographyEnabled() )
1055cdf0e10cSrcweir     {
1056cdf0e10cSrcweir         String sLeft(CUI_RES(ST_LEFTALIGN_ASIAN));
1057cdf0e10cSrcweir         aLeft.SetText(sLeft);
1058cdf0e10cSrcweir         aRight.SetText(String(CUI_RES(ST_RIGHTALIGN_ASIAN)));
1059cdf0e10cSrcweir         sLeft = MnemonicGenerator::EraseAllMnemonicChars( sLeft );
1060cdf0e10cSrcweir 
1061cdf0e10cSrcweir         if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_OLD )
1062cdf0e10cSrcweir         {
1063cdf0e10cSrcweir             aLastLineLB.RemoveEntry( 0 );
1064cdf0e10cSrcweir             aLastLineLB.InsertEntry( sLeft, 0 );
1065cdf0e10cSrcweir         }
1066cdf0e10cSrcweir         else
1067cdf0e10cSrcweir             nLastLinePos = LASTLINEPOS_LEFT;
1068cdf0e10cSrcweir     }
1069cdf0e10cSrcweir     // remove "Default" or "Left" entry, depends on CJKOptions
1070cdf0e10cSrcweir     if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_NEW )
1071cdf0e10cSrcweir         aLastLineLB.RemoveEntry( nLastLinePos );
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir     FreeResource();
1074cdf0e10cSrcweir     Link aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl );
1075cdf0e10cSrcweir     aLeft.SetClickHdl( aLink );
1076cdf0e10cSrcweir     aRight.SetClickHdl( aLink );
1077cdf0e10cSrcweir     aCenter.SetClickHdl( aLink );
1078cdf0e10cSrcweir     aJustify.SetClickHdl( aLink );
1079cdf0e10cSrcweir     aLastLineLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, LastLineHdl_Impl ) );
1080cdf0e10cSrcweir     aTextDirectionLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, TextDirectionHdl_Impl ) );
1081cdf0e10cSrcweir 
1082cdf0e10cSrcweir     sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet);
1083cdf0e10cSrcweir     if(!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES)) )
1084cdf0e10cSrcweir     {
1085cdf0e10cSrcweir         if( aLangOptions.IsCTLFontEnabled() )
1086cdf0e10cSrcweir         {
1087cdf0e10cSrcweir             aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP );
1088cdf0e10cSrcweir             aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP );
1089cdf0e10cSrcweir             aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT );
1090cdf0e10cSrcweir 
1091cdf0e10cSrcweir             aPropertiesFL.Show();
1092cdf0e10cSrcweir             aTextDirectionFT.Show();
1093cdf0e10cSrcweir             aTextDirectionLB.Show();
1094cdf0e10cSrcweir         }
1095cdf0e10cSrcweir     }
1096cdf0e10cSrcweir 
1097cdf0e10cSrcweir     aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir }
1100cdf0e10cSrcweir 
1101cdf0e10cSrcweir /*-----------------16.01.97 19.33-------------------
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir --------------------------------------------------*/
~SvxParaAlignTabPage()1104cdf0e10cSrcweir SvxParaAlignTabPage::~SvxParaAlignTabPage()
1105cdf0e10cSrcweir {
1106cdf0e10cSrcweir }
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir /*-----------------16.01.97 19.33-------------------
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir --------------------------------------------------*/
DeactivatePage(SfxItemSet * _pSet)1111cdf0e10cSrcweir int SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet )
1112cdf0e10cSrcweir {
1113cdf0e10cSrcweir     if ( _pSet )
1114cdf0e10cSrcweir         FillItemSet( *_pSet );
1115cdf0e10cSrcweir     return LEAVE_PAGE;
1116cdf0e10cSrcweir }
1117cdf0e10cSrcweir 
1118cdf0e10cSrcweir /*-----------------16.01.97 19.33-------------------
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir --------------------------------------------------*/
Create(Window * pParent,const SfxItemSet & rSet)1121cdf0e10cSrcweir SfxTabPage* SvxParaAlignTabPage::Create( Window* pParent, const SfxItemSet& rSet )
1122cdf0e10cSrcweir {
1123cdf0e10cSrcweir     return new SvxParaAlignTabPage(pParent, rSet);
1124cdf0e10cSrcweir }
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir /*-----------------16.01.97 19.33-------------------
1127cdf0e10cSrcweir 
1128cdf0e10cSrcweir --------------------------------------------------*/
GetRanges()1129cdf0e10cSrcweir sal_uInt16* SvxParaAlignTabPage::GetRanges()
1130cdf0e10cSrcweir {
1131cdf0e10cSrcweir     return pAlignRanges;
1132cdf0e10cSrcweir 
1133cdf0e10cSrcweir }
1134cdf0e10cSrcweir 
1135cdf0e10cSrcweir /*-----------------16.01.97 19.33-------------------
1136cdf0e10cSrcweir 
1137cdf0e10cSrcweir --------------------------------------------------*/
FillItemSet(SfxItemSet & rOutSet)1138cdf0e10cSrcweir sal_Bool SvxParaAlignTabPage::FillItemSet( SfxItemSet& rOutSet )
1139cdf0e10cSrcweir {
1140cdf0e10cSrcweir     sal_Bool bModified = sal_False;
1141cdf0e10cSrcweir 
1142cdf0e10cSrcweir     FASTBOOL bAdj = sal_False, bChecked = sal_False;
1143cdf0e10cSrcweir     SvxAdjust eAdjust = SVX_ADJUST_LEFT;
1144cdf0e10cSrcweir 
1145cdf0e10cSrcweir     if ( aLeft.IsChecked() )
1146cdf0e10cSrcweir     {
1147cdf0e10cSrcweir         eAdjust = SVX_ADJUST_LEFT;
1148cdf0e10cSrcweir         bAdj = !aLeft.GetSavedValue();
1149cdf0e10cSrcweir         bChecked = sal_True;
1150cdf0e10cSrcweir     }
1151cdf0e10cSrcweir     else if ( aRight.IsChecked() )
1152cdf0e10cSrcweir     {
1153cdf0e10cSrcweir         eAdjust = SVX_ADJUST_RIGHT;
1154cdf0e10cSrcweir         bAdj = !aRight.GetSavedValue();
1155cdf0e10cSrcweir         bChecked = sal_True;
1156cdf0e10cSrcweir     }
1157cdf0e10cSrcweir     else if ( aCenter.IsChecked() )
1158cdf0e10cSrcweir     {
1159cdf0e10cSrcweir         eAdjust = SVX_ADJUST_CENTER;
1160cdf0e10cSrcweir         bAdj = !aCenter.GetSavedValue();
1161cdf0e10cSrcweir         bChecked = sal_True;
1162cdf0e10cSrcweir     }
1163cdf0e10cSrcweir     else if ( aJustify.IsChecked() )
1164cdf0e10cSrcweir     {
1165cdf0e10cSrcweir         eAdjust = SVX_ADJUST_BLOCK;
1166cdf0e10cSrcweir         bAdj = !aJustify.GetSavedValue() ||
1167cdf0e10cSrcweir             aExpandCB.IsChecked() != aExpandCB.GetSavedValue() ||
1168cdf0e10cSrcweir             aLastLineLB.GetSelectEntryPos() != aLastLineLB.GetSavedValue();
1169cdf0e10cSrcweir         bChecked = sal_True;
1170cdf0e10cSrcweir     }
1171cdf0e10cSrcweir     sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir     if ( bAdj )
1174cdf0e10cSrcweir     {
1175cdf0e10cSrcweir         const SvxAdjustItem* pOld =
1176cdf0e10cSrcweir             (const SvxAdjustItem*)GetOldItem( rOutSet, SID_ATTR_PARA_ADJUST );
1177cdf0e10cSrcweir         SvxAdjust eOneWord = aExpandCB.IsChecked() ? SVX_ADJUST_BLOCK
1178cdf0e10cSrcweir                                                    : SVX_ADJUST_LEFT;
1179cdf0e10cSrcweir         sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos();
1180cdf0e10cSrcweir         SvxAdjust eLastBlock = SVX_ADJUST_LEFT;
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir         if ( 1 == nLBPos )
1183cdf0e10cSrcweir             eLastBlock = SVX_ADJUST_CENTER;
1184cdf0e10cSrcweir         else if ( 2 == nLBPos )
1185cdf0e10cSrcweir             eLastBlock = SVX_ADJUST_BLOCK;
1186cdf0e10cSrcweir 
1187cdf0e10cSrcweir         FASTBOOL bNothingWasChecked =
1188cdf0e10cSrcweir             !aLeft.GetSavedValue() && !aRight.GetSavedValue() &&
1189cdf0e10cSrcweir             !aCenter.GetSavedValue() && !aJustify.GetSavedValue();
1190cdf0e10cSrcweir 
1191cdf0e10cSrcweir         if ( !pOld || pOld->GetAdjust() != eAdjust ||
1192cdf0e10cSrcweir              pOld->GetOneWord() != eOneWord ||
1193cdf0e10cSrcweir              pOld->GetLastBlock() != eLastBlock ||
1194cdf0e10cSrcweir              ( bChecked && bNothingWasChecked ) )
1195cdf0e10cSrcweir         {
1196cdf0e10cSrcweir             bModified |= sal_True;
1197cdf0e10cSrcweir             SvxAdjustItem aAdj(
1198cdf0e10cSrcweir                 (const SvxAdjustItem&)GetItemSet().Get( _nWhich ) );
1199cdf0e10cSrcweir             aAdj.SetAdjust( eAdjust );
1200cdf0e10cSrcweir             aAdj.SetOneWord( eOneWord );
1201cdf0e10cSrcweir             aAdj.SetLastBlock( eLastBlock );
1202cdf0e10cSrcweir             rOutSet.Put( aAdj );
1203cdf0e10cSrcweir         }
1204cdf0e10cSrcweir     }
1205cdf0e10cSrcweir     if(aSnapToGridCB.IsChecked() != aSnapToGridCB.GetSavedValue())
1206cdf0e10cSrcweir     {
1207cdf0e10cSrcweir         rOutSet.Put(SvxParaGridItem(aSnapToGridCB.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID )));
1208cdf0e10cSrcweir         bModified = sal_True;
1209cdf0e10cSrcweir     }
1210cdf0e10cSrcweir     if(aVertAlignLB.GetSavedValue() != aVertAlignLB.GetSelectEntryPos())
1211cdf0e10cSrcweir     {
1212cdf0e10cSrcweir         rOutSet.Put(SvxParaVertAlignItem(aVertAlignLB.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN )));
1213cdf0e10cSrcweir         bModified = sal_True;
1214cdf0e10cSrcweir     }
1215cdf0e10cSrcweir 
1216cdf0e10cSrcweir     if( aTextDirectionLB.IsVisible() )
1217cdf0e10cSrcweir     {
1218cdf0e10cSrcweir         SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue();
1219cdf0e10cSrcweir         if( eDir != aTextDirectionLB.GetSavedValue() )
1220cdf0e10cSrcweir         {
1221cdf0e10cSrcweir             rOutSet.Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
1222cdf0e10cSrcweir             bModified = sal_True;
1223cdf0e10cSrcweir         }
1224cdf0e10cSrcweir     }
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir     return bModified;
1227cdf0e10cSrcweir }
1228cdf0e10cSrcweir 
1229cdf0e10cSrcweir /*-----------------16.01.97 19.33-------------------
1230cdf0e10cSrcweir 
1231cdf0e10cSrcweir --------------------------------------------------*/
Reset(const SfxItemSet & rSet)1232cdf0e10cSrcweir void SvxParaAlignTabPage::Reset( const SfxItemSet& rSet )
1233cdf0e10cSrcweir {
1234cdf0e10cSrcweir     sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
1235cdf0e10cSrcweir     SfxItemState eItemState = rSet.GetItemState( _nWhich );
1236cdf0e10cSrcweir 
1237cdf0e10cSrcweir     sal_uInt16 nLBSelect = 0;
1238cdf0e10cSrcweir     if ( eItemState >= SFX_ITEM_AVAILABLE )
1239cdf0e10cSrcweir     {
1240cdf0e10cSrcweir         const SvxAdjustItem& rAdj = (const SvxAdjustItem&)rSet.Get( _nWhich );
1241cdf0e10cSrcweir 
1242cdf0e10cSrcweir         switch ( rAdj.GetAdjust() /*!!! VB fragen rAdj.GetLastBlock()*/ )
1243cdf0e10cSrcweir         {
1244cdf0e10cSrcweir             case SVX_ADJUST_LEFT: aLeft.Check(); break;
1245cdf0e10cSrcweir 
1246cdf0e10cSrcweir             case SVX_ADJUST_RIGHT: aRight.Check(); break;
1247cdf0e10cSrcweir 
1248cdf0e10cSrcweir             case SVX_ADJUST_CENTER: aCenter.Check(); break;
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir             case SVX_ADJUST_BLOCK: aJustify.Check(); break;
1251cdf0e10cSrcweir             default: ; //prevent warning
1252cdf0e10cSrcweir         }
1253cdf0e10cSrcweir         sal_Bool bEnable = aJustify.IsChecked();
1254cdf0e10cSrcweir         aLastLineFT.Enable(bEnable);
1255cdf0e10cSrcweir         aLastLineLB.Enable(bEnable);
1256cdf0e10cSrcweir         aExpandCB  .Enable(bEnable);
1257cdf0e10cSrcweir 
1258cdf0e10cSrcweir         aExpandCB.Check(SVX_ADJUST_BLOCK == rAdj.GetOneWord());
1259cdf0e10cSrcweir         switch(rAdj.GetLastBlock())
1260cdf0e10cSrcweir         {
1261cdf0e10cSrcweir             case SVX_ADJUST_LEFT:  nLBSelect = 0; break;
1262cdf0e10cSrcweir 
1263cdf0e10cSrcweir             case SVX_ADJUST_CENTER: nLBSelect = 1;  break;
1264cdf0e10cSrcweir 
1265cdf0e10cSrcweir             case SVX_ADJUST_BLOCK: nLBSelect = 2;  break;
1266cdf0e10cSrcweir             default: ; //prevent warning
1267cdf0e10cSrcweir         }
1268cdf0e10cSrcweir     }
1269cdf0e10cSrcweir     else
1270cdf0e10cSrcweir     {
1271cdf0e10cSrcweir         aLeft.Check( sal_False );
1272cdf0e10cSrcweir         aRight.Check( sal_False );
1273cdf0e10cSrcweir         aCenter.Check( sal_False );
1274cdf0e10cSrcweir         aJustify.Check( sal_False );
1275cdf0e10cSrcweir     }
1276cdf0e10cSrcweir     aLastLineLB.SelectEntryPos(nLBSelect);
1277cdf0e10cSrcweir 
1278cdf0e10cSrcweir     sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet);
1279cdf0e10cSrcweir     if(nHtmlMode & HTMLMODE_ON)
1280cdf0e10cSrcweir     {
1281cdf0e10cSrcweir         aLastLineLB.Hide();
1282cdf0e10cSrcweir         aLastLineFT.Hide();
1283cdf0e10cSrcweir         aExpandCB.Hide();
1284cdf0e10cSrcweir         if(!(nHtmlMode & (HTMLMODE_FULL_STYLES|HTMLMODE_FIRSTLINE)) )
1285cdf0e10cSrcweir             aJustify.Disable();
1286cdf0e10cSrcweir         aSnapToGridCB.Show(sal_False);
1287cdf0e10cSrcweir     }
1288cdf0e10cSrcweir     _nWhich = GetWhich(SID_ATTR_PARA_SNAPTOGRID);
1289cdf0e10cSrcweir     eItemState = rSet.GetItemState( _nWhich );
1290cdf0e10cSrcweir     if ( eItemState >= SFX_ITEM_AVAILABLE )
1291cdf0e10cSrcweir     {
1292cdf0e10cSrcweir         const SvxParaGridItem& rSnap = (const SvxParaGridItem&)rSet.Get( _nWhich );
1293cdf0e10cSrcweir         aSnapToGridCB.Check(rSnap.GetValue());
1294cdf0e10cSrcweir     }
1295cdf0e10cSrcweir 
1296cdf0e10cSrcweir     _nWhich = GetWhich( SID_PARA_VERTALIGN );
1297cdf0e10cSrcweir     eItemState = rSet.GetItemState( _nWhich );
1298cdf0e10cSrcweir 
1299cdf0e10cSrcweir     if ( eItemState >= SFX_ITEM_AVAILABLE )
1300cdf0e10cSrcweir     {
1301cdf0e10cSrcweir         aVertAlignLB.Show();
1302cdf0e10cSrcweir         aVertAlignFL.Show();
1303cdf0e10cSrcweir         aVertAlignFT.Show();
1304cdf0e10cSrcweir 
1305cdf0e10cSrcweir         const SvxParaVertAlignItem& rAlign = (const SvxParaVertAlignItem&)rSet.Get( _nWhich );
1306cdf0e10cSrcweir         aVertAlignLB.SelectEntryPos(rAlign.GetValue());
1307cdf0e10cSrcweir     }
1308cdf0e10cSrcweir 
1309cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
1310cdf0e10cSrcweir     //text direction
1311cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( _nWhich ) )
1312cdf0e10cSrcweir     {
1313cdf0e10cSrcweir         const SvxFrameDirectionItem& rFrameDirItem = ( const SvxFrameDirectionItem& ) rSet.Get( _nWhich );
1314cdf0e10cSrcweir         aTextDirectionLB.SelectEntryValue( (SvxFrameDirection)rFrameDirItem.GetValue() );
1315cdf0e10cSrcweir         aTextDirectionLB.SaveValue();
1316cdf0e10cSrcweir     }
1317cdf0e10cSrcweir 
1318cdf0e10cSrcweir     aSnapToGridCB.SaveValue();
1319cdf0e10cSrcweir     aVertAlignLB.SaveValue();
1320cdf0e10cSrcweir     aLeft.SaveValue();
1321cdf0e10cSrcweir     aRight.SaveValue();
1322cdf0e10cSrcweir     aCenter.SaveValue();
1323cdf0e10cSrcweir     aJustify.SaveValue();
1324cdf0e10cSrcweir     aLastLineLB.SaveValue();
1325cdf0e10cSrcweir     aExpandCB.SaveValue();
1326cdf0e10cSrcweir 
1327cdf0e10cSrcweir     UpdateExample_Impl(sal_True);
1328cdf0e10cSrcweir }
1329cdf0e10cSrcweir 
1330cdf0e10cSrcweir /*-----------------17.01.97 08.06-------------------
1331cdf0e10cSrcweir 
1332cdf0e10cSrcweir --------------------------------------------------*/
IMPL_LINK(SvxParaAlignTabPage,AlignHdl_Impl,RadioButton *,EMPTYARG)1333cdf0e10cSrcweir IMPL_LINK( SvxParaAlignTabPage, AlignHdl_Impl, RadioButton*, EMPTYARG )
1334cdf0e10cSrcweir {
1335cdf0e10cSrcweir     sal_Bool bJustify = aJustify.IsChecked();
1336cdf0e10cSrcweir     aLastLineFT.Enable(bJustify);
1337cdf0e10cSrcweir     aLastLineLB.Enable(bJustify);
1338cdf0e10cSrcweir     aExpandCB.Enable(bJustify);
1339cdf0e10cSrcweir     UpdateExample_Impl(sal_False);
1340cdf0e10cSrcweir     return 0;
1341cdf0e10cSrcweir }
1342cdf0e10cSrcweir 
IMPL_LINK(SvxParaAlignTabPage,LastLineHdl_Impl,ListBox *,EMPTYARG)1343cdf0e10cSrcweir IMPL_LINK( SvxParaAlignTabPage, LastLineHdl_Impl, ListBox*, EMPTYARG )
1344cdf0e10cSrcweir {
1345cdf0e10cSrcweir     UpdateExample_Impl(sal_False);
1346cdf0e10cSrcweir     return 0;
1347cdf0e10cSrcweir }
1348cdf0e10cSrcweir 
IMPL_LINK(SvxParaAlignTabPage,TextDirectionHdl_Impl,ListBox *,EMPTYARG)1349cdf0e10cSrcweir IMPL_LINK( SvxParaAlignTabPage, TextDirectionHdl_Impl, ListBox*, EMPTYARG )
1350cdf0e10cSrcweir {
1351cdf0e10cSrcweir     SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue();
1352cdf0e10cSrcweir     switch ( eDir )
1353cdf0e10cSrcweir     {
1354cdf0e10cSrcweir         // check the default alignment for this text direction
1355cdf0e10cSrcweir         case FRMDIR_HORI_LEFT_TOP :     aLeft.Check( sal_True ); break;
1356cdf0e10cSrcweir         case FRMDIR_HORI_RIGHT_TOP :    aRight.Check( sal_True ); break;
1357cdf0e10cSrcweir         case FRMDIR_ENVIRONMENT :       /* do nothing */ break;
1358cdf0e10cSrcweir         default:
1359cdf0e10cSrcweir         {
1360cdf0e10cSrcweir             DBG_ERRORFILE( "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" );
1361cdf0e10cSrcweir         }
1362cdf0e10cSrcweir     }
1363cdf0e10cSrcweir 
1364cdf0e10cSrcweir     return 0;
1365cdf0e10cSrcweir }
1366cdf0e10cSrcweir 
1367cdf0e10cSrcweir /*-----------------16.01.97 19.34-------------------
1368cdf0e10cSrcweir 
1369cdf0e10cSrcweir --------------------------------------------------*/
UpdateExample_Impl(sal_Bool bAll)1370cdf0e10cSrcweir void    SvxParaAlignTabPage::UpdateExample_Impl( sal_Bool bAll )
1371cdf0e10cSrcweir {
1372cdf0e10cSrcweir     if ( aLeft.IsChecked() )
1373cdf0e10cSrcweir         aExampleWin.SetAdjust( SVX_ADJUST_LEFT );
1374cdf0e10cSrcweir     else if ( aRight.IsChecked() )
1375cdf0e10cSrcweir         aExampleWin.SetAdjust( SVX_ADJUST_RIGHT );
1376cdf0e10cSrcweir     else if ( aCenter.IsChecked() )
1377cdf0e10cSrcweir         aExampleWin.SetAdjust( SVX_ADJUST_CENTER );
1378cdf0e10cSrcweir     else if ( aJustify.IsChecked() )
1379cdf0e10cSrcweir     {
1380cdf0e10cSrcweir         aExampleWin.SetAdjust( SVX_ADJUST_BLOCK );
1381cdf0e10cSrcweir         SvxAdjust eLastBlock = SVX_ADJUST_LEFT;
1382cdf0e10cSrcweir         sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos();
1383cdf0e10cSrcweir         if(nLBPos == 1)
1384cdf0e10cSrcweir             eLastBlock = SVX_ADJUST_CENTER;
1385cdf0e10cSrcweir         else if(nLBPos == 2)
1386cdf0e10cSrcweir             eLastBlock = SVX_ADJUST_BLOCK;
1387cdf0e10cSrcweir         aExampleWin.SetLastLine( eLastBlock );
1388cdf0e10cSrcweir     }
1389cdf0e10cSrcweir 
1390cdf0e10cSrcweir     aExampleWin.Draw( bAll );
1391cdf0e10cSrcweir }
1392cdf0e10cSrcweir /*-----------------17.01.97 08.04-------------------
1393cdf0e10cSrcweir     Erweiterungen fuer den Blocksatz einschalten
1394cdf0e10cSrcweir --------------------------------------------------*/
EnableJustifyExt()1395cdf0e10cSrcweir void SvxParaAlignTabPage::EnableJustifyExt()
1396cdf0e10cSrcweir {
1397cdf0e10cSrcweir     aLastLineFT.Show();
1398cdf0e10cSrcweir     aLastLineLB.Show();
1399cdf0e10cSrcweir     aExpandCB  .Show();
1400cdf0e10cSrcweir     SvtLanguageOptions aCJKOptions;
1401cdf0e10cSrcweir     if(aCJKOptions.IsAsianTypographyEnabled())
1402cdf0e10cSrcweir         aSnapToGridCB.Show();
1403cdf0e10cSrcweir 
1404cdf0e10cSrcweir }
1405cdf0e10cSrcweir //add CHINA001 begin
PageCreated(SfxAllItemSet aSet)1406cdf0e10cSrcweir void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet)
1407cdf0e10cSrcweir {
1408cdf0e10cSrcweir     SFX_ITEMSET_ARG (&aSet,pBoolItem,SfxBoolItem,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_False);
1409cdf0e10cSrcweir     if (pBoolItem)
1410cdf0e10cSrcweir         if(pBoolItem->GetValue())
1411cdf0e10cSrcweir             EnableJustifyExt();
1412cdf0e10cSrcweir }
1413cdf0e10cSrcweir //end of CHINA001
1414cdf0e10cSrcweir // class SvxExtParagraphTabPage ------------------------------------------
1415cdf0e10cSrcweir 
Create(Window * pParent,const SfxItemSet & rSet)1416cdf0e10cSrcweir SfxTabPage* SvxExtParagraphTabPage::Create( Window* pParent,
1417cdf0e10cSrcweir                                             const SfxItemSet& rSet )
1418cdf0e10cSrcweir {
1419cdf0e10cSrcweir     return new SvxExtParagraphTabPage( pParent, rSet );
1420cdf0e10cSrcweir }
1421cdf0e10cSrcweir 
1422cdf0e10cSrcweir // -----------------------------------------------------------------------
1423cdf0e10cSrcweir 
FillItemSet(SfxItemSet & rOutSet)1424cdf0e10cSrcweir sal_Bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
1425cdf0e10cSrcweir {
1426cdf0e10cSrcweir     sal_Bool bModified = sal_False;
1427cdf0e10cSrcweir     sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
1428cdf0e10cSrcweir     const TriState eHyphenState = aHyphenBox.GetState();
1429cdf0e10cSrcweir     const SfxPoolItem* pOld = GetOldItem( rOutSet, SID_ATTR_PARA_HYPHENZONE );
1430cdf0e10cSrcweir 
1431cdf0e10cSrcweir     if ( eHyphenState != aHyphenBox.GetSavedValue()     ||
1432cdf0e10cSrcweir          aExtHyphenBeforeBox.IsValueModified()          ||
1433cdf0e10cSrcweir          aExtHyphenAfterBox.IsValueModified()           ||
1434cdf0e10cSrcweir          aMaxHyphenEdit.IsValueModified() )
1435cdf0e10cSrcweir     {
1436cdf0e10cSrcweir         SvxHyphenZoneItem aHyphen(
1437cdf0e10cSrcweir             (const SvxHyphenZoneItem&)GetItemSet().Get( _nWhich ) );
1438cdf0e10cSrcweir         aHyphen.SetHyphen( eHyphenState == STATE_CHECK );
1439cdf0e10cSrcweir 
1440cdf0e10cSrcweir         if ( eHyphenState == STATE_CHECK )
1441cdf0e10cSrcweir         {
1442cdf0e10cSrcweir             aHyphen.GetMinLead() = (sal_uInt8)aExtHyphenBeforeBox.GetValue();
1443cdf0e10cSrcweir             aHyphen.GetMinTrail() = (sal_uInt8)aExtHyphenAfterBox.GetValue();
1444cdf0e10cSrcweir         }
1445cdf0e10cSrcweir         aHyphen.GetMaxHyphens() = (sal_uInt8)aMaxHyphenEdit.GetValue();
1446cdf0e10cSrcweir 
1447cdf0e10cSrcweir         if ( !pOld ||
1448cdf0e10cSrcweir             !( *(SvxHyphenZoneItem*)pOld == aHyphen ) ||
1449cdf0e10cSrcweir                 eHyphenState != aHyphenBox.GetSavedValue())
1450cdf0e10cSrcweir         {
1451cdf0e10cSrcweir             rOutSet.Put( aHyphen );
1452cdf0e10cSrcweir             bModified |= sal_True;
1453cdf0e10cSrcweir         }
1454cdf0e10cSrcweir     }
1455cdf0e10cSrcweir 
1456cdf0e10cSrcweir     if (aPagenumEdit.IsEnabled() && aPagenumEdit.IsValueModified())
1457cdf0e10cSrcweir     {
1458cdf0e10cSrcweir         SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM,
1459cdf0e10cSrcweir                                 (sal_uInt16)aPagenumEdit.GetValue() );
1460cdf0e10cSrcweir 
1461cdf0e10cSrcweir         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGENUM );
1462cdf0e10cSrcweir 
1463cdf0e10cSrcweir         if ( !pOld || ( (const SfxUInt16Item*)pOld )->GetValue() != aPageNum.GetValue() )
1464cdf0e10cSrcweir         {
1465cdf0e10cSrcweir             rOutSet.Put( aPageNum );
1466cdf0e10cSrcweir             bModified |= sal_True;
1467cdf0e10cSrcweir         }
1468cdf0e10cSrcweir     }
1469cdf0e10cSrcweir 
1470cdf0e10cSrcweir     // Seitenumbruch
1471cdf0e10cSrcweir 
1472cdf0e10cSrcweir     TriState eState = aApplyCollBtn.GetState();
1473cdf0e10cSrcweir     FASTBOOL bIsPageModel = sal_False;
1474cdf0e10cSrcweir 
1475cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1476cdf0e10cSrcweir     String sPage;
1477cdf0e10cSrcweir     if ( eState != aApplyCollBtn.GetSavedValue() ||
1478cdf0e10cSrcweir          ( STATE_CHECK == eState &&
1479cdf0e10cSrcweir            aApplyCollBox.GetSelectEntryPos() != aApplyCollBox.GetSavedValue() ) )
1480cdf0e10cSrcweir     {
1481cdf0e10cSrcweir         if ( eState == STATE_CHECK )
1482cdf0e10cSrcweir         {
1483cdf0e10cSrcweir             sPage = aApplyCollBox.GetSelectEntry();
1484cdf0e10cSrcweir             bIsPageModel = 0 != sPage.Len();
1485cdf0e10cSrcweir         }
1486cdf0e10cSrcweir         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_MODEL );
1487cdf0e10cSrcweir 
1488cdf0e10cSrcweir         if ( !pOld || ( (const SvxPageModelItem*)pOld )->GetValue() != sPage )
1489cdf0e10cSrcweir         {
1490cdf0e10cSrcweir             rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) );
1491cdf0e10cSrcweir             bModified |= sal_True;
1492cdf0e10cSrcweir         }
1493cdf0e10cSrcweir         else
1494cdf0e10cSrcweir             bIsPageModel = sal_False;
1495cdf0e10cSrcweir     }
1496cdf0e10cSrcweir     else if(STATE_CHECK == eState && aApplyCollBtn.IsEnabled())
1497cdf0e10cSrcweir         bIsPageModel = sal_True;
1498cdf0e10cSrcweir     else
1499cdf0e10cSrcweir         rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) );
1500cdf0e10cSrcweir 
1501cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1502cdf0e10cSrcweir 
1503cdf0e10cSrcweir     if ( bIsPageModel )
1504cdf0e10cSrcweir         // wird PageModel eingeschaltet, dann immer PageBreak ausschalten
1505cdf0e10cSrcweir         rOutSet.Put( SvxFmtBreakItem( SVX_BREAK_NONE, _nWhich ) );
1506cdf0e10cSrcweir     else
1507cdf0e10cSrcweir     {
1508cdf0e10cSrcweir         eState = aPageBreakBox.GetState();
1509cdf0e10cSrcweir         SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, sal_False);
1510cdf0e10cSrcweir 
1511cdf0e10cSrcweir         if ( (eModelState == SFX_ITEM_SET && STATE_CHECK == aPageBreakBox.GetState()) ||
1512cdf0e10cSrcweir              eState != aPageBreakBox.GetSavedValue()                ||
1513cdf0e10cSrcweir              aBreakTypeLB.GetSelectEntryPos() != aBreakTypeLB.GetSavedValue()   ||
1514cdf0e10cSrcweir              aBreakPositionLB.GetSelectEntryPos() != aBreakPositionLB.GetSavedValue() )
1515cdf0e10cSrcweir         {
1516cdf0e10cSrcweir             const SvxFmtBreakItem rOldBreak(
1517cdf0e10cSrcweir                     (const SvxFmtBreakItem&)GetItemSet().Get( _nWhich ));
1518cdf0e10cSrcweir             SvxFmtBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which());
1519cdf0e10cSrcweir 
1520cdf0e10cSrcweir             switch ( eState )
1521cdf0e10cSrcweir             {
1522cdf0e10cSrcweir                 case STATE_CHECK:
1523cdf0e10cSrcweir                 {
1524cdf0e10cSrcweir                     sal_Bool bBefore = aBreakPositionLB.GetSelectEntryPos() == 0;
1525cdf0e10cSrcweir 
1526cdf0e10cSrcweir                     if ( aBreakTypeLB.GetSelectEntryPos() == 0 )
1527cdf0e10cSrcweir                     {
1528cdf0e10cSrcweir                         if ( bBefore )
1529cdf0e10cSrcweir                             aBreak.SetValue( SVX_BREAK_PAGE_BEFORE );
1530cdf0e10cSrcweir                         else
1531cdf0e10cSrcweir                             aBreak.SetValue( SVX_BREAK_PAGE_AFTER );
1532cdf0e10cSrcweir                     }
1533cdf0e10cSrcweir                     else
1534cdf0e10cSrcweir                     {
1535cdf0e10cSrcweir                         if ( bBefore )
1536cdf0e10cSrcweir                             aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE );
1537cdf0e10cSrcweir                         else
1538cdf0e10cSrcweir                             aBreak.SetValue( SVX_BREAK_COLUMN_AFTER );
1539cdf0e10cSrcweir                     }
1540cdf0e10cSrcweir                     break;
1541cdf0e10cSrcweir                 }
1542cdf0e10cSrcweir 
1543cdf0e10cSrcweir                 case STATE_NOCHECK:
1544cdf0e10cSrcweir                     aBreak.SetValue( SVX_BREAK_NONE );
1545cdf0e10cSrcweir                     break;
1546cdf0e10cSrcweir                 default: ; //prevent warning
1547cdf0e10cSrcweir             }
1548cdf0e10cSrcweir             pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGEBREAK );
1549cdf0e10cSrcweir 
1550cdf0e10cSrcweir             if ( eState != aPageBreakBox.GetSavedValue()                ||
1551cdf0e10cSrcweir                     !pOld || !( *(const SvxFmtBreakItem*)pOld == aBreak ) )
1552cdf0e10cSrcweir             {
1553cdf0e10cSrcweir                 bModified |= sal_True;
1554cdf0e10cSrcweir                 rOutSet.Put( aBreak );
1555cdf0e10cSrcweir             }
1556cdf0e10cSrcweir         }
1557cdf0e10cSrcweir     }
1558cdf0e10cSrcweir 
1559cdf0e10cSrcweir 
1560cdf0e10cSrcweir     // Absatztrennung
1561cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1562cdf0e10cSrcweir     eState = aKeepTogetherBox.GetState();
1563cdf0e10cSrcweir 
1564cdf0e10cSrcweir     if ( eState != aKeepTogetherBox.GetSavedValue() )
1565cdf0e10cSrcweir     {
1566cdf0e10cSrcweir         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_SPLIT );
1567cdf0e10cSrcweir 
1568cdf0e10cSrcweir         if ( !pOld || ( (const SvxFmtSplitItem*)pOld )->GetValue() !=
1569cdf0e10cSrcweir                       ( eState == STATE_NOCHECK ) )
1570cdf0e10cSrcweir         {
1571cdf0e10cSrcweir             rOutSet.Put( SvxFmtSplitItem( eState == STATE_NOCHECK, _nWhich ) );
1572cdf0e10cSrcweir             bModified |= sal_True;
1573cdf0e10cSrcweir         }
1574cdf0e10cSrcweir     }
1575cdf0e10cSrcweir 
1576cdf0e10cSrcweir     // Absaetze zusammenhalten
1577cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1578cdf0e10cSrcweir     eState = aKeepParaBox.GetState();
1579cdf0e10cSrcweir 
1580cdf0e10cSrcweir     if ( eState != aKeepParaBox.GetSavedValue() )
1581cdf0e10cSrcweir     {
1582cdf0e10cSrcweir         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_KEEP );
1583cdf0e10cSrcweir 
1584cdf0e10cSrcweir         // hat sich der Status geaendert, muss immer geputtet werden
1585cdf0e10cSrcweir         rOutSet.Put( SvxFmtKeepItem( eState == STATE_CHECK, _nWhich ) );
1586cdf0e10cSrcweir         bModified |= sal_True;
1587cdf0e10cSrcweir     }
1588cdf0e10cSrcweir 
1589cdf0e10cSrcweir     // Witwen und Waisen
1590cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1591cdf0e10cSrcweir     eState = aWidowBox.GetState();
1592cdf0e10cSrcweir 
1593cdf0e10cSrcweir     if ( eState != aWidowBox.GetSavedValue() ||
1594cdf0e10cSrcweir          aWidowRowNo.IsValueModified() )
1595cdf0e10cSrcweir     {
1596cdf0e10cSrcweir         SvxWidowsItem rItem( eState == STATE_CHECK ?
1597cdf0e10cSrcweir                              (sal_uInt8)aWidowRowNo.GetValue() : 0, _nWhich );
1598cdf0e10cSrcweir         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_WIDOWS );
1599cdf0e10cSrcweir 
1600cdf0e10cSrcweir         if ( eState != aWidowBox.GetSavedValue() || !pOld || !( *(const SvxWidowsItem*)pOld == rItem ) )
1601cdf0e10cSrcweir         {
1602cdf0e10cSrcweir             rOutSet.Put( rItem );
1603cdf0e10cSrcweir             bModified |= sal_True;
1604cdf0e10cSrcweir         }
1605cdf0e10cSrcweir     }
1606cdf0e10cSrcweir 
1607cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1608cdf0e10cSrcweir     eState = aOrphanBox.GetState();
1609cdf0e10cSrcweir 
1610cdf0e10cSrcweir     if ( eState != aOrphanBox.GetSavedValue() ||
1611cdf0e10cSrcweir          aOrphanRowNo.IsValueModified() )
1612cdf0e10cSrcweir     {
1613cdf0e10cSrcweir         SvxOrphansItem rItem( eState == STATE_CHECK ?
1614cdf0e10cSrcweir                              (sal_uInt8)aOrphanRowNo.GetValue() : 0, _nWhich );
1615cdf0e10cSrcweir         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_ORPHANS );
1616cdf0e10cSrcweir 
1617cdf0e10cSrcweir         if ( eState != aOrphanBox.GetSavedValue() ||
1618cdf0e10cSrcweir                 !pOld ||
1619cdf0e10cSrcweir                     !( *(const SvxOrphansItem*)pOld == rItem ) )
1620cdf0e10cSrcweir         {
1621cdf0e10cSrcweir             rOutSet.Put( rItem );
1622cdf0e10cSrcweir             bModified |= sal_True;
1623cdf0e10cSrcweir         }
1624cdf0e10cSrcweir     }
1625cdf0e10cSrcweir 
1626cdf0e10cSrcweir     return bModified;
1627cdf0e10cSrcweir }
1628cdf0e10cSrcweir 
1629cdf0e10cSrcweir // -----------------------------------------------------------------------
1630cdf0e10cSrcweir 
Reset(const SfxItemSet & rSet)1631cdf0e10cSrcweir void SvxExtParagraphTabPage::Reset( const SfxItemSet& rSet )
1632cdf0e10cSrcweir {
1633cdf0e10cSrcweir     sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
1634cdf0e10cSrcweir     SfxItemState eItemState = rSet.GetItemState( _nWhich );
1635cdf0e10cSrcweir 
1636cdf0e10cSrcweir     sal_Bool bItemAvailable = eItemState >= SFX_ITEM_AVAILABLE;
1637cdf0e10cSrcweir     sal_Bool bIsHyphen = sal_False;
1638cdf0e10cSrcweir     if( !bHtmlMode && bItemAvailable )
1639cdf0e10cSrcweir     {
1640cdf0e10cSrcweir         const SvxHyphenZoneItem& rHyphen =
1641cdf0e10cSrcweir             (const SvxHyphenZoneItem&)rSet.Get( _nWhich );
1642cdf0e10cSrcweir         aHyphenBox.EnableTriState( sal_False );
1643cdf0e10cSrcweir 
1644cdf0e10cSrcweir         bIsHyphen = rHyphen.IsHyphen();
1645cdf0e10cSrcweir         aHyphenBox.SetState( bIsHyphen ? STATE_CHECK : STATE_NOCHECK );
1646cdf0e10cSrcweir 
1647cdf0e10cSrcweir         aExtHyphenBeforeBox.SetValue( rHyphen.GetMinLead() );
1648cdf0e10cSrcweir         aExtHyphenAfterBox.SetValue( rHyphen.GetMinTrail() );
1649cdf0e10cSrcweir         aMaxHyphenEdit.SetValue( rHyphen.GetMaxHyphens() );
1650cdf0e10cSrcweir     }
1651cdf0e10cSrcweir     else
1652cdf0e10cSrcweir     {
1653cdf0e10cSrcweir         aHyphenBox.SetState( STATE_DONTKNOW );
1654cdf0e10cSrcweir     }
1655cdf0e10cSrcweir     sal_Bool bEnable = bItemAvailable && bIsHyphen;
1656cdf0e10cSrcweir     aExtHyphenBeforeBox.Enable(bEnable);
1657cdf0e10cSrcweir     aExtHyphenAfterBox.Enable(bEnable);
1658cdf0e10cSrcweir     aBeforeText.Enable(bEnable);
1659cdf0e10cSrcweir     aAfterText.Enable(bEnable);
1660cdf0e10cSrcweir     aMaxHyphenLabel.Enable(bEnable);
1661cdf0e10cSrcweir     aMaxHyphenEdit.Enable(bEnable);
1662cdf0e10cSrcweir 
1663cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM );
1664cdf0e10cSrcweir 
1665cdf0e10cSrcweir     if ( rSet.GetItemState(_nWhich) >= SFX_ITEM_AVAILABLE )
1666cdf0e10cSrcweir     {
1667cdf0e10cSrcweir         const sal_uInt16 nPageNum =
1668cdf0e10cSrcweir             ( (const SfxUInt16Item&)rSet.Get( _nWhich ) ).GetValue();
1669cdf0e10cSrcweir         aPagenumEdit.SetValue( nPageNum );
1670cdf0e10cSrcweir     }
1671cdf0e10cSrcweir 
1672cdf0e10cSrcweir     if ( bPageBreak )
1673cdf0e10cSrcweir     {
1674cdf0e10cSrcweir         // zuerst PageModel behandeln
1675cdf0e10cSrcweir         _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
1676cdf0e10cSrcweir         sal_Bool bIsPageModel = sal_False;
1677cdf0e10cSrcweir         eItemState = rSet.GetItemState( _nWhich );
1678cdf0e10cSrcweir 
1679cdf0e10cSrcweir         if ( eItemState >= SFX_ITEM_SET )
1680cdf0e10cSrcweir         {
1681cdf0e10cSrcweir             aApplyCollBtn.EnableTriState( sal_False );
1682cdf0e10cSrcweir 
1683cdf0e10cSrcweir             const SvxPageModelItem& rModel =
1684cdf0e10cSrcweir                 (const SvxPageModelItem&)rSet.Get( _nWhich );
1685cdf0e10cSrcweir             String aStr( rModel.GetValue() );
1686cdf0e10cSrcweir 
1687cdf0e10cSrcweir             if ( aStr.Len() &&
1688cdf0e10cSrcweir                  aApplyCollBox.GetEntryPos( aStr ) != LISTBOX_ENTRY_NOTFOUND )
1689cdf0e10cSrcweir             {
1690cdf0e10cSrcweir                 aApplyCollBox.SelectEntry( aStr );
1691cdf0e10cSrcweir                 aApplyCollBtn.SetState( STATE_CHECK );
1692cdf0e10cSrcweir                 bIsPageModel = sal_True;
1693cdf0e10cSrcweir 
1694cdf0e10cSrcweir                 aPageBreakBox.Enable();
1695cdf0e10cSrcweir                 aPageBreakBox.EnableTriState( sal_False );
1696cdf0e10cSrcweir                 aBreakTypeFT.Enable();
1697cdf0e10cSrcweir                 aBreakTypeLB.Enable();
1698cdf0e10cSrcweir                 aBreakPositionFT.Enable();
1699cdf0e10cSrcweir                 aBreakPositionLB.Enable();
1700cdf0e10cSrcweir                 aApplyCollBtn.Enable();
1701cdf0e10cSrcweir                 aPageBreakBox.SetState( STATE_CHECK );
1702cdf0e10cSrcweir 
1703cdf0e10cSrcweir                 //select page break
1704cdf0e10cSrcweir                 aBreakTypeLB.SelectEntryPos(0);
1705cdf0e10cSrcweir                 //select break before
1706cdf0e10cSrcweir                 aBreakPositionLB.SelectEntryPos(0);
1707cdf0e10cSrcweir             }
1708cdf0e10cSrcweir             else
1709cdf0e10cSrcweir             {
1710cdf0e10cSrcweir                 aApplyCollBox.SetNoSelection();
1711cdf0e10cSrcweir                 aApplyCollBtn.SetState( STATE_NOCHECK );
1712cdf0e10cSrcweir             }
1713cdf0e10cSrcweir         }
1714cdf0e10cSrcweir         else if ( SFX_ITEM_DONTCARE == eItemState )
1715cdf0e10cSrcweir         {
1716cdf0e10cSrcweir             aApplyCollBtn.EnableTriState( sal_True );
1717cdf0e10cSrcweir             aApplyCollBtn.SetState( STATE_DONTKNOW );
1718cdf0e10cSrcweir             aApplyCollBox.SetNoSelection();
1719cdf0e10cSrcweir         }
1720cdf0e10cSrcweir         else
1721cdf0e10cSrcweir         {
1722cdf0e10cSrcweir             aApplyCollBtn.Enable(sal_False);
1723cdf0e10cSrcweir             aApplyCollBox.Enable(sal_False);
1724cdf0e10cSrcweir             aPagenumEdit.Enable(sal_False);
1725cdf0e10cSrcweir             aPagenumText.Enable(sal_False);
1726cdf0e10cSrcweir         }
1727cdf0e10cSrcweir //!!!   ApplyCollClickHdl_Impl( &aApplyCollBtn );
1728cdf0e10cSrcweir 
1729cdf0e10cSrcweir         if ( !bIsPageModel )
1730cdf0e10cSrcweir         {
1731cdf0e10cSrcweir             _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
1732cdf0e10cSrcweir             eItemState = rSet.GetItemState( _nWhich );
1733cdf0e10cSrcweir 
1734cdf0e10cSrcweir             if ( eItemState >= SFX_ITEM_AVAILABLE )
1735cdf0e10cSrcweir             {
1736cdf0e10cSrcweir                 const SvxFmtBreakItem& rPageBreak =
1737cdf0e10cSrcweir                     (const SvxFmtBreakItem&)rSet.Get( _nWhich );
1738cdf0e10cSrcweir 
1739cdf0e10cSrcweir                 SvxBreak eBreak = (SvxBreak)rPageBreak.GetValue();
1740cdf0e10cSrcweir 
1741cdf0e10cSrcweir                 // PageBreak nicht ueber CTRL-RETURN,
1742cdf0e10cSrcweir                 // dann kann CheckBox frei gegeben werden
1743cdf0e10cSrcweir                 aPageBreakBox.Enable();
1744cdf0e10cSrcweir                 aPageBreakBox.EnableTriState( sal_False );
1745cdf0e10cSrcweir                 aBreakTypeFT.Enable();
1746cdf0e10cSrcweir                 aBreakTypeLB.Enable();
1747cdf0e10cSrcweir                 aBreakPositionFT.Enable();
1748cdf0e10cSrcweir                 aBreakPositionLB.Enable();
1749cdf0e10cSrcweir 
1750cdf0e10cSrcweir                 aPageBreakBox.SetState( STATE_CHECK );
1751cdf0e10cSrcweir 
1752cdf0e10cSrcweir                 sal_Bool _bEnable =     eBreak != SVX_BREAK_NONE &&
1753cdf0e10cSrcweir                                 eBreak != SVX_BREAK_COLUMN_BEFORE &&
1754cdf0e10cSrcweir                                 eBreak != SVX_BREAK_COLUMN_AFTER;
1755cdf0e10cSrcweir                 aApplyCollBtn.Enable(_bEnable);
1756cdf0e10cSrcweir                 if(!_bEnable)
1757cdf0e10cSrcweir                 {
1758cdf0e10cSrcweir                     aApplyCollBox.Enable(_bEnable);
1759cdf0e10cSrcweir                     aPagenumEdit.Enable(_bEnable);
1760cdf0e10cSrcweir                 }
1761cdf0e10cSrcweir 
1762cdf0e10cSrcweir                 if ( eBreak == SVX_BREAK_NONE )
1763cdf0e10cSrcweir                     aPageBreakBox.SetState( STATE_NOCHECK );
1764cdf0e10cSrcweir 
1765cdf0e10cSrcweir                 sal_uInt16 nType = 0; // selection position in break type ListBox : Page
1766cdf0e10cSrcweir                 sal_uInt16 nPosition = 0; //  selection position in break position ListBox : Before
1767cdf0e10cSrcweir                 switch ( eBreak )
1768cdf0e10cSrcweir                 {
1769cdf0e10cSrcweir                     case SVX_BREAK_PAGE_BEFORE:
1770cdf0e10cSrcweir                         break;
1771cdf0e10cSrcweir                     case SVX_BREAK_PAGE_AFTER:
1772cdf0e10cSrcweir                         nPosition = 1;
1773cdf0e10cSrcweir                         break;
1774cdf0e10cSrcweir                     case SVX_BREAK_COLUMN_BEFORE:
1775cdf0e10cSrcweir                         nType = 1;
1776cdf0e10cSrcweir                         break;
1777cdf0e10cSrcweir                     case SVX_BREAK_COLUMN_AFTER:
1778cdf0e10cSrcweir                         nType = 1;
1779cdf0e10cSrcweir                         nPosition = 1;
1780cdf0e10cSrcweir                         break;
1781cdf0e10cSrcweir                     default: ;//prevent warning
1782cdf0e10cSrcweir                 }
1783cdf0e10cSrcweir                 aBreakTypeLB.SelectEntryPos(nType);
1784cdf0e10cSrcweir                 aBreakPositionLB.SelectEntryPos(nPosition);
1785cdf0e10cSrcweir             }
1786cdf0e10cSrcweir             else if ( SFX_ITEM_DONTCARE == eItemState )
1787cdf0e10cSrcweir                 aPageBreakBox.SetState( STATE_DONTKNOW );
1788cdf0e10cSrcweir             else
1789cdf0e10cSrcweir             {
1790cdf0e10cSrcweir                 aPageBreakBox.Enable(sal_False);
1791cdf0e10cSrcweir                 aBreakTypeFT.Enable(sal_False);
1792cdf0e10cSrcweir                 aBreakTypeLB.Enable(sal_False);
1793cdf0e10cSrcweir                 aBreakPositionFT.Enable(sal_False);
1794cdf0e10cSrcweir                 aBreakPositionLB.Enable(sal_False);
1795cdf0e10cSrcweir             }
1796cdf0e10cSrcweir         }
1797cdf0e10cSrcweir 
1798cdf0e10cSrcweir         PageBreakPosHdl_Impl( &aBreakPositionLB );
1799cdf0e10cSrcweir         PageBreakHdl_Impl( &aPageBreakBox );
1800cdf0e10cSrcweir     }
1801cdf0e10cSrcweir 
1802cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
1803cdf0e10cSrcweir     eItemState = rSet.GetItemState( _nWhich );
1804cdf0e10cSrcweir 
1805cdf0e10cSrcweir     if ( eItemState >= SFX_ITEM_AVAILABLE )
1806cdf0e10cSrcweir     {
1807cdf0e10cSrcweir         aKeepParaBox.EnableTriState( sal_False );
1808cdf0e10cSrcweir         const SvxFmtKeepItem& rKeep =
1809cdf0e10cSrcweir             (const SvxFmtKeepItem&)rSet.Get( _nWhich );
1810cdf0e10cSrcweir 
1811cdf0e10cSrcweir         if ( rKeep.GetValue() )
1812cdf0e10cSrcweir             aKeepParaBox.SetState( STATE_CHECK );
1813cdf0e10cSrcweir         else
1814cdf0e10cSrcweir             aKeepParaBox.SetState( STATE_NOCHECK );
1815cdf0e10cSrcweir     }
1816cdf0e10cSrcweir     else if ( SFX_ITEM_DONTCARE == eItemState )
1817cdf0e10cSrcweir         aKeepParaBox.SetState( STATE_DONTKNOW );
1818cdf0e10cSrcweir     else
1819cdf0e10cSrcweir         aKeepParaBox.Enable(sal_False);
1820cdf0e10cSrcweir 
1821cdf0e10cSrcweir     _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
1822cdf0e10cSrcweir     eItemState = rSet.GetItemState( _nWhich );
1823cdf0e10cSrcweir 
1824cdf0e10cSrcweir     if ( eItemState >= SFX_ITEM_AVAILABLE )
1825cdf0e10cSrcweir     {
1826cdf0e10cSrcweir         const SvxFmtSplitItem& rSplit =
1827cdf0e10cSrcweir             (const SvxFmtSplitItem&)rSet.Get( _nWhich );
1828cdf0e10cSrcweir         aKeepTogetherBox.EnableTriState( sal_False );
1829cdf0e10cSrcweir 
1830cdf0e10cSrcweir         if ( !rSplit.GetValue() )
1831cdf0e10cSrcweir             aKeepTogetherBox.SetState( STATE_CHECK );
1832cdf0e10cSrcweir         else
1833cdf0e10cSrcweir         {
1834cdf0e10cSrcweir             aKeepTogetherBox.SetState( STATE_NOCHECK );
1835cdf0e10cSrcweir 
1836cdf0e10cSrcweir             // Witwen und Waisen
1837cdf0e10cSrcweir             aWidowBox.Enable();
1838cdf0e10cSrcweir             _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
1839cdf0e10cSrcweir             SfxItemState eTmpState = rSet.GetItemState( _nWhich );
1840cdf0e10cSrcweir 
1841cdf0e10cSrcweir             if ( eTmpState >= SFX_ITEM_AVAILABLE )
1842cdf0e10cSrcweir             {
1843cdf0e10cSrcweir                 const SvxWidowsItem& rWidow =
1844cdf0e10cSrcweir                     (const SvxWidowsItem&)rSet.Get( _nWhich );
1845cdf0e10cSrcweir                 aWidowBox.EnableTriState( sal_False );
1846cdf0e10cSrcweir                 const sal_uInt16 nLines = rWidow.GetValue();
1847cdf0e10cSrcweir 
1848cdf0e10cSrcweir                 sal_Bool _bEnable = nLines > 0;
1849cdf0e10cSrcweir                 aWidowRowNo.SetValue( aWidowRowNo.Normalize( nLines ) );
1850cdf0e10cSrcweir                 aWidowBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK);
1851cdf0e10cSrcweir                 aWidowRowNo.Enable(_bEnable);
1852cdf0e10cSrcweir                 aWidowRowLabel.Enable(_bEnable);
1853cdf0e10cSrcweir 
1854cdf0e10cSrcweir             }
1855cdf0e10cSrcweir             else if ( SFX_ITEM_DONTCARE == eTmpState )
1856cdf0e10cSrcweir                 aWidowBox.SetState( STATE_DONTKNOW );
1857cdf0e10cSrcweir             else
1858cdf0e10cSrcweir                 aWidowBox.Enable(sal_False);
1859cdf0e10cSrcweir 
1860cdf0e10cSrcweir             aOrphanBox.Enable();
1861cdf0e10cSrcweir             _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
1862cdf0e10cSrcweir             eTmpState = rSet.GetItemState( _nWhich );
1863cdf0e10cSrcweir 
1864cdf0e10cSrcweir             if ( eTmpState >= SFX_ITEM_AVAILABLE )
1865cdf0e10cSrcweir             {
1866cdf0e10cSrcweir                 const SvxOrphansItem& rOrphan =
1867cdf0e10cSrcweir                     (const SvxOrphansItem&)rSet.Get( _nWhich );
1868cdf0e10cSrcweir                 const sal_uInt16 nLines = rOrphan.GetValue();
1869cdf0e10cSrcweir                 aOrphanBox.EnableTriState( sal_False );
1870cdf0e10cSrcweir 
1871cdf0e10cSrcweir                 sal_Bool _bEnable = nLines > 0;
1872cdf0e10cSrcweir                 aOrphanBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK);
1873cdf0e10cSrcweir                 aOrphanRowNo.SetValue( aOrphanRowNo.Normalize( nLines ) );
1874cdf0e10cSrcweir                 aOrphanRowNo.Enable(_bEnable);
1875cdf0e10cSrcweir                 aOrphanRowLabel.Enable(_bEnable);
1876cdf0e10cSrcweir 
1877cdf0e10cSrcweir             }
1878cdf0e10cSrcweir             else if ( SFX_ITEM_DONTCARE == eTmpState )
1879cdf0e10cSrcweir                 aOrphanBox.SetState( STATE_DONTKNOW );
1880cdf0e10cSrcweir             else
1881cdf0e10cSrcweir                 aOrphanBox.Enable(sal_False);
1882cdf0e10cSrcweir         }
1883cdf0e10cSrcweir     }
1884cdf0e10cSrcweir     else if ( SFX_ITEM_DONTCARE == eItemState )
1885cdf0e10cSrcweir         aKeepTogetherBox.SetState( STATE_DONTKNOW );
1886cdf0e10cSrcweir     else
1887cdf0e10cSrcweir         aKeepTogetherBox.Enable(sal_False);
1888cdf0e10cSrcweir 
1889cdf0e10cSrcweir     // damit alles richt enabled wird
1890cdf0e10cSrcweir     KeepTogetherHdl_Impl( 0 );
1891cdf0e10cSrcweir     WidowHdl_Impl( 0 );
1892cdf0e10cSrcweir     OrphanHdl_Impl( 0 );
1893cdf0e10cSrcweir 
1894cdf0e10cSrcweir     aHyphenBox.SaveValue();
1895cdf0e10cSrcweir     aExtHyphenBeforeBox.SaveValue();
1896cdf0e10cSrcweir     aExtHyphenAfterBox.SaveValue();
1897cdf0e10cSrcweir     aMaxHyphenEdit.SaveValue();
1898cdf0e10cSrcweir     aPageBreakBox.SaveValue();
1899cdf0e10cSrcweir     aBreakPositionLB.SaveValue();
1900cdf0e10cSrcweir     aBreakTypeLB.SaveValue();
1901cdf0e10cSrcweir     aApplyCollBtn.SaveValue();
1902cdf0e10cSrcweir     aApplyCollBox.SaveValue();
1903cdf0e10cSrcweir     aPagenumEdit.SaveValue();
1904cdf0e10cSrcweir     aKeepTogetherBox.SaveValue();
1905cdf0e10cSrcweir     aKeepParaBox.SaveValue();
1906cdf0e10cSrcweir     aWidowBox.SaveValue();
1907cdf0e10cSrcweir     aOrphanBox.SaveValue();
1908cdf0e10cSrcweir }
1909cdf0e10cSrcweir 
1910cdf0e10cSrcweir // -----------------------------------------------------------------------
1911cdf0e10cSrcweir 
DeactivatePage(SfxItemSet * _pSet)1912cdf0e10cSrcweir int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
1913cdf0e10cSrcweir {
1914cdf0e10cSrcweir     if ( _pSet )
1915cdf0e10cSrcweir         FillItemSet( *_pSet );
1916cdf0e10cSrcweir     return LEAVE_PAGE;
1917cdf0e10cSrcweir }
1918cdf0e10cSrcweir 
1919cdf0e10cSrcweir // -----------------------------------------------------------------------
1920cdf0e10cSrcweir 
DisablePageBreak()1921cdf0e10cSrcweir void SvxExtParagraphTabPage::DisablePageBreak()
1922cdf0e10cSrcweir {
1923cdf0e10cSrcweir     bPageBreak = sal_False;
1924cdf0e10cSrcweir     aPageBreakBox.Enable(sal_False);
1925cdf0e10cSrcweir     aBreakTypeLB.RemoveEntry(0);
1926cdf0e10cSrcweir     aBreakPositionFT.Enable(sal_False);
1927cdf0e10cSrcweir     aBreakPositionLB.Enable(sal_False);
1928cdf0e10cSrcweir     aApplyCollBtn.Enable(sal_False);
1929cdf0e10cSrcweir     aApplyCollBox.Enable(sal_False);
1930cdf0e10cSrcweir     aPagenumEdit.Enable(sal_False);
1931cdf0e10cSrcweir }
1932cdf0e10cSrcweir 
1933cdf0e10cSrcweir // -----------------------------------------------------------------------
1934cdf0e10cSrcweir 
SvxExtParagraphTabPage(Window * pParent,const SfxItemSet & rAttr)1935cdf0e10cSrcweir SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSet& rAttr ) :
1936cdf0e10cSrcweir 
1937cdf0e10cSrcweir     SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_EXT_PARAGRAPH ), rAttr ),
1938cdf0e10cSrcweir 
1939cdf0e10cSrcweir     aExtFL              ( this, CUI_RES( FL_HYPHEN ) ),
1940cdf0e10cSrcweir     aHyphenBox          ( this, CUI_RES( BTN_HYPHEN ) ),
1941cdf0e10cSrcweir     aBeforeText         ( this, CUI_RES( FT_HYPHENBEFORE ) ),
1942cdf0e10cSrcweir     aExtHyphenBeforeBox ( this, CUI_RES( ED_HYPHENBEFORE ) ),
1943cdf0e10cSrcweir     aAfterText          ( this, CUI_RES( FT_HYPHENAFTER ) ),
1944cdf0e10cSrcweir     aExtHyphenAfterBox  ( this, CUI_RES( ED_HYPHENAFTER ) ),
1945cdf0e10cSrcweir     aMaxHyphenLabel     ( this, CUI_RES( FT_MAXHYPH ) ),
1946cdf0e10cSrcweir     aMaxHyphenEdit      ( this, CUI_RES( ED_MAXHYPH ) ),
1947cdf0e10cSrcweir     aBreaksFL           ( this, CUI_RES( FL_BREAKS ) ),
1948cdf0e10cSrcweir     aPageBreakBox       ( this, CUI_RES( BTN_PAGEBREAK ) ),
1949cdf0e10cSrcweir     aBreakTypeFT        ( this, CUI_RES( FT_BREAKTYPE     )),
1950cdf0e10cSrcweir     aBreakTypeLB        ( this, CUI_RES( LB_BREAKTYPE     )),
1951cdf0e10cSrcweir     aBreakPositionFT    ( this, CUI_RES( FT_BREAKPOSITION )),
1952cdf0e10cSrcweir     aBreakPositionLB    ( this, CUI_RES( LB_BREAKPOSITION )),
1953cdf0e10cSrcweir //    aPageBox            ( this, CUI_RES( BTN_BREAKPAGE ) ),
1954cdf0e10cSrcweir //    aColumnBox          ( this, CUI_RES( BTN_BREAKCOLUMN ) ),
1955cdf0e10cSrcweir //    aBeforeBox          ( this, CUI_RES( BTN_PAGEBREAKBEFORE ) ),
1956cdf0e10cSrcweir //    aAfterBox           ( this, CUI_RES( BTN_PAGEBREAKAFTER ) ),
1957cdf0e10cSrcweir     aApplyCollBtn       ( this, CUI_RES( BTN_PAGECOLL ) ),
1958cdf0e10cSrcweir     aApplyCollBox       ( this, CUI_RES( LB_PAGECOLL ) ),
1959cdf0e10cSrcweir     aPagenumText        ( this, CUI_RES( FT_PAGENUM ) ),
1960cdf0e10cSrcweir     aPagenumEdit        ( this, CUI_RES( ED_PAGENUM ) ),
1961cdf0e10cSrcweir     aExtendFL           ( this, CUI_RES( FL_OPTIONS ) ),
1962cdf0e10cSrcweir     aKeepTogetherBox    ( this, CUI_RES( BTN_KEEPTOGETHER ) ),
1963cdf0e10cSrcweir     aKeepParaBox        ( this, CUI_RES( CB_KEEPTOGETHER ) ),
1964cdf0e10cSrcweir     aOrphanBox          ( this, CUI_RES( BTN_ORPHANS ) ),
1965cdf0e10cSrcweir     aOrphanRowNo        ( this, CUI_RES( ED_ORPHANS ) ),
1966cdf0e10cSrcweir     aOrphanRowLabel     ( this, CUI_RES( FT_ORPHANS ) ),
1967cdf0e10cSrcweir     aWidowBox           ( this, CUI_RES( BTN_WIDOWS ) ),
1968cdf0e10cSrcweir     aWidowRowNo         ( this, CUI_RES( ED_WIDOWS ) ),
1969cdf0e10cSrcweir     aWidowRowLabel      ( this, CUI_RES( FT_WIDOWS ) ),
1970cdf0e10cSrcweir     bPageBreak  ( sal_True ),
1971cdf0e10cSrcweir     bHtmlMode   ( sal_False ),
1972cdf0e10cSrcweir     nStdPos     ( 0 )
1973cdf0e10cSrcweir {
1974cdf0e10cSrcweir     FreeResource();
1975cdf0e10cSrcweir 
1976cdf0e10cSrcweir     aApplyCollBox.SetAccessibleRelationLabeledBy(&aApplyCollBtn);
1977cdf0e10cSrcweir     aApplyCollBox.SetAccessibleName(String(CUI_RES(STR_PAGE_STYLE)));
1978cdf0e10cSrcweir     aOrphanRowNo.SetAccessibleRelationLabeledBy(&aOrphanBox);
1979cdf0e10cSrcweir     aWidowRowNo.SetAccessibleRelationLabeledBy(&aWidowBox);
1980cdf0e10cSrcweir 
1981cdf0e10cSrcweir     // diese Page braucht ExchangeSupport
1982cdf0e10cSrcweir     SetExchangeSupport();
1983cdf0e10cSrcweir 
1984cdf0e10cSrcweir     aHyphenBox.SetClickHdl(         LINK( this, SvxExtParagraphTabPage, HyphenClickHdl_Impl ) );
1985cdf0e10cSrcweir     aPageBreakBox.SetClickHdl(      LINK( this, SvxExtParagraphTabPage, PageBreakHdl_Impl ) );
1986cdf0e10cSrcweir     aKeepTogetherBox.SetClickHdl(   LINK( this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl ) );
1987cdf0e10cSrcweir     aWidowBox.SetClickHdl(          LINK( this, SvxExtParagraphTabPage, WidowHdl_Impl ) );
1988cdf0e10cSrcweir     aOrphanBox.SetClickHdl(         LINK( this, SvxExtParagraphTabPage, OrphanHdl_Impl ) );
1989cdf0e10cSrcweir     aApplyCollBtn.SetClickHdl(      LINK( this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl ) );
1990cdf0e10cSrcweir     aBreakTypeLB.SetSelectHdl(      LINK( this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl ) );
1991cdf0e10cSrcweir     aBreakPositionLB.SetSelectHdl(  LINK( this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl ) );
1992cdf0e10cSrcweir 
1993cdf0e10cSrcweir     SfxObjectShell* pSh = SfxObjectShell::Current();
1994cdf0e10cSrcweir     if ( pSh )
1995cdf0e10cSrcweir     {
1996cdf0e10cSrcweir         SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
1997cdf0e10cSrcweir         pPool->SetSearchMask( SFX_STYLE_FAMILY_PAGE );
1998cdf0e10cSrcweir         SfxStyleSheetBase* pStyle = pPool->First();
1999cdf0e10cSrcweir         String aStdName;
2000cdf0e10cSrcweir 
2001cdf0e10cSrcweir         while( pStyle )
2002cdf0e10cSrcweir         {
2003cdf0e10cSrcweir             if ( aStdName.Len() == 0 )
2004cdf0e10cSrcweir                 // first style == standard style
2005cdf0e10cSrcweir                 aStdName = pStyle->GetName();
2006cdf0e10cSrcweir             aApplyCollBox.InsertEntry( pStyle->GetName() );
2007cdf0e10cSrcweir             pStyle = pPool->Next();
2008cdf0e10cSrcweir         }
2009cdf0e10cSrcweir         nStdPos = aApplyCollBox.GetEntryPos( aStdName );
2010cdf0e10cSrcweir     }
2011cdf0e10cSrcweir 
2012cdf0e10cSrcweir     sal_uInt16 nHtmlMode = GetHtmlMode_Impl( rAttr );
2013cdf0e10cSrcweir     if ( nHtmlMode & HTMLMODE_ON )
2014cdf0e10cSrcweir     {
2015cdf0e10cSrcweir         bHtmlMode = sal_True;
2016cdf0e10cSrcweir         aHyphenBox           .Enable(sal_False);
2017cdf0e10cSrcweir         aBeforeText          .Enable(sal_False);
2018cdf0e10cSrcweir         aExtHyphenBeforeBox  .Enable(sal_False);
2019cdf0e10cSrcweir         aAfterText           .Enable(sal_False);
2020cdf0e10cSrcweir         aExtHyphenAfterBox   .Enable(sal_False);
2021cdf0e10cSrcweir         aMaxHyphenLabel      .Enable(sal_False);
2022cdf0e10cSrcweir         aMaxHyphenEdit       .Enable(sal_False);
2023cdf0e10cSrcweir         aExtFL               .Enable(sal_False);
2024cdf0e10cSrcweir         aPagenumText         .Enable(sal_False);
2025cdf0e10cSrcweir         aPagenumEdit         .Enable(sal_False);
2026cdf0e10cSrcweir         // no column break in HTML
2027cdf0e10cSrcweir         aBreakTypeLB.RemoveEntry(1);
2028cdf0e10cSrcweir     }
2029cdf0e10cSrcweir }
2030cdf0e10cSrcweir 
2031cdf0e10cSrcweir // -----------------------------------------------------------------------
2032cdf0e10cSrcweir 
~SvxExtParagraphTabPage()2033cdf0e10cSrcweir __EXPORT SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
2034cdf0e10cSrcweir {
2035cdf0e10cSrcweir }
2036cdf0e10cSrcweir 
2037cdf0e10cSrcweir // -----------------------------------------------------------------------
2038cdf0e10cSrcweir 
GetRanges()2039cdf0e10cSrcweir sal_uInt16* SvxExtParagraphTabPage::GetRanges()
2040cdf0e10cSrcweir {
2041cdf0e10cSrcweir     return pExtRanges;
2042cdf0e10cSrcweir }
2043cdf0e10cSrcweir 
2044cdf0e10cSrcweir // -----------------------------------------------------------------------
2045cdf0e10cSrcweir 
IMPL_LINK(SvxExtParagraphTabPage,PageBreakHdl_Impl,TriStateBox *,EMPTYARG)2046cdf0e10cSrcweir IMPL_LINK( SvxExtParagraphTabPage, PageBreakHdl_Impl, TriStateBox *, EMPTYARG )
2047cdf0e10cSrcweir {
2048cdf0e10cSrcweir     switch ( aPageBreakBox.GetState() )
2049cdf0e10cSrcweir     {
2050cdf0e10cSrcweir         case STATE_CHECK:
2051cdf0e10cSrcweir             aBreakTypeFT.Enable();
2052cdf0e10cSrcweir             aBreakTypeLB.Enable();
2053cdf0e10cSrcweir             aBreakPositionFT.Enable();
2054cdf0e10cSrcweir             aBreakPositionLB.Enable();
2055cdf0e10cSrcweir 
2056cdf0e10cSrcweir             if ( 0 == aBreakTypeLB.GetSelectEntryPos()&&
2057cdf0e10cSrcweir                 0 == aBreakPositionLB.GetSelectEntryPos() )
2058cdf0e10cSrcweir             {
2059cdf0e10cSrcweir                 aApplyCollBtn.Enable();
2060cdf0e10cSrcweir 
2061cdf0e10cSrcweir                 sal_Bool bEnable = STATE_CHECK == aApplyCollBtn.GetState() &&
2062cdf0e10cSrcweir                                             aApplyCollBox.GetEntryCount();
2063cdf0e10cSrcweir                 aApplyCollBox.Enable(bEnable);
2064cdf0e10cSrcweir                 if(!bHtmlMode)
2065cdf0e10cSrcweir                 {
2066cdf0e10cSrcweir                     aPagenumText.Enable(bEnable);
2067cdf0e10cSrcweir                     aPagenumEdit.Enable(bEnable);
2068cdf0e10cSrcweir                 }
2069cdf0e10cSrcweir             }
2070cdf0e10cSrcweir             break;
2071cdf0e10cSrcweir 
2072cdf0e10cSrcweir         case STATE_NOCHECK:
2073cdf0e10cSrcweir         case STATE_DONTKNOW:
2074cdf0e10cSrcweir             aApplyCollBtn.SetState( STATE_NOCHECK );
2075cdf0e10cSrcweir             aApplyCollBtn.Enable(sal_False);
2076cdf0e10cSrcweir             aApplyCollBox.Enable(sal_False);
2077cdf0e10cSrcweir             aPagenumText.Enable(sal_False);
2078cdf0e10cSrcweir             aPagenumEdit.Enable(sal_False);
2079cdf0e10cSrcweir             aBreakTypeFT.Enable(sal_False);
2080cdf0e10cSrcweir             aBreakTypeLB.Enable(sal_False);
2081cdf0e10cSrcweir             aBreakPositionFT.Enable(sal_False);
2082cdf0e10cSrcweir             aBreakPositionLB.Enable(sal_False);
2083cdf0e10cSrcweir             break;
2084cdf0e10cSrcweir     }
2085cdf0e10cSrcweir     return 0;
2086cdf0e10cSrcweir }
2087cdf0e10cSrcweir 
2088cdf0e10cSrcweir // -----------------------------------------------------------------------
2089cdf0e10cSrcweir 
IMPL_LINK(SvxExtParagraphTabPage,KeepTogetherHdl_Impl,TriStateBox *,EMPTYARG)2090cdf0e10cSrcweir IMPL_LINK( SvxExtParagraphTabPage, KeepTogetherHdl_Impl, TriStateBox *, EMPTYARG )
2091cdf0e10cSrcweir {
2092cdf0e10cSrcweir     sal_Bool bEnable = aKeepTogetherBox.GetState() == STATE_NOCHECK;
2093cdf0e10cSrcweir     aWidowBox.Enable(bEnable);
2094cdf0e10cSrcweir     aOrphanBox.Enable(bEnable);
2095cdf0e10cSrcweir 
2096cdf0e10cSrcweir     return 0;
2097cdf0e10cSrcweir }
2098cdf0e10cSrcweir 
2099cdf0e10cSrcweir // -----------------------------------------------------------------------
2100cdf0e10cSrcweir 
IMPL_LINK(SvxExtParagraphTabPage,WidowHdl_Impl,TriStateBox *,EMPTYARG)2101cdf0e10cSrcweir IMPL_LINK( SvxExtParagraphTabPage, WidowHdl_Impl, TriStateBox *, EMPTYARG )
2102cdf0e10cSrcweir {
2103cdf0e10cSrcweir     switch ( aWidowBox.GetState() )
2104cdf0e10cSrcweir     {
2105cdf0e10cSrcweir         case STATE_CHECK:
2106cdf0e10cSrcweir             aWidowRowNo.Enable();
2107cdf0e10cSrcweir             aWidowRowLabel.Enable();
2108cdf0e10cSrcweir             aKeepTogetherBox.Enable(sal_False);
2109cdf0e10cSrcweir             break;
2110cdf0e10cSrcweir 
2111cdf0e10cSrcweir         case STATE_NOCHECK:
2112cdf0e10cSrcweir             if ( aOrphanBox.GetState() == STATE_NOCHECK )
2113cdf0e10cSrcweir                 aKeepTogetherBox.Enable();
2114cdf0e10cSrcweir 
2115cdf0e10cSrcweir         // kein break
2116cdf0e10cSrcweir         case STATE_DONTKNOW:
2117cdf0e10cSrcweir             aWidowRowNo.Enable(sal_False);
2118cdf0e10cSrcweir             aWidowRowLabel.Enable(sal_False);
2119cdf0e10cSrcweir             break;
2120cdf0e10cSrcweir     }
2121cdf0e10cSrcweir     return 0;
2122cdf0e10cSrcweir }
2123cdf0e10cSrcweir 
2124cdf0e10cSrcweir // -----------------------------------------------------------------------
2125cdf0e10cSrcweir 
IMPL_LINK(SvxExtParagraphTabPage,OrphanHdl_Impl,TriStateBox *,EMPTYARG)2126cdf0e10cSrcweir IMPL_LINK( SvxExtParagraphTabPage, OrphanHdl_Impl, TriStateBox *, EMPTYARG )
2127cdf0e10cSrcweir {
2128cdf0e10cSrcweir     switch( aOrphanBox.GetState() )
2129cdf0e10cSrcweir     {
2130cdf0e10cSrcweir         case STATE_CHECK:
2131cdf0e10cSrcweir             aOrphanRowNo.Enable();
2132cdf0e10cSrcweir             aOrphanRowLabel.Enable();
2133cdf0e10cSrcweir             aKeepTogetherBox.Enable(sal_False);
2134cdf0e10cSrcweir             break;
2135cdf0e10cSrcweir 
2136cdf0e10cSrcweir         case STATE_NOCHECK:
2137cdf0e10cSrcweir             if ( aWidowBox.GetState() == STATE_NOCHECK )
2138cdf0e10cSrcweir                 aKeepTogetherBox.Enable();
2139cdf0e10cSrcweir 
2140cdf0e10cSrcweir         // kein break
2141cdf0e10cSrcweir         case STATE_DONTKNOW:
2142cdf0e10cSrcweir             aOrphanRowNo.Enable(sal_False);
2143cdf0e10cSrcweir             aOrphanRowLabel.Enable(sal_False);
2144cdf0e10cSrcweir             break;
2145cdf0e10cSrcweir     }
2146cdf0e10cSrcweir     return 0;
2147cdf0e10cSrcweir }
2148cdf0e10cSrcweir 
2149cdf0e10cSrcweir // -----------------------------------------------------------------------
2150cdf0e10cSrcweir 
IMPL_LINK(SvxExtParagraphTabPage,HyphenClickHdl_Impl,TriStateBox *,EMPTYARG)2151cdf0e10cSrcweir IMPL_LINK( SvxExtParagraphTabPage, HyphenClickHdl_Impl, TriStateBox *, EMPTYARG )
2152cdf0e10cSrcweir {
2153cdf0e10cSrcweir 
2154cdf0e10cSrcweir     sal_Bool bEnable = aHyphenBox.GetState() == STATE_CHECK;
2155cdf0e10cSrcweir     aBeforeText.Enable(bEnable);
2156cdf0e10cSrcweir     aExtHyphenBeforeBox.Enable(bEnable);
2157cdf0e10cSrcweir     aAfterText.Enable(bEnable);
2158cdf0e10cSrcweir     aExtHyphenAfterBox.Enable(bEnable);
2159cdf0e10cSrcweir     aMaxHyphenLabel.Enable(bEnable);
2160cdf0e10cSrcweir     aMaxHyphenEdit.Enable(bEnable);
2161cdf0e10cSrcweir     aHyphenBox.SetState( bEnable ? STATE_CHECK : STATE_NOCHECK);
2162cdf0e10cSrcweir 
2163cdf0e10cSrcweir     return 0;
2164cdf0e10cSrcweir }
2165cdf0e10cSrcweir 
2166cdf0e10cSrcweir // -----------------------------------------------------------------------
2167cdf0e10cSrcweir 
IMPL_LINK(SvxExtParagraphTabPage,ApplyCollClickHdl_Impl,TriStateBox *,EMPTYARG)2168cdf0e10cSrcweir IMPL_LINK( SvxExtParagraphTabPage, ApplyCollClickHdl_Impl, TriStateBox *, EMPTYARG )
2169cdf0e10cSrcweir {
2170cdf0e10cSrcweir     sal_Bool bEnable = sal_False;
2171cdf0e10cSrcweir     if ( aApplyCollBtn.GetState() == STATE_CHECK &&
2172cdf0e10cSrcweir          aApplyCollBox.GetEntryCount() )
2173cdf0e10cSrcweir     {
2174cdf0e10cSrcweir         bEnable = sal_True;
2175cdf0e10cSrcweir         aApplyCollBox.SelectEntryPos( nStdPos );
2176cdf0e10cSrcweir     }
2177cdf0e10cSrcweir     else
2178cdf0e10cSrcweir     {
2179cdf0e10cSrcweir         aApplyCollBox.SetNoSelection();
2180cdf0e10cSrcweir     }
2181cdf0e10cSrcweir     aApplyCollBox.Enable(bEnable);
2182cdf0e10cSrcweir     if(!bHtmlMode)
2183cdf0e10cSrcweir     {
2184cdf0e10cSrcweir         aPagenumText.Enable(bEnable);
2185cdf0e10cSrcweir         aPagenumEdit.Enable(bEnable);
2186cdf0e10cSrcweir     }
2187cdf0e10cSrcweir     return 0;
2188cdf0e10cSrcweir }
2189cdf0e10cSrcweir 
2190cdf0e10cSrcweir // -----------------------------------------------------------------------
2191cdf0e10cSrcweir 
IMPL_LINK(SvxExtParagraphTabPage,PageBreakPosHdl_Impl,ListBox *,pListBox)2192cdf0e10cSrcweir IMPL_LINK( SvxExtParagraphTabPage, PageBreakPosHdl_Impl, ListBox *, pListBox )
2193cdf0e10cSrcweir {
2194cdf0e10cSrcweir     if ( 0 == pListBox->GetSelectEntryPos() )
2195cdf0e10cSrcweir     {
2196cdf0e10cSrcweir         aApplyCollBtn.Enable();
2197cdf0e10cSrcweir 
2198cdf0e10cSrcweir         sal_Bool bEnable = aApplyCollBtn.GetState() == STATE_CHECK &&
2199cdf0e10cSrcweir                                     aApplyCollBox.GetEntryCount();
2200cdf0e10cSrcweir 
2201cdf0e10cSrcweir         aApplyCollBox.Enable(bEnable);
2202cdf0e10cSrcweir         if(!bHtmlMode)
2203cdf0e10cSrcweir         {
2204cdf0e10cSrcweir             aPagenumText.Enable(bEnable);
2205cdf0e10cSrcweir             aPagenumEdit.Enable(bEnable);
2206cdf0e10cSrcweir         }
2207cdf0e10cSrcweir     }
2208cdf0e10cSrcweir     else if ( 1 == pListBox->GetSelectEntryPos() )
2209cdf0e10cSrcweir     {
2210cdf0e10cSrcweir         aApplyCollBtn.SetState( STATE_NOCHECK );
2211cdf0e10cSrcweir         aApplyCollBtn.Enable(sal_False);
2212cdf0e10cSrcweir         aApplyCollBox.Enable(sal_False);
2213cdf0e10cSrcweir         aPagenumText.Enable(sal_False);
2214cdf0e10cSrcweir         aPagenumEdit.Enable(sal_False);
2215cdf0e10cSrcweir     }
2216cdf0e10cSrcweir     return 0;
2217cdf0e10cSrcweir }
2218cdf0e10cSrcweir 
2219cdf0e10cSrcweir // -----------------------------------------------------------------------
2220cdf0e10cSrcweir 
IMPL_LINK(SvxExtParagraphTabPage,PageBreakTypeHdl_Impl,ListBox *,pListBox)2221cdf0e10cSrcweir IMPL_LINK( SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, ListBox *, pListBox )
2222cdf0e10cSrcweir {
2223cdf0e10cSrcweir     //column break or break break after
2224cdf0e10cSrcweir     sal_uInt16 nBreakPos = aBreakPositionLB.GetSelectEntryPos();
2225cdf0e10cSrcweir     if ( pListBox->GetSelectEntryPos() == 1 || 1 == nBreakPos)
2226cdf0e10cSrcweir     {
2227cdf0e10cSrcweir         aApplyCollBtn.SetState( STATE_NOCHECK );
2228cdf0e10cSrcweir         aApplyCollBtn.Enable(sal_False);
2229cdf0e10cSrcweir         aApplyCollBox.Enable(sal_False);
2230cdf0e10cSrcweir         aPagenumText.Enable(sal_False);
2231cdf0e10cSrcweir         aPagenumEdit.Enable(sal_False);
2232cdf0e10cSrcweir     }
2233cdf0e10cSrcweir     else
2234cdf0e10cSrcweir         PageBreakPosHdl_Impl( &aBreakPositionLB );
2235cdf0e10cSrcweir     return 0;
2236cdf0e10cSrcweir }
2237cdf0e10cSrcweir //Add CHINA001 begin
PageCreated(SfxAllItemSet aSet)2238cdf0e10cSrcweir void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet)
2239cdf0e10cSrcweir {
2240cdf0e10cSrcweir 
2241cdf0e10cSrcweir 
2242cdf0e10cSrcweir     SFX_ITEMSET_ARG (&aSet,pDisablePageBreakItem,SfxBoolItem,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_False);
2243cdf0e10cSrcweir 
2244cdf0e10cSrcweir     if (pDisablePageBreakItem)
2245cdf0e10cSrcweir         if ( pDisablePageBreakItem->GetValue())
2246cdf0e10cSrcweir                     DisablePageBreak();
2247cdf0e10cSrcweir 
2248cdf0e10cSrcweir 
2249cdf0e10cSrcweir }
2250cdf0e10cSrcweir //end of Add CHINA001
2251cdf0e10cSrcweir /*-- 29.11.00 11:36:24---------------------------------------------------
2252cdf0e10cSrcweir 
2253cdf0e10cSrcweir   -----------------------------------------------------------------------*/
SvxAsianTabPage(Window * pParent,const SfxItemSet & rSet)2254cdf0e10cSrcweir SvxAsianTabPage::SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet ) :
2255cdf0e10cSrcweir     SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_PARA_ASIAN ), rSet),
2256cdf0e10cSrcweir     aOptionsFL(         this, CUI_RES(FL_AS_OPTIONS       )),
2257cdf0e10cSrcweir     aForbiddenRulesCB(  this, CUI_RES(CB_AS_FORBIDDEN     )),
2258cdf0e10cSrcweir     aHangingPunctCB(    this, CUI_RES(CB_AS_HANG_PUNC     )),
2259cdf0e10cSrcweir     aScriptSpaceCB(     this, CUI_RES(CB_AS_SCRIPT_SPACE    ))//,
2260cdf0e10cSrcweir 
2261cdf0e10cSrcweir {
2262cdf0e10cSrcweir     FreeResource();
2263cdf0e10cSrcweir 
2264cdf0e10cSrcweir     Link aLink = LINK( this, SvxAsianTabPage, ClickHdl_Impl );
2265cdf0e10cSrcweir     aHangingPunctCB.SetClickHdl( aLink );
2266cdf0e10cSrcweir     aScriptSpaceCB.SetClickHdl( aLink );
2267cdf0e10cSrcweir     aForbiddenRulesCB.SetClickHdl( aLink );
2268cdf0e10cSrcweir 
2269cdf0e10cSrcweir }
2270cdf0e10cSrcweir /*-- 29.11.00 11:36:24---------------------------------------------------
2271cdf0e10cSrcweir 
2272cdf0e10cSrcweir   -----------------------------------------------------------------------*/
~SvxAsianTabPage()2273cdf0e10cSrcweir SvxAsianTabPage::~SvxAsianTabPage()
2274cdf0e10cSrcweir {
2275cdf0e10cSrcweir }
2276cdf0e10cSrcweir /*-- 29.11.00 11:36:24---------------------------------------------------
2277cdf0e10cSrcweir 
2278cdf0e10cSrcweir   -----------------------------------------------------------------------*/
Create(Window * pParent,const SfxItemSet & rSet)2279cdf0e10cSrcweir SfxTabPage* SvxAsianTabPage::Create(    Window* pParent, const SfxItemSet& rSet )
2280cdf0e10cSrcweir {
2281cdf0e10cSrcweir     return new SvxAsianTabPage(pParent, rSet);
2282cdf0e10cSrcweir }
2283cdf0e10cSrcweir /*-- 29.11.00 11:36:24---------------------------------------------------
2284cdf0e10cSrcweir 
2285cdf0e10cSrcweir   -----------------------------------------------------------------------*/
GetRanges()2286cdf0e10cSrcweir sal_uInt16*     SvxAsianTabPage::GetRanges()
2287cdf0e10cSrcweir {
2288cdf0e10cSrcweir     static sal_uInt16 pRanges[] =
2289cdf0e10cSrcweir     {
2290cdf0e10cSrcweir         SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES,
2291cdf0e10cSrcweir         0
2292cdf0e10cSrcweir     };
2293cdf0e10cSrcweir     return pRanges;
2294cdf0e10cSrcweir }
2295cdf0e10cSrcweir /*-- 29.11.00 11:36:24---------------------------------------------------
2296cdf0e10cSrcweir 
2297cdf0e10cSrcweir   -----------------------------------------------------------------------*/
FillItemSet(SfxItemSet & rSet)2298cdf0e10cSrcweir sal_Bool        SvxAsianTabPage::FillItemSet( SfxItemSet& rSet )
2299cdf0e10cSrcweir {
2300cdf0e10cSrcweir     sal_Bool bRet = sal_False;
2301cdf0e10cSrcweir     SfxItemPool* pPool = rSet.GetPool();
2302cdf0e10cSrcweir     if(aScriptSpaceCB.IsChecked() != aScriptSpaceCB.GetSavedValue())
2303cdf0e10cSrcweir     {
2304cdf0e10cSrcweir         SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
2305cdf0e10cSrcweir             pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone();
2306cdf0e10cSrcweir         pNewItem->SetValue(aScriptSpaceCB.IsChecked());
2307cdf0e10cSrcweir         rSet.Put(*pNewItem);
2308cdf0e10cSrcweir         delete pNewItem;
2309cdf0e10cSrcweir         bRet = sal_True;
2310cdf0e10cSrcweir     }
2311cdf0e10cSrcweir     if(aHangingPunctCB.IsChecked() != aHangingPunctCB.GetSavedValue())
2312cdf0e10cSrcweir     {
2313cdf0e10cSrcweir         SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
2314cdf0e10cSrcweir             pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone();
2315cdf0e10cSrcweir         pNewItem->SetValue(aHangingPunctCB.IsChecked());
2316cdf0e10cSrcweir         rSet.Put(*pNewItem);
2317cdf0e10cSrcweir         delete pNewItem;
2318cdf0e10cSrcweir         bRet = sal_True;
2319cdf0e10cSrcweir     }
2320cdf0e10cSrcweir     if(aForbiddenRulesCB.IsChecked() != aForbiddenRulesCB.GetSavedValue())
2321cdf0e10cSrcweir     {
2322cdf0e10cSrcweir         SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
2323cdf0e10cSrcweir             pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone();
2324cdf0e10cSrcweir         pNewItem->SetValue(aForbiddenRulesCB.IsChecked());
2325cdf0e10cSrcweir         rSet.Put(*pNewItem);
2326cdf0e10cSrcweir         delete pNewItem;
2327cdf0e10cSrcweir         bRet = sal_True;
2328cdf0e10cSrcweir     }
2329cdf0e10cSrcweir     return bRet;
2330cdf0e10cSrcweir }
2331cdf0e10cSrcweir /*-- 29.11.00 11:36:25---------------------------------------------------
2332cdf0e10cSrcweir 
2333cdf0e10cSrcweir   -----------------------------------------------------------------------*/
lcl_SetBox(const SfxItemSet & rSet,sal_uInt16 nSlotId,TriStateBox & rBox)2334cdf0e10cSrcweir void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, TriStateBox& rBox)
2335cdf0e10cSrcweir {
2336cdf0e10cSrcweir     sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId);
2337cdf0e10cSrcweir     SfxItemState eState = rSet.GetItemState(_nWhich, sal_True);
2338cdf0e10cSrcweir     if(!eState || eState == SFX_ITEM_DISABLED )
2339cdf0e10cSrcweir         rBox.Enable(sal_False);
2340cdf0e10cSrcweir     else if(eState >= SFX_ITEM_AVAILABLE)
2341cdf0e10cSrcweir     {
2342cdf0e10cSrcweir         rBox.EnableTriState( sal_False );
2343cdf0e10cSrcweir         rBox.Check(((const SfxBoolItem&)rSet.Get(_nWhich)).GetValue());
2344cdf0e10cSrcweir     }
2345cdf0e10cSrcweir     else
2346cdf0e10cSrcweir         rBox.SetState( STATE_DONTKNOW );
2347cdf0e10cSrcweir     rBox.SaveValue();
2348cdf0e10cSrcweir }
2349cdf0e10cSrcweir 
2350cdf0e10cSrcweir 
Reset(const SfxItemSet & rSet)2351cdf0e10cSrcweir void SvxAsianTabPage::Reset( const SfxItemSet& rSet )
2352cdf0e10cSrcweir {
2353cdf0e10cSrcweir     lcl_SetBox(rSet, SID_ATTR_PARA_FORBIDDEN_RULES, aForbiddenRulesCB );
2354cdf0e10cSrcweir //  lcl_SetBox(rSet, , aAllowWordBreakCB );
2355cdf0e10cSrcweir     lcl_SetBox(rSet, SID_ATTR_PARA_HANGPUNCTUATION, aHangingPunctCB );
2356cdf0e10cSrcweir 
2357cdf0e10cSrcweir 
2358cdf0e10cSrcweir     //character distance not yet available
2359cdf0e10cSrcweir //  lcl_SetBox(rSet, , aPuntuationCB    );
2360cdf0e10cSrcweir     lcl_SetBox(rSet, SID_ATTR_PARA_SCRIPTSPACE, aScriptSpaceCB );
2361cdf0e10cSrcweir //  lcl_SetBox(rSet, , aAdjustNumbersCB );
2362cdf0e10cSrcweir //  aAllowWordBreakCB   .Enable(sal_False);
2363cdf0e10cSrcweir //  aPuntuationCB       .Enable(sal_False);
2364cdf0e10cSrcweir //  aAdjustNumbersCB    .Enable(sal_False);
2365cdf0e10cSrcweir }
2366cdf0e10cSrcweir /* -----------------------------19.12.00 12:59--------------------------------
2367cdf0e10cSrcweir 
2368cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
IMPL_LINK(SvxAsianTabPage,ClickHdl_Impl,TriStateBox *,pBox)2369cdf0e10cSrcweir IMPL_LINK( SvxAsianTabPage, ClickHdl_Impl, TriStateBox*, pBox )
2370cdf0e10cSrcweir {
2371cdf0e10cSrcweir     pBox->EnableTriState( sal_False );
2372cdf0e10cSrcweir     return 0;
2373cdf0e10cSrcweir }
2374