15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file
55b190011SAndrew Rist * distributed with this work for additional information
65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file
75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist * "License"); you may not use this file except in compliance
95b190011SAndrew Rist * with the License. You may obtain a copy of the License at
105b190011SAndrew Rist *
115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist *
135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist * software distributed under the License is distributed on an
155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist * KIND, either express or implied. See the License for the
175b190011SAndrew Rist * specific language governing permissions and limitations
185b190011SAndrew Rist * under the License.
195b190011SAndrew Rist *
205b190011SAndrew Rist *************************************************************/
215b190011SAndrew Rist
225b190011SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #ifdef SD_DLLIMPLEMENTATION
28cdf0e10cSrcweir #undef SD_DLLIMPLEMENTATION
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <com/sun/star/document/PrinterIndependentLayout.hpp>
33cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
36cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
37cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
38cdf0e10cSrcweir #include <com/sun/star/uno/Exception.hpp>
39cdf0e10cSrcweir #include <sfx2/module.hxx>
40cdf0e10cSrcweir #include <sfx2/app.hxx>
41cdf0e10cSrcweir #include <svx/svxids.hrc>
42cdf0e10cSrcweir #include <svx/dialogs.hrc>
43cdf0e10cSrcweir #include <svx/strarray.hxx>
44cdf0e10cSrcweir #include <svx/dlgutil.hxx>
45cdf0e10cSrcweir #include <vcl/msgbox.hxx>
46cdf0e10cSrcweir
47cdf0e10cSrcweir #include "sdattr.hxx"
48cdf0e10cSrcweir #include "sdresid.hxx"
49cdf0e10cSrcweir #include "optsitem.hxx"
50cdf0e10cSrcweir #include "tpoption.hrc"
51cdf0e10cSrcweir #include "tpoption.hxx"
52cdf0e10cSrcweir #include "strings.hrc"
53cdf0e10cSrcweir #include "app.hrc"
54cdf0e10cSrcweir #include <svl/intitem.hxx>
55cdf0e10cSrcweir #include <sfx2/request.hxx>
56cdf0e10cSrcweir #define DLGWIN this->GetParent()->GetParent()
57cdf0e10cSrcweir
58cdf0e10cSrcweir using namespace ::com::sun::star;
59cdf0e10cSrcweir using namespace ::com::sun::star::uno;
60cdf0e10cSrcweir
61cdf0e10cSrcweir /*************************************************************************
62cdf0e10cSrcweir |*
63cdf0e10cSrcweir |* TabPage zum Einstellen der Fang-Optionen
64cdf0e10cSrcweir |*
65cdf0e10cSrcweir \************************************************************************/
66cdf0e10cSrcweir
SdTpOptionsSnap(Window * pParent,const SfxItemSet & rInAttrs)67cdf0e10cSrcweir SdTpOptionsSnap::SdTpOptionsSnap( Window* pParent, const SfxItemSet& rInAttrs ) :
68cdf0e10cSrcweir SvxGridTabPage(pParent, rInAttrs)
69cdf0e10cSrcweir {
70cdf0e10cSrcweir aGrpSnap.Show();
71cdf0e10cSrcweir aCbxSnapHelplines.Show();
72cdf0e10cSrcweir aCbxSnapBorder.Show();
73cdf0e10cSrcweir aCbxSnapFrame.Show();
74cdf0e10cSrcweir aCbxSnapPoints.Show();
75cdf0e10cSrcweir aFtSnapArea.Show();
76cdf0e10cSrcweir aMtrFldSnapArea.Show();
77cdf0e10cSrcweir aGrpOrtho.Show();
78cdf0e10cSrcweir aCbxOrtho.Show();
79cdf0e10cSrcweir aCbxBigOrtho.Show();
80cdf0e10cSrcweir aCbxRotate.Show();
81cdf0e10cSrcweir aMtrFldAngle.Show();
82cdf0e10cSrcweir aFtBezAngle.Show();
83cdf0e10cSrcweir aMtrFldBezAngle.Show();
84cdf0e10cSrcweir aSeparatorFL.Show();
85cdf0e10cSrcweir }
86cdf0e10cSrcweir
87cdf0e10cSrcweir // -----------------------------------------------------------------------
88cdf0e10cSrcweir
~SdTpOptionsSnap()89cdf0e10cSrcweir SdTpOptionsSnap::~SdTpOptionsSnap()
90cdf0e10cSrcweir {
91cdf0e10cSrcweir }
92cdf0e10cSrcweir
93cdf0e10cSrcweir // -----------------------------------------------------------------------
94cdf0e10cSrcweir
FillItemSet(SfxItemSet & rAttrs)95cdf0e10cSrcweir sal_Bool SdTpOptionsSnap::FillItemSet( SfxItemSet& rAttrs )
96cdf0e10cSrcweir {
97cdf0e10cSrcweir SvxGridTabPage::FillItemSet(rAttrs);
98cdf0e10cSrcweir SdOptionsSnapItem* pOptsItem = NULL;
99cdf0e10cSrcweir // if(SFX_ITEM_SET != rAttrs.GetItemState( ATTR_OPTIONS_SNAP, sal_False, (const SfxPoolItem**)&pOptsItem ))
100cdf0e10cSrcweir // pExampleSet->GetItemState( ATTR_OPTIONS_SNAP, sal_False, (const SfxPoolItem**)&pOptsItem );
101cdf0e10cSrcweir
102cdf0e10cSrcweir SdOptionsSnapItem aOptsItem( ATTR_OPTIONS_SNAP );
103cdf0e10cSrcweir
104cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetSnapHelplines( aCbxSnapHelplines.IsChecked() );
105cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetSnapBorder( aCbxSnapBorder.IsChecked() );
106cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetSnapFrame( aCbxSnapFrame.IsChecked() );
107cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetSnapPoints( aCbxSnapPoints.IsChecked() );
108cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetOrtho( aCbxOrtho.IsChecked() );
109cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetBigOrtho( aCbxBigOrtho.IsChecked() );
110cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetRotate( aCbxRotate.IsChecked() );
111cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetSnapArea( (sal_Int16) aMtrFldSnapArea.GetValue() );
112cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetAngle( (sal_Int16) aMtrFldAngle.GetValue() );
113cdf0e10cSrcweir aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle( (sal_Int16) aMtrFldBezAngle.GetValue() );
114cdf0e10cSrcweir
115cdf0e10cSrcweir if( pOptsItem == NULL || !(aOptsItem == *pOptsItem) )
116cdf0e10cSrcweir rAttrs.Put( aOptsItem );
117cdf0e10cSrcweir
118cdf0e10cSrcweir // Evtl. vorhandenes GridItem wird geholt, um nicht versehentlich
119cdf0e10cSrcweir // irgendwelche Standardwerte einzustellen
120cdf0e10cSrcweir return( sal_True );
121cdf0e10cSrcweir }
122cdf0e10cSrcweir
123cdf0e10cSrcweir // -----------------------------------------------------------------------
124cdf0e10cSrcweir
Reset(const SfxItemSet & rAttrs)125cdf0e10cSrcweir void SdTpOptionsSnap::Reset( const SfxItemSet& rAttrs )
126cdf0e10cSrcweir {
127cdf0e10cSrcweir SvxGridTabPage::Reset(rAttrs);
128cdf0e10cSrcweir
129cdf0e10cSrcweir SdOptionsSnapItem aOptsItem( (const SdOptionsSnapItem&) rAttrs.
130cdf0e10cSrcweir Get( ATTR_OPTIONS_SNAP ) );
131cdf0e10cSrcweir
132cdf0e10cSrcweir aCbxSnapHelplines.Check( aOptsItem.GetOptionsSnap().IsSnapHelplines() );
133cdf0e10cSrcweir aCbxSnapBorder.Check( aOptsItem.GetOptionsSnap().IsSnapBorder() );
134cdf0e10cSrcweir aCbxSnapFrame.Check( aOptsItem.GetOptionsSnap().IsSnapFrame() );
135cdf0e10cSrcweir aCbxSnapPoints.Check( aOptsItem.GetOptionsSnap().IsSnapPoints() );
136cdf0e10cSrcweir aCbxOrtho.Check( aOptsItem.GetOptionsSnap().IsOrtho() );
137cdf0e10cSrcweir aCbxBigOrtho.Check( aOptsItem.GetOptionsSnap().IsBigOrtho() );
138cdf0e10cSrcweir aCbxRotate.Check( aOptsItem.GetOptionsSnap().IsRotate() );
139cdf0e10cSrcweir aMtrFldSnapArea.SetValue( aOptsItem.GetOptionsSnap().GetSnapArea() );
140cdf0e10cSrcweir aMtrFldAngle.SetValue( aOptsItem.GetOptionsSnap().GetAngle() );
141cdf0e10cSrcweir aMtrFldBezAngle.SetValue( aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle() );
142cdf0e10cSrcweir
143cdf0e10cSrcweir aCbxRotate.GetClickHdl().Call(0);
144cdf0e10cSrcweir }
145cdf0e10cSrcweir
146cdf0e10cSrcweir // -----------------------------------------------------------------------
147cdf0e10cSrcweir
Create(Window * pWindow,const SfxItemSet & rAttrs)148cdf0e10cSrcweir SfxTabPage* SdTpOptionsSnap::Create( Window* pWindow,
149cdf0e10cSrcweir const SfxItemSet& rAttrs )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir return( new SdTpOptionsSnap( pWindow, rAttrs ) );
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
154cdf0e10cSrcweir /*************************************************************************
155cdf0e10cSrcweir |*
156cdf0e10cSrcweir |* TabPage zum Einstellen der Inhalte-Optionen
157cdf0e10cSrcweir |*
158cdf0e10cSrcweir \************************************************************************/
159cdf0e10cSrcweir
SdTpOptionsContents(Window * pParent,const SfxItemSet & rInAttrs)160cdf0e10cSrcweir SdTpOptionsContents::SdTpOptionsContents( Window* pParent, const SfxItemSet& rInAttrs ) :
161cdf0e10cSrcweir SfxTabPage ( pParent, SdResId( TP_OPTIONS_CONTENTS ), rInAttrs ),
162cdf0e10cSrcweir aGrpDisplay ( this, SdResId( GRP_DISPLAY ) ),
163cdf0e10cSrcweir aCbxRuler ( this, SdResId( CBX_RULER ) ),
164cdf0e10cSrcweir aCbxDragStripes ( this, SdResId( CBX_HELPLINES ) ),
165cdf0e10cSrcweir aCbxHandlesBezier ( this, SdResId( CBX_HANDLES_BEZIER ) ),
166cdf0e10cSrcweir aCbxMoveOutline ( this, SdResId( CBX_MOVE_OUTLINE ) )
167cdf0e10cSrcweir {
168cdf0e10cSrcweir FreeResource();
169cdf0e10cSrcweir }
170cdf0e10cSrcweir
171cdf0e10cSrcweir // -----------------------------------------------------------------------
172cdf0e10cSrcweir
~SdTpOptionsContents()173cdf0e10cSrcweir SdTpOptionsContents::~SdTpOptionsContents()
174cdf0e10cSrcweir {
175cdf0e10cSrcweir }
176cdf0e10cSrcweir
177cdf0e10cSrcweir // -----------------------------------------------------------------------
178cdf0e10cSrcweir
FillItemSet(SfxItemSet & rAttrs)179cdf0e10cSrcweir sal_Bool SdTpOptionsContents::FillItemSet( SfxItemSet& rAttrs )
180cdf0e10cSrcweir {
181cdf0e10cSrcweir sal_Bool bModified = sal_False;
182cdf0e10cSrcweir
183cdf0e10cSrcweir if( aCbxRuler.GetSavedValue() != aCbxRuler.IsChecked() ||
184cdf0e10cSrcweir aCbxMoveOutline.GetSavedValue() != aCbxMoveOutline.IsChecked() ||
185cdf0e10cSrcweir aCbxDragStripes.GetSavedValue() != aCbxDragStripes.IsChecked() ||
186cdf0e10cSrcweir //aCbxHelplines.GetSavedValue() != aCbxHelplines.IsChecked() ||
187cdf0e10cSrcweir aCbxHandlesBezier.GetSavedValue() != aCbxHandlesBezier.IsChecked() )
188cdf0e10cSrcweir {
189cdf0e10cSrcweir SdOptionsLayoutItem aOptsItem( ATTR_OPTIONS_LAYOUT );
190cdf0e10cSrcweir
191cdf0e10cSrcweir aOptsItem.GetOptionsLayout().SetRulerVisible( aCbxRuler.IsChecked() );
192cdf0e10cSrcweir aOptsItem.GetOptionsLayout().SetMoveOutline( aCbxMoveOutline.IsChecked() );
193cdf0e10cSrcweir aOptsItem.GetOptionsLayout().SetDragStripes( aCbxDragStripes.IsChecked() );
194cdf0e10cSrcweir aOptsItem.GetOptionsLayout().SetHandlesBezier( aCbxHandlesBezier.IsChecked() );
195cdf0e10cSrcweir //aOptsItem.GetOptionsLayout().SetHelplines( aCbxHelplines.IsChecked() );
196cdf0e10cSrcweir
197cdf0e10cSrcweir rAttrs.Put( aOptsItem );
198cdf0e10cSrcweir bModified = sal_True;
199cdf0e10cSrcweir }
200cdf0e10cSrcweir return( bModified );
201cdf0e10cSrcweir }
202cdf0e10cSrcweir
203cdf0e10cSrcweir // -----------------------------------------------------------------------
204cdf0e10cSrcweir
Reset(const SfxItemSet & rAttrs)205cdf0e10cSrcweir void SdTpOptionsContents::Reset( const SfxItemSet& rAttrs )
206cdf0e10cSrcweir {
207cdf0e10cSrcweir SdOptionsContentsItem aOptsItem( (const SdOptionsContentsItem&) rAttrs.
208cdf0e10cSrcweir Get( ATTR_OPTIONS_CONTENTS ) );
209cdf0e10cSrcweir
210cdf0e10cSrcweir SdOptionsLayoutItem aLayoutItem( (const SdOptionsLayoutItem&) rAttrs.
211cdf0e10cSrcweir Get( ATTR_OPTIONS_LAYOUT ) );
212cdf0e10cSrcweir
213cdf0e10cSrcweir aCbxRuler.Check( aLayoutItem.GetOptionsLayout().IsRulerVisible() );
214cdf0e10cSrcweir aCbxMoveOutline.Check( aLayoutItem.GetOptionsLayout().IsMoveOutline() );
215cdf0e10cSrcweir aCbxDragStripes.Check( aLayoutItem.GetOptionsLayout().IsDragStripes() );
216cdf0e10cSrcweir aCbxHandlesBezier.Check( aLayoutItem.GetOptionsLayout().IsHandlesBezier() );
217cdf0e10cSrcweir //aCbxHelplines.Check( aLayoutItem.GetOptionsLayout().IsHelplines() );
218cdf0e10cSrcweir
219cdf0e10cSrcweir aCbxRuler.SaveValue();
220cdf0e10cSrcweir aCbxMoveOutline.SaveValue();
221cdf0e10cSrcweir aCbxDragStripes.SaveValue();
222cdf0e10cSrcweir aCbxHandlesBezier.SaveValue();
223cdf0e10cSrcweir //aCbxHelplines.SaveValue();
224cdf0e10cSrcweir }
225cdf0e10cSrcweir
226cdf0e10cSrcweir // -----------------------------------------------------------------------
227cdf0e10cSrcweir
Create(Window * pWindow,const SfxItemSet & rAttrs)228cdf0e10cSrcweir SfxTabPage* SdTpOptionsContents::Create( Window* pWindow,
229cdf0e10cSrcweir const SfxItemSet& rAttrs )
230cdf0e10cSrcweir {
231cdf0e10cSrcweir return( new SdTpOptionsContents( pWindow, rAttrs ) );
232cdf0e10cSrcweir }
233cdf0e10cSrcweir
234cdf0e10cSrcweir /*************************************************************************
235cdf0e10cSrcweir |*
236cdf0e10cSrcweir |* TabPage zum Einstellen der Sonstige-Optionen
237cdf0e10cSrcweir |*
238cdf0e10cSrcweir \************************************************************************/
239cdf0e10cSrcweir #define TABLE_COUNT 12
240cdf0e10cSrcweir #define TOKEN (sal_Unicode(':'))
241cdf0e10cSrcweir
SdTpOptionsMisc(Window * pParent,const SfxItemSet & rInAttrs)242cdf0e10cSrcweir SdTpOptionsMisc::SdTpOptionsMisc( Window* pParent, const SfxItemSet& rInAttrs ) :
243cdf0e10cSrcweir SfxTabPage ( pParent, SdResId( TP_OPTIONS_MISC ), rInAttrs ),
244cdf0e10cSrcweir aGrpText ( this, SdResId( GRP_TEXT ) ),
245cdf0e10cSrcweir aCbxQuickEdit ( this, SdResId( CBX_QUICKEDIT ) ),
246cdf0e10cSrcweir aCbxPickThrough ( this, SdResId( CBX_PICKTHROUGH ) ),
247cdf0e10cSrcweir
248cdf0e10cSrcweir // Template & Layout laufen z.Z. synchron!
249cdf0e10cSrcweir aGrpProgramStart ( this, SdResId( GRP_PROGRAMSTART ) ),
250cdf0e10cSrcweir aCbxStartWithTemplate ( this, SdResId( CBX_START_WITH_TEMPLATE ) ),
251cdf0e10cSrcweir
252cdf0e10cSrcweir aGrpSettings ( this, SdResId( GRP_SETTINGS ) ),
253cdf0e10cSrcweir aCbxMasterPageCache ( this, SdResId( CBX_MASTERPAGE_CACHE ) ),
254cdf0e10cSrcweir aCbxCopy ( this, SdResId( CBX_COPY ) ),
255cdf0e10cSrcweir aCbxMarkedHitMovesAlways ( this, SdResId( CBX_MARKED_HIT_MOVES_ALWAYS ) ),
256cdf0e10cSrcweir aCbxCrookNoContortion ( this, SdResId( CBX_CROOK_NO_CONTORTION ) ),
257cdf0e10cSrcweir
258cdf0e10cSrcweir aTxtMetric ( this, SdResId( FT_METRIC ) ),
259cdf0e10cSrcweir aLbMetric ( this, SdResId( LB_METRIC ) ),
260cdf0e10cSrcweir aTxtTabstop ( this, SdResId( FT_TABSTOP ) ),
261cdf0e10cSrcweir aMtrFldTabstop ( this, SdResId( MTR_FLD_TABSTOP ) ),
262cdf0e10cSrcweir
263cdf0e10cSrcweir aCbxStartWithActualPage ( this, SdResId( CBX_START_WITH_ACTUAL_PAGE ) ),
2642da1a64cSAriel Constenla-Haile aCbxStartWithPresenterScreen( this, SdResId( CBX_START_WITH_PRESENTER_SCREEN ) ),
265cdf0e10cSrcweir aGrpStartWithActualPage ( this, SdResId( GRP_START_WITH_ACTUAL_PAGE ) ),
266cdf0e10cSrcweir aTxtCompatibility ( this, SdResId( FT_COMPATIBILITY ) ),
267cdf0e10cSrcweir aCbxUsePrinterMetrics ( this, SdResId( CB_USE_PRINTER_METRICS ) ),
268cdf0e10cSrcweir aCbxCompatibility ( this, SdResId( CB_MERGE_PARA_DIST ) ),
269cdf0e10cSrcweir aGrpScale ( this, SdResId( GRP_SCALE ) ),
270cdf0e10cSrcweir aFtScale ( this, SdResId( FT_SCALE ) ),
271cdf0e10cSrcweir aCbScale ( this, SdResId( CB_SCALE ) ),
272cdf0e10cSrcweir aFtOriginal ( this, SdResId( FT_ORIGINAL ) ),
273cdf0e10cSrcweir aFtEquivalent ( this, SdResId( FT_EQUIVALENT ) ),
274cdf0e10cSrcweir aFtPageWidth ( this, SdResId( FT_PAGEWIDTH ) ),
275cdf0e10cSrcweir aFiInfo1 ( this, SdResId( FI_INFO_1 ) ),
276cdf0e10cSrcweir aMtrFldOriginalWidth ( this, SdResId( MTR_FLD_ORIGINAL_WIDTH ) ),
277cdf0e10cSrcweir aFtPageHeight ( this, SdResId( FT_PAGEHEIGHT ) ),
278cdf0e10cSrcweir aFiInfo2 ( this, SdResId( FI_INFO_2 ) ),
279cdf0e10cSrcweir aMtrFldOriginalHeight ( this, SdResId( MTR_FLD_ORIGINAL_HEIGHT ) ),
280cdf0e10cSrcweir aMtrFldInfo1 ( this, WinBits( WB_HIDE ) ),
281cdf0e10cSrcweir aMtrFldInfo2 ( this, WinBits( WB_HIDE ) )
282cdf0e10cSrcweir {
283cdf0e10cSrcweir FreeResource();
284cdf0e10cSrcweir SetExchangeSupport();
285cdf0e10cSrcweir
286cdf0e10cSrcweir // Metrik einstellen
287cdf0e10cSrcweir FieldUnit eFUnit;
288cdf0e10cSrcweir
289cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC );
290cdf0e10cSrcweir if ( rInAttrs.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir const SfxUInt16Item& rItem = (SfxUInt16Item&)rInAttrs.Get( nWhich );
293cdf0e10cSrcweir eFUnit = (FieldUnit)rItem.GetValue();
294cdf0e10cSrcweir }
295cdf0e10cSrcweir else
296cdf0e10cSrcweir eFUnit = SfxModule::GetCurrentFieldUnit();
297cdf0e10cSrcweir
298cdf0e10cSrcweir SetFieldUnit( aMtrFldTabstop, eFUnit );
299cdf0e10cSrcweir
300cdf0e10cSrcweir // ListBox mit Metriken f"ullen
301cdf0e10cSrcweir SvxStringArray aMetricArr( RID_SVXSTR_FIELDUNIT_TABLE );
302cdf0e10cSrcweir sal_uInt16 i;
303cdf0e10cSrcweir
304cdf0e10cSrcweir for ( i = 0; i < aMetricArr.Count(); ++i )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir String sMetric = aMetricArr.GetStringByPos( i );
307cdf0e10cSrcweir long nFieldUnit = aMetricArr.GetValue( i );
308cdf0e10cSrcweir sal_uInt16 nPos = aLbMetric.InsertEntry( sMetric );
309cdf0e10cSrcweir aLbMetric.SetEntryData( nPos, (void*)nFieldUnit );
310cdf0e10cSrcweir }
311cdf0e10cSrcweir aLbMetric.SetSelectHdl( LINK( this, SdTpOptionsMisc, SelectMetricHdl_Impl ) );
312cdf0e10cSrcweir
313cdf0e10cSrcweir SetFieldUnit( aMtrFldOriginalWidth, eFUnit );
314cdf0e10cSrcweir SetFieldUnit( aMtrFldOriginalHeight, eFUnit );
315cdf0e10cSrcweir aMtrFldOriginalWidth.SetLast( 999999999 );
316cdf0e10cSrcweir aMtrFldOriginalWidth.SetMax( 999999999 );
317cdf0e10cSrcweir aMtrFldOriginalHeight.SetLast( 999999999 );
318cdf0e10cSrcweir aMtrFldOriginalHeight.SetMax( 999999999 );
319cdf0e10cSrcweir
320cdf0e10cSrcweir // Temporaere Fields fuer Info-Texte (fuer Formatierung/Berechnung)
321cdf0e10cSrcweir aMtrFldInfo1.SetUnit( eFUnit );
322cdf0e10cSrcweir aMtrFldInfo1.SetMax( 999999999 );
323cdf0e10cSrcweir aMtrFldInfo1.SetDecimalDigits( 2 );
324cdf0e10cSrcweir aMtrFldInfo2.SetUnit( eFUnit );
325cdf0e10cSrcweir aMtrFldInfo2.SetMax( 999999999 );
326cdf0e10cSrcweir aMtrFldInfo2.SetDecimalDigits( 2 );
327cdf0e10cSrcweir
328cdf0e10cSrcweir // PoolUnit ermitteln
329cdf0e10cSrcweir SfxItemPool* pPool = rInAttrs.GetPool();
330cdf0e10cSrcweir DBG_ASSERT( pPool, "Wo ist der Pool?" );
331cdf0e10cSrcweir ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH );
332cdf0e10cSrcweir
333cdf0e10cSrcweir // Fuellen der CB
334cdf0e10cSrcweir sal_uInt16 aTable[ TABLE_COUNT ] =
335cdf0e10cSrcweir { 1, 2, 4, 5, 8, 10, 16, 20, 30, 40, 50, 100 };
336cdf0e10cSrcweir
337cdf0e10cSrcweir for( i = 0; i < TABLE_COUNT; i++ )
338cdf0e10cSrcweir aCbScale.InsertEntry( GetScale( 1, aTable[i] ) );
339cdf0e10cSrcweir for( i = 1; i < TABLE_COUNT; i++ )
340cdf0e10cSrcweir aCbScale.InsertEntry( GetScale( aTable[i], 1 ) );
341cdf0e10cSrcweir }
342cdf0e10cSrcweir
343cdf0e10cSrcweir // -----------------------------------------------------------------------
344cdf0e10cSrcweir
~SdTpOptionsMisc()345cdf0e10cSrcweir SdTpOptionsMisc::~SdTpOptionsMisc()
346cdf0e10cSrcweir {
347cdf0e10cSrcweir }
348cdf0e10cSrcweir // -----------------------------------------------------------------------
ActivatePage(const SfxItemSet & rSet)349cdf0e10cSrcweir void SdTpOptionsMisc::ActivatePage( const SfxItemSet& rSet )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir // Hier muss noch einmal SaveValue gerufen werden, da sonst u.U.
352cdf0e10cSrcweir // der Wert in anderen TabPages keine Wirkung hat
353cdf0e10cSrcweir aLbMetric.SaveValue();
354cdf0e10cSrcweir // Metrik ggfs. aendern (da TabPage im Dialog liegt,
355cdf0e10cSrcweir // wo die Metrik eingestellt werden kann
356cdf0e10cSrcweir const SfxPoolItem* pAttr = NULL;
357cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_METRIC , sal_False,
358cdf0e10cSrcweir (const SfxPoolItem**)&pAttr ))
359cdf0e10cSrcweir {
360cdf0e10cSrcweir const SfxUInt16Item* pItem = (SfxUInt16Item*) pAttr;
361cdf0e10cSrcweir
362cdf0e10cSrcweir FieldUnit eFUnit = (FieldUnit)(long)pItem->GetValue();
363cdf0e10cSrcweir
364cdf0e10cSrcweir if( eFUnit != aMtrFldOriginalWidth.GetUnit() )
365cdf0e10cSrcweir {
366cdf0e10cSrcweir // Metriken einstellen
367cdf0e10cSrcweir sal_Int64 nVal = aMtrFldOriginalWidth.Denormalize( aMtrFldOriginalWidth.GetValue( FUNIT_TWIP ) );
368cdf0e10cSrcweir SetFieldUnit( aMtrFldOriginalWidth, eFUnit, sal_True );
369cdf0e10cSrcweir aMtrFldOriginalWidth.SetValue( aMtrFldOriginalWidth.Normalize( nVal ), FUNIT_TWIP );
370cdf0e10cSrcweir
371cdf0e10cSrcweir nVal = aMtrFldOriginalHeight.Denormalize( aMtrFldOriginalHeight.GetValue( FUNIT_TWIP ) );
372cdf0e10cSrcweir SetFieldUnit( aMtrFldOriginalHeight, eFUnit, sal_True );
373cdf0e10cSrcweir aMtrFldOriginalHeight.SetValue( aMtrFldOriginalHeight.Normalize( nVal ), FUNIT_TWIP );
374cdf0e10cSrcweir
375cdf0e10cSrcweir
376cdf0e10cSrcweir if( nWidth != 0 && nHeight != 0 )
377cdf0e10cSrcweir {
378cdf0e10cSrcweir aMtrFldInfo1.SetUnit( eFUnit );
379cdf0e10cSrcweir aMtrFldInfo2.SetUnit( eFUnit );
380cdf0e10cSrcweir
381cdf0e10cSrcweir SetMetricValue( aMtrFldInfo1, nWidth, ePoolUnit );
382cdf0e10cSrcweir aInfo1 = aMtrFldInfo1.GetText();
383cdf0e10cSrcweir aFiInfo1.SetText( aInfo1 );
384cdf0e10cSrcweir
385cdf0e10cSrcweir SetMetricValue( aMtrFldInfo2, nHeight, ePoolUnit );
386cdf0e10cSrcweir aInfo2 = aMtrFldInfo2.GetText();
387cdf0e10cSrcweir aFiInfo2.SetText( aInfo2 );
388cdf0e10cSrcweir }
389cdf0e10cSrcweir }
390cdf0e10cSrcweir }
391cdf0e10cSrcweir }
392cdf0e10cSrcweir
393cdf0e10cSrcweir // -----------------------------------------------------------------------
394cdf0e10cSrcweir
DeactivatePage(SfxItemSet * pActiveSet)395cdf0e10cSrcweir int SdTpOptionsMisc::DeactivatePage( SfxItemSet* pActiveSet )
396cdf0e10cSrcweir {
397cdf0e10cSrcweir // Parsercheck
398cdf0e10cSrcweir sal_Int32 nX, nY;
399cdf0e10cSrcweir if( SetScale( aCbScale.GetText(), nX, nY ) )
400cdf0e10cSrcweir {
401cdf0e10cSrcweir if( pActiveSet )
402cdf0e10cSrcweir FillItemSet( *pActiveSet );
403cdf0e10cSrcweir return( LEAVE_PAGE );
404cdf0e10cSrcweir }
405cdf0e10cSrcweir WarningBox aWarnBox( GetParent(), WB_YES_NO, String( SdResId( STR_WARN_SCALE_FAIL ) ) );
406cdf0e10cSrcweir short nReturn = aWarnBox.Execute();
407cdf0e10cSrcweir
408cdf0e10cSrcweir if( nReturn == RET_YES )
409cdf0e10cSrcweir return( KEEP_PAGE );
410cdf0e10cSrcweir
411cdf0e10cSrcweir if( pActiveSet )
412cdf0e10cSrcweir FillItemSet( *pActiveSet );
413cdf0e10cSrcweir
414cdf0e10cSrcweir return( LEAVE_PAGE );
415cdf0e10cSrcweir }
416cdf0e10cSrcweir
417cdf0e10cSrcweir // -----------------------------------------------------------------------
418cdf0e10cSrcweir
FillItemSet(SfxItemSet & rAttrs)419cdf0e10cSrcweir sal_Bool SdTpOptionsMisc::FillItemSet( SfxItemSet& rAttrs )
420cdf0e10cSrcweir {
421cdf0e10cSrcweir sal_Bool bModified = sal_False;
422cdf0e10cSrcweir
423cdf0e10cSrcweir if( aCbxStartWithTemplate.GetSavedValue() != aCbxStartWithTemplate.IsChecked() ||
424cdf0e10cSrcweir aCbxMarkedHitMovesAlways.GetSavedValue()!= aCbxMarkedHitMovesAlways.IsChecked() ||
425cdf0e10cSrcweir aCbxCrookNoContortion.GetSavedValue() != aCbxCrookNoContortion.IsChecked() ||
426cdf0e10cSrcweir aCbxQuickEdit.GetSavedValue() != aCbxQuickEdit.IsChecked() ||
427cdf0e10cSrcweir aCbxPickThrough.GetSavedValue() != aCbxPickThrough.IsChecked() ||
428cdf0e10cSrcweir aCbxMasterPageCache.GetSavedValue() != aCbxMasterPageCache.IsChecked() ||
429cdf0e10cSrcweir aCbxCopy.GetSavedValue() != aCbxCopy.IsChecked() ||
430cdf0e10cSrcweir aCbxStartWithActualPage.GetSavedValue() != aCbxStartWithActualPage.IsChecked() ||
4312da1a64cSAriel Constenla-Haile aCbxStartWithPresenterScreen.GetSavedValue() != aCbxStartWithPresenterScreen.IsChecked() ||
432cdf0e10cSrcweir aCbxCompatibility.GetSavedValue() != aCbxCompatibility.IsChecked() ||
433cdf0e10cSrcweir aCbxUsePrinterMetrics.GetSavedValue() != aCbxUsePrinterMetrics.IsChecked() )
434cdf0e10cSrcweir {
435cdf0e10cSrcweir SdOptionsMiscItem aOptsItem( ATTR_OPTIONS_MISC );
436cdf0e10cSrcweir
437cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetStartWithTemplate( aCbxStartWithTemplate.IsChecked() );
438cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetMarkedHitMovesAlways( aCbxMarkedHitMovesAlways.IsChecked() );
439cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetCrookNoContortion( aCbxCrookNoContortion.IsChecked() );
440cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetQuickEdit( aCbxQuickEdit.IsChecked() );
441cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetPickThrough( aCbxPickThrough.IsChecked() );
442cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetMasterPagePaintCaching( aCbxMasterPageCache.IsChecked() );
443cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetDragWithCopy( aCbxCopy.IsChecked() );
444cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetStartWithActualPage( aCbxStartWithActualPage.IsChecked() );
4452da1a64cSAriel Constenla-Haile aOptsItem.GetOptionsMisc().SetStartWithPresenterScreen( aCbxStartWithPresenterScreen.IsChecked() );
446cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetSummationOfParagraphs( aCbxCompatibility.IsChecked() );
447cdf0e10cSrcweir aOptsItem.GetOptionsMisc().SetPrinterIndependentLayout (
448cdf0e10cSrcweir aCbxUsePrinterMetrics.IsChecked()
449cdf0e10cSrcweir ? ::com::sun::star::document::PrinterIndependentLayout::DISABLED
450cdf0e10cSrcweir : ::com::sun::star::document::PrinterIndependentLayout::ENABLED);
451cdf0e10cSrcweir rAttrs.Put( aOptsItem );
452cdf0e10cSrcweir
453cdf0e10cSrcweir bModified = sal_True;
454cdf0e10cSrcweir }
455cdf0e10cSrcweir
456cdf0e10cSrcweir // Metrik
457cdf0e10cSrcweir const sal_uInt16 nMPos = aLbMetric.GetSelectEntryPos();
458cdf0e10cSrcweir if ( nMPos != aLbMetric.GetSavedValue() )
459cdf0e10cSrcweir {
460cdf0e10cSrcweir sal_uInt16 nFieldUnit = (sal_uInt16)(long)aLbMetric.GetEntryData( nMPos );
461cdf0e10cSrcweir rAttrs.Put( SfxUInt16Item( GetWhich( SID_ATTR_METRIC ),
462cdf0e10cSrcweir (sal_uInt16)nFieldUnit ) );
463cdf0e10cSrcweir bModified |= sal_True;
464cdf0e10cSrcweir }
465cdf0e10cSrcweir
466cdf0e10cSrcweir // Tabulatorabstand
467cdf0e10cSrcweir if( aMtrFldTabstop.GetText() != aMtrFldTabstop.GetSavedValue() )
468cdf0e10cSrcweir {
469cdf0e10cSrcweir sal_uInt16 nWh = GetWhich( SID_ATTR_DEFTABSTOP );
470cdf0e10cSrcweir SfxMapUnit eUnit = rAttrs.GetPool()->GetMetric( nWh );
471cdf0e10cSrcweir SfxUInt16Item aDef( nWh,(sal_uInt16)GetCoreValue( aMtrFldTabstop, eUnit ) );
472cdf0e10cSrcweir rAttrs.Put( aDef );
473cdf0e10cSrcweir bModified |= sal_True;
474cdf0e10cSrcweir }
475cdf0e10cSrcweir
476cdf0e10cSrcweir sal_Int32 nX, nY;
477cdf0e10cSrcweir if( SetScale( aCbScale.GetText(), nX, nY ) )
478cdf0e10cSrcweir {
479cdf0e10cSrcweir rAttrs.Put( SfxInt32Item( ATTR_OPTIONS_SCALE_X, nX ) );
480cdf0e10cSrcweir rAttrs.Put( SfxInt32Item( ATTR_OPTIONS_SCALE_Y, nY ) );
481cdf0e10cSrcweir
482cdf0e10cSrcweir bModified = sal_True;
483cdf0e10cSrcweir }
484cdf0e10cSrcweir
485cdf0e10cSrcweir return( bModified );
486cdf0e10cSrcweir }
487cdf0e10cSrcweir
488cdf0e10cSrcweir // -----------------------------------------------------------------------
489cdf0e10cSrcweir
Reset(const SfxItemSet & rAttrs)490cdf0e10cSrcweir void SdTpOptionsMisc::Reset( const SfxItemSet& rAttrs )
491cdf0e10cSrcweir {
492cdf0e10cSrcweir SdOptionsMiscItem aOptsItem( (const SdOptionsMiscItem&) rAttrs.
493cdf0e10cSrcweir Get( ATTR_OPTIONS_MISC ) );
494cdf0e10cSrcweir
495cdf0e10cSrcweir aCbxStartWithTemplate.Check( aOptsItem.GetOptionsMisc().IsStartWithTemplate() );
496cdf0e10cSrcweir aCbxMarkedHitMovesAlways.Check( aOptsItem.GetOptionsMisc().IsMarkedHitMovesAlways() );
497cdf0e10cSrcweir aCbxCrookNoContortion.Check( aOptsItem.GetOptionsMisc().IsCrookNoContortion() );
498cdf0e10cSrcweir aCbxQuickEdit.Check( aOptsItem.GetOptionsMisc().IsQuickEdit() );
499cdf0e10cSrcweir aCbxPickThrough.Check( aOptsItem.GetOptionsMisc().IsPickThrough() );
500cdf0e10cSrcweir aCbxMasterPageCache.Check( aOptsItem.GetOptionsMisc().IsMasterPagePaintCaching() );
501cdf0e10cSrcweir aCbxCopy.Check( aOptsItem.GetOptionsMisc().IsDragWithCopy() );
502cdf0e10cSrcweir aCbxStartWithActualPage.Check( aOptsItem.GetOptionsMisc().IsStartWithActualPage() );
5032da1a64cSAriel Constenla-Haile aCbxStartWithPresenterScreen.Check( aOptsItem.GetOptionsMisc().IsStartWithPresenterScreen() );
504cdf0e10cSrcweir aCbxCompatibility.Check( aOptsItem.GetOptionsMisc().IsSummationOfParagraphs() );
505cdf0e10cSrcweir aCbxUsePrinterMetrics.Check( aOptsItem.GetOptionsMisc().GetPrinterIndependentLayout()==1 );
506cdf0e10cSrcweir aCbxStartWithTemplate.SaveValue();
507cdf0e10cSrcweir aCbxMarkedHitMovesAlways.SaveValue();
508cdf0e10cSrcweir aCbxCrookNoContortion.SaveValue();
509cdf0e10cSrcweir aCbxQuickEdit.SaveValue();
510cdf0e10cSrcweir aCbxPickThrough.SaveValue();
511cdf0e10cSrcweir
512cdf0e10cSrcweir aCbxMasterPageCache.SaveValue();
513cdf0e10cSrcweir aCbxCopy.SaveValue();
514cdf0e10cSrcweir aCbxStartWithActualPage.SaveValue();
5152da1a64cSAriel Constenla-Haile aCbxStartWithPresenterScreen.SaveValue();
516cdf0e10cSrcweir aCbxCompatibility.SaveValue();
517cdf0e10cSrcweir aCbxUsePrinterMetrics.SaveValue();
518cdf0e10cSrcweir
519cdf0e10cSrcweir // Metrik
520cdf0e10cSrcweir sal_uInt16 nWhich = GetWhich( SID_ATTR_METRIC );
521cdf0e10cSrcweir aLbMetric.SetNoSelection();
522cdf0e10cSrcweir
523cdf0e10cSrcweir if ( rAttrs.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
524cdf0e10cSrcweir {
525cdf0e10cSrcweir const SfxUInt16Item& rItem = (SfxUInt16Item&)rAttrs.Get( nWhich );
526cdf0e10cSrcweir long nFieldUnit = (long)rItem.GetValue();
527cdf0e10cSrcweir
528cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aLbMetric.GetEntryCount(); ++i )
529cdf0e10cSrcweir {
530cdf0e10cSrcweir if ( (long)aLbMetric.GetEntryData( i ) == nFieldUnit )
531cdf0e10cSrcweir {
532cdf0e10cSrcweir aLbMetric.SelectEntryPos( i );
533cdf0e10cSrcweir break;
534cdf0e10cSrcweir }
535cdf0e10cSrcweir }
536cdf0e10cSrcweir }
537cdf0e10cSrcweir
538cdf0e10cSrcweir // Tabulatorabstand
539cdf0e10cSrcweir nWhich = GetWhich( SID_ATTR_DEFTABSTOP );
540cdf0e10cSrcweir if( rAttrs.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE )
541cdf0e10cSrcweir {
542cdf0e10cSrcweir SfxMapUnit eUnit = rAttrs.GetPool()->GetMetric( nWhich );
543cdf0e10cSrcweir const SfxUInt16Item& rItem = (SfxUInt16Item&)rAttrs.Get( nWhich );
544cdf0e10cSrcweir SetMetricValue( aMtrFldTabstop, rItem.GetValue(), eUnit );
545cdf0e10cSrcweir }
546cdf0e10cSrcweir aLbMetric.SaveValue();
547cdf0e10cSrcweir aMtrFldTabstop.SaveValue();
548cdf0e10cSrcweir //Scale
549cdf0e10cSrcweir sal_Int32 nX = ( (const SfxInt32Item&) rAttrs.
550cdf0e10cSrcweir Get( ATTR_OPTIONS_SCALE_X ) ).GetValue();
551cdf0e10cSrcweir sal_Int32 nY = ( (const SfxInt32Item&) rAttrs.
552cdf0e10cSrcweir Get( ATTR_OPTIONS_SCALE_Y ) ).GetValue();
553cdf0e10cSrcweir nWidth = ( (const SfxUInt32Item&) rAttrs.
554cdf0e10cSrcweir Get( ATTR_OPTIONS_SCALE_WIDTH ) ).GetValue();
555cdf0e10cSrcweir nHeight = ( (const SfxUInt32Item&) rAttrs.
556cdf0e10cSrcweir Get( ATTR_OPTIONS_SCALE_HEIGHT ) ).GetValue();
557cdf0e10cSrcweir
558cdf0e10cSrcweir aCbScale.SetText( GetScale( nX, nY ) );
559cdf0e10cSrcweir
560cdf0e10cSrcweir // #92067# broken feature disabled for 6.0
561cdf0e10cSrcweir aFtOriginal.Hide();
562cdf0e10cSrcweir aFtEquivalent.Hide();
563cdf0e10cSrcweir aMtrFldOriginalWidth.Hide();
564cdf0e10cSrcweir aMtrFldOriginalWidth.SetText( aInfo1 ); // leer
565cdf0e10cSrcweir aMtrFldOriginalHeight.Hide();
566cdf0e10cSrcweir aMtrFldOriginalHeight.SetText( aInfo2 ); //leer
567cdf0e10cSrcweir aFtPageWidth.Hide();
568cdf0e10cSrcweir aFtPageHeight.Hide();
569cdf0e10cSrcweir aFiInfo1.Hide();
570cdf0e10cSrcweir aFiInfo2.Hide();
571cdf0e10cSrcweir
572cdf0e10cSrcweir UpdateCompatibilityControls ();
573cdf0e10cSrcweir }
574cdf0e10cSrcweir
575cdf0e10cSrcweir // -----------------------------------------------------------------------
576cdf0e10cSrcweir
Create(Window * pWindow,const SfxItemSet & rAttrs)577cdf0e10cSrcweir SfxTabPage* SdTpOptionsMisc::Create( Window* pWindow,
578cdf0e10cSrcweir const SfxItemSet& rAttrs )
579cdf0e10cSrcweir {
580cdf0e10cSrcweir return( new SdTpOptionsMisc( pWindow, rAttrs ) );
581cdf0e10cSrcweir }
582cdf0e10cSrcweir //------------------------------------------------------------------------
583cdf0e10cSrcweir
IMPL_LINK(SdTpOptionsMisc,SelectMetricHdl_Impl,ListBox *,EMPTYARG)584cdf0e10cSrcweir IMPL_LINK( SdTpOptionsMisc, SelectMetricHdl_Impl, ListBox *, EMPTYARG )
585cdf0e10cSrcweir {
586cdf0e10cSrcweir sal_uInt16 nPos = aLbMetric.GetSelectEntryPos();
587cdf0e10cSrcweir
588cdf0e10cSrcweir if( nPos != LISTBOX_ENTRY_NOTFOUND )
589cdf0e10cSrcweir {
590cdf0e10cSrcweir FieldUnit eUnit = (FieldUnit)(long)aLbMetric.GetEntryData( nPos );
591cdf0e10cSrcweir sal_Int64 nVal =
592cdf0e10cSrcweir aMtrFldTabstop.Denormalize( aMtrFldTabstop.GetValue( FUNIT_TWIP ) );
593cdf0e10cSrcweir SetFieldUnit( aMtrFldTabstop, eUnit );
594cdf0e10cSrcweir aMtrFldTabstop.SetValue( aMtrFldTabstop.Normalize( nVal ), FUNIT_TWIP );
595cdf0e10cSrcweir }
596cdf0e10cSrcweir return 0;
597cdf0e10cSrcweir }
598cdf0e10cSrcweir
599cdf0e10cSrcweir
600cdf0e10cSrcweir namespace {
lcl_MoveWin(Window & rWin,long nYDiff)601cdf0e10cSrcweir void lcl_MoveWin( Window& rWin, long nYDiff)
602cdf0e10cSrcweir {
603cdf0e10cSrcweir Point aPos(rWin.GetPosPixel());
604cdf0e10cSrcweir aPos.Y() += nYDiff;
605cdf0e10cSrcweir rWin.SetPosPixel (aPos);
606cdf0e10cSrcweir }
607cdf0e10cSrcweir
lcl_MoveWin(Window & rWin,long nXdiff,long nYdiff)608cdf0e10cSrcweir void lcl_MoveWin( Window& rWin, long nXdiff, long nYdiff)
609cdf0e10cSrcweir {
610cdf0e10cSrcweir Point aPos(rWin.GetPosPixel());
611cdf0e10cSrcweir aPos.X() += nXdiff;
612cdf0e10cSrcweir aPos.Y() += nYdiff;
613cdf0e10cSrcweir rWin.SetPosPixel(aPos);
614cdf0e10cSrcweir }
615cdf0e10cSrcweir }
616cdf0e10cSrcweir
SetImpressMode(void)617cdf0e10cSrcweir void SdTpOptionsMisc::SetImpressMode (void)
618cdf0e10cSrcweir {
619cdf0e10cSrcweir long nDialogWidth = GetSizePixel().Width();
620cdf0e10cSrcweir long nLineHeight = aCbxPickThrough.GetPosPixel().Y()
621cdf0e10cSrcweir - aCbxQuickEdit.GetPosPixel().Y();
622cdf0e10cSrcweir
623cdf0e10cSrcweir // Put both "Text objects" check boxes side by side.
624cdf0e10cSrcweir lcl_MoveWin (aCbxPickThrough,
625cdf0e10cSrcweir nDialogWidth/2 - aCbxPickThrough.GetPosPixel().X(),
626cdf0e10cSrcweir -nLineHeight);
627cdf0e10cSrcweir
628cdf0e10cSrcweir // Move the other controls up one line.
629cdf0e10cSrcweir lcl_MoveWin (aGrpProgramStart, -nLineHeight);
630cdf0e10cSrcweir lcl_MoveWin (aCbxStartWithTemplate, -nLineHeight);
631cdf0e10cSrcweir lcl_MoveWin (aGrpSettings, -nLineHeight);
632cdf0e10cSrcweir lcl_MoveWin (aCbxMasterPageCache, -nLineHeight);
633cdf0e10cSrcweir lcl_MoveWin (aCbxCopy, -nLineHeight);
634cdf0e10cSrcweir lcl_MoveWin (aCbxMarkedHitMovesAlways, -nLineHeight);
635cdf0e10cSrcweir lcl_MoveWin (aCbxCrookNoContortion, -nLineHeight);
636cdf0e10cSrcweir lcl_MoveWin (aTxtMetric, -nLineHeight);
637cdf0e10cSrcweir lcl_MoveWin (aLbMetric, -nLineHeight);
638cdf0e10cSrcweir lcl_MoveWin (aTxtTabstop, -nLineHeight);
639cdf0e10cSrcweir lcl_MoveWin (aMtrFldTabstop, -nLineHeight);
640cdf0e10cSrcweir lcl_MoveWin (aGrpStartWithActualPage, -nLineHeight);
641cdf0e10cSrcweir lcl_MoveWin (aCbxStartWithActualPage, -nLineHeight);
6422da1a64cSAriel Constenla-Haile
6432da1a64cSAriel Constenla-Haile lcl_MoveWin (aCbxStartWithPresenterScreen,
6442da1a64cSAriel Constenla-Haile nDialogWidth/2 - aCbxStartWithPresenterScreen.GetPosPixel().X(),
6452da1a64cSAriel Constenla-Haile -nLineHeight);
6462da1a64cSAriel Constenla-Haile
647cdf0e10cSrcweir lcl_MoveWin (aTxtCompatibility, -nLineHeight);
648cdf0e10cSrcweir
649cdf0e10cSrcweir // Move the printer-independent-metrics check box up two lines to change
650cdf0e10cSrcweir // places with spacing-between-paragraphs check box.
651cdf0e10cSrcweir lcl_MoveWin (aCbxUsePrinterMetrics, -2*nLineHeight);
652cdf0e10cSrcweir }
653cdf0e10cSrcweir
SetDrawMode()654cdf0e10cSrcweir void SdTpOptionsMisc::SetDrawMode()
655cdf0e10cSrcweir {
656cdf0e10cSrcweir aCbxStartWithTemplate.Hide();
657cdf0e10cSrcweir aGrpProgramStart.Hide();
658cdf0e10cSrcweir aCbxStartWithActualPage.Hide();
6592da1a64cSAriel Constenla-Haile aCbxStartWithPresenterScreen.Hide();
660cdf0e10cSrcweir aCbxCompatibility.Hide();
661cdf0e10cSrcweir aGrpStartWithActualPage.Hide();
662cdf0e10cSrcweir aCbxCrookNoContortion.Show();
663cdf0e10cSrcweir
664cdf0e10cSrcweir aGrpScale.Show();
665cdf0e10cSrcweir aFtScale.Show();
666cdf0e10cSrcweir aCbScale.Show();
667cdf0e10cSrcweir
668cdf0e10cSrcweir aFtOriginal.Show();
669cdf0e10cSrcweir aFtEquivalent.Show();
670cdf0e10cSrcweir
671cdf0e10cSrcweir aFtPageWidth.Show();
672cdf0e10cSrcweir aFiInfo1.Show();
673cdf0e10cSrcweir aMtrFldOriginalWidth.Show();
674cdf0e10cSrcweir
675cdf0e10cSrcweir aFtPageHeight.Show();
676cdf0e10cSrcweir aFiInfo2.Show();
677cdf0e10cSrcweir aMtrFldOriginalHeight.Show();
678cdf0e10cSrcweir
679cdf0e10cSrcweir long nDiff = aGrpSettings.GetPosPixel().Y() - aGrpProgramStart.GetPosPixel().Y();
680cdf0e10cSrcweir lcl_MoveWin( aGrpSettings, -nDiff );
681cdf0e10cSrcweir lcl_MoveWin( aCbxMasterPageCache, -nDiff );
682cdf0e10cSrcweir lcl_MoveWin( aCbxCopy, -nDiff );
683cdf0e10cSrcweir lcl_MoveWin( aCbxMarkedHitMovesAlways, -nDiff );
684cdf0e10cSrcweir lcl_MoveWin( aCbxCrookNoContortion, -nDiff );
685cdf0e10cSrcweir nDiff -= aCbxCrookNoContortion.GetPosPixel().Y() - aCbxMarkedHitMovesAlways.GetPosPixel().Y();
686cdf0e10cSrcweir lcl_MoveWin( aTxtMetric, -nDiff );
687cdf0e10cSrcweir lcl_MoveWin( aLbMetric, -nDiff );
688cdf0e10cSrcweir lcl_MoveWin( aTxtTabstop, -nDiff );
689cdf0e10cSrcweir lcl_MoveWin( aMtrFldTabstop, -nDiff );
690cdf0e10cSrcweir
691*86e1cf34SPedro Giffuni // Move the scale controls so that they are visually centered between the
692cdf0e10cSrcweir // group controls above and below.
693cdf0e10cSrcweir lcl_MoveWin (aFtScale, -17);
694cdf0e10cSrcweir lcl_MoveWin (aCbScale, -17);
695cdf0e10cSrcweir
696cdf0e10cSrcweir // Move the printer-independent-metrics check box in the place that the
697cdf0e10cSrcweir // spacing-between-paragraphs check box normally is in.
698cdf0e10cSrcweir aCbxUsePrinterMetrics.SetPosPixel (aCbxCompatibility.GetPosPixel());
699cdf0e10cSrcweir }
700cdf0e10cSrcweir // -----------------------------------------------------------------------
701cdf0e10cSrcweir
IMPL_LINK(SdTpOptionsMisc,ModifyScaleHdl,void *,EMPTYARG)702cdf0e10cSrcweir IMPL_LINK( SdTpOptionsMisc, ModifyScaleHdl, void *, EMPTYARG )
703cdf0e10cSrcweir {
704cdf0e10cSrcweir // Originalgroesse berechnen
705cdf0e10cSrcweir sal_Int32 nX, nY;
706cdf0e10cSrcweir if( SetScale( aCbScale.GetText(), nX, nY ) )
707cdf0e10cSrcweir {
708cdf0e10cSrcweir sal_Int32 nW = nWidth * nY / nX;
709cdf0e10cSrcweir sal_Int32 nH = nHeight * nY / nX;
710cdf0e10cSrcweir
711cdf0e10cSrcweir SetMetricValue( aMtrFldOriginalWidth, nW, ePoolUnit );
712cdf0e10cSrcweir SetMetricValue( aMtrFldOriginalHeight, nH, ePoolUnit );
713cdf0e10cSrcweir }
714cdf0e10cSrcweir
715cdf0e10cSrcweir return( 0L );
716cdf0e10cSrcweir }
717cdf0e10cSrcweir
718cdf0e10cSrcweir // -----------------------------------------------------------------------
719cdf0e10cSrcweir
IMPL_LINK(SdTpOptionsMisc,ModifyOriginalScaleHdl,void *,EMPTYARG)720cdf0e10cSrcweir IMPL_LINK( SdTpOptionsMisc, ModifyOriginalScaleHdl, void *, EMPTYARG )
721cdf0e10cSrcweir {
722cdf0e10cSrcweir // Berechnen des Massstabs
723cdf0e10cSrcweir long nOrgW = static_cast<long>(aMtrFldOriginalWidth.GetValue());
724cdf0e10cSrcweir long nOrgH = static_cast<long>(aMtrFldOriginalHeight.GetValue());
725cdf0e10cSrcweir
726cdf0e10cSrcweir if( nOrgW == 0 || nOrgH == 0 )
727cdf0e10cSrcweir return( 0L );
728cdf0e10cSrcweir
729cdf0e10cSrcweir Fraction aFract1( nOrgW, static_cast<long>(aMtrFldInfo1.GetValue()) );
730cdf0e10cSrcweir Fraction aFract2( nOrgH, static_cast<long>(aMtrFldInfo2.GetValue()) );
731cdf0e10cSrcweir Fraction aFract( aFract1 > aFract2 ? aFract1 : aFract2 );
732cdf0e10cSrcweir
733cdf0e10cSrcweir long nValue;
734cdf0e10cSrcweir if( aFract < Fraction( 1, 1 ) )
735cdf0e10cSrcweir {
736cdf0e10cSrcweir // Fraction umdrehen
737cdf0e10cSrcweir aFract1 = aFract;
738cdf0e10cSrcweir aFract = Fraction( aFract1.GetDenominator(), aFract1.GetNumerator() );
739cdf0e10cSrcweir nValue = aFract;
740cdf0e10cSrcweir
741cdf0e10cSrcweir // #92067# Swap nominator and denominator
742cdf0e10cSrcweir aCbScale.SetText( GetScale( nValue, 1 ) );
743cdf0e10cSrcweir }
744cdf0e10cSrcweir else
745cdf0e10cSrcweir {
746cdf0e10cSrcweir double fValue = aFract;
747cdf0e10cSrcweir nValue = aFract;
748cdf0e10cSrcweir if( fValue > (double)nValue )
749cdf0e10cSrcweir nValue++;
750cdf0e10cSrcweir
751cdf0e10cSrcweir // #92067# Swap nominator and denominator
752cdf0e10cSrcweir aCbScale.SetText( GetScale( 1, nValue ) );
753cdf0e10cSrcweir }
754cdf0e10cSrcweir return( 0L );
755cdf0e10cSrcweir }
756cdf0e10cSrcweir
757cdf0e10cSrcweir // -----------------------------------------------------------------------
758cdf0e10cSrcweir
GetScale(sal_Int32 nX,sal_Int32 nY)759cdf0e10cSrcweir String SdTpOptionsMisc::GetScale( sal_Int32 nX, sal_Int32 nY )
760cdf0e10cSrcweir {
761cdf0e10cSrcweir String aScale( UniString::CreateFromInt32( nX ) );
762cdf0e10cSrcweir aScale.Append( TOKEN );
763cdf0e10cSrcweir aScale.Append( UniString::CreateFromInt32( nY ) );
764cdf0e10cSrcweir
765cdf0e10cSrcweir return( aScale );
766cdf0e10cSrcweir }
767cdf0e10cSrcweir
768cdf0e10cSrcweir // -----------------------------------------------------------------------
769cdf0e10cSrcweir
SetScale(const String & aScale,sal_Int32 & rX,sal_Int32 & rY)770cdf0e10cSrcweir sal_Bool SdTpOptionsMisc::SetScale( const String& aScale, sal_Int32& rX, sal_Int32& rY )
771cdf0e10cSrcweir {
772cdf0e10cSrcweir if( aScale.GetTokenCount( TOKEN ) != 2 )
773cdf0e10cSrcweir return( sal_False );
774cdf0e10cSrcweir
775cdf0e10cSrcweir ByteString aTmp( aScale.GetToken( 0, TOKEN ), RTL_TEXTENCODING_ASCII_US );
776cdf0e10cSrcweir if( !aTmp.IsNumericAscii() )
777cdf0e10cSrcweir return( sal_False );
778cdf0e10cSrcweir
779cdf0e10cSrcweir rX = (long) aTmp.ToInt32();
780cdf0e10cSrcweir if( rX == 0 )
781cdf0e10cSrcweir return( sal_False );
782cdf0e10cSrcweir
783cdf0e10cSrcweir aTmp = ByteString( aScale.GetToken( 1, TOKEN ), RTL_TEXTENCODING_ASCII_US );
784cdf0e10cSrcweir if( !aTmp.IsNumericAscii() )
785cdf0e10cSrcweir return( sal_False );
786cdf0e10cSrcweir
787cdf0e10cSrcweir rY = (long) aTmp.ToInt32();
788cdf0e10cSrcweir if( rY == 0 )
789cdf0e10cSrcweir return( sal_False );
790cdf0e10cSrcweir
791cdf0e10cSrcweir return( sal_True );
792cdf0e10cSrcweir }
793cdf0e10cSrcweir
794cdf0e10cSrcweir
795cdf0e10cSrcweir
796cdf0e10cSrcweir
UpdateCompatibilityControls(void)797cdf0e10cSrcweir void SdTpOptionsMisc::UpdateCompatibilityControls (void)
798cdf0e10cSrcweir {
799cdf0e10cSrcweir // Disable the compatibility controls by default. Enable them only when
800cdf0e10cSrcweir // there is at least one open document.
801cdf0e10cSrcweir sal_Bool bIsEnabled = sal_False;
802cdf0e10cSrcweir
803cdf0e10cSrcweir try
804cdf0e10cSrcweir {
805cdf0e10cSrcweir // Get a component enumeration from the desktop and search it for documents.
806cdf0e10cSrcweir Reference<lang::XMultiServiceFactory> xFactory (
807cdf0e10cSrcweir ::comphelper::getProcessServiceFactory ());
808cdf0e10cSrcweir do
809cdf0e10cSrcweir {
810cdf0e10cSrcweir if ( ! xFactory.is())
811cdf0e10cSrcweir break;
812cdf0e10cSrcweir
813cdf0e10cSrcweir Reference<frame::XDesktop> xDesktop (xFactory->createInstance (
814cdf0e10cSrcweir ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY);
815cdf0e10cSrcweir if ( ! xDesktop.is())
816cdf0e10cSrcweir break;
817cdf0e10cSrcweir
818cdf0e10cSrcweir Reference<container::XEnumerationAccess> xComponents (
819cdf0e10cSrcweir xDesktop->getComponents(), UNO_QUERY);
820cdf0e10cSrcweir if ( ! xComponents.is())
821cdf0e10cSrcweir break;
822cdf0e10cSrcweir
823cdf0e10cSrcweir Reference<container::XEnumeration> xEnumeration (
824cdf0e10cSrcweir xComponents->createEnumeration());
825cdf0e10cSrcweir if ( ! xEnumeration.is())
826cdf0e10cSrcweir break;
827cdf0e10cSrcweir
828cdf0e10cSrcweir while (xEnumeration->hasMoreElements())
829cdf0e10cSrcweir {
830cdf0e10cSrcweir Reference<frame::XModel> xModel (xEnumeration->nextElement(), UNO_QUERY);
831cdf0e10cSrcweir if (xModel.is())
832cdf0e10cSrcweir {
833cdf0e10cSrcweir // There is at leas one model/document: Enable the compatibility controls.
834cdf0e10cSrcweir bIsEnabled = sal_True;
835cdf0e10cSrcweir break;
836cdf0e10cSrcweir }
837cdf0e10cSrcweir }
838cdf0e10cSrcweir
839cdf0e10cSrcweir }
840cdf0e10cSrcweir while (false); // One 'loop'.
841cdf0e10cSrcweir }
842cdf0e10cSrcweir catch (uno::Exception e)
843cdf0e10cSrcweir {
844cdf0e10cSrcweir // When there is an exception then simply use the default value of
845cdf0e10cSrcweir // bIsEnabled and disable the controls.
846cdf0e10cSrcweir }
847cdf0e10cSrcweir
848cdf0e10cSrcweir aTxtCompatibility.Enable (bIsEnabled);
849cdf0e10cSrcweir aCbxCompatibility.Enable(bIsEnabled);
850cdf0e10cSrcweir aCbxUsePrinterMetrics.Enable (bIsEnabled);
851cdf0e10cSrcweir }
852cdf0e10cSrcweir
PageCreated(SfxAllItemSet aSet)853cdf0e10cSrcweir void SdTpOptionsMisc::PageCreated (SfxAllItemSet aSet)
854cdf0e10cSrcweir {
855cdf0e10cSrcweir SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt32Item,SID_SDMODE_FLAG,sal_False);
856cdf0e10cSrcweir if (pFlagItem)
857cdf0e10cSrcweir {
858cdf0e10cSrcweir sal_uInt32 nFlags=pFlagItem->GetValue();
859cdf0e10cSrcweir if ( ( nFlags & SD_DRAW_MODE ) == SD_DRAW_MODE )
860cdf0e10cSrcweir SetDrawMode();
861cdf0e10cSrcweir if ( ( nFlags & SD_IMPRESS_MODE ) == SD_IMPRESS_MODE )
862cdf0e10cSrcweir SetImpressMode();
863cdf0e10cSrcweir }
864cdf0e10cSrcweir }
865cdf0e10cSrcweir
866