Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "scitems.hxx"
31 : : #include <sfx2/bindings.hxx>
32 : : #include <sfx2/viewsh.hxx>
33 : : #include <sfx2/dispatch.hxx>
34 : : #include <editeng/fontitem.hxx>
35 : : #include <editeng/langitem.hxx>
36 : : #include <editeng/scripttypeitem.hxx>
37 : : #include <svl/itempool.hxx>
38 : : #include <svl/itemset.hxx>
39 : : #include <svl/cjkoptions.hxx>
40 : : #include <svl/ctloptions.hxx>
41 : : #include <vcl/svapp.hxx>
42 : : #include <vcl/msgbox.hxx>
43 : : #include <vcl/wrkwin.hxx>
44 : : #include <sfx2/request.hxx>
45 : : #include <sfx2/objsh.hxx>
46 : : #include <svl/stritem.hxx>
47 : : #include <svl/eitem.hxx>
48 : :
49 : : #include <com/sun/star/i18n/TransliterationModules.hpp>
50 : : #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
51 : :
52 : :
53 : : #include "viewutil.hxx"
54 : : #include "global.hxx"
55 : : #include "chgtrack.hxx"
56 : : #include "chgviset.hxx"
57 : : #include "markdata.hxx"
58 : :
59 : : #include <svx/svxdlg.hxx>
60 : : #include <svx/dialogs.hrc>
61 : : // STATIC DATA -----------------------------------------------------------
62 : :
63 : : //==================================================================
64 : :
65 : 1260 : void ScViewUtil::PutItemScript( SfxItemSet& rShellSet, const SfxItemSet& rCoreSet,
66 : : sal_uInt16 nWhichId, sal_uInt16 nScript )
67 : : {
68 : : // take the effective item from rCoreSet according to nScript
69 : : // and put in rShellSet under the (base) nWhichId
70 : :
71 : 1260 : SfxItemPool& rPool = *rShellSet.GetPool();
72 [ + - ][ + - ]: 1260 : SvxScriptSetItem aSetItem( rPool.GetSlotId(nWhichId), rPool );
73 : : // use PutExtended with eDefaultAs = SFX_ITEM_SET, so defaults from rCoreSet
74 : : // (document pool) are read and put into rShellSet (MessagePool)
75 [ + - ]: 1260 : aSetItem.GetItemSet().PutExtended( rCoreSet, SFX_ITEM_DONTCARE, SFX_ITEM_SET );
76 [ + - ]: 1260 : const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
77 [ + - ]: 1260 : if (pI)
78 [ + - ]: 1260 : rShellSet.Put( *pI, nWhichId );
79 : : else
80 [ # # ][ + - ]: 1260 : rShellSet.InvalidateItem( nWhichId );
81 : 1260 : }
82 : :
83 : 0 : sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos )
84 : : {
85 : : // used for thesaurus
86 : :
87 : 0 : sal_uInt8 nScript = pDoc->GetScriptType( rPos.Col(), rPos.Row(), rPos.Tab() );
88 : : sal_uInt16 nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE :
89 [ # # ][ # # ]: 0 : ( ( nScript == SCRIPTTYPE_COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE );
90 : 0 : const SfxPoolItem* pItem = pDoc->GetAttr( rPos.Col(), rPos.Row(), rPos.Tab(), nWhich);
91 [ # # ][ # # ]: 0 : SvxLanguageItem* pLangIt = PTR_CAST( SvxLanguageItem, pItem );
92 : : LanguageType eLnge;
93 [ # # ]: 0 : if (pLangIt)
94 : : {
95 : 0 : eLnge = (LanguageType) pLangIt->GetValue();
96 [ # # ]: 0 : if (eLnge == LANGUAGE_DONTKNOW) //! can this happen?
97 : : {
98 : : LanguageType eLatin, eCjk, eCtl;
99 [ # # ]: 0 : pDoc->GetLanguage( eLatin, eCjk, eCtl );
100 : : eLnge = ( nScript == SCRIPTTYPE_ASIAN ) ? eCjk :
101 [ # # ][ # # ]: 0 : ( ( nScript == SCRIPTTYPE_COMPLEX ) ? eCtl : eLatin );
102 : : }
103 : : }
104 : : else
105 : 0 : eLnge = LANGUAGE_ENGLISH_US;
106 [ # # ]: 0 : if ( eLnge == LANGUAGE_SYSTEM )
107 : 0 : eLnge = Application::GetSettings().GetLanguage(); // never use SYSTEM for spelling
108 : :
109 : 0 : return eLnge;
110 : : }
111 : :
112 : 0 : sal_Int32 ScViewUtil::GetTransliterationType( sal_uInt16 nSlotID )
113 : : {
114 : 0 : sal_Int32 nType = 0;
115 [ # # # # : 0 : switch ( nSlotID )
# # # # #
# ]
116 : : {
117 : : case SID_TRANSLITERATE_SENTENCE_CASE:
118 : 0 : nType = com::sun::star::i18n::TransliterationModulesExtra::SENTENCE_CASE;
119 : 0 : break;
120 : : case SID_TRANSLITERATE_TITLE_CASE:
121 : 0 : nType = com::sun::star::i18n::TransliterationModulesExtra::TITLE_CASE;
122 : 0 : break;
123 : : case SID_TRANSLITERATE_TOGGLE_CASE:
124 : 0 : nType = com::sun::star::i18n::TransliterationModulesExtra::TOGGLE_CASE;
125 : 0 : break;
126 : : case SID_TRANSLITERATE_UPPER:
127 : 0 : nType = com::sun::star::i18n::TransliterationModules_LOWERCASE_UPPERCASE;
128 : 0 : break;
129 : : case SID_TRANSLITERATE_LOWER:
130 : 0 : nType = com::sun::star::i18n::TransliterationModules_UPPERCASE_LOWERCASE;
131 : 0 : break;
132 : : case SID_TRANSLITERATE_HALFWIDTH:
133 : 0 : nType = com::sun::star::i18n::TransliterationModules_FULLWIDTH_HALFWIDTH;
134 : 0 : break;
135 : : case SID_TRANSLITERATE_FULLWIDTH:
136 : 0 : nType = com::sun::star::i18n::TransliterationModules_HALFWIDTH_FULLWIDTH;
137 : 0 : break;
138 : : case SID_TRANSLITERATE_HIRAGANA:
139 : 0 : nType = com::sun::star::i18n::TransliterationModules_KATAKANA_HIRAGANA;
140 : 0 : break;
141 : : case SID_TRANSLITERATE_KATAGANA:
142 : 0 : nType = com::sun::star::i18n::TransliterationModules_HIRAGANA_KATAKANA;
143 : 0 : break;
144 : : }
145 : 0 : return nType;
146 : : }
147 : :
148 : 0 : sal_Bool ScViewUtil::IsActionShown( const ScChangeAction& rAction,
149 : : const ScChangeViewSettings& rSettings,
150 : : ScDocument& rDocument )
151 : : {
152 : : // abgelehnte werden durch eine invertierende akzeptierte Action dargestellt,
153 : : // die Reihenfolge von ShowRejected/ShowAccepted ist deswegen wichtig
154 : :
155 [ # # ][ # # ]: 0 : if ( !rSettings.IsShowRejected() && rAction.IsRejecting() )
[ # # ]
156 : 0 : return false;
157 : :
158 [ # # ][ # # ]: 0 : if ( !rSettings.IsShowAccepted() && rAction.IsAccepted() && !rAction.IsRejecting() )
[ # # ][ # # ]
159 : 0 : return false;
160 : :
161 [ # # ]: 0 : if ( rSettings.HasAuthor() )
162 : : {
163 [ # # ]: 0 : if ( rSettings.IsEveryoneButMe() )
164 : : {
165 : : // GetUser() am ChangeTrack ist der aktuelle Benutzer
166 : 0 : ScChangeTrack* pTrack = rDocument.GetChangeTrack();
167 [ # # ][ # # ]: 0 : if ( !pTrack || rAction.GetUser().equals(pTrack->GetUser()) )
[ # # ]
168 : 0 : return false;
169 : : }
170 [ # # ][ # # ]: 0 : else if ( !rAction.GetUser().equals(rSettings.GetTheAuthorToShow()) )
171 : 0 : return false;
172 : : }
173 : :
174 [ # # ]: 0 : if ( rSettings.HasComment() )
175 : : {
176 [ # # ][ # # ]: 0 : rtl::OUStringBuffer aBuf(rAction.GetComment());
177 [ # # ]: 0 : aBuf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" ("));
178 : 0 : rtl::OUString aTmp;
179 [ # # ]: 0 : rAction.GetDescription(aTmp, &rDocument);
180 [ # # ]: 0 : aBuf.append(aTmp);
181 [ # # ]: 0 : aBuf.append(sal_Unicode(')'));
182 [ # # ]: 0 : rtl::OUString aComStr = aBuf.makeStringAndClear();
183 : :
184 [ # # ][ # # ]: 0 : if(!rSettings.IsValidComment(&aComStr))
185 [ # # ][ # # ]: 0 : return false;
[ # # ]
186 : : }
187 : :
188 [ # # ]: 0 : if ( rSettings.HasRange() )
189 [ # # ][ # # ]: 0 : if ( !rSettings.GetTheRangeList().Intersects( rAction.GetBigRange().MakeRange() ) )
190 : 0 : return false;
191 : :
192 [ # # ][ # # ]: 0 : if ( rSettings.HasDate() && rSettings.GetTheDateMode() != SCDM_NO_DATEMODE )
[ # # ]
193 : : {
194 [ # # ]: 0 : DateTime aDateTime = rAction.GetDateTime();
195 : 0 : const DateTime& rFirst = rSettings.GetTheFirstDateTime();
196 : 0 : const DateTime& rLast = rSettings.GetTheLastDateTime();
197 [ # # # # : 0 : switch ( rSettings.GetTheDateMode() )
# # ]
198 : : { // korrespondiert mit ScHighlightChgDlg::OKBtnHdl
199 : : case SCDM_DATE_BEFORE:
200 [ # # ][ # # ]: 0 : if ( aDateTime > rFirst )
201 : 0 : return false;
202 : 0 : break;
203 : :
204 : : case SCDM_DATE_SINCE:
205 [ # # ][ # # ]: 0 : if ( aDateTime < rFirst )
206 : 0 : return false;
207 : 0 : break;
208 : :
209 : : case SCDM_DATE_EQUAL:
210 : : case SCDM_DATE_BETWEEN:
211 [ # # ][ # # ]: 0 : if ( aDateTime < rFirst || aDateTime > rLast )
[ # # ][ # # ]
[ # # ]
212 : 0 : return false;
213 : 0 : break;
214 : :
215 : : case SCDM_DATE_NOTEQUAL:
216 [ # # ][ # # ]: 0 : if ( aDateTime >= rFirst && aDateTime <= rLast )
[ # # ][ # # ]
[ # # ]
217 : 0 : return false;
218 : 0 : break;
219 : :
220 : : case SCDM_DATE_SAVE:
221 : : {
222 : 0 : ScChangeTrack* pTrack = rDocument.GetChangeTrack();
223 [ # # ][ # # ]: 0 : if ( !pTrack || pTrack->GetLastSavedActionNumber() >=
[ # # ]
224 : 0 : rAction.GetActionNumber() )
225 : 0 : return false;
226 : : }
227 : 0 : break;
228 : :
229 : : default:
230 : : {
231 : : // added to avoid warnings
232 : : }
233 : : }
234 : : }
235 : :
236 [ # # ]: 0 : if ( rSettings.HasActionRange() )
237 : : {
238 : 0 : sal_uLong nAction = rAction.GetActionNumber();
239 : : sal_uLong nFirstAction;
240 : : sal_uLong nLastAction;
241 : 0 : rSettings.GetTheActionRange( nFirstAction, nLastAction );
242 [ # # ][ # # ]: 0 : if ( nAction < nFirstAction || nAction > nLastAction )
243 : : {
244 : 0 : return false;
245 : : }
246 : : }
247 : :
248 : 0 : return sal_True;
249 : : }
250 : :
251 : 0 : void ScViewUtil::UnmarkFiltered( ScMarkData& rMark, ScDocument* pDoc )
252 : : {
253 [ # # ]: 0 : rMark.MarkToMulti();
254 : :
255 : 0 : ScRange aMultiArea;
256 [ # # ]: 0 : rMark.GetMultiMarkArea( aMultiArea );
257 : 0 : SCCOL nStartCol = aMultiArea.aStart.Col();
258 : 0 : SCROW nStartRow = aMultiArea.aStart.Row();
259 : 0 : SCCOL nEndCol = aMultiArea.aEnd.Col();
260 : 0 : SCROW nEndRow = aMultiArea.aEnd.Row();
261 : :
262 : 0 : bool bChanged = false;
263 [ # # ][ # # ]: 0 : ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
264 [ # # ][ # # ]: 0 : for (; itr != itrEnd; ++itr)
[ # # ]
265 : : {
266 [ # # ]: 0 : SCTAB nTab = *itr;
267 [ # # ]: 0 : for (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
268 : : {
269 : 0 : SCROW nLastRow = nRow;
270 [ # # ][ # # ]: 0 : if (pDoc->RowFiltered(nRow, nTab, NULL, &nLastRow))
271 : : {
272 : : // use nStartCol/nEndCol, so the multi mark area isn't extended to all columns
273 : : // (visible in repaint for indentation)
274 : : rMark.SetMultiMarkArea(
275 [ # # ]: 0 : ScRange(nStartCol, nRow, nTab, nEndCol, nLastRow, nTab), false);
276 : 0 : bChanged = true;
277 : 0 : nRow = nLastRow;
278 : : }
279 : : }
280 : : }
281 : :
282 [ # # ][ # # ]: 0 : if ( bChanged && !rMark.HasAnyMultiMarks() )
[ # # ][ # # ]
283 [ # # ]: 0 : rMark.ResetMark();
284 : :
285 [ # # ]: 0 : rMark.MarkToSimple();
286 : 0 : }
287 : :
288 : :
289 : 0 : bool ScViewUtil::FitToUnfilteredRows( ScRange & rRange, ScDocument * pDoc, size_t nRows )
290 : : {
291 : 0 : SCTAB nTab = rRange.aStart.Tab();
292 : 0 : bool bOneTabOnly = (nTab == rRange.aEnd.Tab());
293 : : // Always fit the range on its first sheet.
294 : : OSL_ENSURE( bOneTabOnly, "ScViewUtil::ExtendToUnfilteredRows: works only on one sheet");
295 : 0 : SCROW nStartRow = rRange.aStart.Row();
296 : 0 : SCROW nLastRow = pDoc->LastNonFilteredRow(nStartRow, MAXROW, nTab);
297 [ # # ]: 0 : if (ValidRow(nLastRow))
298 : 0 : rRange.aEnd.SetRow(nLastRow);
299 : 0 : SCROW nCount = pDoc->CountNonFilteredRows(nStartRow, MAXROW, nTab);
300 [ # # ][ # # ]: 0 : return static_cast<size_t>(nCount) == nRows && bOneTabOnly;
301 : : }
302 : :
303 : 121 : bool ScViewUtil::HasFiltered( const ScRange& rRange, ScDocument* pDoc )
304 : : {
305 : 121 : SCROW nStartRow = rRange.aStart.Row();
306 : 121 : SCROW nEndRow = rRange.aEnd.Row();
307 [ + + ]: 242 : for (SCTAB nTab=rRange.aStart.Tab(); nTab<=rRange.aEnd.Tab(); nTab++)
308 : : {
309 [ - + ]: 121 : if (pDoc->HasFilteredRows(nStartRow, nEndRow, nTab))
310 : 0 : return true;
311 : : }
312 : :
313 : 121 : return false;
314 : : }
315 : :
316 : 0 : void ScViewUtil::HideDisabledSlot( SfxItemSet& rSet, SfxBindings& rBindings, sal_uInt16 nSlotId )
317 : : {
318 [ # # ]: 0 : SvtCJKOptions aCJKOptions;
319 [ # # ]: 0 : SvtCTLOptions aCTLOptions;
320 : 0 : bool bEnabled = true;
321 : :
322 [ # # # # ]: 0 : switch( nSlotId )
323 : : {
324 : : case SID_CHINESE_CONVERSION:
325 : : case SID_HANGUL_HANJA_CONVERSION:
326 [ # # ]: 0 : bEnabled = aCJKOptions.IsAnyEnabled();
327 : 0 : break;
328 : :
329 : : case SID_TRANSLITERATE_HALFWIDTH:
330 : : case SID_TRANSLITERATE_FULLWIDTH:
331 : : case SID_TRANSLITERATE_HIRAGANA:
332 : : case SID_TRANSLITERATE_KATAGANA:
333 [ # # ]: 0 : bEnabled = aCJKOptions.IsChangeCaseMapEnabled();
334 : 0 : break;
335 : :
336 : : case SID_INSERT_RLM:
337 : : case SID_INSERT_LRM:
338 : : case SID_INSERT_ZWNBSP:
339 : : case SID_INSERT_ZWSP:
340 [ # # ]: 0 : bEnabled = aCTLOptions.IsCTLFontEnabled();
341 : 0 : break;
342 : :
343 : : default:
344 : : OSL_FAIL( "ScViewUtil::HideDisabledSlot - unknown slot ID" );
345 : 0 : return;
346 : : }
347 : :
348 [ # # ]: 0 : rBindings.SetVisibleState( nSlotId, bEnabled );
349 [ # # ]: 0 : if( !bEnabled )
350 [ # # ][ # # ]: 0 : rSet.DisableItem( nSlotId );
[ # # ][ # # ]
[ # # ]
351 : : }
352 : :
353 : : //==================================================================
354 : :
355 : 0 : sal_Bool ScViewUtil::ExecuteCharMap( const SvxFontItem& rOldFont,
356 : : SfxViewFrame& rFrame,
357 : : SvxFontItem& rNewFont,
358 : : String& rString )
359 : : {
360 : 0 : sal_Bool bRet = false;
361 : 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
362 [ # # ]: 0 : if(pFact)
363 : : {
364 [ # # ][ # # ]: 0 : SfxAllItemSet aSet( rFrame.GetObjectShell()->GetPool() );
365 [ # # ][ # # ]: 0 : aSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
[ # # ]
366 [ # # ][ # # ]: 0 : aSet.Put( SvxFontItem( rOldFont.GetFamily(), rOldFont.GetFamilyName(), rOldFont.GetStyleName(), rOldFont.GetPitch(), rOldFont.GetCharSet(), aSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ) ) );
[ # # ][ # # ]
367 [ # # ][ # # ]: 0 : SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( &rFrame.GetWindow(), aSet, rFrame.GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
[ # # ][ # # ]
368 [ # # ][ # # ]: 0 : if ( pDlg->Execute() == RET_OK )
369 : : {
370 [ # # ][ # # ]: 0 : SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, false );
[ # # ]
371 [ # # ][ # # ]: 0 : SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, false );
[ # # ]
372 [ # # ]: 0 : if ( pItem )
373 [ # # ]: 0 : rString = pItem->GetValue();
374 [ # # ]: 0 : if ( pFontItem )
375 [ # # ][ # # ]: 0 : rNewFont = SvxFontItem( pFontItem->GetFamily(), pFontItem->GetFamilyName(), pFontItem->GetStyleName(), pFontItem->GetPitch(), pFontItem->GetCharSet(), rNewFont.Which() );
[ # # ]
376 : 0 : bRet = sal_True;
377 : : }
378 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ]
379 : : }
380 : 0 : return bRet;
381 : : }
382 : :
383 : 0 : bool ScViewUtil::IsFullScreen( SfxViewShell& rViewShell )
384 : : {
385 : 0 : SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings();
386 : 0 : SfxPoolItem* pItem = 0;
387 : 0 : bool bIsFullScreen = false;
388 : :
389 [ # # ][ # # ]: 0 : if (rBindings.QueryState( SID_WIN_FULLSCREEN, pItem ) >= SFX_ITEM_DEFAULT)
390 : 0 : bIsFullScreen = static_cast< SfxBoolItem* >( pItem )->GetValue();
391 : 0 : return bIsFullScreen;
392 : : }
393 : :
394 : 0 : void ScViewUtil::SetFullScreen( SfxViewShell& rViewShell, bool bSet )
395 : : {
396 [ # # ]: 0 : if( IsFullScreen( rViewShell ) != bSet )
397 : : {
398 [ # # ]: 0 : SfxBoolItem aItem( SID_WIN_FULLSCREEN, bSet );
399 [ # # ][ # # ]: 0 : rViewShell.GetDispatcher()->Execute( SID_WIN_FULLSCREEN, SFX_CALLMODE_RECORD, &aItem, 0L );
[ # # ]
400 : : }
401 : 0 : }
402 : :
403 : : //------------------------------------------------------------------
404 : :
405 : 0 : ScUpdateRect::ScUpdateRect( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 )
406 : : {
407 : 0 : PutInOrder( nX1, nX2 );
408 : 0 : PutInOrder( nY1, nY2 );
409 : :
410 : 0 : nOldStartX = nX1;
411 : 0 : nOldStartY = nY1;
412 : 0 : nOldEndX = nX2;
413 : 0 : nOldEndY = nY2;
414 : 0 : }
415 : :
416 : 0 : void ScUpdateRect::SetNew( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 )
417 : : {
418 : 0 : PutInOrder( nX1, nX2 );
419 : 0 : PutInOrder( nY1, nY2 );
420 : :
421 : 0 : nNewStartX = nX1;
422 : 0 : nNewStartY = nY1;
423 : 0 : nNewEndX = nX2;
424 : 0 : nNewEndY = nY2;
425 : 0 : }
426 : :
427 : 0 : sal_Bool ScUpdateRect::GetDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 )
428 : : {
429 [ # # ][ # # ]: 0 : if ( nNewStartX == nOldStartX && nNewEndX == nOldEndX &&
[ # # ][ # # ]
430 : : nNewStartY == nOldStartY && nNewEndY == nOldEndY )
431 : : {
432 : 0 : rX1 = nNewStartX;
433 : 0 : rY1 = nNewStartY;
434 : 0 : rX2 = nNewStartX;
435 : 0 : rY2 = nNewStartY;
436 : 0 : return false;
437 : : }
438 : :
439 : 0 : rX1 = Min(nNewStartX,nOldStartX);
440 : 0 : rY1 = Min(nNewStartY,nOldStartY);
441 : 0 : rX2 = Max(nNewEndX,nOldEndX);
442 : 0 : rY2 = Max(nNewEndY,nOldEndY);
443 : :
444 [ # # ][ # # ]: 0 : if ( nNewStartX == nOldStartX && nNewEndX == nOldEndX )
445 : : {
446 [ # # ]: 0 : if ( nNewStartY == nOldStartY )
447 : : {
448 : 0 : rY1 = Min( nNewEndY, nOldEndY );
449 : 0 : rY2 = Max( nNewEndY, nOldEndY );
450 : : }
451 [ # # ]: 0 : else if ( nNewEndY == nOldEndY )
452 : : {
453 : 0 : rY1 = Min( nNewStartY, nOldStartY );
454 : 0 : rY2 = Max( nNewStartY, nOldStartY );
455 : : }
456 : : }
457 [ # # ][ # # ]: 0 : else if ( nNewStartY == nOldStartY && nNewEndY == nOldEndY )
458 : : {
459 [ # # ]: 0 : if ( nNewStartX == nOldStartX )
460 : : {
461 : 0 : rX1 = Min( nNewEndX, nOldEndX );
462 : 0 : rX2 = Max( nNewEndX, nOldEndX );
463 : : }
464 [ # # ]: 0 : else if ( nNewEndX == nOldEndX )
465 : : {
466 : 0 : rX1 = Min( nNewStartX, nOldStartX );
467 : 0 : rX2 = Max( nNewStartX, nOldStartX );
468 : : }
469 : : }
470 : :
471 : 0 : return sal_True;
472 : : }
473 : :
474 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|