|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Rotate command handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_GLXCOMMANDHANDLERROTATE_H |
|
22 #define C_GLXCOMMANDHANDLERROTATE_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <glxmedialistcommandhandler.h> |
|
27 #include <glxrotationlayout.h> |
|
28 #include <glxlayoutsplitter.h> |
|
29 |
|
30 #include <ExifModify.h> |
|
31 #include <glxmedia.h> |
|
32 // FORWARD DECLARATIONS |
|
33 |
|
34 class CGlxDefaultAttributeContext; |
|
35 class CGlxDefaultThumbnailContext; |
|
36 class CGlxUiUtility; |
|
37 class CGlxVisualListManager; |
|
38 class MGlxLayoutOwner; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * Command to rotate the thumbnail in full screen view to better fit the aspect |
|
46 * ratio of the screen. |
|
47 * |
|
48 * @ingroup glx_group_command_handlers |
|
49 */ |
|
50 NONSHARABLE_CLASS (CGlxCommandHandlerRotate) |
|
51 : public CGlxMediaListCommandHandler, public MGlxMediaListObserver |
|
52 { |
|
53 public: |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * @param aMediaListProvider Source of media list |
|
57 * @param aLayoutOwner Owner of Layout to append rotate layout to |
|
58 * @param aLayoutIndex Index of layout to append rotate layout to |
|
59 */ |
|
60 IMPORT_C static CGlxCommandHandlerRotate* NewL( |
|
61 MGlxMediaListProvider* aMediaListProvider, |
|
62 MGlxLayoutOwner* aLayoutOwner = NULL, |
|
63 TInt aLayoutIndex = 0); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 ~CGlxCommandHandlerRotate(); |
|
69 |
|
70 private: // From CGlxMediaListCommandHandler |
|
71 TBool DoExecuteL(TInt aCommandId, MGlxMediaList& aList); |
|
72 void DoActivateL(TInt aViewId); |
|
73 void Deactivate(); |
|
74 TBool DoIsDisabled(TInt aCommandId, MGlxMediaList& aList) const; |
|
75 |
|
76 private: // From MGlxMediaListObserver |
|
77 void HandleItemAddedL(TInt aStartIndex, TInt aEndIndex, |
|
78 MGlxMediaList* aList); |
|
79 void HandleMediaL(TInt aListIndex, MGlxMediaList* aList); |
|
80 void HandleItemRemovedL(TInt aStartIndex, TInt aEndIndex, |
|
81 MGlxMediaList* aList); |
|
82 void HandleItemModifiedL(const RArray<TInt>& aItemIndexes, |
|
83 MGlxMediaList* aList); |
|
84 void HandleAttributesAvailableL(TInt aItemIndex, |
|
85 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList); |
|
86 void HandleFocusChangedL(NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, |
|
87 TInt aOldIndex, MGlxMediaList* aList); |
|
88 void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList); |
|
89 void HandleMessageL(const CMPXMessage& aMessage, MGlxMediaList* aList); |
|
90 |
|
91 private: |
|
92 /** |
|
93 * C++ default constructor. |
|
94 * @param aMediaListProvider Source of media list |
|
95 * @param aLayoutOwner Owner of Layout to append rotate layout to |
|
96 * @param aLayoutIndex Index of layout to append rotate layout to |
|
97 */ |
|
98 CGlxCommandHandlerRotate(MGlxMediaListProvider* aMediaListProvider, |
|
99 MGlxLayoutOwner* aLayoutOwner, TInt aLayoutIndex); |
|
100 |
|
101 /** |
|
102 * By default Symbian 2nd phase constructor is private. |
|
103 */ |
|
104 void ConstructL(); |
|
105 |
|
106 /** |
|
107 * Rotate the Image Using antriksh animation. |
|
108 */ |
|
109 void DoRotateL(MGlxMediaList& aList, TInt aAngle); |
|
110 /** |
|
111 * Calculate and Update the image's Exif data with final orientation. |
|
112 */ |
|
113 void DoPreserveOrientationL(); |
|
114 /** |
|
115 * Calculate the final orientation from the previous orientation and the final rotation angle. |
|
116 */ |
|
117 TInt DoCalculateOrientationL(TInt aInitialOrientation); |
|
118 /** |
|
119 * Initializes class variables required for rotation |
|
120 */ |
|
121 void DoInitializeRotationParametersL(); |
|
122 /** |
|
123 * Cleans up all class variables used for rotation |
|
124 */ |
|
125 void DoCleanupRotationParametersL(); |
|
126 private: // Data |
|
127 /** ID of owning view */ |
|
128 TInt iViewId; |
|
129 /** Visual list manager */ |
|
130 CGlxVisualListManager* iVisualListManager; |
|
131 /** HUI utility */ |
|
132 CGlxUiUtility* iUiUtility; |
|
133 /** Attribute context */ |
|
134 CGlxDefaultAttributeContext* iAttributeContext; |
|
135 /** Thumbnail context for portrait thumbnails */ |
|
136 CGlxDefaultThumbnailContext* iPortraitThumbnailContext; |
|
137 /** Visual list containing the rotated visual */ |
|
138 MGlxVisualList* iVisualList; |
|
139 /** Visual to which the rotation is applied (not owned) */ |
|
140 CAlfVisual* iVisual; |
|
141 |
|
142 /** Layout to split layout chain to focused item */ |
|
143 TGlxLayoutSplitter iSplitter; |
|
144 /** Layout to rotate the focused item */ |
|
145 TGlxRotationLayout iLayout; |
|
146 /** Whether the command is shown in the active palette */ |
|
147 TBool iShowInToolbar; |
|
148 /** Whether the command is available in the current view state */ |
|
149 TBool iRotationAvailable; |
|
150 /** Whether we have rotated the visual */ |
|
151 TBool iRotationApplied; |
|
152 /** Which tooltip to show */ |
|
153 TBool iViewPortrait; |
|
154 |
|
155 /// The layout owner |
|
156 MGlxLayoutOwner* iLayoutOwner; |
|
157 /// The index of the layout to request from the owner |
|
158 TInt iLayoutIndex; |
|
159 /// The layout to append the rotate layout to |
|
160 MGlxLayout* iLayoutToFollow; |
|
161 MGlxMediaList* iMediaList; //not owned do not delete |
|
162 TInt iRotationAngle; |
|
163 TFileName iFileToBeRotated; |
|
164 TFileName iTempFile; |
|
165 RFs iFs; |
|
166 TUint16 iInitialOrientation; |
|
167 RFile iFileHandle; |
|
168 HBufC8* iExifData; |
|
169 CExifModify* iExifWriter; |
|
170 TBool iDoAttemptToSaveFile; |
|
171 const TGlxMedia* iGlxItem; |
|
172 TBool iAddedObserver; |
|
173 |
|
174 }; |
|
175 |
|
176 #endif // C_GLXCOMMANDHANDLERROTATE_H |
|
177 |
|
178 // End of File |