1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 20 #pragma once 21 22 #include <unotools/configitem.hxx> 23 #include <sfx2/module.hxx> 24 #include <svx/optgrid.hxx> 25 #include <tools/degree.hxx> 26 #include <sddllapi.h> 27 #include <memory> 28 29 class SdOptions; 30 31 namespace sd { 32 class FrameView; 33 } 34 35 class SdOptionsGeneric; 36 37 class SD_DLLPUBLIC SdOptionsItem : public ::utl::ConfigItem 38 { 39 40 private: 41 42 const SdOptionsGeneric& mrParent; 43 44 virtual void ImplCommit() override; 45 46 public: 47 48 SdOptionsItem( const SdOptionsGeneric& rParent, const OUString& rSubTree ); 49 virtual ~SdOptionsItem() override; 50 51 SdOptionsItem(SdOptionsItem const &) = default; 52 SdOptionsItem(SdOptionsItem &&) = default; 53 SdOptionsItem & operator =(SdOptionsItem const &) = delete; // due to ConfigItem 54 SdOptionsItem & operator =(SdOptionsItem &&) = delete; // due to ConfigItem 55 56 virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames) override; 57 58 css::uno::Sequence< css::uno::Any > GetProperties( const css::uno::Sequence< OUString >& rNames ); 59 bool PutProperties( const css::uno::Sequence< OUString >& rNames, 60 const css::uno::Sequence< css::uno::Any>& rValues ); 61 using ConfigItem::SetModified; 62 }; 63 64 class SD_DLLPUBLIC SdOptionsGeneric 65 { 66 friend class SdOptionsItem; 67 68 private: 69 70 OUString maSubTree; 71 std::unique_ptr<SdOptionsItem> 72 mpCfgItem; 73 bool mbImpress; 74 bool mbInit : 1; 75 bool mbEnableModify : 1; 76 77 SAL_DLLPRIVATE void Commit( SdOptionsItem& rCfgItem ) const; 78 SAL_DLLPRIVATE css::uno::Sequence< OUString > GetPropertyNames() const; 79 80 protected: 81 82 void Init() const; OptionsChanged()83 void OptionsChanged() { if( mpCfgItem && mbEnableModify ) mpCfgItem->SetModified(); } 84 85 protected: 86 87 virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const = 0; 88 virtual bool ReadData( const css::uno::Any* pValues ) = 0; 89 virtual bool WriteData( css::uno::Any* pValues ) const = 0; 90 91 public: 92 93 SdOptionsGeneric(bool bImpress, const OUString& rSubTree); 94 SdOptionsGeneric(SdOptionsGeneric const &); 95 virtual ~SdOptionsGeneric(); 96 97 SdOptionsGeneric& operator=( SdOptionsGeneric const & ); 98 IsImpress() const99 bool IsImpress() const { return mbImpress; } 100 EnableModify(bool bModify)101 void EnableModify( bool bModify ) { mbEnableModify = bModify; } 102 103 void Store(); 104 105 static bool isMetricSystem(); 106 }; 107 108 class SD_DLLPUBLIC SdOptionsLayout : public SdOptionsGeneric 109 { 110 private: 111 112 bool bRuler; // Layout/Display/Ruler 113 bool bMoveOutline; // Layout/Display/Contour 114 bool bDragStripes; // Layout/Display/Guide 115 bool bHandlesBezier; // Layout/Display/Bezier 116 bool bHelplines; // Layout/Display/Helpline 117 sal_uInt16 nMetric; // Layout/Other/MeasureUnit 118 sal_uInt16 nDefTab; // Layout/Other/TabStop 119 120 protected: 121 122 virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; 123 virtual bool ReadData( const css::uno::Any* pValues ) override; 124 virtual bool WriteData( css::uno::Any* pValues ) const override; 125 126 public: 127 SdOptionsLayout(bool bImpress, bool bUseConfig); 128 129 bool operator==( const SdOptionsLayout& rOpt ) const; 130 IsRulerVisible() const131 bool IsRulerVisible() const { Init(); return bRuler; } IsMoveOutline() const132 bool IsMoveOutline() const { Init(); return bMoveOutline; } IsDragStripes() const133 bool IsDragStripes() const { Init(); return bDragStripes; } IsHandlesBezier() const134 bool IsHandlesBezier() const { Init(); return bHandlesBezier; } IsHelplines() const135 bool IsHelplines() const { Init(); return bHelplines; } GetMetric() const136 sal_uInt16 GetMetric() const { Init(); return( ( 0xffff == nMetric ) ? static_cast<sal_uInt16>(SfxModule::GetCurrentFieldUnit()) : nMetric ); } GetDefTab() const137 sal_uInt16 GetDefTab() const { Init(); return nDefTab; } 138 SetRulerVisible(bool bOn)139 void SetRulerVisible( bool bOn ) { if( bRuler != bOn ) { OptionsChanged(); bRuler = bOn; } } SetMoveOutline(bool bOn)140 void SetMoveOutline( bool bOn ) { if( bMoveOutline != bOn ) { OptionsChanged(); bMoveOutline = bOn; } } SetDragStripes(bool bOn)141 void SetDragStripes( bool bOn ) { if( bDragStripes != bOn ) { OptionsChanged(); bDragStripes = bOn; } } SetHandlesBezier(bool bOn)142 void SetHandlesBezier( bool bOn ) { if( bHandlesBezier != bOn ) { OptionsChanged(); bHandlesBezier = bOn; } } SetHelplines(bool bOn)143 void SetHelplines( bool bOn ) { if( bHelplines != bOn ) { OptionsChanged(); bHelplines = bOn; } } SetMetric(sal_uInt16 nInMetric)144 void SetMetric( sal_uInt16 nInMetric ) { if( nMetric != nInMetric ) { OptionsChanged(); nMetric = nInMetric; } } SetDefTab(sal_uInt16 nTab)145 void SetDefTab( sal_uInt16 nTab ) { if( nDefTab != nTab ) { OptionsChanged(); nDefTab = nTab; } } 146 }; 147 148 class SD_DLLPUBLIC SdOptionsLayoutItem : public SfxPoolItem 149 { 150 public: 151 152 explicit SdOptionsLayoutItem(); 153 SdOptionsLayoutItem( SdOptions const * pOpts, ::sd::FrameView const * pView ); 154 155 virtual SdOptionsLayoutItem* Clone( SfxItemPool *pPool = nullptr ) const override; 156 virtual bool operator==( const SfxPoolItem& ) const override; 157 158 void SetOptions( SdOptions* pOpts ) const; 159 GetOptionsLayout()160 SdOptionsLayout& GetOptionsLayout() { return maOptionsLayout; } 161 private: 162 SdOptionsLayout maOptionsLayout; 163 }; 164 165 class SdOptionsContents : public SdOptionsGeneric 166 { 167 private: 168 protected: 169 170 virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; 171 virtual bool ReadData( const css::uno::Any* pValues ) override; 172 virtual bool WriteData( css::uno::Any* pValues ) const override; 173 174 public: 175 176 SdOptionsContents(bool bImpress); 177 178 bool operator==( const SdOptionsContents& rOpt ) const; 179 }; 180 181 class SD_DLLPUBLIC SdOptionsMisc : public SdOptionsGeneric 182 { 183 private: 184 185 sal_uLong nDefaultObjectSizeWidth; 186 sal_uLong nDefaultObjectSizeHeight; 187 188 bool bStartWithTemplate : 1; // Misc/NewDoc/AutoPilot 189 bool bMarkedHitMovesAlways : 1; // Misc/ObjectMoveable 190 bool bMoveOnlyDragging : 1; // Currently, not in use !!! 191 bool bCrookNoContortion : 1; // Misc/NoDistort 192 bool bQuickEdit : 1; // Misc/TextObject/QuickEditing 193 bool bMasterPageCache : 1; // Misc/BackgroundCache 194 bool bDragWithCopy : 1; // Misc/CopyWhileMoving 195 bool bPickThrough : 1; // Misc/TextObject/Selectable 196 bool bDoubleClickTextEdit : 1; // Misc/DclickTextedit 197 bool bClickChangeRotation : 1; // Misc/RotateClick 198 bool bEnableSdremote : 1; // Misc/Start/EnableSdremote 199 bool bEnablePresenterScreen : 1; // Misc/Start/EnablePresenterDisplay 200 bool bSolidDragging : 1; // Misc/ModifyWithAttributes 201 bool bSummationOfParagraphs : 1; // misc/SummationOfParagraphs 202 bool bTabBarVisible : 1; // Misc/TabBarVisible 203 bool bShowUndoDeleteWarning : 1; // Misc/ShowUndoDeleteWarning 204 // #i75315# 205 bool bSlideshowRespectZOrder : 1; // Misc/SlideshowRespectZOrder 206 bool bShowComments : 1; // Misc/ShowComments 207 208 bool bPreviewNewEffects; 209 bool bPreviewChangedEffects; 210 bool bPreviewTransitions; 211 212 213 sal_Int32 mnDisplay; 214 215 sal_Int32 mnPenColor; 216 double mnPenWidth; 217 218 /** This value controls the device to use for formatting documents. 219 The currently supported values are 0 for the current printer or 1 220 for the printer independent virtual device the can be retrieved from 221 the modules. 222 */ 223 sal_uInt16 mnPrinterIndependentLayout; // Misc/Compatibility/PrinterIndependentLayout 224 // Misc 225 226 protected: 227 228 virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; 229 virtual bool ReadData( const css::uno::Any* pValues ) override; 230 virtual bool WriteData( css::uno::Any* pValues ) const override; 231 232 public: 233 234 SdOptionsMisc(bool bImpress, bool bUseConfig); 235 236 bool operator==( const SdOptionsMisc& rOpt ) const; 237 IsStartWithTemplate() const238 bool IsStartWithTemplate() const { Init(); return bStartWithTemplate; } IsMarkedHitMovesAlways() const239 bool IsMarkedHitMovesAlways() const { Init(); return bMarkedHitMovesAlways; } IsMoveOnlyDragging() const240 bool IsMoveOnlyDragging() const { Init(); return bMoveOnlyDragging; } IsCrookNoContortion() const241 bool IsCrookNoContortion() const { Init(); return bCrookNoContortion; } IsQuickEdit() const242 bool IsQuickEdit() const { Init(); return bQuickEdit; } IsMasterPagePaintCaching() const243 bool IsMasterPagePaintCaching() const { Init(); return bMasterPageCache; } IsDragWithCopy() const244 bool IsDragWithCopy() const { Init(); return bDragWithCopy; } IsPickThrough() const245 bool IsPickThrough() const { Init(); return bPickThrough; } IsDoubleClickTextEdit() const246 bool IsDoubleClickTextEdit() const { Init(); return bDoubleClickTextEdit; } IsClickChangeRotation() const247 bool IsClickChangeRotation() const { Init(); return bClickChangeRotation; } IsEnableSdremote() const248 bool IsEnableSdremote() const { Init(); return bEnableSdremote; } IsEnablePresenterScreen() const249 bool IsEnablePresenterScreen() const { Init(); return bEnablePresenterScreen; } IsSolidDragging() const250 bool IsSolidDragging() const { Init(); return bSolidDragging; } IsSummationOfParagraphs() const251 bool IsSummationOfParagraphs() const { Init(); return bSummationOfParagraphs; }; IsTabBarVisible() const252 bool IsTabBarVisible() const { Init(); return bTabBarVisible; }; 253 254 /** Return the currently selected printer independent layout mode. 255 @return 256 Returns 1 for printer independent layout enabled and 0 when it 257 is disabled. Other values are reserved for future use. 258 */ GetPrinterIndependentLayout() const259 sal_uInt16 GetPrinterIndependentLayout() const { Init(); return mnPrinterIndependentLayout; }; IsShowUndoDeleteWarning() const260 bool IsShowUndoDeleteWarning() const { Init(); return bShowUndoDeleteWarning; } IsSlideshowRespectZOrder() const261 bool IsSlideshowRespectZOrder() const { Init(); return bSlideshowRespectZOrder; } GetDefaultObjectSizeWidth() const262 sal_uLong GetDefaultObjectSizeWidth() const { Init(); return nDefaultObjectSizeWidth; } GetDefaultObjectSizeHeight() const263 sal_uLong GetDefaultObjectSizeHeight() const { Init(); return nDefaultObjectSizeHeight; } 264 IsPreviewNewEffects() const265 bool IsPreviewNewEffects() const { Init(); return bPreviewNewEffects; } IsPreviewChangedEffects() const266 bool IsPreviewChangedEffects() const { Init(); return bPreviewChangedEffects; } IsPreviewTransitions() const267 bool IsPreviewTransitions() const { Init(); return bPreviewTransitions; } 268 269 sal_Int32 GetDisplay() const; 270 void SetDisplay( sal_Int32 nDisplay ); 271 GetPresentationPenColor() const272 sal_Int32 GetPresentationPenColor() const { Init(); return mnPenColor; } SetPresentationPenColor(sal_Int32 nPenColor)273 void SetPresentationPenColor( sal_Int32 nPenColor ) { if( mnPenColor != nPenColor ) { OptionsChanged(); mnPenColor = nPenColor; } } 274 GetPresentationPenWidth() const275 double GetPresentationPenWidth() const { Init(); return mnPenWidth; } SetPresentationPenWidth(double nPenWidth)276 void SetPresentationPenWidth( double nPenWidth ) { if( mnPenWidth != nPenWidth ) { OptionsChanged(); mnPenWidth = nPenWidth; } } 277 SetStartWithTemplate(bool bOn)278 void SetStartWithTemplate( bool bOn ) { if( bStartWithTemplate != bOn ) { OptionsChanged(); bStartWithTemplate = bOn; } } SetMarkedHitMovesAlways(bool bOn)279 void SetMarkedHitMovesAlways( bool bOn ) { if( bMarkedHitMovesAlways != bOn ) { OptionsChanged(); bMarkedHitMovesAlways = bOn; } } SetMoveOnlyDragging(bool bOn)280 void SetMoveOnlyDragging( bool bOn ) { if( bMoveOnlyDragging != bOn ) { OptionsChanged(); bMoveOnlyDragging = bOn; } } SetCrookNoContortion(bool bOn)281 void SetCrookNoContortion( bool bOn ) { if( bCrookNoContortion != bOn ) { OptionsChanged(); bCrookNoContortion = bOn; } } SetQuickEdit(bool bOn)282 void SetQuickEdit( bool bOn ) { if( bQuickEdit != bOn ) { OptionsChanged(); bQuickEdit = bOn; } } SetMasterPagePaintCaching(bool bOn)283 void SetMasterPagePaintCaching( bool bOn ) { if( bMasterPageCache != bOn ) { OptionsChanged(); bMasterPageCache = bOn; } } SetDragWithCopy(bool bOn)284 void SetDragWithCopy( bool bOn ) { if( bDragWithCopy != bOn ) { OptionsChanged(); bDragWithCopy = bOn; } } SetPickThrough(bool bOn)285 void SetPickThrough( bool bOn ) { if( bPickThrough != bOn ) { OptionsChanged(); bPickThrough = bOn; } } SetDoubleClickTextEdit(bool bOn)286 void SetDoubleClickTextEdit( bool bOn ) { if( bDoubleClickTextEdit != bOn ) { OptionsChanged(); bDoubleClickTextEdit = bOn; } } SetClickChangeRotation(bool bOn)287 void SetClickChangeRotation( bool bOn ) { if( bClickChangeRotation != bOn ) { OptionsChanged(); bClickChangeRotation = bOn; } } SetEnableSdremote(bool bOn)288 void SetEnableSdremote( bool bOn ) { if( bEnableSdremote != bOn ) { OptionsChanged(); bEnableSdremote = bOn; } } SetEnablePresenterScreen(bool bOn)289 void SetEnablePresenterScreen( bool bOn ) { if( bEnablePresenterScreen != bOn ) { OptionsChanged(); bEnablePresenterScreen = bOn; } } SetSummationOfParagraphs(bool bOn)290 void SetSummationOfParagraphs( bool bOn ){ if ( bOn != bSummationOfParagraphs ) { OptionsChanged(); bSummationOfParagraphs = bOn; } } SetTabBarVisible(bool bOn)291 void SetTabBarVisible( bool bOn ){ if ( bOn != bTabBarVisible ) { OptionsChanged(); bTabBarVisible = bOn; } } 292 /** Set the printer independent layout mode. 293 @param nOn 294 The default value is to switch printer independent layout on, 295 hence the parameters name. Use 0 for turning it off. Other 296 values are reserved for future use. 297 */ SetPrinterIndependentLayout(sal_uInt16 nOn)298 void SetPrinterIndependentLayout (sal_uInt16 nOn ){ if ( nOn != mnPrinterIndependentLayout ) { OptionsChanged(); mnPrinterIndependentLayout = nOn; } } SetSolidDragging(bool bOn)299 void SetSolidDragging( bool bOn ) { if( bSolidDragging != bOn ) { OptionsChanged(); bSolidDragging = bOn; } } SetShowUndoDeleteWarning(bool bOn)300 void SetShowUndoDeleteWarning( bool bOn ) { if( bShowUndoDeleteWarning != bOn ) { OptionsChanged(); bShowUndoDeleteWarning = bOn; } } SetSlideshowRespectZOrder(bool bOn)301 void SetSlideshowRespectZOrder( bool bOn ) { if( bSlideshowRespectZOrder != bOn ) { OptionsChanged(); bSlideshowRespectZOrder = bOn; } } SetDefaultObjectSizeWidth(sal_uLong nWidth)302 void SetDefaultObjectSizeWidth( sal_uLong nWidth ) { if( nDefaultObjectSizeWidth != nWidth ) { OptionsChanged(); nDefaultObjectSizeWidth = nWidth; } } SetDefaultObjectSizeHeight(sal_uLong nHeight)303 void SetDefaultObjectSizeHeight( sal_uLong nHeight ) { if( nDefaultObjectSizeHeight != nHeight ) { OptionsChanged(); nDefaultObjectSizeHeight = nHeight; } } 304 SetPreviewNewEffects(bool bOn)305 void SetPreviewNewEffects( bool bOn ) { if( bPreviewNewEffects != bOn ) { OptionsChanged(); bPreviewNewEffects = bOn; } } SetPreviewChangedEffects(bool bOn)306 void SetPreviewChangedEffects( bool bOn ) { if( bPreviewChangedEffects != bOn ) { OptionsChanged(); bPreviewChangedEffects = bOn; } } SetPreviewTransitions(bool bOn)307 void SetPreviewTransitions( bool bOn ) { if( bPreviewTransitions != bOn ) { OptionsChanged(); bPreviewTransitions = bOn; } } 308 IsShowComments() const309 bool IsShowComments() const { Init(); return bShowComments; } SetShowComments(bool bShow)310 void SetShowComments( bool bShow ) { if( bShowComments != bShow ) { OptionsChanged(); bShowComments = bShow; } } 311 }; 312 313 class SD_DLLPUBLIC SdOptionsMiscItem : public SfxPoolItem 314 { 315 public: 316 317 explicit SdOptionsMiscItem(); 318 SdOptionsMiscItem( SdOptions const * pOpts, ::sd::FrameView const * pView ); 319 320 virtual SdOptionsMiscItem* Clone( SfxItemPool *pPool = nullptr ) const override; 321 virtual bool operator==( const SfxPoolItem& ) const override; 322 323 void SetOptions( SdOptions* pOpts ) const; 324 GetOptionsMisc()325 SdOptionsMisc& GetOptionsMisc() { return maOptionsMisc; } GetOptionsMisc() const326 const SdOptionsMisc& GetOptionsMisc() const { return maOptionsMisc; } 327 private: 328 SdOptionsMisc maOptionsMisc; 329 }; 330 331 class SD_DLLPUBLIC SdOptionsSnap : public SdOptionsGeneric 332 { 333 private: 334 335 bool bSnapHelplines : 1; // Snap/Object/SnapLine 336 bool bSnapBorder : 1; // Snap/Object/PageMargin 337 bool bSnapFrame : 1; // Snap/Object/ObjectFrame 338 bool bSnapPoints : 1; // Snap/Object/ObjectPoint 339 bool bOrtho : 1; // Snap/Position/CreatingMoving 340 bool bBigOrtho : 1; // Snap/Position/ExtendEdges 341 bool bRotate : 1; // Snap/Position/Rotating 342 sal_Int16 nSnapArea; // Snap/Object/Range 343 Degree100 nAngle; // Snap/Position/RotatingValue 344 Degree100 nBezAngle; // Snap/Position/PointReduction 345 346 protected: 347 348 virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; 349 virtual bool ReadData( const css::uno::Any* pValues ) override; 350 virtual bool WriteData( css::uno::Any* pValues ) const override; 351 352 public: 353 354 SdOptionsSnap(bool bImpress, bool bUseConfig); 355 356 bool operator==( const SdOptionsSnap& rOpt ) const; 357 IsSnapHelplines() const358 bool IsSnapHelplines() const { Init(); return bSnapHelplines; } IsSnapBorder() const359 bool IsSnapBorder() const { Init(); return bSnapBorder; } IsSnapFrame() const360 bool IsSnapFrame() const { Init(); return bSnapFrame; } IsSnapPoints() const361 bool IsSnapPoints() const { Init(); return bSnapPoints; } IsOrtho() const362 bool IsOrtho() const { Init(); return bOrtho; } IsBigOrtho() const363 bool IsBigOrtho() const { Init(); return bBigOrtho; } IsRotate() const364 bool IsRotate() const { Init(); return bRotate; } GetSnapArea() const365 sal_Int16 GetSnapArea() const { Init(); return nSnapArea; } GetAngle() const366 Degree100 GetAngle() const { Init(); return nAngle; } GetEliminatePolyPointLimitAngle() const367 Degree100 GetEliminatePolyPointLimitAngle() const { Init(); return nBezAngle; } 368 SetSnapHelplines(bool bOn)369 void SetSnapHelplines( bool bOn ) { if( bSnapHelplines != bOn ) { OptionsChanged(); bSnapHelplines = bOn; } } SetSnapBorder(bool bOn)370 void SetSnapBorder( bool bOn ) { if( bSnapBorder != bOn ) { OptionsChanged(); bSnapBorder = bOn; } } SetSnapFrame(bool bOn)371 void SetSnapFrame( bool bOn ) { if( bSnapFrame != bOn ) { OptionsChanged(); bSnapFrame = bOn; } } SetSnapPoints(bool bOn)372 void SetSnapPoints( bool bOn ) { if( bSnapPoints != bOn ) { OptionsChanged(); bSnapPoints = bOn; } } SetOrtho(bool bOn)373 void SetOrtho( bool bOn ) { if( bOrtho != bOn ) { OptionsChanged(); bOrtho = bOn; } } SetBigOrtho(bool bOn)374 void SetBigOrtho( bool bOn ) { if( bBigOrtho != bOn ) { OptionsChanged(); bBigOrtho = bOn; } } SetRotate(bool bOn)375 void SetRotate( bool bOn ) { if( bRotate != bOn ) { OptionsChanged(); bRotate = bOn; } } SetSnapArea(sal_Int16 nIn)376 void SetSnapArea( sal_Int16 nIn ) { if( nSnapArea != nIn ) { OptionsChanged(); nSnapArea = nIn; } } SetAngle(Degree100 nIn)377 void SetAngle( Degree100 nIn ) { if( nAngle != nIn ) { OptionsChanged(); nAngle = nIn; } } SetEliminatePolyPointLimitAngle(Degree100 nIn)378 void SetEliminatePolyPointLimitAngle( Degree100 nIn ) { if( nBezAngle != nIn ) { OptionsChanged(); nBezAngle = nIn; } } 379 }; 380 381 class SD_DLLPUBLIC SdOptionsSnapItem : public SfxPoolItem 382 { 383 public: 384 385 explicit SdOptionsSnapItem(); 386 SdOptionsSnapItem( SdOptions const * pOpts, ::sd::FrameView const * pView ); 387 388 virtual SdOptionsSnapItem* Clone( SfxItemPool *pPool = nullptr ) const override; 389 virtual bool operator==( const SfxPoolItem& ) const override; 390 391 void SetOptions( SdOptions* pOpts ) const; 392 GetOptionsSnap()393 SdOptionsSnap& GetOptionsSnap() { return maOptionsSnap; } 394 private: 395 SdOptionsSnap maOptionsSnap; 396 }; 397 398 class SdOptionsZoom : public SdOptionsGeneric 399 { 400 private: 401 402 sal_Int32 nX; // Zoom/ScaleX 403 sal_Int32 nY; // Zoom/ScaleY 404 405 protected: 406 407 virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; 408 virtual bool ReadData( const css::uno::Any* pValues ) override; 409 virtual bool WriteData( css::uno::Any* pValues ) const override; 410 411 public: 412 413 explicit SdOptionsZoom(bool bImpress); 414 GetScale(sal_Int32 & rX,sal_Int32 & rY) const415 void GetScale( sal_Int32& rX, sal_Int32& rY ) const { Init(); rX = nX; rY = nY; } SetScale(sal_Int32 nInX,sal_Int32 nInY)416 void SetScale( sal_Int32 nInX, sal_Int32 nInY ) { if( nX != nInX || nY != nInY ) { OptionsChanged(); nX = nInX; nY = nInY; } } 417 }; 418 419 class SdOptionsGrid : public SdOptionsGeneric, public SvxOptionsGrid 420 { 421 protected: 422 423 virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; 424 virtual bool ReadData( const css::uno::Any* pValues ) override; 425 virtual bool WriteData( css::uno::Any* pValues ) const override; 426 427 public: 428 429 explicit SdOptionsGrid(bool bImpress); 430 virtual ~SdOptionsGrid() override; 431 432 void SetDefaults(); 433 GetFieldDrawX() const434 sal_uInt32 GetFieldDrawX() const { Init(); return SvxOptionsGrid::GetFieldDrawX(); } GetFieldDivisionX() const435 sal_uInt32 GetFieldDivisionX() const { Init(); return SvxOptionsGrid::GetFieldDivisionX(); } GetFieldDrawY() const436 sal_uInt32 GetFieldDrawY() const { Init(); return SvxOptionsGrid::GetFieldDrawY(); } GetFieldDivisionY() const437 sal_uInt32 GetFieldDivisionY() const { Init(); return SvxOptionsGrid::GetFieldDivisionY(); } GetFieldSnapX() const438 sal_uInt32 GetFieldSnapX() const { Init(); return SvxOptionsGrid::GetFieldSnapX(); } GetFieldSnapY() const439 sal_uInt32 GetFieldSnapY() const { Init(); return SvxOptionsGrid::GetFieldSnapY(); } IsUseGridSnap() const440 bool IsUseGridSnap() const { Init(); return SvxOptionsGrid::GetUseGridSnap(); } IsSynchronize() const441 bool IsSynchronize() const { Init(); return SvxOptionsGrid::GetSynchronize(); } IsGridVisible() const442 bool IsGridVisible() const { Init(); return SvxOptionsGrid::GetGridVisible(); } IsEqualGrid() const443 bool IsEqualGrid() const { Init(); return SvxOptionsGrid::GetEqualGrid(); } 444 SetFieldDrawX(sal_uInt32 nSet)445 void SetFieldDrawX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldDrawX() ) { OptionsChanged(); SvxOptionsGrid::SetFieldDrawX( nSet ); } } SetFieldDivisionX(sal_uInt32 nSet)446 void SetFieldDivisionX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldDivisionX() ) { OptionsChanged(); SvxOptionsGrid::SetFieldDivisionX( nSet ); } } SetFieldDrawY(sal_uInt32 nSet)447 void SetFieldDrawY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldDrawY() ) { OptionsChanged(); SvxOptionsGrid::SetFieldDrawY( nSet ); } } SetFieldDivisionY(sal_uInt32 nSet)448 void SetFieldDivisionY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldDivisionY() ) { OptionsChanged(); SvxOptionsGrid::SetFieldDivisionY( nSet ); } } SetFieldSnapX(sal_uInt32 nSet)449 void SetFieldSnapX( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldSnapX() ) { OptionsChanged(); SvxOptionsGrid::SetFieldSnapX( nSet ); } } SetFieldSnapY(sal_uInt32 nSet)450 void SetFieldSnapY( sal_uInt32 nSet ) { if( nSet != SvxOptionsGrid::GetFieldSnapY() ) { OptionsChanged(); SvxOptionsGrid::SetFieldSnapY( nSet ); } } SetUseGridSnap(bool bSet)451 void SetUseGridSnap( bool bSet ) { if( bSet != SvxOptionsGrid::GetUseGridSnap() ) { OptionsChanged(); SvxOptionsGrid::SetUseGridSnap( bSet ); } } SetSynchronize(bool bSet)452 void SetSynchronize( bool bSet ) { if( bSet != SvxOptionsGrid::GetSynchronize() ) { OptionsChanged(); SvxOptionsGrid::SetSynchronize( bSet ); } } SetGridVisible(bool bSet)453 void SetGridVisible( bool bSet ) { if( bSet != SvxOptionsGrid::GetGridVisible() ) { OptionsChanged(); SvxOptionsGrid::SetGridVisible( bSet ); } } SetEqualGrid(bool bSet)454 void SetEqualGrid( bool bSet ) { if( bSet != SvxOptionsGrid::GetEqualGrid() ) { OptionsChanged(); SvxOptionsGrid::SetEqualGrid( bSet ); } } 455 }; 456 457 class SdOptionsGridItem : public SvxGridItem 458 { 459 460 public: 461 explicit SdOptionsGridItem( SdOptions const * pOpts ); 462 463 void SetOptions( SdOptions* pOpts ) const; 464 }; 465 466 class SD_DLLPUBLIC SdOptionsPrint : public SdOptionsGeneric 467 { 468 private: 469 470 bool bDraw : 1; // Print/Content/Drawing 471 bool bNotes : 1; // Print/Content/Note 472 bool bHandout : 1; // Print/Content/Handout 473 bool bOutline : 1; // Print/Content/Outline 474 bool bDate : 1; // Print/Other/Date 475 bool bTime : 1; // Print/Other/Time 476 bool bPagename : 1; // Print/Other/PageName 477 bool bHiddenPages : 1; // Print/Other/HiddenPage 478 bool bPagesize : 1; // Print/Page/PageSize 479 bool bPagetile : 1; // Print/Page/PageTile 480 bool bWarningPrinter : 1; // These flags you get 481 bool bWarningSize : 1; // from the common options, 482 bool bWarningOrientation : 1; // currently org.openoffice.Office.Common.xml (class OfaMiscCfg ; sfx2/misccfg.hxx ) 483 bool bBooklet : 1; // Print/Page/Booklet 484 bool bFront : 1; // Print/Page/BookletFront 485 bool bBack : 1; // Print/Page/BookletFront 486 bool bCutPage : 1; // NOT persistent !!! 487 bool bPaperbin : 1; // Print/Other/FromPrinterSetup 488 bool mbHandoutHorizontal : 1; // Order Page previews on Handout Pages horizontal 489 sal_uInt16 mnHandoutPages; // Number of page previews on handout page (only 1/2/4/6/9 are supported) 490 sal_uInt16 nQuality; // Print/Other/Quality 491 492 protected: 493 494 virtual void GetPropNameArray( const char**& ppNames, sal_uLong& rCount ) const override; 495 virtual bool ReadData( const css::uno::Any* pValues ) override; 496 virtual bool WriteData( css::uno::Any* pValues ) const override; 497 498 public: 499 500 SdOptionsPrint(bool bImpress, bool bUseConfig); 501 502 bool operator==( const SdOptionsPrint& rOpt ) const; 503 IsDraw() const504 bool IsDraw() const { Init(); return bDraw; } IsNotes() const505 bool IsNotes() const { Init(); return bNotes; } IsHandout() const506 bool IsHandout() const { Init(); return bHandout; } IsOutline() const507 bool IsOutline() const { Init(); return bOutline; } IsDate() const508 bool IsDate() const { Init(); return bDate; } IsTime() const509 bool IsTime() const { Init(); return bTime; } IsPagename() const510 bool IsPagename() const { Init(); return bPagename; } IsHiddenPages() const511 bool IsHiddenPages() const { Init(); return bHiddenPages; } IsPagesize() const512 bool IsPagesize() const { Init(); return bPagesize; } IsPagetile() const513 bool IsPagetile() const { Init(); return bPagetile; } IsWarningPrinter() const514 bool IsWarningPrinter() const { Init(); return bWarningPrinter; } IsWarningSize() const515 bool IsWarningSize() const { Init(); return bWarningSize; } IsWarningOrientation() const516 bool IsWarningOrientation() const { Init(); return bWarningOrientation; } IsBooklet() const517 bool IsBooklet() const { Init(); return bBooklet; } IsFrontPage() const518 bool IsFrontPage() const { Init(); return bFront; } IsBackPage() const519 bool IsBackPage() const { Init(); return bBack; } IsCutPage() const520 bool IsCutPage() const { Init(); return bCutPage; } IsPaperbin() const521 bool IsPaperbin() const { Init(); return bPaperbin; } GetOutputQuality() const522 sal_uInt16 GetOutputQuality() const { Init(); return nQuality; } IsHandoutHorizontal() const523 bool IsHandoutHorizontal() const { Init(); return mbHandoutHorizontal; } GetHandoutPages() const524 sal_uInt16 GetHandoutPages() const { Init(); return mnHandoutPages; } 525 SetDraw(bool bOn)526 void SetDraw( bool bOn ) { if( bDraw != bOn ) { OptionsChanged(); bDraw = bOn; } } SetNotes(bool bOn)527 void SetNotes( bool bOn ) { if( bNotes != bOn ) { OptionsChanged(); bNotes = bOn; } } SetHandout(bool bOn)528 void SetHandout( bool bOn ) { if( bHandout != bOn ) { OptionsChanged(); bHandout = bOn; } } SetOutline(bool bOn)529 void SetOutline( bool bOn ) { if( bOutline != bOn ) { OptionsChanged(); bOutline = bOn; } } SetDate(bool bOn)530 void SetDate( bool bOn ) { if( bDate != bOn ) { OptionsChanged(); bDate = bOn; } } SetTime(bool bOn)531 void SetTime( bool bOn ) { if( bTime != bOn ) { OptionsChanged(); bTime = bOn; } } SetPagename(bool bOn)532 void SetPagename( bool bOn ) { if( bPagename != bOn ) { OptionsChanged(); bPagename = bOn; } } SetHiddenPages(bool bOn)533 void SetHiddenPages( bool bOn ) { if( bHiddenPages != bOn ) { OptionsChanged(); bHiddenPages = bOn; } } SetPagesize(bool bOn)534 void SetPagesize( bool bOn ) { if( bPagesize != bOn ) { OptionsChanged(); bPagesize = bOn; } } SetPagetile(bool bOn)535 void SetPagetile( bool bOn ) { if( bPagetile != bOn ) { OptionsChanged(); bPagetile = bOn; } } SetWarningPrinter(bool bOn)536 void SetWarningPrinter( bool bOn ) { if( bWarningPrinter != bOn ) { OptionsChanged(); bWarningPrinter = bOn; } } SetWarningSize(bool bOn)537 void SetWarningSize( bool bOn ) { if( bWarningSize != bOn ) { OptionsChanged(); bWarningSize = bOn; } } SetWarningOrientation(bool bOn)538 void SetWarningOrientation( bool bOn) { if( bWarningOrientation != bOn ) { OptionsChanged(); bWarningOrientation = bOn; } } SetBooklet(bool bOn)539 void SetBooklet( bool bOn ) { if( bBooklet != bOn ) { OptionsChanged(); bBooklet = bOn; } } SetFrontPage(bool bOn)540 void SetFrontPage( bool bOn ) { if( bFront != bOn ) { OptionsChanged(); bFront = bOn; } } SetBackPage(bool bOn)541 void SetBackPage( bool bOn ) { if( bBack != bOn ) { OptionsChanged(); bBack = bOn; } } SetCutPage(bool bOn)542 void SetCutPage( bool bOn ) { if( bCutPage != bOn ) { OptionsChanged(); bCutPage = bOn; } } SetPaperbin(bool bOn)543 void SetPaperbin( bool bOn ) { if( bPaperbin != bOn ) { OptionsChanged(); bPaperbin = bOn; } } SetOutputQuality(sal_uInt16 nInQuality)544 void SetOutputQuality( sal_uInt16 nInQuality ) { if( nQuality != nInQuality ) { OptionsChanged(); nQuality = nInQuality; } } SetHandoutHorizontal(bool bHandoutHorizontal)545 void SetHandoutHorizontal( bool bHandoutHorizontal ) { if( mbHandoutHorizontal != bHandoutHorizontal ) { OptionsChanged(); mbHandoutHorizontal = bHandoutHorizontal; } } SetHandoutPages(sal_uInt16 nHandoutPages)546 void SetHandoutPages( sal_uInt16 nHandoutPages ) { if( nHandoutPages != mnHandoutPages ) { OptionsChanged(); mnHandoutPages = nHandoutPages; } } 547 }; 548 549 class SD_DLLPUBLIC SdOptionsPrintItem : public SfxPoolItem 550 { 551 public: 552 553 explicit SdOptionsPrintItem(); 554 explicit SdOptionsPrintItem( SdOptions const * pOpts ); 555 556 virtual SdOptionsPrintItem* Clone( SfxItemPool *pPool = nullptr ) const override; 557 virtual bool operator==( const SfxPoolItem& ) const override; 558 559 void SetOptions( SdOptions* pOpts ) const; 560 GetOptionsPrint()561 SdOptionsPrint& GetOptionsPrint() { return maOptionsPrint; } GetOptionsPrint() const562 const SdOptionsPrint& GetOptionsPrint() const { return maOptionsPrint; } 563 private: 564 SdOptionsPrint maOptionsPrint; 565 }; 566 567 class SdOptions : public SdOptionsLayout, public SdOptionsContents, 568 public SdOptionsMisc, public SdOptionsSnap, 569 public SdOptionsZoom, public SdOptionsGrid, 570 public SdOptionsPrint 571 { 572 public: 573 574 explicit SdOptions(bool bImpress); 575 virtual ~SdOptions() override; 576 577 void StoreConfig(); 578 }; 579 580 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 581