1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "FrameView.hxx"
22 #include <svx/svxids.hrc>
23 #include <com/sun/star/awt/Rectangle.hpp>
24 #include <com/sun/star/drawing/framework/ResourceId.hpp>
25 #include <rtl/ustrbuf.hxx>
26 #include "unokywds.hxx"
27 #include <vcl/settings.hxx>
30 #include "ViewShell.hxx"
31 #include "drawdoc.hxx"
32 #include "DrawDocShell.hxx"
33 #include "optsitem.hxx"
34 #include "ViewShellBase.hxx"
35 #include "DrawViewShell.hxx"
36 #include "OutlineViewShell.hxx"
38 #include "sdresid.hxx"
41 #include "sdiocmpt.hxx"
42 #include "framework/FrameworkHelper.hxx"
43 #include <comphelper/processfactory.hxx>
44 #include <sfx2/viewfrm.hxx>
46 using namespace ::com::sun::star
;
47 using namespace ::com::sun::star::uno
;
48 using namespace ::com::sun::star::beans
;
49 using namespace ::std
;
53 FrameView::FrameView(SdDrawDocument
* pDrawDoc
, FrameView
* pFrameView
/* = NULK */)
54 : SdrView(pDrawDoc
, (OutputDevice
*) NULL
),
56 mnPresViewShellId(SID_VIEWSHELL0
),
57 mnSlotId(SID_OBJECT_SELECT
),
58 mbIsNavigatorShowingAllShapes(false)
60 EndListening(*pDrawDoc
);
62 EnableExtendedKeyInputDispatcher(false);
63 EnableExtendedMouseEventDispatcher(false);
64 EnableExtendedCommandEventDispatcher(false);
66 SetGridFront( false );
67 SetHlplFront( false );
69 SetFrameDragSingles( true );
72 if( NULL
== pFrameView
)
74 DrawDocShell
* pDocShell
= pDrawDoc
->GetDocSh();
78 // document is loaded, is there a FrameView?
79 sal_uLong nSdViewShellCount
= 0;
80 SfxViewFrame
* pSfxViewFrame
= SfxViewFrame::GetFirst(pDocShell
);
84 // Count the FrameViews and remember the type of the main
86 SfxViewShell
* pSfxViewSh
= pSfxViewFrame
->GetViewShell();
87 ViewShellBase
* pBase
= PTR_CAST(ViewShellBase
, pSfxViewSh
);
94 Reference
<drawing::framework::XView
> xView (
95 framework::FrameworkHelper::Instance(*pBase
)->GetView(
96 drawing::framework::ResourceId::create(
97 ::comphelper::getProcessComponentContext(),
98 framework::FrameworkHelper::msCenterPaneURL
)));
100 sViewURL
= xView
->getResourceId()->getResourceURL();
102 switch (framework::FrameworkHelper::GetViewId(sViewURL
))
105 // case ViewShell::ST_IMPRESS:
106 // case ViewShell::ST_NOTES:
107 // case ViewShell::ST_HANDOUT:
108 mnPresViewShellId
= SID_VIEWSHELL0
;
111 case ViewShell::ST_SLIDE_SORTER
:
112 mnPresViewShellId
= SID_VIEWSHELL1
;
115 case ViewShell::ST_OUTLINE
:
116 mnPresViewShellId
= SID_VIEWSHELL2
;
121 pSfxViewFrame
= SfxViewFrame::GetNext(*pSfxViewFrame
, pDocShell
);
124 SdDrawDocument
* pDoc
= pDocShell
->GetDoc();
125 pFrameView
= pDoc
->GetFrameView(nSdViewShellCount
);
131 // initialize FrameView with the FrameView of the DocShell
132 SetRuler( pFrameView
->HasRuler() );
133 SetGridCoarse( pFrameView
->GetGridCoarse() );
134 SetGridFine( pFrameView
->GetGridFine() );
135 SetSnapGridWidth(pFrameView
->GetSnapGridWidthX(), pFrameView
->GetSnapGridWidthY());
136 SetGridVisible( pFrameView
->IsGridVisible() );
137 SetGridFront( pFrameView
->IsGridFront() );
138 SetSnapAngle( pFrameView
->GetSnapAngle() );
139 SetGridSnap( pFrameView
->IsGridSnap() );
140 SetBordSnap( pFrameView
->IsBordSnap() );
141 SetHlplSnap( pFrameView
->IsHlplSnap() );
142 SetOFrmSnap( pFrameView
->IsOFrmSnap() );
143 SetOPntSnap( pFrameView
->IsOPntSnap() );
144 SetOConSnap( pFrameView
->IsOConSnap() );
145 SetHlplVisible( pFrameView
->IsHlplVisible() );
146 SetDragStripes( pFrameView
->IsDragStripes() );
147 SetPlusHandlesAlwaysVisible( pFrameView
->IsPlusHandlesAlwaysVisible() );
148 SetFrameDragSingles( pFrameView
->IsFrameDragSingles() );
149 SetSnapMagneticPixel( pFrameView
->GetSnapMagneticPixel() );
150 SetMarkedHitMovesAlways( pFrameView
->IsMarkedHitMovesAlways() );
151 SetMoveOnlyDragging( pFrameView
->IsMoveOnlyDragging() );
152 SetCrookNoContortion( pFrameView
->IsCrookNoContortion() );
153 SetSlantButShear( pFrameView
->IsSlantButShear() );
154 SetNoDragXorPolys( pFrameView
->IsNoDragXorPolys() );
155 SetAngleSnapEnabled( pFrameView
->IsAngleSnapEnabled() );
156 SetBigOrtho( pFrameView
->IsBigOrtho() );
157 SetOrtho( pFrameView
->IsOrtho() );
158 SetEliminatePolyPointLimitAngle( pFrameView
->GetEliminatePolyPointLimitAngle() );
159 SetEliminatePolyPoints( pFrameView
->IsEliminatePolyPoints() );
160 SetDesignMode( pFrameView
->IsDesignMode() );
162 SetSolidDragging( pFrameView
->IsSolidDragging() );
164 maVisibleLayers
= pFrameView
->GetVisibleLayers();
165 maPrintableLayers
= pFrameView
->GetPrintableLayers();
166 maLockedLayers
= pFrameView
->GetLockedLayers();
167 maStandardHelpLines
= pFrameView
->GetStandardHelpLines();
168 maNotesHelpLines
= pFrameView
->GetNotesHelpLines();
169 maHandoutHelpLines
= pFrameView
->GetHandoutHelpLines();
170 SetActiveLayer( pFrameView
->GetActiveLayer() );
171 mbNoColors
= pFrameView
->IsNoColors();
172 mbNoAttribs
= pFrameView
->IsNoAttribs() ;
173 maVisArea
= pFrameView
->GetVisArea();
174 mePageKind
= pFrameView
->GetPageKind();
175 mePageKindOnLoad
= pFrameView
->GetPageKindOnLoad();
176 mnSelectedPage
= pFrameView
->GetSelectedPage();
177 mnSelectedPageOnLoad
= pFrameView
->GetSelectedPageOnLoad();
178 meStandardEditMode
= pFrameView
->GetViewShEditMode(PK_STANDARD
);
179 meNotesEditMode
= pFrameView
->GetViewShEditMode(PK_NOTES
);
180 meHandoutEditMode
= pFrameView
->GetViewShEditMode(PK_HANDOUT
);
181 SetViewShEditModeOnLoad(pFrameView
->GetViewShEditModeOnLoad());
182 mbLayerMode
= pFrameView
->IsLayerMode();
183 mbQuickEdit
= pFrameView
->IsQuickEdit();
186 SetMasterPagePaintCaching( pFrameView
->IsMasterPagePaintCaching() );
188 SetDragWithCopy( pFrameView
->IsDragWithCopy() );
189 mbDoubleClickTextEdit
= pFrameView
->IsDoubleClickTextEdit();
190 mbClickChangeRotation
= pFrameView
->IsClickChangeRotation();
191 mnSlidesPerRow
= pFrameView
->GetSlidesPerRow();
192 mnDrawMode
= pFrameView
->GetDrawMode();
193 mbIsNavigatorShowingAllShapes
= pFrameView
->IsNavigatorShowingAllShapes();
194 SetPreviousViewShellType (pFrameView
->GetPreviousViewShellType());
195 SetViewShellTypeOnLoad (pFrameView
->GetViewShellTypeOnLoad());
199 // initialize FrameView with the application data
200 maVisibleLayers
.SetAll();
201 maPrintableLayers
.SetAll();
202 SetGridCoarse( Size( 1000, 1000 ) );
203 SetSnapGridWidth(Fraction(1000, 1), Fraction(1000, 1));
204 SetActiveLayer( SD_RESSTR(STR_LAYER_LAYOUT
) );
207 maVisArea
= Rectangle( Point(), Size(0, 0) );
208 mePageKind
= PK_STANDARD
;
209 mePageKindOnLoad
= PK_STANDARD
;
211 mnSelectedPageOnLoad
= 0;
212 meStandardEditMode
= EM_PAGE
;
213 meNotesEditMode
= EM_PAGE
;
214 meHandoutEditMode
= EM_MASTERPAGE
;
215 SetViewShEditModeOnLoad(EM_PAGE
);
217 SetEliminatePolyPoints(false);
218 mbDoubleClickTextEdit
= false;
219 mbClickChangeRotation
= false;
223 bool bUseContrast
= Application::GetSettings().GetStyleSettings().GetHighContrastMode();
224 mnDrawMode
= bUseContrast
? OUTPUT_DRAWMODE_CONTRAST
: OUTPUT_DRAWMODE_COLOR
;
226 mbIsNavigatorShowingAllShapes
= false;
227 SetPreviousViewShellType (ViewShell::ST_NONE
);
228 SetViewShellTypeOnLoad (ViewShell::ST_IMPRESS
);
230 // get default for design mode
231 bool bInitDesignMode
= pDrawDoc
->GetOpenInDesignMode();
232 if( pDrawDoc
->OpenInDesignModeIsDefaulted() )
234 bInitDesignMode
= true;
237 SfxObjectShell
* pObjShell
= pDrawDoc
->GetObjectShell();
238 if( pObjShell
&& pObjShell
->IsReadOnly() )
239 bInitDesignMode
= false;
240 SetDesignMode( bInitDesignMode
);
242 Update( SD_MOD()->GetSdOptions(pDrawDoc
->GetDocumentType()) );
247 FrameView::~FrameView()
251 void FrameView::Connect()
256 void FrameView::Disconnect()
270 * Update with data from the specified SdOptions
272 void FrameView::Update(SdOptions
* pOptions
)
276 mbRuler
= pOptions
->IsRulerVisible();
277 SetGridVisible( pOptions
->IsGridVisible() );
278 SetSnapAngle( pOptions
->GetAngle() );
279 SetGridSnap( pOptions
->IsUseGridSnap() );
280 SetBordSnap( pOptions
->IsSnapBorder() );
281 SetHlplSnap( pOptions
->IsSnapHelplines() );
282 SetOFrmSnap( pOptions
->IsSnapFrame() );
283 SetOPntSnap( pOptions
->IsSnapPoints() );
284 SetHlplVisible( pOptions
->IsHelplines() );
285 SetDragStripes( pOptions
->IsDragStripes() );
286 SetPlusHandlesAlwaysVisible( pOptions
->IsHandlesBezier() );
287 SetSnapMagneticPixel( pOptions
->GetSnapArea() );
288 SetMarkedHitMovesAlways( pOptions
->IsMarkedHitMovesAlways() );
289 SetMoveOnlyDragging( pOptions
->IsMoveOnlyDragging() );
290 SetSlantButShear( pOptions
->IsMoveOnlyDragging() );
291 SetNoDragXorPolys ( !pOptions
->IsMoveOutline() );
292 SetCrookNoContortion( pOptions
->IsCrookNoContortion() );
293 SetAngleSnapEnabled( pOptions
->IsRotate() );
294 SetBigOrtho( pOptions
->IsBigOrtho() );
295 SetOrtho( pOptions
->IsOrtho() );
296 SetEliminatePolyPointLimitAngle( pOptions
->GetEliminatePolyPointLimitAngle() );
297 GetModel()->SetPickThroughTransparentTextFrames( pOptions
->IsPickThrough() );
299 SetSolidDragging( pOptions
->IsSolidDragging() );
301 SetGridCoarse( Size( pOptions
->GetFieldDrawX(), pOptions
->GetFieldDrawY() ) );
302 SetGridFine( Size( pOptions
->GetFieldDivisionX(), pOptions
->GetFieldDivisionY() ) );
303 Fraction
aFractX(pOptions
->GetFieldDrawX(), pOptions
->GetFieldDrawX() / ( pOptions
->GetFieldDivisionX() ? pOptions
->GetFieldDivisionX() : 1 ));
304 Fraction
aFractY(pOptions
->GetFieldDrawY(), pOptions
->GetFieldDrawY() / ( pOptions
->GetFieldDivisionY() ? pOptions
->GetFieldDivisionY() : 1 ));
305 SetSnapGridWidth(aFractX
, aFractY
);
306 SetQuickEdit(pOptions
->IsQuickEdit());
309 SetMasterPagePaintCaching( pOptions
->IsMasterPagePaintCaching() );
311 SetDragWithCopy(pOptions
->IsDragWithCopy());
312 SetDoubleClickTextEdit( pOptions
->IsDoubleClickTextEdit() );
313 SetClickChangeRotation( pOptions
->IsClickChangeRotation() );
318 * Set EditMode (Page or MasterPage) of working mode
320 void FrameView::SetViewShEditMode(EditMode eMode
, PageKind eKind
)
322 if (eKind
== PK_STANDARD
)
324 meStandardEditMode
= eMode
;
326 else if (eKind
== PK_NOTES
)
328 meNotesEditMode
= eMode
;
330 else if (eKind
== PK_HANDOUT
)
332 meHandoutEditMode
= eMode
;
337 * Return EditMode (Page or MasterPage) of working mode
339 EditMode
FrameView::GetViewShEditMode(PageKind eKind
)
341 EditMode eMode
= EM_PAGE
;
343 if (eKind
== PK_STANDARD
)
345 eMode
= meStandardEditMode
;
347 else if (eKind
== PK_NOTES
)
349 eMode
= meNotesEditMode
;
351 else if (eKind
== PK_HANDOUT
)
353 eMode
= meHandoutEditMode
;
359 void FrameView::SetViewShEditModeOnLoad (EditMode eMode
)
361 meEditModeOnLoad
= eMode
;
364 static OUString
createHelpLinesString( const SdrHelpLineList
& rHelpLines
)
366 OUStringBuffer aLines
;
368 const sal_uInt16 nCount
= rHelpLines
.GetCount();
369 for( sal_uInt16 nHlpLine
= 0; nHlpLine
< nCount
; nHlpLine
++ )
371 const SdrHelpLine
& rHelpLine
= rHelpLines
[nHlpLine
];
372 const Point
& rPos
= rHelpLine
.GetPos();
374 switch( rHelpLine
.GetKind() )
376 case SDRHELPLINE_POINT
:
377 aLines
.append( 'P' );
378 aLines
.append( (sal_Int32
)rPos
.X() );
379 aLines
.append( ',' );
380 aLines
.append( (sal_Int32
)rPos
.Y() );
382 case SDRHELPLINE_VERTICAL
:
383 aLines
.append( 'V' );
384 aLines
.append( (sal_Int32
)rPos
.X() );
386 case SDRHELPLINE_HORIZONTAL
:
387 aLines
.append( 'H' );
388 aLines
.append( (sal_Int32
)rPos
.Y() );
391 OSL_FAIL( "Unsupported helpline Kind!" );
395 return aLines
.makeStringAndClear();
398 #define addValue( n, v ) push_back( std::pair< OUString, Any >( OUString( n ), v ) )
399 void FrameView::WriteUserDataSequence ( ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& rValues
, bool )
401 std::vector
< std::pair
< OUString
, Any
> > aUserData
;
403 aUserData
.addValue( sUNO_View_GridIsVisible
, makeAny( IsGridVisible() ) );
404 aUserData
.addValue( sUNO_View_GridIsFront
, makeAny( IsGridFront() ) );
405 aUserData
.addValue( sUNO_View_IsSnapToGrid
, makeAny( IsGridSnap() ) );
406 aUserData
.addValue( sUNO_View_IsSnapToPageMargins
, makeAny( IsBordSnap() ) );
407 aUserData
.addValue( sUNO_View_IsSnapToSnapLines
, makeAny( IsHlplSnap() ) );
408 aUserData
.addValue( sUNO_View_IsSnapToObjectFrame
, makeAny( IsOFrmSnap() ) );
409 aUserData
.addValue( sUNO_View_IsSnapToObjectPoints
, makeAny( IsOPntSnap() ) );
411 aUserData
.addValue( sUNO_View_IsPlusHandlesAlwaysVisible
, makeAny( IsPlusHandlesAlwaysVisible() ) );
412 aUserData
.addValue( sUNO_View_IsFrameDragSingles
, makeAny( IsFrameDragSingles() ) );
414 aUserData
.addValue( sUNO_View_EliminatePolyPointLimitAngle
, makeAny( (sal_Int32
)GetEliminatePolyPointLimitAngle() ) );
415 aUserData
.addValue( sUNO_View_IsEliminatePolyPoints
, makeAny( IsEliminatePolyPoints() ) );
418 GetVisibleLayers().QueryValue( aAny
);
419 aUserData
.addValue( sUNO_View_VisibleLayers
, aAny
);
421 GetPrintableLayers().QueryValue( aAny
);
422 aUserData
.addValue( sUNO_View_PrintableLayers
, aAny
);
424 GetLockedLayers().QueryValue( aAny
);
425 aUserData
.addValue( sUNO_View_LockedLayers
, aAny
);
427 aUserData
.addValue( sUNO_View_NoAttribs
, makeAny( IsNoAttribs() ) );
428 aUserData
.addValue( sUNO_View_NoColors
, makeAny( IsNoColors() ) );
430 if( GetStandardHelpLines().GetCount() )
431 aUserData
.addValue( sUNO_View_SnapLinesDrawing
, makeAny( createHelpLinesString( GetStandardHelpLines() ) ) );
433 if( GetNotesHelpLines().GetCount() )
434 aUserData
.addValue( sUNO_View_SnapLinesNotes
, makeAny( createHelpLinesString( GetNotesHelpLines() ) ) );
436 if( GetHandoutHelpLines().GetCount() )
437 aUserData
.addValue( sUNO_View_SnapLinesHandout
, makeAny( createHelpLinesString( GetHandoutHelpLines() ) ) );
439 aUserData
.addValue( sUNO_View_RulerIsVisible
, makeAny( HasRuler() ) );
440 aUserData
.addValue( sUNO_View_PageKind
, makeAny( (sal_Int16
)GetPageKind() ) );
441 aUserData
.addValue( sUNO_View_SelectedPage
, makeAny( (sal_Int16
)GetSelectedPage() ) );
442 aUserData
.addValue( sUNO_View_IsLayerMode
, makeAny( IsLayerMode() ) );
444 aUserData
.addValue( sUNO_View_IsDoubleClickTextEdit
, makeAny( IsDoubleClickTextEdit() ) );
445 aUserData
.addValue( sUNO_View_IsClickChangeRotation
, makeAny( IsClickChangeRotation() ) );
447 aUserData
.addValue( sUNO_View_SlidesPerRow
, makeAny( (sal_Int16
)GetSlidesPerRow() ) );
448 aUserData
.addValue( sUNO_View_EditModeStandard
, makeAny( (sal_Int32
)GetViewShEditMode( PK_STANDARD
) ) );
449 aUserData
.addValue( sUNO_View_EditModeNotes
, makeAny( (sal_Int32
)GetViewShEditMode( PK_NOTES
) ) );
450 aUserData
.addValue( sUNO_View_EditModeHandout
, makeAny( (sal_Int32
)GetViewShEditMode( PK_HANDOUT
) ) );
453 const Rectangle aVisArea
= GetVisArea();
455 aUserData
.addValue( sUNO_View_VisibleAreaTop
, makeAny( (sal_Int32
)aVisArea
.Top() ) );
456 aUserData
.addValue( sUNO_View_VisibleAreaLeft
, makeAny( (sal_Int32
)aVisArea
.Left() ) );
457 aUserData
.addValue( sUNO_View_VisibleAreaWidth
, makeAny( (sal_Int32
)aVisArea
.GetWidth() ) );
458 aUserData
.addValue( sUNO_View_VisibleAreaHeight
, makeAny( (sal_Int32
)aVisArea
.GetHeight() ) );
461 aUserData
.addValue( sUNO_View_GridCoarseWidth
, makeAny( (sal_Int32
)GetGridCoarse().Width() ) );
462 aUserData
.addValue( sUNO_View_GridCoarseHeight
, makeAny( (sal_Int32
)GetGridCoarse().Height() ) );
463 aUserData
.addValue( sUNO_View_GridFineWidth
, makeAny( (sal_Int32
)GetGridFine().Width() ) );
464 aUserData
.addValue( sUNO_View_GridFineHeight
, makeAny( (sal_Int32
)GetGridFine().Height() ) );
465 aUserData
.addValue( sUNO_View_GridSnapWidthXNumerator
, makeAny( (sal_Int32
)GetSnapGridWidthX().GetNumerator() ) );
466 aUserData
.addValue( sUNO_View_GridSnapWidthXDenominator
, makeAny( (sal_Int32
)GetSnapGridWidthX().GetDenominator() ) );
467 aUserData
.addValue( sUNO_View_GridSnapWidthYNumerator
, makeAny( (sal_Int32
)GetSnapGridWidthY().GetNumerator() ) );
468 aUserData
.addValue( sUNO_View_GridSnapWidthYDenominator
, makeAny( (sal_Int32
)GetSnapGridWidthY().GetDenominator() ) );
469 aUserData
.addValue( sUNO_View_IsAngleSnapEnabled
, makeAny( IsAngleSnapEnabled() ) );
470 aUserData
.addValue( sUNO_View_SnapAngle
, makeAny( (sal_Int32
)GetSnapAngle() ) );
472 const sal_Int32 nOldLength
= rValues
.getLength();
473 rValues
.realloc( nOldLength
+ aUserData
.size() );
475 PropertyValue
* pValue
= &(rValues
.getArray()[nOldLength
]);
477 std::vector
< std::pair
< OUString
, Any
> >::iterator
aIter( aUserData
.begin() );
478 for( ; aIter
!= aUserData
.end(); ++aIter
, ++pValue
)
480 pValue
->Name
= (*aIter
).first
;
481 pValue
->Value
= (*aIter
).second
;
486 static void createHelpLinesFromString( const OUString
& rLines
, SdrHelpLineList
& rHelpLines
)
488 const sal_Unicode
* pStr
= rLines
.getStr();
489 SdrHelpLine aNewHelpLine
;
490 OUStringBuffer sBuffer
;
498 case (sal_Unicode
)'P':
499 aNewHelpLine
.SetKind( SDRHELPLINE_POINT
);
501 case (sal_Unicode
)'V':
502 aNewHelpLine
.SetKind( SDRHELPLINE_VERTICAL
);
504 case (sal_Unicode
)'H':
505 aNewHelpLine
.SetKind( SDRHELPLINE_HORIZONTAL
);
508 OSL_FAIL( "syntax error in snap lines settings string" );
514 while( (*pStr
>= '0' && *pStr
<= '9') || (*pStr
== '+') || (*pStr
== '-') )
516 sBuffer
.append( *pStr
++ );
519 sal_Int32 nValue
= sBuffer
.makeStringAndClear().toInt32();
521 if( aNewHelpLine
.GetKind() == SDRHELPLINE_HORIZONTAL
)
529 if( aNewHelpLine
.GetKind() == SDRHELPLINE_POINT
)
534 while( (*pStr
>= '0' && *pStr
<= '9') || (*pStr
== '+') || (*pStr
== '-') )
536 sBuffer
.append( *pStr
++ );
539 aPoint
.Y() = sBuffer
.makeStringAndClear().toInt32();
544 aNewHelpLine
.SetPos( aPoint
);
545 rHelpLines
.Insert( aNewHelpLine
);
549 void FrameView::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& rSequence
, bool )
551 const sal_Int32 nLength
= rSequence
.getLength();
554 SdDrawDocument
* pDrawDocument
= dynamic_cast<SdDrawDocument
*>(GetModel());
555 const bool bImpress
= pDrawDocument
&& pDrawDocument
->GetDocumentType() == DOCUMENT_TYPE_IMPRESS
;
558 sal_Int32 nInt32
= 0;
559 sal_Int16 nInt16
= 0;
562 sal_Int32 aSnapGridWidthXNum
= GetSnapGridWidthX().GetNumerator();
563 sal_Int32 aSnapGridWidthXDom
= GetSnapGridWidthX().GetDenominator();
565 sal_Int32 aSnapGridWidthYNum
= GetSnapGridWidthY().GetNumerator();
566 sal_Int32 aSnapGridWidthYDom
= GetSnapGridWidthY().GetDenominator();
568 const com::sun::star::beans::PropertyValue
*pValue
= rSequence
.getConstArray();
569 for (sal_Int16 i
= 0 ; i
< nLength
; i
++, pValue
++ )
571 if ( pValue
->Name
== sUNO_View_ViewId
)
574 else if ( pValue
->Name
== sUNO_View_SnapLinesDrawing
)
576 if( pValue
->Value
>>= aString
)
578 SdrHelpLineList aHelpLines
;
579 createHelpLinesFromString( aString
, aHelpLines
);
580 SetStandardHelpLines( aHelpLines
);
583 else if ( pValue
->Name
== sUNO_View_SnapLinesNotes
)
585 if( pValue
->Value
>>= aString
)
587 SdrHelpLineList aHelpLines
;
588 createHelpLinesFromString( aString
, aHelpLines
);
589 SetNotesHelpLines( aHelpLines
);
592 else if ( pValue
->Name
== sUNO_View_SnapLinesHandout
)
594 if( pValue
->Value
>>= aString
)
596 SdrHelpLineList aHelpLines
;
597 createHelpLinesFromString( aString
, aHelpLines
);
598 SetHandoutHelpLines( aHelpLines
);
601 else if ( pValue
->Name
== sUNO_View_RulerIsVisible
)
603 if( pValue
->Value
>>= bBool
)
608 else if ( pValue
->Name
== sUNO_View_PageKind
)
610 if( pValue
->Value
>>= nInt16
)
612 SdDrawDocument
* pDoc
= dynamic_cast< SdDrawDocument
* >( GetModel() );
613 if( pDoc
&& pDoc
->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED
== pDoc
->GetDocSh()->GetCreateMode() ) )
614 SetPageKind( (PageKind
)nInt16
);
616 SetPageKindOnLoad( (PageKind
)nInt16
);
619 else if ( pValue
->Name
== sUNO_View_SelectedPage
)
621 if( pValue
->Value
>>= nInt16
)
623 SdDrawDocument
* pDoc
= dynamic_cast< SdDrawDocument
* >( GetModel() );
624 if( pDoc
&& pDoc
->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED
== pDoc
->GetDocSh()->GetCreateMode() ) )
625 SetSelectedPage( (sal_uInt16
)nInt16
);
627 SetSelectedPageOnLoad( (sal_uInt16
)nInt16
);
630 else if ( pValue
->Name
== sUNO_View_IsLayerMode
)
632 if( pValue
->Value
>>= bBool
)
634 SetLayerMode( bBool
);
637 else if ( pValue
->Name
== sUNO_View_IsDoubleClickTextEdit
)
639 if( pValue
->Value
>>= bBool
)
641 SetDoubleClickTextEdit( bBool
);
644 else if ( pValue
->Name
== sUNO_View_IsClickChangeRotation
)
646 if( pValue
->Value
>>= bBool
)
648 SetClickChangeRotation( bBool
);
651 else if ( pValue
->Name
== sUNO_View_SlidesPerRow
)
653 if( pValue
->Value
>>= nInt16
)
655 SetSlidesPerRow( (sal_uInt16
)nInt16
);
658 else if ( pValue
->Name
== sUNO_View_EditModeStandard
)
660 if( pValue
->Value
>>= nInt32
)
662 SdDrawDocument
* pDoc
= dynamic_cast< SdDrawDocument
* >( GetModel() );
663 if( pDoc
&& pDoc
->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED
== pDoc
->GetDocSh()->GetCreateMode() ) )
664 SetViewShEditMode( (EditMode
)nInt32
, PK_STANDARD
);
667 else if ( pValue
->Name
== sUNO_View_EditModeNotes
)
669 if( pValue
->Value
>>= nInt32
)
671 SdDrawDocument
* pDoc
= dynamic_cast< SdDrawDocument
* >( GetModel() );
672 if( pDoc
&& pDoc
->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED
== pDoc
->GetDocSh()->GetCreateMode() ) )
673 SetViewShEditMode( (EditMode
)nInt32
, PK_NOTES
);
676 else if ( pValue
->Name
== sUNO_View_EditModeHandout
)
678 if( pValue
->Value
>>= nInt32
)
680 SdDrawDocument
* pDoc
= dynamic_cast< SdDrawDocument
* >( GetModel() );
681 if( pDoc
&& pDoc
->GetDocSh() && ( SfxObjectCreateMode::EMBEDDED
== pDoc
->GetDocSh()->GetCreateMode() ) )
682 SetViewShEditMode( (EditMode
)nInt32
, PK_HANDOUT
);
685 else if ( pValue
->Name
== sUNO_View_VisibleAreaTop
)
688 if( pValue
->Value
>>= nTop
)
690 Rectangle
aVisArea( GetVisArea() );
691 aVisArea
.Bottom() += nTop
- aVisArea
.Top();
692 aVisArea
.Top() = nTop
;
693 SetVisArea( aVisArea
);
696 else if ( pValue
->Name
== sUNO_View_VisibleAreaLeft
)
699 if( pValue
->Value
>>= nLeft
)
701 Rectangle
aVisArea( GetVisArea() );
702 aVisArea
.Right() += nLeft
- aVisArea
.Left();
703 aVisArea
.Left() = nLeft
;
704 SetVisArea( aVisArea
);
707 else if ( pValue
->Name
== sUNO_View_VisibleAreaWidth
)
709 sal_Int32 nWidth
= 0;
710 if( pValue
->Value
>>= nWidth
)
712 Rectangle
aVisArea( GetVisArea() );
713 aVisArea
.Right() = aVisArea
.Left() + nWidth
- 1;
714 SetVisArea( aVisArea
);
717 else if ( pValue
->Name
== sUNO_View_VisibleAreaHeight
)
719 sal_Int32 nHeight
= 0;
720 if( pValue
->Value
>>= nHeight
)
722 Rectangle
aVisArea( GetVisArea() );
723 aVisArea
.Bottom() = nHeight
+ aVisArea
.Top() - 1;
724 SetVisArea( aVisArea
);
728 else if ( pValue
->Name
== sUNO_View_GridIsVisible
)
730 if( pValue
->Value
>>= bBool
)
732 SetGridVisible( bBool
);
736 else if ( pValue
->Name
== sUNO_View_IsSnapToGrid
)
738 if( pValue
->Value
>>= bBool
)
740 SetGridSnap( bBool
);
743 else if ( pValue
->Name
== sUNO_View_GridIsFront
)
745 if( pValue
->Value
>>= bBool
)
747 SetGridFront( bBool
);
750 else if ( pValue
->Name
== sUNO_View_IsSnapToPageMargins
)
752 if( pValue
->Value
>>= bBool
)
754 SetBordSnap( bBool
);
757 else if ( pValue
->Name
== sUNO_View_IsSnapToSnapLines
)
759 if( pValue
->Value
>>= bBool
)
761 SetHlplSnap( bBool
);
764 else if ( pValue
->Name
== sUNO_View_IsSnapToObjectFrame
)
766 if( pValue
->Value
>>= bBool
)
768 SetOFrmSnap( bBool
);
771 else if ( pValue
->Name
== sUNO_View_IsSnapToObjectPoints
)
773 if( pValue
->Value
>>= bBool
)
775 SetOPntSnap( bBool
);
778 else if ( pValue
->Name
== sUNO_View_IsPlusHandlesAlwaysVisible
)
780 if( pValue
->Value
>>= bBool
)
782 SetPlusHandlesAlwaysVisible( bBool
);
785 else if ( pValue
->Name
== sUNO_View_IsFrameDragSingles
)
787 if( pValue
->Value
>>= bBool
)
789 SetFrameDragSingles( bBool
);
792 else if ( pValue
->Name
== sUNO_View_EliminatePolyPointLimitAngle
)
794 if( pValue
->Value
>>= nInt32
)
796 SetEliminatePolyPointLimitAngle( nInt32
);
799 else if ( pValue
->Name
== sUNO_View_IsEliminatePolyPoints
)
801 if( pValue
->Value
>>= bBool
)
803 SetEliminatePolyPoints( bBool
);
806 else if ( pValue
->Name
== sUNO_View_ActiveLayer
)
808 if( pValue
->Value
>>= aString
)
810 SetActiveLayer( aString
);
813 else if ( pValue
->Name
== sUNO_View_NoAttribs
)
815 if( pValue
->Value
>>= bBool
)
817 SetNoAttribs( bBool
);
820 else if ( pValue
->Name
== sUNO_View_NoColors
)
822 if( pValue
->Value
>>= bBool
)
824 SetNoColors( bBool
);
827 else if ( pValue
->Name
== sUNO_View_GridCoarseWidth
)
829 if( pValue
->Value
>>= nInt32
)
831 const Size
aCoarse( nInt32
, GetGridCoarse().Height() );
832 SetGridCoarse( aCoarse
);
835 else if ( pValue
->Name
== sUNO_View_GridCoarseHeight
)
837 if( pValue
->Value
>>= nInt32
)
839 const Size
aCoarse( GetGridCoarse().Width(), nInt32
);
840 SetGridCoarse( aCoarse
);
843 else if ( pValue
->Name
== sUNO_View_GridFineWidth
)
845 if( pValue
->Value
>>= nInt32
)
847 const Size
aCoarse( nInt32
, GetGridFine().Height() );
848 SetGridFine( aCoarse
);
851 else if ( pValue
->Name
== sUNO_View_GridFineHeight
)
853 if( pValue
->Value
>>= nInt32
)
855 const Size
aCoarse( GetGridFine().Width(), nInt32
);
856 SetGridFine( aCoarse
);
859 else if ( pValue
->Name
== sUNO_View_IsAngleSnapEnabled
)
861 if( pValue
->Value
>>= bBool
)
863 SetAngleSnapEnabled( bBool
);
866 else if ( pValue
->Name
== sUNO_View_SnapAngle
)
868 if( pValue
->Value
>>= nInt32
)
870 SetSnapAngle( nInt32
);
873 else if ( pValue
->Name
== sUNO_View_GridSnapWidthXNumerator
)
875 pValue
->Value
>>= aSnapGridWidthXNum
;
877 else if ( pValue
->Name
== sUNO_View_GridSnapWidthXDenominator
)
879 pValue
->Value
>>= aSnapGridWidthXDom
;
881 else if ( pValue
->Name
== sUNO_View_GridSnapWidthYNumerator
)
883 pValue
->Value
>>= aSnapGridWidthYNum
;
885 else if ( pValue
->Name
== sUNO_View_GridSnapWidthYDenominator
)
887 pValue
->Value
>>= aSnapGridWidthYDom
;
889 else if (!bImpress
&& pValue
->Name
== sUNO_View_VisibleLayers
)
891 SetOfByte aSetOfBytes
;
892 aSetOfBytes
.PutValue( pValue
->Value
);
893 SetVisibleLayers( aSetOfBytes
);
895 else if (!bImpress
&& pValue
->Name
== sUNO_View_PrintableLayers
)
897 SetOfByte aSetOfBytes
;
898 aSetOfBytes
.PutValue( pValue
->Value
);
899 SetPrintableLayers( aSetOfBytes
);
901 else if (!bImpress
&& pValue
->Name
== sUNO_View_LockedLayers
)
903 SetOfByte aSetOfBytes
;
904 aSetOfBytes
.PutValue( pValue
->Value
);
905 SetLockedLayers( aSetOfBytes
);
909 switch (GetPageKindOnLoad())
911 case PK_STANDARD
: SetViewShEditModeOnLoad(meStandardEditMode
); break;
912 case PK_NOTES
: SetViewShEditModeOnLoad(meNotesEditMode
); break;
913 case PK_HANDOUT
: SetViewShEditModeOnLoad(meHandoutEditMode
); break;
914 default: SetViewShEditModeOnLoad(EM_PAGE
); break;
917 const Fraction
aSnapGridWidthX( aSnapGridWidthXNum
, aSnapGridWidthXDom
);
918 const Fraction
aSnapGridWidthY( aSnapGridWidthYNum
, aSnapGridWidthYDom
);
920 SetSnapGridWidth( aSnapGridWidthX
, aSnapGridWidthY
);
924 void FrameView::SetPreviousViewShellType (ViewShell::ShellType eType
)
926 mePreviousViewShellType
= eType
;
929 void FrameView::SetViewShellTypeOnLoad (ViewShell::ShellType eType
)
931 meViewShellTypeOnLoad
= eType
;
934 void FrameView::SetSelectedPage(sal_uInt16 nPage
)
936 mnSelectedPage
= nPage
;
939 void FrameView::SetIsNavigatorShowingAllShapes (const bool bIsNavigatorShowingAllShapes
)
941 mbIsNavigatorShowingAllShapes
= bIsNavigatorShowingAllShapes
;
944 } // end of namespace sd
946 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */