docshini.cxx (233d87e4) docshini.cxx (5b4f8e55)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 344 unchanged lines hidden (view full) ---

353 // at the document instance, the document is modified. Thus, reset this
354 // status here. Note: In method <SubInitNew()> this is also done.
355 pDoc->ResetModified();
356 // <--
357
358 return bRet;
359}
360
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 344 unchanged lines hidden (view full) ---

353 // at the document instance, the document is modified. Thus, reset this
354 // status here. Note: In method <SubInitNew()> this is also done.
355 pDoc->ResetModified();
356 // <--
357
358 return bRet;
359}
360
361//#115580# When creating a new document, if needed, set the default
362// font and languague attributes.
363void SwDocShell::InitDefaultFontAttr( SwDoc* pDoc )
364{
365 sal_uInt16 aFontWhich[] =
366 {
367 RES_CHRATR_FONT,
368 RES_CHRATR_CJK_FONT,
369 RES_CHRATR_CTL_FONT
370 };
371 sal_uInt16 aFontHeightWhich[] =
372 {
373 RES_CHRATR_FONTSIZE,
374 RES_CHRATR_CJK_FONTSIZE,
375 RES_CHRATR_CTL_FONTSIZE
376 };
377 sal_uInt16 aFontIds[] =
378 {
379 FONT_STANDARD,
380 FONT_STANDARD_CJK,
381 FONT_STANDARD_CTL
382 };
383 sal_uInt16 nFontTypes[] =
384 {
385 DEFAULTFONT_LATIN_TEXT,
386 DEFAULTFONT_CJK_TEXT,
387 DEFAULTFONT_CTL_TEXT
388 };
389
390 sal_uInt16 aLangWhich[] =
391 {
392 RES_CHRATR_LANGUAGE,
393 RES_CHRATR_CJK_LANGUAGE,
394 RES_CHRATR_CTL_LANGUAGE
395 };
396 sal_uInt16 aLangTypes[] =
397 {
398 LANGUAGE_ENGLISH_US,
399 LANGUAGE_ENGLISH_US,
400 LANGUAGE_ARABIC_SAUDI_ARABIA
401 };
402
403 SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig();
404 String sEntry;
405
406 for(sal_uInt8 i = 0; i < 3; i++)
407 {
408 sal_uInt16 nFontWhich = aFontWhich[i];
409 sal_uInt16 nFontId = aFontIds[i];
410 SvxFontItem* pFontItem = 0;
411 const SvxLanguageItem& rLang = (const SvxLanguageItem&)pDoc->GetDefault( aLangWhich[i] );
412 LanguageType eLanguage = rLang.GetLanguage();
413 if ( (eLanguage == LANGUAGE_DONTKNOW) || (eLanguage == LANGUAGE_NONE) )
414 eLanguage = aLangTypes[i];
415 {
416 if ( i == 0 )
417 {//At present, just supports for the following languages: english, french and german.
418 LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
419 switch( eUiLanguage )
420 {
421 case LANGUAGE_ENGLISH_US:
422 case LANGUAGE_FRENCH:
423 case LANGUAGE_FRENCH_BELGIAN:
424 case LANGUAGE_FRENCH_CAMEROON:
425 case LANGUAGE_FRENCH_CANADIAN:
426 case LANGUAGE_FRENCH_COTE_D_IVOIRE:
427 case LANGUAGE_FRENCH_HAITI:
428 case LANGUAGE_FRENCH_LUXEMBOURG:
429 case LANGUAGE_FRENCH_MALI:
430 case LANGUAGE_FRENCH_MONACO:
431 case LANGUAGE_FRENCH_MOROCCO:
432 case LANGUAGE_FRENCH_NORTH_AFRICA:
433 case LANGUAGE_FRENCH_REUNION:
434 case LANGUAGE_FRENCH_SENEGAL:
435 case LANGUAGE_FRENCH_SWISS:
436 case LANGUAGE_FRENCH_WEST_INDIES:
437 case LANGUAGE_FRENCH_ZAIRE:
438 case LANGUAGE_GERMAN:
439 case LANGUAGE_GERMAN_AUSTRIAN:
440 case LANGUAGE_GERMAN_LIECHTENSTEIN:
441 case LANGUAGE_GERMAN_LUXEMBOURG:
442 case LANGUAGE_GERMAN_SWISS:
443 eLanguage = eUiLanguage;
444 break;
445
446 }
447 }
448
449 if ( i == 2 ) //CTL,just supports for HINDI and ARABIC_SAUDI_ARABIA
450 {
451 LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
452 switch( eUiLanguage )
453 {
454 case LANGUAGE_HINDI:
455 eLanguage = eUiLanguage;
456 break;
457
458 }
459 }
460
461 if ( i == 1 ) //CJK
462 {
463 LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
464 switch( eUiLanguage )
465 {
466 case LANGUAGE_KOREAN:
467 case LANGUAGE_KOREAN_JOHAB:
468 case LANGUAGE_CHINESE:
469 case LANGUAGE_CHINESE_HONGKONG:
470 case LANGUAGE_CHINESE_MACAU:
471 case LANGUAGE_CHINESE_SIMPLIFIED:
472 case LANGUAGE_CHINESE_SINGAPORE:
473 case LANGUAGE_CHINESE_TRADITIONAL:
474 case LANGUAGE_JAPANESE:
475 eLanguage = eUiLanguage;
476 break;
477 }
478 }
479
480 Font aLangDefFont = OutputDevice::GetDefaultFont(
481 nFontTypes[i],
482 eLanguage,
483 DEFAULTFONT_FLAGS_ONLYONE );
484 pFontItem = new SvxFontItem(aLangDefFont.GetFamily(), aLangDefFont.GetName(),
485 aEmptyStr, aLangDefFont.GetPitch(), aLangDefFont.GetCharSet(), nFontWhich);
486 }
487
488 pDoc->SetDefault(*pFontItem);
489 delete pFontItem;
490
491 sal_Int32 nFontHeight = pStdFont->GetFontHeight( FONT_STANDARD, i, eLanguage );
492 if(nFontHeight <= 0)
493 nFontHeight = pStdFont->GetDefaultHeightFor( nFontId, eLanguage );
494 pDoc->SetDefault(SvxFontHeightItem( nFontHeight, 100, aFontHeightWhich[i] ));
495 pDoc->SetDefault( SvxLanguageItem( eLanguage, aLangWhich[i] ) );
496 }
497}
498
499/*--------------------------------------------------------------------
500 Beschreibung: Ctor mit SfxCreateMode ?????
501 --------------------------------------------------------------------*/
502
503
504SwDocShell::SwDocShell( SfxObjectCreateMode eMode ) :
505 SfxObjectShell ( eMode ),
506 pDoc(0),

--- 448 unchanged lines hidden ---
361/*--------------------------------------------------------------------
362 Beschreibung: Ctor mit SfxCreateMode ?????
363 --------------------------------------------------------------------*/
364
365
366SwDocShell::SwDocShell( SfxObjectCreateMode eMode ) :
367 SfxObjectShell ( eMode ),
368 pDoc(0),

--- 448 unchanged lines hidden ---