1 diff --git sc/inc/sc.hrc sc/inc/sc.hrc
2 index d67b625..33d0240 100644
6 #define SID_DATA_FORM (SC_OOO_BUILD_START + 2) // menu (in Data menu)
7 #define RID_SCDLG_DATAFORM (SC_OOO_BUILD_START + 3) // dialog
10 +// Autoformat for DataPilot
11 +#define SID_PIVOT_AFMT (SC_OOO_BUILD_START + 4)
16 diff --git sc/sdi/pivotsh.sdi sc/sdi/pivotsh.sdi
17 index ddbb49c..94821e5 100644
18 --- sc/sdi/pivotsh.sdi
19 +++ sc/sdi/pivotsh.sdi
20 @@ -34,6 +34,7 @@ interface Pivot
21 SID_PIVOT_RECALC [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
22 SID_PIVOT_KILL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
23 SID_DP_FILTER [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
24 + SID_PIVOT_AFMT [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
28 diff --git sc/sdi/scalc.sdi sc/sdi/scalc.sdi
29 index 39380f8..ad21670 100644
32 @@ -1900,6 +1900,30 @@ SfxVoidItem DeletePivotTable SID_PIVOT_KILL
36 +SfxVoidItem AutoFormatPivotTable SID_PIVOT_AFMT
41 + Cachable = Cachable,
48 + RecordAbsolute = FALSE,
53 + AccelConfig = FALSE,
55 + StatusBarConfig = FALSE,
56 + ToolBoxConfig = FALSE,
60 //--------------------------------------------------------------------------
61 SfxVoidItem DeletePrintArea SID_DELETE_PRINTAREA
63 diff --git sc/source/ui/docshell/dbdocfun.cxx sc/source/ui/docshell/dbdocfun.cxx
64 index 8ee336e..d525da1 100644
65 --- sc/source/ui/docshell/dbdocfun.cxx
66 +++ sc/source/ui/docshell/dbdocfun.cxx
67 @@ -1405,6 +1405,36 @@ BOOL ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
71 + if (const_cast<ScDPObject *>(pNewObj)->GetAutoFormatIndex() != 65535)
73 + ScViewData* pViewData = rDocShell.GetViewData();
74 + ScTabViewShell* pViewShell = pViewData->GetViewShell();
75 + pViewShell->GetDBData( TRUE, SC_DB_OLD );
76 + const ScMarkData& rMark1 = pViewData->GetMarkData();
84 + rDocShell.GetViewData()->GetSimpleArea( nStartCol,nStartRow,nStartTab,nEndCol,nEndRow,nEndTab );
85 + ScRange Outrange = pNewObj->GetOutRange();
86 + if (( (Outrange.aStart.Col() <= nStartCol) && (nStartCol <= Outrange.aEnd.Col() )&& (nStartTab == Outrange.aStart.Tab()))
87 + && ( (Outrange.aStart.Row() <= nStartRow) && (nStartRow <= Outrange.aEnd.Row() )) )
90 + if ( !rMark1.IsMarked() && !rMark1.IsMultiMarked() )
91 + pViewShell->MarkDataArea( TRUE );
92 + //FIXME: Autoformat even when clicked from a non-dp cell.
93 + pViewData->MoveNextRow();
94 + sal_uInt16 nAutoFmtIndex = pNewObj->GetAutoFormatIndex();
95 + pViewShell->AutoFormat(nAutoFmtIndex);
96 + pViewShell->AutoFormatPivotTable(const_cast<ScDPObject*>(pNewObj), nAutoFmtIndex);
97 + pViewData->MovePrevRow();
102 aModificator.SetDocumentModified();
104 diff --git sc/source/ui/inc/dbfunc.hxx sc/source/ui/inc/dbfunc.hxx
105 index bb43553..91834e1 100644
106 --- sc/source/ui/inc/dbfunc.hxx
107 +++ sc/source/ui/inc/dbfunc.hxx
108 @@ -90,6 +90,8 @@ public:
109 const ScDPObject& rSource, BOOL bApi = FALSE );
110 void DeletePivotTable();
111 void RecalcPivotTable();
112 + void AutoFormatPivotTable(USHORT nIndex);
113 + void AutoFormatPivotTable(ScDPObject* pDPObj, USHORT nIndex);
115 BOOL HasSelectionForDateGroup( ScDPNumGroupInfo& rOldInfo, sal_Int32& rParts );
116 BOOL HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo );
117 diff --git sc/source/ui/inc/viewdata.hxx sc/source/ui/inc/viewdata.hxx
118 index 024eac3..6f0d986 100644
119 --- sc/source/ui/inc/viewdata.hxx
120 +++ sc/source/ui/inc/viewdata.hxx
121 @@ -332,6 +332,10 @@ public:
122 ScMarkType GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB& rStartTab,
123 SCCOL& rEndCol, SCROW& rEndRow, SCTAB& rEndTab ) const;
124 ScMarkType GetSimpleArea( ScRange& rRange ) const;
126 + void MoveNextRow();
127 + void MovePrevRow();
129 /// May modify rNewMark using MarkToSimple().
130 ScMarkType GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) const;
131 void GetMultiArea( ScRangeListRef& rRange ) const;
132 diff --git sc/source/ui/miscdlgs/makefile.mk sc/source/ui/miscdlgs/makefile.mk
133 index 12b2d2f..df75a88 100644
134 --- sc/source/ui/miscdlgs/makefile.mk
135 +++ sc/source/ui/miscdlgs/makefile.mk
136 @@ -126,6 +124,8 @@ LIB1OBJFILES = \
137 $(SLO)$/warnbox.obj \
138 $(SLO)$/conflictsdlg.obj \
139 $(SLO)$/sharedocdlg.obj \
140 + $(SLO)$/scuiautofmt.obj \
141 + $(SLO)$/strindlg.obj \
142 $(SLO)$/protectiondlg.obj \
143 $(SLO)$/retypepassdlg.obj
145 diff --git sc/source/ui/src/popup.src sc/source/ui/src/popup.src
146 index 05d10b9..4e19349 100644
147 --- sc/source/ui/src/popup.src
148 +++ sc/source/ui/src/popup.src
149 @@ -213,6 +213,84 @@ Menu RID_POPUP_PIVOT
153 + Identifier = SID_PIVOT_AFMT ;
154 + HelpId = SID_PIVOT_AFMT ;
155 + Text [ en-US ] = "~AutoFormat..." ;
156 + Text [ de ] = "A~utoFormat" ;
157 + Text [ af ] = "OutoFormateer..." ;
158 + Text [ ar ] = "تنسيق تلقائي..." ;
159 + Text [ as-IN ] = "স্বয়ংক্ৰিয় ফৰমেট ..." ;
160 + Text [ be-BY ] = "Аўта-фармат..." ;
161 + Text [ bg ] = "Автоформат..." ;
162 + Text [ br ] = "EmVentrezhañ..." ;
163 + Text [ bs ] = "AutoFormat..." ;
164 + Text [ ca ] = "Formatació automàtica..." ;
165 + Text [ cs ] = "Automatický formát..." ;
166 + Text [ cy ] = "AwtoFformat..." ;
167 + Text [ da ] = "Autoformat..." ;
168 + Text [ el ] = "Αυτόματη μορφοποίηση..." ;
169 + Text [ en-GB ] = "AutoFormat..." ;
170 + Text [ en-ZA ] = "AutoFormat..." ;
171 + Text [ eo ] = "Aŭtomate Formati..." ;
172 + Text [ es ] = "Formateado automático..." ;
173 + Text [ et ] = "Automaatvormindus..." ;
174 + Text [ fa ] = "قالببندی خودکار..." ;
175 + Text [ fi ] = "Automaattinen muotoilu..." ;
176 + Text [ fr ] = "AutoFormat..." ;
177 + Text [ ga ] = "UathFhormáidigh..." ;
178 + Text [ gu ] = "આપોઆપબંધારણ..." ;
179 + Text [ gu-IN ] = "આપોઆપબંધારણ..." ;
180 + Text [ hi-IN ] = "स्वचालित ढंग से रचना..." ;
181 + Text [ hr ] = "SamoOblikovanje..." ;
182 + Text [ hu ] = "Automatikus formázás..." ;
183 + Text [ it ] = "Formattazione automatica..." ;
184 + Text [ ja ] = "オートフォーマット..." ;
185 + Text [ ka ] = "ავტო-ფორმატირება..." ;
186 + Text [ km ] = "ទ្រង់ទ្រាយស្វ័យប្រវត្តិ..." ;
187 + Text [ ko ] = "자동 서식..." ;
188 + Text [ ku ] = "TeşekirinaBixweber..." ;
189 + Text [ lt ] = "Automatinis formatavimas..." ;
190 + Text [ mk ] = "Автоматско форматирање..." ;
191 + Text [ ml-IN ] = "സ്വയം രൂപപ്പെടുത്തുക..." ;
192 + Text [ mr-IN ] = "स्वंयचलित रचना..." ;
193 + Text [ nb ] = "Autoformatering..." ;
194 + Text [ nl ] = "AutoOpmaak..." ;
195 + Text [ nn ] = "Autoformatering..." ;
196 + Text [ nr ] = "Fometha ngokuzenzakalela..." ;
197 + Text [ ns ] = "Fomate ye e Itiragalelago..." ;
198 + Text [ or-IN ] = "ସ୍ବଯଂଚାଳିତଫର୍ମାଟ..." ;
199 + Text [ pa-IN ] = "ਸਵੈ-ਫਾਰਮਿਟ..." ;
200 + Text [ pl ] = "Autoformatowanie..." ;
201 + Text [ pt ] = "Formatação automática..." ;
202 + Text [ pt-BR ] = "AutoFormatar..." ;
203 + Text [ ru ] = "Автоформат..." ;
204 + Text [ rw ] = "Nyamwihamiterere..." ;
205 + Text [ sh-YU ] = "Automatsko formatiranje..." ;
206 + Text [ sk ] = "Automatický formát..." ;
207 + Text [ sl ] = "Samooblikovanje..." ;
208 + Text [ sr-CS ] = "Аутоматско форматирање..." ;
209 + Text [ ss ] = "Kutifomethekela..." ;
210 + Text [ st ] = "Fomate e iketsahallang..." ;
211 + Text [ sv ] = "Autoformat..." ;
212 + Text [ sw-TZ ] = "AutoFormat..." ;
213 + Text [ ta ] = "தானியக்க வடிவம்..." ;
214 + Text [ ta-IN ] = "தானியக்க வடிவம்..." ;
215 + Text [ te-IN ] = "స్వయంరూపలావణ్యం..." ;
216 + Text [ tg ] = "Автоформат..." ;
217 + Text [ th ] = "AutoFormat..." ;
218 + Text [ tr ] = "Otomatik Biçimlendirme..." ;
219 + Text [ ts ] = "Fomati yo tiendlekela hi yoxe..." ;
220 + Text [ uk ] = "Автоформат..." ;
221 + Text [ ur-IN ] = "خودکارطریقہ..." ;
222 + Text [ ve ] = "OthoFomathi..." ;
223 + Text [ vi ] = "Tự định dạng..." ;
224 + Text [ xh ] = "Ulungiselelo Oluzenzekelayo..." ;
225 + Text [ zh-CN ] = "自动格式..." ;
226 + Text [ zh-TW ] = "自動格式..." ;
227 + Text [ zu ] = "Isakhiwo esizenzekelayo..." ;
231 Identifier = SID_PIVOT_RECALC ;
232 HelpId = SID_PIVOT_RECALC ;
233 Text [ en-US ] = "~Refresh" ;
234 diff --git sc/source/ui/view/dbfunc3.cxx sc/source/ui/view/dbfunc3.cxx
235 index 86fc703..1e5ff2c 100644
236 --- sc/source/ui/view/dbfunc3.cxx
237 +++ sc/source/ui/view/dbfunc3.cxx
238 @@ -2296,6 +2296,28 @@ void ScDBFunc::RepeatDB( BOOL bRecord )
239 ErrorMessage(STR_MSSG_REPEATDB_0);
242 +void ScDBFunc::AutoFormatPivotTable(USHORT nIndex)
244 + ScDocument* pDoc = GetViewData()->GetDocument();
246 + // old pivot not used any more
248 + ScDPObject* pDPObj = pDoc->GetDPAtCursor(
249 + GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
253 + pDPObj->SetAutoFormatIndex(nIndex);
256 + ErrorMessage(STR_PIVOT_NOTFOUND);
260 +void ScDBFunc::AutoFormatPivotTable(ScDPObject* pDPObj, USHORT nIndex)
262 + pDPObj->SetAutoFormatIndex(nIndex);
267 diff --git sc/source/ui/view/pivotsh.cxx sc/source/ui/view/pivotsh.cxx
268 index 5af6f2e..cd33bde 100644
269 --- sc/source/ui/view/pivotsh.cxx
270 +++ sc/source/ui/view/pivotsh.cxx
272 #include "uiitems.hxx"
273 //CHINA001 #include "pfiltdlg.hxx"
274 #include "scabstdlg.hxx" //CHINA001
276 +#include "autoform.hxx"
277 +#include "scuiautofmt.hxx"
278 +#include "editable.hxx"
281 //------------------------------------------------------------------------
284 @@ -102,7 +108,45 @@ void ScPivotShell::Execute( SfxRequest& rReq )
285 case SID_PIVOT_RECALC:
286 pViewShell->RecalcPivotTable();
288 + case SID_PIVOT_AFMT:
290 + ScViewData* pViewData = pViewShell->GetViewData();
292 + pViewShell->GetDBData( TRUE, SC_DB_OLD );
293 + const ScMarkData& rMark1 = pViewData->GetMarkData();
294 + if ( !rMark1.IsMarked() && !rMark1.IsMultiMarked() )
295 + pViewShell->MarkDataArea( TRUE );
297 + Window* pDlgParent = pViewShell->GetDialogParent();
299 + pViewData->MoveNextRow();
301 + ScGlobal::ClearAutoFormat();
302 + ScAutoFormatData* pNewEntry = pViewShell->CreateAutoFormatData();
303 + ScAutoFormatDlg* pDlg = new ScAutoFormatDlg(
304 + pDlgParent, ScGlobal::GetAutoFormat(), pNewEntry, pViewData->GetDocument() );
306 + if ( pDlg->Execute() == RET_OK )
308 + ScEditableTester aTester( pViewShell );
309 + if ( !aTester.IsEditable() )
311 + pViewShell->ErrorMessage(aTester.GetMessageId());
315 + /* AutoFormat and Store the index */
316 + pViewShell->AutoFormat( pDlg->GetIndex() );
317 + pViewShell->AutoFormatPivotTable( pDlg->GetIndex() );
323 + //pViewShell->DeletePivotTable();
324 + //pViewShell->RecalcPivotTable();
328 pViewShell->DeletePivotTable();
330 diff --git sc/source/ui/view/viewdata.cxx sc/source/ui/view/viewdata.cxx
331 index fbb1306..df48982 100644
332 --- sc/source/ui/view/viewdata.cxx
333 +++ sc/source/ui/view/viewdata.cxx
334 @@ -670,6 +670,22 @@ void ScViewData::RefreshZoom()
335 aLogicMode.SetScaleY( GetZoomY() );
338 +void ScViewData::MoveNextRow()
340 + ScRange aMarkRange;
341 + aMarkData.GetMarkArea(aMarkRange);
342 + aMarkRange.aStart.Set(aMarkRange.aStart.Col(), aMarkRange.aStart.Row() +1, aMarkRange.aStart.Tab());
343 + aMarkData.SetMarkArea(aMarkRange);
346 +void ScViewData::MovePrevRow()
348 + ScRange aMarkRange;
349 + aMarkData.GetMarkArea(aMarkRange);
350 + aMarkRange.aStart.Set(aMarkRange.aStart.Col(), aMarkRange.aStart.Row() -1, aMarkRange.aStart.Tab());
351 + aMarkData.SetMarkArea(aMarkRange);
354 void ScViewData::SetPagebreakMode( BOOL bSet )