From 757f6d98c004988c98c506aa9bff4572affcf3e1 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 17 Sep 2009 07:35:16 +0000 Subject: #i1601# Sentence case, Title case, and Toggle case transliteration added --- sw/source/core/edit/editsh.cxx | 26 ++++++++++++++++++++++++++ sw/source/ui/shells/annotsh.cxx | 10 ++++++++++ sw/source/ui/shells/drwtxtsh.cxx | 10 ++++++++++ sw/source/ui/shells/textsh.cxx | 12 +++++++++++- 4 files changed, 57 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 0035a8880ba9..3bfea5fa6290 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -1182,6 +1182,32 @@ void SwEditShell::TransliterateText( sal_uInt32 nType ) EndAllAction(); } +void SwEditShell::TransliterateText( const String& rModuleName ) +{ + utl::TransliterationWrapper aTrans(::comphelper::getProcessServiceFactory(), 0 ); + aTrans.loadModuleByImplName( rModuleName, LANGUAGE_SYSTEM ); + StartAllAction(); + SET_CURR_SHELL( this ); + + SwPaM* pCrsr = GetCrsr(); + if( pCrsr->GetNext() != pCrsr ) + { + GetDoc()->StartUndo(UNDO_EMPTY, NULL); + FOREACHPAM_START( this ) + + if( PCURCRSR->HasMark() ) + GetDoc()->TransliterateText( *PCURCRSR, aTrans ); + + FOREACHPAM_END() + GetDoc()->EndUndo(UNDO_EMPTY, NULL); + } + else + GetDoc()->TransliterateText( *pCrsr, aTrans ); + + EndAllAction(); +} + + void SwEditShell::CountWords( SwDocStat& rStat ) const { FOREACHPAM_START( this ) diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 054220be6707..2e5a54076d7e 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -1286,6 +1287,15 @@ void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq) switch( rReq.GetSlot() ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nMode = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nMode = TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 99a2bf71bca7..2b3d07d83b7d 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -723,6 +724,15 @@ void SwDrawTextShell::ExecTransliteration( SfxRequest & rReq ) switch( rReq.GetSlot() ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nMode = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nMode = TransliterationModules_LOWERCASE_UPPERCASE; break; diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 742e93b646c2..a16c8dc81616 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -67,7 +67,8 @@ #include #include #include -#include +#include +#include #include #include @@ -1029,6 +1030,15 @@ void SwTextShell::ExecTransliteration( SfxRequest & rReq ) switch( rReq.GetSlot() ) { + case SID_TRANSLITERATE_SENTENCE_CASE: + nMode = TransliterationModulesExtra::SENTENCE_CASE; + break; + case SID_TRANSLITERATE_TITLE_CASE: + nMode = TransliterationModulesExtra::TITLE_CASE; + break; + case SID_TRANSLITERATE_TOGGLE_CASE: + nMode = TransliterationModulesExtra::TOGGLE_CASE; + break; case SID_TRANSLITERATE_UPPER: nMode = TransliterationModules_LOWERCASE_UPPERCASE; break; -- cgit From 46f1a498f70bbed831ae1e01a3a016a26f298eba Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 23 Sep 2009 12:26:08 +0000 Subject: #i1601# transliteration for sentence case, title case and toggle case --- sw/source/core/edit/editsh.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 3bfea5fa6290..267d45fca53f 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -1159,8 +1159,7 @@ void SwEditShell::SetExtTextInputData( const CommandExtTextInputData& rData ) void SwEditShell::TransliterateText( sal_uInt32 nType ) { - utl::TransliterationWrapper aTrans( - ::comphelper::getProcessServiceFactory(), nType ); + utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), nType ); StartAllAction(); SET_CURR_SHELL( this ); -- cgit From 4d8fe0ad149fe01976f2a23d598cfaf5eafbcc82 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Mon, 19 Oct 2009 08:12:25 +0000 Subject: #106019# 'reset languages' menu entry --- sw/source/ui/inc/langhelper.hxx | 22 +- sw/source/ui/inc/olmenu.hxx | 11 +- sw/source/ui/lingu/olmenu.cxx | 734 +++++++++++++++++-------------------- sw/source/ui/lingu/olmenu.hrc | 82 +++-- sw/source/ui/lingu/olmenu.src | 17 +- sw/source/ui/shells/langhelper.cxx | 256 +++++++------ sw/source/ui/shells/textsh1.cxx | 9 +- 7 files changed, 573 insertions(+), 558 deletions(-) (limited to 'sw/source') diff --git a/sw/source/ui/inc/langhelper.hxx b/sw/source/ui/inc/langhelper.hxx index 751cff109eee..bcf5de8cfc27 100755 --- a/sw/source/ui/inc/langhelper.hxx +++ b/sw/source/ui/inc/langhelper.hxx @@ -34,31 +34,37 @@ class SwWrtShell; class SwView; class EditEngine; class EditView; +class OutlinerView; class SfxItemSet; struct ESelection; namespace SwLangHelper { - extern USHORT GetLanguageStatus(OutlinerView* pOLV,SfxItemSet& rSet); - extern bool SetLanguageStatus(OutlinerView* pOLV,SfxRequest &rReq,SwView &rView,SwWrtShell &rSh); + extern USHORT GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ); + extern bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView &rView, SwWrtShell &rSh ); - extern void SetLanguage(SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet); - extern void SetLanguage(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet); - extern void SetLanguage_None(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); - extern void SetLanguage_None(SwWrtShell &rWrtSh,bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage( SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); +// extern void SetLanguage( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet ); +// extern void SetLanguage_None( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ); + extern void ResetLanguages( SwWrtShell &rWrtSh, bool bIsForSelection ); +// extern void ResetLanguages( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, bool bIsForSelection ); + extern void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection ); // document extern void SelectCurrentPara( SwWrtShell &rWrtSh ); // EditView extern void SelectPara( EditView &rEditView, const ESelection &rCurSel ); - extern String GetTextForLanguageGuessing(EditEngine* rEditEngine, ESelection aDocSelection ); + extern String GetTextForLanguageGuessing( EditEngine* rEditEngine, ESelection aDocSelection ); extern String GetTextForLanguageGuessing( SwWrtShell &rSh ); extern LanguageType GetLanguage( SfxItemSet aSet, USHORT nLangWhichId ); extern LanguageType GetLanguage( SwWrtShell &rSh, USHORT nLangWhichId ); - extern LanguageType GetCurrentLanguage(SfxItemSet aSet,USHORT nScriptType ); + extern LanguageType GetCurrentLanguage( SfxItemSet aSet, USHORT nScriptType ); extern LanguageType GetCurrentLanguage( SwWrtShell &rSh ); } diff --git a/sw/source/ui/inc/olmenu.hxx b/sw/source/ui/inc/olmenu.hxx index 0985c3bdc4da..c7fd1f4e71f3 100644 --- a/sw/source/ui/inc/olmenu.hxx +++ b/sw/source/ui/inc/olmenu.hxx @@ -54,23 +54,22 @@ class SwSpellPopup : public PopupMenu ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt; ::com::sun::star::uno::Sequence< rtl::OUString > aSuggestions; - LanguageType nCheckedLanguage; + LanguageType nCheckedLanguage; LanguageType nGuessLangWord; LanguageType nGuessLangPara; - USHORT nNumLanguageTextEntries; - USHORT nNumLanguageParaEntries; - USHORT nNumLanguageDocEntries; std::map< sal_Int16, ::rtl::OUString > aLangTable_Text; std::map< sal_Int16, ::rtl::OUString > aLangTable_Paragraph; - std::map< sal_Int16, ::rtl::OUString > aLangTable_Document; +// std::map< sal_Int16, ::rtl::OUString > aLangTable_Document; bool bGrammarResults; // show grammar results? Or show spellcheck results? Image aInfo16; - USHORT fillLangPopupMenu( PopupMenu *pPopupMenu , USHORT Lang_Start, ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq,SwWrtShell* pWrtSh, USHORT nLangTable); + void fillLangPopupMenu( PopupMenu *pPopupMenu, USHORT nLangStart, + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq, SwWrtShell* pWrtSh, + std::map< sal_Int16, ::rtl::OUString > &rLangTable ); using PopupMenu::Execute; diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 865908568cd6..41bed8ff7650 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -31,86 +31,75 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include - -#ifndef _SVSTDARR_HXX -#define _SVSTDARR_STRINGSDTOR -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include +#include #include -#include +#include #include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include #include #include -#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include //CheckSpellChanges -#include -#include -#include -#include -#include -#include - -// -> #111827# -#include -#include -#include -// <- #111827# - -#include -#include -#include -#include -#include -#include -#include -#include "swabstdlg.hxx" -#include "chrdlg.hrc" -#include -#include -#include -#include - -#include -#include +#include -#include +#include "SwRewriter.hxx" +#include "chrdlg.hrc" +#include "cmdid.h" +#include "comcore.hrc" +#include "crsskip.hxx" +#include "doc.hxx" +#include "docsh.hxx" //CheckSpellChanges +#include "edtwin.hxx" +#include "helpid.h" +#include "hintids.hxx" +#include "langhelper.hxx" +#include "ndtxt.hxx" +#include "olmenu.hrc" +#include "olmenu.hxx" +#include "svtools/langtab.hxx" +#include "svtools/stritem.hxx" +#include "svx/brshitem.hxx" +#include "swabstdlg.hxx" +#include "swmodule.hxx" +#include "swtypes.hxx" +#include "swundo.hxx" +#include "uitool.hxx" +#include "undobj.hxx" +#include "unomid.h" +#include "view.hxx" +#include "viewopt.hxx" +#include "wrtsh.hxx" +#include "wview.hxx" -#include +#include using namespace ::com::sun::star; using ::rtl::OUString; @@ -218,63 +207,59 @@ inline bool lcl_checkScriptType( sal_Int16 nScriptType, LanguageType nLang ) return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )); } -USHORT SwSpellPopup::fillLangPopupMenu( +void SwSpellPopup::fillLangPopupMenu( PopupMenu *pPopupMenu, - USHORT Lang_Start, - uno::Sequence< ::rtl::OUString > aSeq, + USHORT nLangItemIdStart, + uno::Sequence< OUString > aSeq, SwWrtShell* pWrtSh, - USHORT nLangTable ) + std::map< sal_Int16, ::rtl::OUString > &rLangTable ) { if (!pPopupMenu) - return 0; - - //Reference< awt::XMenuExtended > m_xMenuExtended( m_xPopupMenu, UNO_QUERY ); - std::map< ::rtl::OUString, ::rtl::OUString > LangItems; + return; SvtLanguageTable aLanguageTable; - USHORT nItemId = Lang_Start; - rtl::OUString curLang = aSeq[0]; - USHORT nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); - rtl::OUString keyboardLang = aSeq[2]; - rtl::OUString guessLang = aSeq[3]; - - //1--add current language - if(curLang!=OUString::createFromAscii("")) - { - LangItems[curLang]=curLang; - } - SvtLanguageTable aLangTable; + // set of languages to be displayed in the sub menus + std::set< OUString > aLangItems; + + OUString aCurLang( aSeq[0] ); + USHORT nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); + OUString aKeyboardLang( aSeq[2] ); + OUString aGuessedTextLang( aSeq[3] ); + + if (aCurLang != OUString() && + LANGUAGE_DONTKNOW != aLanguageTable.GetType( aCurLang )) + aLangItems.insert( aCurLang ); + //2--System - const AllSettings& rAllSettings=Application::GetSettings(); + const AllSettings& rAllSettings = Application::GetSettings(); LanguageType rSystemLanguage = rAllSettings.GetLanguage(); - if(rSystemLanguage!=LANGUAGE_DONTKNOW) + if (rSystemLanguage != LANGUAGE_DONTKNOW) { - if (lcl_checkScriptType(nScriptType,rSystemLanguage )) - LangItems[OUString(aLangTable.GetString(rSystemLanguage))]=OUString(aLangTable.GetString(rSystemLanguage)); + if (lcl_checkScriptType( nScriptType, rSystemLanguage )) + aLangItems.insert( aLanguageTable.GetString(rSystemLanguage) ); } //3--UI LanguageType rUILanguage = rAllSettings.GetUILanguage(); - if(rUILanguage!=LANGUAGE_DONTKNOW) + if (rUILanguage != LANGUAGE_DONTKNOW) { if (lcl_checkScriptType(nScriptType, rUILanguage )) - LangItems[OUString(aLangTable.GetString(rUILanguage))]=OUString(aLangTable.GetString(rUILanguage)); + aLangItems.insert( aLanguageTable.GetString(rUILanguage) ); } //4--guessed language - if(guessLang!=OUString::createFromAscii("")) + if (aGuessedTextLang.getLength() > 0) { - if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(guessLang))) - LangItems[guessLang]=guessLang; + if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aGuessedTextLang))) + aLangItems.insert( aGuessedTextLang ); } - //5--keyboard language - if(keyboardLang!=OUString::createFromAscii("")) + if (aKeyboardLang.getLength() > 0) { - if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(keyboardLang))) - LangItems[keyboardLang]=keyboardLang; + if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aKeyboardLang))) + aLangItems.insert( aKeyboardLang ); } //6--all languages used in current document @@ -282,68 +267,57 @@ USHORT SwSpellPopup::fillLangPopupMenu( uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface()->getController(), uno::UNO_QUERY ); if ( xController.is() ) xModel = xController->getModel(); - uno::Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, uno::UNO_QUERY ); - /*the description of nScriptType - LATIN : 1 - ASIAN : 2 - COMPLEX:4 - LATIN + ASIAN : 3 - LATIN + COMPLEX : 5 - ASIAN + COMPLEX : 6 - LATIN + ASIAN + COMPLEX : 7 + /*the description of nScriptType flags + LATIN : 0x0001 + ASIAN : 0x0002 + COMPLEX: 0x0004 */ - - sal_Int16 nCount=7; - if(xDocumentLanguages.is()) + const sal_Int16 nMaxCount = 7; + if (xDocumentLanguages.is()) { - uno::Sequence< lang::Locale > rLocales(xDocumentLanguages->getDocumentLanguages(nScriptType,nCount)); - if(rLocales.getLength()>0) + uno::Sequence< lang::Locale > rLocales( xDocumentLanguages->getDocumentLanguages( nScriptType, nMaxCount ) ); + if (rLocales.getLength() > 0) { - for(USHORT i = 0; i::const_iterator it = LangItems.begin(); it != LangItems.end(); ++it) + + USHORT nItemId = nLangItemIdStart; + const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection + const OUString sEmpty; // 'no language found' from language guessing + std::set< OUString >::const_iterator it; + for (it = aLangItems.begin(); it != aLangItems.end(); ++it) { - rtl::OUString aEntryTxt( it->first ); - if (aEntryTxt != rtl::OUString( aLangTable.GetString( LANGUAGE_NONE ) )&& - aEntryTxt != rtl::OUString::createFromAscii("*") && - aEntryTxt.getLength() > 0) + OUString aEntryTxt( *it ); + if (aEntryTxt != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& + aEntryTxt != sAsterix && + aEntryTxt != sEmpty) { - ++nItemId; - if (nLangTable == 0) // language for selection - aLangTable_Text[nItemId] = aEntryTxt; - else if (nLangTable == 1) // language for paragraph - aLangTable_Paragraph[nItemId] = aEntryTxt; - else if (nLangTable == 2) // language for document - aLangTable_Document[nItemId] = aEntryTxt; - + DBG_ASSERT( nLangItemIdStart <= nItemId && nItemId <= nLangItemIdStart + MN_MAX_NUM_LANG, + "nItemId outside of expected range!" ); pPopupMenu->InsertItem( nItemId, aEntryTxt, MIB_RADIOCHECK ); - if (aEntryTxt == curLang) + if (aEntryTxt == aCurLang) { //make a check mark for the current language pPopupMenu->CheckItem( nItemId, TRUE ); } + rLangTable[ nItemId ] = aEntryTxt; + ++nItemId; } } - //7--none - nItemId++; - pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_NONE )), MIB_RADIOCHECK ); - - //More... - nItemId++; - pPopupMenu->InsertItem( nItemId, String(SW_RES( STR_LANGSTATUS_MORE )), MIB_RADIOCHECK ); - - return nItemId - Lang_Start; // return number of inserted entries + pPopupMenu->InsertItem( nLangItemIdStart + MN_NONE_OFFSET, String(SW_RES( STR_LANGSTATUS_NONE )), MIB_RADIOCHECK ); + pPopupMenu->InsertItem( nLangItemIdStart + MN_RESET_OFFSET, String(SW_RES( STR_RESET_TO_DEFAULT_LANGUAGE )), MIB_RADIOCHECK ); + pPopupMenu->InsertItem( nLangItemIdStart + MN_MORE_OFFSET, String(SW_RES( STR_LANGSTATUS_MORE )), MIB_RADIOCHECK ); } @@ -366,22 +340,22 @@ static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) } -::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) +OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) { - ::rtl::OUString aLabel; + OUString aLabel; if ( aCmdURL.getLength() ) { try { - uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); + uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); if ( xNameAccess.is() ) { uno::Reference< container::XNameAccess > xUICommandLabels; - const ::rtl::OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ); + const OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ); uno::Any a = xNameAccess->getByName( aModule ); uno::Reference< container::XNameAccess > xUICommands; a >>= xUICommandLabels; - rtl::OUString aStr; + OUString aStr; uno::Sequence< beans::PropertyValue > aPropSeq; a = xUICommandLabels->getByName( aCmdURL ); if ( a >>= aPropSeq ) @@ -446,25 +420,28 @@ bGrammarResults(false) InsertSeparator(0); bEnable = sal_True; - for( sal_uInt16 i = 0, nPos = 1, nId = MN_AUTOCORR_START + 1; - i < nStringCount; ++i, ++nPos, ++nId ) + USHORT nAutoCorrItemId = MN_AUTOCORR_START; + USHORT nItemId = MN_SUGGESTION_START; + for (USHORT i = 0; i < nStringCount; ++i) { const String aEntry = aSuggestions[ i ]; - InsertItem( nPos, aEntry, 0, i ); - SetHelpId( nPos, HID_LINGU_REPLACE); - + InsertItem( nItemId, aEntry, 0, i ); + SetHelpId( nItemId, HID_LINGU_REPLACE); if (aSuggestionImageUrl.getLength() > 0) - SetItemImage( nPos, aImage ); + SetItemImage( nItemId, aImage ); + + pMenu->InsertItem( nAutoCorrItemId, aEntry ); + pMenu->SetHelpId( nAutoCorrItemId, HID_LINGU_AUTOCORR); - pMenu->InsertItem( nId, aEntry ); - pMenu->SetHelpId( nPos, HID_LINGU_AUTOCORR); + ++nAutoCorrItemId; + ++nItemId; } } OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) ); OUString aSpellingAndGrammar = RetrieveLabelFromCommand( C2U(".uno:SpellingAndGrammarDialog") ); - SetItemText( MN_SPELLING, aSpellingAndGrammar ); - USHORT nItemPos = GetItemPos( MN_IGNORE ); + SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar ); + USHORT nItemPos = GetItemPos( MN_IGNORE_WORD ); InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); @@ -487,11 +464,9 @@ bGrammarResults(false) nGuessLangPara = nGuessLangWord; } - pMenu = GetPopupMenu(MN_INSERT); - - bEnable = FALSE; // enable MN_INSERT? - + pMenu = GetPopupMenu(MN_ADD_TO_DIC); pMenu->CreateAutoMnemonics(); + bEnable = FALSE; // enable MN_ADD_TO_DIC? uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() ); if (xDicList.is()) { @@ -506,6 +481,7 @@ bGrammarResults(false) const uno::Reference< linguistic2::XDictionary > *pDic = aDics.getConstArray(); USHORT nDicCount = static_cast< USHORT >(aDics.getLength()); + USHORT nItemId = MN_DICTIONARIES_START; for( USHORT i = 0; i < nDicCount; i++ ) { uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); @@ -521,8 +497,7 @@ bGrammarResults(false) { // the extra 1 is because of the (possible) external // linguistic entry above - USHORT nPos = MN_INSERT_START + i + 1; - pMenu->InsertItem( nPos, xDicTmp->getName() ); + pMenu->InsertItem( nItemId, xDicTmp->getName() ); bEnable = sal_True; uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY ); @@ -533,18 +508,20 @@ bGrammarResults(false) if (aDictionaryImageUrl.getLength() > 0) { Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); - pMenu->SetItemImage( nPos, aImage ); + pMenu->SetItemImage( nItemId, aImage ); } } + + ++nItemId; } } } - EnableItem( MN_INSERT, bEnable ); + EnableItem( MN_ADD_TO_DIC, bEnable ); //ADD NEW LANGUAGE MENU ITEM /////////////////////////////////////////////////////////////////////////// String aScriptTypesInUse( String::CreateFromInt32( pWrtSh->GetScriptType() ) ); - SvtLanguageTable aLangTable; + SvtLanguageTable aLanguageTable; // get keyboard language String aKeyboardLang; @@ -552,39 +529,40 @@ bGrammarResults(false) SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); nLang = rEditWin.GetInputLanguage(); if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) - aKeyboardLang = aLangTable.GetString( nLang ); + aKeyboardLang = aLanguageTable.GetString( nLang ); // get the language that is in use const String aMultipleLanguages = String::CreateFromAscii("*"); String aCurrentLang = aMultipleLanguages; nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh ); if (nLang != LANGUAGE_DONTKNOW) - aCurrentLang = aLangTable.GetString( nLang ); + aCurrentLang = aLanguageTable.GetString( nLang ); // build sequence for status value - uno::Sequence< ::rtl::OUString > aSeq( 4 ); + uno::Sequence< OUString > aSeq( 4 ); aSeq[0] = aCurrentLang; aSeq[1] = aScriptTypesInUse; aSeq[2] = aKeyboardLang; - aSeq[3] = aLangTable.GetString(nGuessLangWord); + aSeq[3] = aLanguageTable.GetString(nGuessLangWord); - pMenu = GetPopupMenu(MN_LANGUAGE_SELECTION); - nNumLanguageTextEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_SELECTION_START, aSeq, pWrtSh, 0 ); - EnableItem( MN_LANGUAGE_SELECTION, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_SELECTION); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_SELECTION_START, aSeq, pWrtSh, aLangTable_Text ); + EnableItem( MN_SET_LANGUAGE_SELECTION, true ); - pMenu = GetPopupMenu(MN_LANGUAGE_PARAGRAPH); - nNumLanguageParaEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, 1 ); - EnableItem( MN_LANGUAGE_PARAGRAPH, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_PARAGRAPH); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, aLangTable_Paragraph ); + EnableItem( MN_SET_LANGUAGE_PARAGRAPH, true ); /* - pMenu = GetPopupMenu(MN_LANGUAGE_ALL_TEXT); - nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); - EnableItem( MN_LANGUAGE_ALL_TEXT, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_ALL_TEXT); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, aLangTable_Document ); + EnableItem( MN_SET_LANGUAGE_ALL_TEXT, true ); */ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); Image rImg = ::GetImage( xFrame, - ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, + OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark() ); - SetItemImage( MN_SPELLING, rImg ); + SetItemImage( MN_SPELLING_DLG, rImg ); + ////////////////////////////////////////////////////////////////////////////////// RemoveDisabledEntries( TRUE, TRUE ); @@ -599,7 +577,7 @@ SwSpellPopup::SwSpellPopup( SwWrtShell *pWrtSh, const linguistic2::ProofreadingResult &rResult, sal_Int32 nErrorInResult, - const uno::Sequence< rtl::OUString > &rSuggestions, + const uno::Sequence< OUString > &rSuggestions, const String &rParaText ) : PopupMenu( SW_RES(MN_SPELL_POPUP) ), pSh( pWrtSh ), @@ -609,13 +587,11 @@ aInfo16( SW_RES(IMG_INFO_16) ) { nCheckedLanguage = SvxLocaleToLanguage( rResult.aLocale ); - sal_Int16 nItemId = 1; - sal_Int16 nPos = 0; + USHORT nPos = 0; OUString aMessageText( rResult.aErrors[ nErrorInResult ].aShortComment ); InsertSeparator( nPos++ ); - InsertItem( nItemId, aMessageText, MIB_NOSELECT, nPos++ ); - SetItemImage( nItemId, aInfo16 ); - ++nItemId; + InsertItem( MN_SHORT_COMMENT, aMessageText, MIB_NOSELECT, nPos++ ); + SetItemImage( MN_SHORT_COMMENT, aInfo16 ); CreateAutoMnemonics(); @@ -632,12 +608,12 @@ aInfo16( SW_RES(IMG_INFO_16) ) aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) ); } + USHORT nItemId = MN_SUGGESTION_START; for (sal_uInt16 i = 0; i < nStringCount; ++i) { const String aEntry = aSuggestions[ i ]; InsertItem( nItemId, aEntry, 0, nPos++ ); SetHelpId( nItemId, HID_LINGU_REPLACE ); - if (aSuggestionImageUrl.getLength() > 0) SetItemImage( nItemId, aImage ); @@ -648,8 +624,8 @@ aInfo16( SW_RES(IMG_INFO_16) ) OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) ); OUString aSpellingAndGrammar = RetrieveLabelFromCommand( C2U(".uno:SpellingAndGrammarDialog") ); - SetItemText( MN_SPELLING, aSpellingAndGrammar ); - USHORT nItemPos = GetItemPos( MN_IGNORE ); + SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar ); + USHORT nItemPos = GetItemPos( MN_IGNORE_WORD ); InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); @@ -672,13 +648,13 @@ aInfo16( SW_RES(IMG_INFO_16) ) nGuessLangPara = nGuessLangWord; } - EnableItem( MN_IGNORE, false ); - EnableItem( MN_INSERT, false ); + EnableItem( MN_IGNORE_WORD, false ); + EnableItem( MN_ADD_TO_DIC, false ); //ADD NEW LANGUAGE MENU ITEM /////////////////////////////////////////////////////////////////////////// String aScriptTypesInUse( String::CreateFromInt32( pWrtSh->GetScriptType() ) ); - SvtLanguageTable aLangTable; + SvtLanguageTable aLanguageTable; // get keyboard language String aKeyboardLang; @@ -686,39 +662,39 @@ aInfo16( SW_RES(IMG_INFO_16) ) SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); nLang = rEditWin.GetInputLanguage(); if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) - aKeyboardLang = aLangTable.GetString( nLang ); + aKeyboardLang = aLanguageTable.GetString( nLang ); // get the language that is in use const String aMultipleLanguages = String::CreateFromAscii("*"); String aCurrentLang = aMultipleLanguages; nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh ); if (nLang != LANGUAGE_DONTKNOW) - aCurrentLang = aLangTable.GetString( nLang ); + aCurrentLang = aLanguageTable.GetString( nLang ); // build sequence for status value - uno::Sequence< ::rtl::OUString > aSeq( 4 ); + uno::Sequence< OUString > aSeq( 4 ); aSeq[0] = aCurrentLang; aSeq[1] = aScriptTypesInUse; aSeq[2] = aKeyboardLang; - aSeq[3] = aLangTable.GetString(nGuessLangWord); + aSeq[3] = aLanguageTable.GetString(nGuessLangWord); - PopupMenu *pMenu = GetPopupMenu(MN_LANGUAGE_SELECTION); - nNumLanguageTextEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_SELECTION_START, aSeq, pWrtSh, 0 ); - EnableItem( MN_LANGUAGE_SELECTION, true ); + PopupMenu *pMenu = GetPopupMenu(MN_SET_LANGUAGE_SELECTION); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_SELECTION_START, aSeq, pWrtSh, aLangTable_Text ); + EnableItem( MN_SET_LANGUAGE_SELECTION, true ); - pMenu = GetPopupMenu(MN_LANGUAGE_PARAGRAPH); - nNumLanguageParaEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, 1 ); - EnableItem( MN_LANGUAGE_PARAGRAPH, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_PARAGRAPH); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, aLangTable_Paragraph ); + EnableItem( MN_SET_LANGUAGE_PARAGRAPH, true ); /* - pMenu = GetPopupMenu(MN_LANGUAGE_ALL_TEXT); - nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); - EnableItem( MN_LANGUAGE_ALL_TEXT, true ); + pMenu = GetPopupMenu(MN_SET_LANGUAGE_ALL_TEXT); + fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, aLangTable_Document ); + EnableItem( MN_SET_LANGUAGE_ALL_TEXT, true ); */ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); Image rImg = ::GetImage( xFrame, - ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, + OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark() ); - SetItemImage( MN_SPELLING, rImg ); + SetItemImage( MN_SPELLING_DLG, rImg ); ////////////////////////////////////////////////////////////////////////////////// @@ -741,25 +717,23 @@ sal_uInt16 SwSpellPopup::Execute( const Rectangle& rWordPos, Window* pWin ) -----------------------------------------------------------------------*/ void SwSpellPopup::Execute( USHORT nId ) { - if (bGrammarResults && nId == 1) - return; // nothing to do since it is the error message (short comment) + if (nId == USHRT_MAX) + return; - sal_Bool bAutoCorr = sal_False; - if( nId > MN_AUTOCORR_START && nId < MN_LANGUAGE_SELECTION_START && nId != USHRT_MAX ) - { - nId -= MN_AUTOCORR_START; - bAutoCorr = sal_True; - } + if (/*bGrammarResults && */nId == MN_SHORT_COMMENT) + return; // nothing to do since it is the error message (short comment) - if( nId && nId != USHRT_MAX) + if ((MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) || + (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END)) { - int nAltIdx = bGrammarResults ? nId - 2 : nId - 1; - if ( nAltIdx >= 0 && nAltIdx < aSuggestions.getLength() && (bGrammarResults || xSpellAlt.is()) ) + USHORT nAltIdx = (MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ? + nId - MN_SUGGESTION_START : nId - MN_AUTOCORR_START; + DBG_ASSERT( 0 <= nAltIdx && nAltIdx < aSuggestions.getLength(), "index out of range" ); + if (0 <= nAltIdx && nAltIdx < aSuggestions.getLength() && (bGrammarResults || xSpellAlt.is())) { sal_Bool bOldIns = pSh->IsInsMode(); pSh->SetInsMode( sal_True ); - DBG_ASSERT( 0 <= nAltIdx && nAltIdx <= aSuggestions.getLength(), "index out of range"); String aTmp( aSuggestions[ nAltIdx ] ); String aOrig( bGrammarResults ? OUString() : xSpellAlt->getWord() ); @@ -778,40 +752,30 @@ void SwSpellPopup::Execute( USHORT nId ) aRewriter.AddRule(UNDO_ARG1, pSh->GetCrsrDescr()); aRewriter.AddRule(UNDO_ARG2, String(SW_RES(STR_YIELDS))); - { - String aTmpStr; - - aTmpStr += String(SW_RES(STR_START_QUOTE)); - aTmpStr += aTmp; - aTmpStr += String(SW_RES(STR_END_QUOTE)); - aRewriter.AddRule(UNDO_ARG3, aTmpStr); - } + String aTmpStr( SW_RES(STR_START_QUOTE) ); + aTmpStr += aTmp; + aTmpStr += String(SW_RES(STR_END_QUOTE)); + aRewriter.AddRule(UNDO_ARG3, aTmpStr); pSh->StartUndo(UNDO_UI_REPLACE, &aRewriter); pSh->StartAction(); pSh->DelLeft(); pSh->Insert( aTmp ); + /* #102505# EndAction/EndUndo moved down since insertion of temporary auto correction is now undoable two and must reside in the same undo group.*/ - // nur aufnehmen, wenn es NICHT schon in der Autokorrektur vorhanden ist SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect(); String aOrigWord( bGrammarResults ? OUString() : xSpellAlt->getWord() ) ; - String aNewWord; - if( nId ) - aNewWord = aSuggestions[ nAltIdx ]; - else - aNewWord = aOrigWord; + String aNewWord( aSuggestions[ nAltIdx ] ); SvxPrepareAutoCorrect( aOrigWord, aNewWord ); - if( bAutoCorr ) - { + if (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END) pACorr->PutText( aOrigWord, aNewWord, nCheckedLanguage ); - } /* #102505# EndAction/EndUndo moved down since insertion of temporary auto correction is now undoable two and @@ -821,180 +785,140 @@ void SwSpellPopup::Execute( USHORT nId ) pSh->SetInsMode( bOldIns ); } - else + } + else if (nId == MN_SPELLING_DLG) + { + if (bGrammarResults) + { + SvtLinguConfig().SetProperty( A2OU( UPN_IS_GRAMMAR_INTERACTIVE ), uno::makeAny( sal_True )); + } + pSh->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE ); { - if (nId < MN_LANGUAGE_SELECTION_START) + uno::Reference xDictionaryList( SvxGetDictionaryList() ); + SvxDicListChgClamp aClamp( xDictionaryList ); + pSh->GetView().GetViewFrame()->GetDispatcher()-> + Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON ); + } + } + else if (nId == MN_IGNORE_SELECTION) + { + SwPaM *pPaM = pSh->GetCrsr(); + if (pPaM) + pSh->IgnoreGrammarErrorAt( *pPaM ); + } + else if (nId == MN_IGNORE_WORD) + { + uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY ); + linguistic::AddEntryToDic( xDictionary, + xSpellAlt->getWord(), sal_False, aEmptyStr, LANGUAGE_NONE ); + } + else if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) + { + OUString aWord( xSpellAlt->getWord() ); + USHORT nDicIdx = nId - MN_DICTIONARIES_START; + DBG_ASSERT( nDicIdx < aDics.getLength(), "dictionary index out of range" ); + + if (nDicIdx < aDics.getLength()) { - switch( nId ) + uno::Reference< linguistic2::XDictionary > xDic = aDics.getConstArray()[nDicIdx]; + INT16 nAddRes = linguistic::AddEntryToDic( xDic, aWord, FALSE, aEmptyStr, LANGUAGE_NONE ); + // save modified user-dictionary if it is persistent + uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); + if (xSavDic.is()) + xSavDic->store(); + + if (DIC_ERR_NONE != nAddRes + && !xDic->getEntry( aWord ).is()) { - case MN_SPELLING: - { - if (bGrammarResults) - { - SvtLinguConfig().SetProperty( A2OU( UPN_IS_GRAMMAR_INTERACTIVE ), uno::makeAny( sal_True )); - } - pSh->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE ); - { - uno::Reference xDictionaryList( SvxGetDictionaryList() ); - SvxDicListChgClamp aClamp( xDictionaryList ); - pSh->GetView().GetViewFrame()->GetDispatcher()-> - Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON ); - } - } - break; - case MN_IGNORE_SELECTION : - { - SwPaM *pPaM = pSh->GetCrsr(); - if (pPaM) - pSh->IgnoreGrammarErrorAt( *pPaM ); - } - break; - case MN_IGNORE : - { - uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY ); - linguistic::AddEntryToDic( - xDictionary, - xSpellAlt->getWord(), sal_False, - aEmptyStr, LANGUAGE_NONE ); - } - break; - case MN_INSERT: - DBG_ERROR("geht noch nicht!"); - break; - case MN_LANGUAGE_WORD: - case MN_LANGUAGE_PARA: - { - pSh->StartAction(); - - if( MN_LANGUAGE_PARA == nId ) - { - if( !pSh->IsSttPara() ) - pSh->MovePara( fnParaCurr, fnParaStart ); - pSh->SwapPam(); - if( !pSh->IsEndPara() ) - pSh->MovePara( fnParaCurr, fnParaEnd ); - } - - LanguageType nLangToUse = (MN_LANGUAGE_PARA == nId) ? nGuessLangPara : nGuessLangWord; - sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse ); - USHORT nResId = 0; - switch (nScriptType) - { - case SCRIPTTYPE_COMPLEX : nResId = RES_CHRATR_CTL_LANGUAGE; break; - case SCRIPTTYPE_ASIAN : nResId = RES_CHRATR_CJK_LANGUAGE; break; - default /*SCRIPTTYPE_LATIN*/: nResId = RES_CHRATR_LANGUAGE; break; - } - SfxItemSet aSet(pSh->GetAttrPool(), nResId, nResId ); - aSet.Put( SvxLanguageItem( nLangToUse, nResId ) ); - pSh->SetAttr( aSet ); - - pSh->EndAction(); - } - break; - default: - if(nId >= MN_INSERT_START ) - { - OUString aWord( xSpellAlt->getWord() ); - INT32 nDicIdx = nId - MN_INSERT_START - 1; - DBG_ASSERT( nDicIdx < aDics.getLength(), - "dictionary index out of range" ); - uno::Reference< linguistic2::XDictionary > xDic = - aDics.getConstArray()[nDicIdx]; - INT16 nAddRes = linguistic::AddEntryToDic( xDic, - aWord, FALSE, aEmptyStr, LANGUAGE_NONE ); - // save modified user-dictionary if it is persistent - uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY ); - if (xSavDic.is()) - xSavDic->store(); - - if (DIC_ERR_NONE != nAddRes - && !xDic->getEntry( aWord ).is()) - { - SvxDicError( - &pSh->GetView().GetViewFrame()->GetWindow(), - nAddRes ); - } - } + SvxDicError( + &pSh->GetView().GetViewFrame()->GetWindow(), + nAddRes ); } } - else - { - SfxItemSet aCoreSet( pSh->GetView().GetPool(), - RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, - RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, - RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, - 0 ); - String aNewLangTxt; + } + else + { + // Set language for selection or for paragraph... -// pSh->StartAction(); + SfxItemSet aCoreSet( pSh->GetView().GetPool(), + RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, + RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, + RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE, + 0 ); + String aNewLangTxt; - if (nId >= MN_LANGUAGE_SELECTION_START && nId < MN_LANGUAGE_SELECTION_START + nNumLanguageTextEntries - 1) - { - //Set language for current selection - aNewLangTxt=aLangTable_Text[nId]; - SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); - } - else if (nId == MN_LANGUAGE_SELECTION_START + nNumLanguageTextEntries - 1) - { - //Set Language_None for current selection - SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); - } - else if (nId == MN_LANGUAGE_SELECTION_START + nNumLanguageTextEntries) - { - //Open Format/Character Dialog - lcl_CharDialog( *pSh, true, nId, 0, 0 ); - } - else if (nId >= MN_LANGUAGE_PARAGRAPH_START && nId < MN_LANGUAGE_PARAGRAPH_START + nNumLanguageParaEntries - 1) - { - //Set language for current paragraph - aNewLangTxt=aLangTable_Paragraph[nId]; - pSh->Push(); // save cursor - SwLangHelper::SelectCurrentPara( *pSh ); - SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); - pSh->Pop( FALSE ); // restore cursor - } - else if (nId == MN_LANGUAGE_PARAGRAPH_START + nNumLanguageParaEntries - 1) - { - //Set Language_None for current paragraph - pSh->Push(); // save cursor - SwLangHelper::SelectCurrentPara( *pSh ); - SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); - pSh->Pop( FALSE ); // restore cursor - } - else if (nId == MN_LANGUAGE_PARAGRAPH_START + nNumLanguageParaEntries) - { - pSh->Push(); // save cursor - SwLangHelper::SelectCurrentPara( *pSh ); - //Open Format/Character Dialog - lcl_CharDialog( *pSh, true, nId, 0, 0 ); - pSh->Pop( FALSE ); // restore cursor - } - else if (nId >= MN_LANGUAGE_ALL_TEXT_START && nId < MN_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1) - { - //Set selected language as the default language - aNewLangTxt=aLangTable_Document[nId]; - SwLangHelper::SetLanguage( *pSh, aNewLangTxt, false, aCoreSet ); - } - else if (nId == MN_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1) - { - //Set Language_None as the default language - SwLangHelper::SetLanguage_None( *pSh, false, aCoreSet ); - } - else if (nId == MN_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries) - { - // open the dialog "Tools/Options/Language Settings - Language" - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact) - { - VclAbstractDialog* pDlg = pFact->CreateVclDialog( pSh->GetView().GetWindow(), SID_LANGUAGE_OPTIONS ); - pDlg->Execute(); - delete pDlg; - } - } - -// pSh->EndAction(); + if (MN_SET_LANGUAGE_SELECTION_START <= nId && nId <= MN_SET_LANGUAGE_SELECTION_END) + { + //Set language for current selection + aNewLangTxt = aLangTable_Text[nId]; + SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); + } + else if (nId == MN_SET_SELECTION_NONE) + { + //Set Language_None for current selection + SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); + } + else if (nId == MN_SET_SELECTION_RESET) + { + //reset languages for current selection + SwLangHelper::ResetLanguages( *pSh, true ); + } + else if (nId == MN_SET_SELECTION_MORE) + { + //Open Format/Character Dialog + lcl_CharDialog( *pSh, true, nId, 0, 0 ); + } + else if (MN_SET_LANGUAGE_PARAGRAPH_START <= nId && nId <= MN_SET_LANGUAGE_PARAGRAPH_END) + { + //Set language for current paragraph + aNewLangTxt = aLangTable_Paragraph[nId]; + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet ); + pSh->Pop( FALSE ); // restore cursor + } + else if (nId == MN_SET_PARA_NONE) + { + //Set Language_None for current paragraph + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet ); + pSh->Pop( FALSE ); // restore cursor + } + else if (nId == MN_SET_PARA_RESET) + { + //reset languages for current paragraph + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + SwLangHelper::ResetLanguages( *pSh, true ); + pSh->Pop( FALSE ); // restore cursor + } + else if (nId == MN_SET_PARA_MORE) + { + pSh->Push(); // save cursor + SwLangHelper::SelectCurrentPara( *pSh ); + //Open Format/Character Dialog + lcl_CharDialog( *pSh, true, nId, 0, 0 ); + pSh->Pop( FALSE ); // restore cursor + } +#if 0 + else if (nId == MN_SET_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1) + { + //Set Language_None as the default language + SwLangHelper::SetLanguage_None( *pSh, false, aCoreSet ); + } + else if (nId == MN_SET_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries) + { + // open the dialog "Tools/Options/Language Settings - Language" + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + if (pFact) + { + VclAbstractDialog* pDlg = pFact->CreateVclDialog( pSh->GetView().GetWindow(), SID_LANGUAGE_OPTIONS ); + pDlg->Execute(); + delete pDlg; } } +#endif } pSh->EnterStdMode(); diff --git a/sw/source/ui/lingu/olmenu.hrc b/sw/source/ui/lingu/olmenu.hrc index 4e13b83bf10a..e69d51fbc98b 100644 --- a/sw/source/ui/lingu/olmenu.hrc +++ b/sw/source/ui/lingu/olmenu.hrc @@ -33,35 +33,65 @@ #include "rcid.hrc" -#define MN_SPELL_POPUP (RC_LINGU_BEGIN + 1) -#define STR_SPELL_OK (RC_LINGU_BEGIN + 2) -#define STR_HYP_OK (RC_LINGU_BEGIN + 3) -#define STR_WORD (RC_LINGU_BEGIN + 4) -#define STR_PARAGRAPH (RC_LINGU_BEGIN + 5) -#define STR_LANGSTATUS_NONE (RC_LINGU_BEGIN + 6) -#define STR_LANGSTATUS_MORE (RC_LINGU_BEGIN + 7) -#define STR_IGNORE_SELECTION (RC_LINGU_BEGIN + 8) +#define MN_SPELL_POPUP (RC_LINGU_BEGIN + 1) +#define STR_SPELL_OK (RC_LINGU_BEGIN + 2) +#define STR_HYP_OK (RC_LINGU_BEGIN + 3) +#define STR_WORD (RC_LINGU_BEGIN + 4) +#define STR_PARAGRAPH (RC_LINGU_BEGIN + 5) +#define STR_LANGSTATUS_NONE (RC_LINGU_BEGIN + 6) +#define STR_LANGSTATUS_MORE (RC_LINGU_BEGIN + 7) +#define STR_IGNORE_SELECTION (RC_LINGU_BEGIN + 8) +#define STR_RESET_TO_DEFAULT_LANGUAGE (RC_LINGU_BEGIN + 9) -#define IMG_INFO_16 (RC_LINGU_BEGIN + 8) +#define IMG_INFO_16 (RC_LINGU_BEGIN + 100) //! Don't change these values. You may break context menu modifying extensions! -#define MN_SPELLING 100 -#define MN_IGNORE_SELECTION 101 -#define MN_IGNORE 102 -#define MN_INSERT 103 -#define MN_AUTOCORR 104 -#define MN_LANGUAGE_WORD 105 -#define MN_LANGUAGE_PARA 106 -#define MN_LANGUAGE_SELECTION 107 -#define MN_LANGUAGE_PARAGRAPH 108 -#define MN_LANGUAGE_ALL_TEXT 109 - -#define MN_INSERT_START 500 -#define MN_AUTOCORR_START 900 - -#define MN_LANGUAGE_SELECTION_START 1170 -#define MN_LANGUAGE_PARAGRAPH_START 1270 -#define MN_LANGUAGE_ALL_TEXT_START 1370 +#define MN_SPELLING_DLG 200 +#define MN_IGNORE_SELECTION 201 +#define MN_IGNORE_WORD 202 +#define MN_ADD_TO_DIC 203 +#define MN_AUTOCORR 204 +#define MN_SET_LANGUAGE_SELECTION 205 +#define MN_SET_LANGUAGE_PARAGRAPH 206 +#define MN_SET_LANGUAGE_ALL_TEXT 207 +#define MN_SHORT_COMMENT 208 + +// id range for dictionaries sub menu +#define MN_DICTIONARIES_START 300 +#define MN_DICTIONARIES_END (MN_DICTIONARIES_START + 99) + +// id range for suggestions from spell and grammar checker +#define MN_SUGGESTION_START 500 +#define MN_SUGGESTION_END (MN_SUGGESTION_START + MN_MAX_NUM_LANG) + +// id range for auto correction sub menu entries +#define MN_AUTOCORR_START 700 +#define MN_AUTOCORR_END (MN_AUTOCORR_START + MN_MAX_NUM_LANG) + +// max number of language entries sub menus +#define MN_MAX_NUM_LANG 99 + +#define MN_NONE_OFFSET (MN_MAX_NUM_LANG + 1) +#define MN_RESET_OFFSET (MN_MAX_NUM_LANG + 2) +#define MN_MORE_OFFSET (MN_MAX_NUM_LANG + 3) + +// id range for 'set language for selection' sub menu entries +#define MN_SET_LANGUAGE_SELECTION_START 900 +#define MN_SET_LANGUAGE_SELECTION_END (MN_SET_LANGUAGE_SELECTION_START + MN_MAX_NUM_LANG) +#define MN_SET_SELECTION_NONE (MN_SET_LANGUAGE_SELECTION_START + MN_NONE_OFFSET) +#define MN_SET_SELECTION_RESET (MN_SET_LANGUAGE_SELECTION_START + MN_RESET_OFFSET) +#define MN_SET_SELECTION_MORE (MN_SET_LANGUAGE_SELECTION_START + MN_MORE_OFFSET) + +// id range for 'set language for paragraph' sub menu entries +#define MN_SET_LANGUAGE_PARAGRAPH_START 1100 +#define MN_SET_LANGUAGE_PARAGRAPH_END (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MAX_NUM_LANG) +#define MN_SET_PARA_NONE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_NONE_OFFSET) +#define MN_SET_PARA_RESET (MN_SET_LANGUAGE_PARAGRAPH_START + MN_RESET_OFFSET) +#define MN_SET_PARA_MORE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MORE_OFFSET) + +// id range for 'set language for all text' sub menu entries +#define MN_SET_LANGUAGE_ALL_TEXT_START 1300 +#define MN_SET_LANGUAGE_ALL_TEXT_END (MN_SET_LANGUAGE_ALL_TEXT_START + MN_MAX_NUM_LANG) #endif diff --git a/sw/source/ui/lingu/olmenu.src b/sw/source/ui/lingu/olmenu.src index 82175a74bc23..0a07b41d64ed 100644 --- a/sw/source/ui/lingu/olmenu.src +++ b/sw/source/ui/lingu/olmenu.src @@ -41,13 +41,13 @@ Menu MN_SPELL_POPUP { MenuItem { - Identifier = MN_IGNORE ; + Identifier = MN_IGNORE_WORD ; HelpID = HID_LINGU_IGNORE_WORD ; Text [ en-US ] = "Ignore All" ; }; MenuItem { - Identifier = MN_INSERT ; + Identifier = MN_ADD_TO_DIC ; HelpID = HID_LINGU_ADD_WORD ; SubMenu = Menu { @@ -65,14 +65,14 @@ Menu MN_SPELL_POPUP }; MenuItem { - Identifier = MN_SPELLING ; + Identifier = MN_SPELLING_DLG ; HelpID = HID_LINGU_SPELLING_DLG ; Text [ en-US ] = "~Spellcheck..." ; }; SEPARATOR MenuItem { - Identifier = MN_LANGUAGE_SELECTION ; + Identifier = MN_SET_LANGUAGE_SELECTION ; SubMenu = Menu { }; @@ -80,7 +80,7 @@ Menu MN_SPELL_POPUP }; MenuItem { - Identifier = MN_LANGUAGE_PARAGRAPH ; + Identifier = MN_SET_LANGUAGE_PARAGRAPH ; SubMenu = Menu { }; @@ -89,7 +89,7 @@ Menu MN_SPELL_POPUP /* MenuItem { - Identifier = MN_LANGUAGE_ALL_TEXT ; + Identifier = MN_SET_LANGUAGE_ALL_TEXT ; SubMenu = Menu { }; @@ -118,6 +118,11 @@ String STR_LANGSTATUS_NONE { Text [ en-US ] = "None (Do not check spelling)" ; }; +String STR_RESET_TO_DEFAULT_LANGUAGE +{ + Text [ en-US ] = "Reset to Default Language" ; + Text [ x-comment ] = " "; +}; String STR_LANGSTATUS_MORE { Text [ en-US ] = "More..." ; diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx index e5e4dbe81b29..fb6e0e6e7594 100755 --- a/sw/source/ui/shells/langhelper.cxx +++ b/sw/source/ui/shells/langhelper.cxx @@ -69,7 +69,8 @@ using namespace ::com::sun::star; namespace SwLangHelper { - USHORT GetLanguageStatus(OutlinerView* pOLV,SfxItemSet& rSet) + + USHORT GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet ) { ESelection aSelection = pOLV->GetSelection(); EditView& rEditView=pOLV->GetEditView(); @@ -113,7 +114,7 @@ namespace SwLangHelper return 0; } - bool SetLanguageStatus(OutlinerView* pOLV,SfxRequest &rReq,SwView &rView,SwWrtShell &rSh) + bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView &rView, SwWrtShell &rSh ) { bool bRestoreSelection = false; SfxItemSet aEditAttr(pOLV->GetAttribs()); @@ -133,126 +134,132 @@ namespace SwLangHelper //!! SwTextShell got destroyed meanwhile.) SfxViewFrame *pViewFrame = rView.GetViewFrame(); - if (aNewLangTxt.EqualsAscii( "*" )) + if (aNewLangTxt.EqualsAscii( "*" )) + { + // open the dialog "Tools/Options/Language Settings - Language" + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + if (pFact) { - // open the dialog "Tools/Options/Language Settings - Language" - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - if (pFact) - { - VclAbstractDialog* pDlg = pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS ); - pDlg->Execute(); - delete pDlg; - } + VclAbstractDialog* pDlg = pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS ); + pDlg->Execute(); + delete pDlg; } - else + } + else + { + // setting the new language... + if (aNewLangTxt.Len() > 0) { - // setting the new language... - if (aNewLangTxt.Len() > 0) + const String aSelectionLangPrefix( String::CreateFromAscii("Current_") ); + const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); + const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); + const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); + const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") ); + + xub_StrLen nPos = 0; + bool bForSelection = true; + bool bForParagraph = false; + if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 ))) { - const String aSelectionLangPrefix( String::CreateFromAscii("Current_") ); - const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); - const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); - const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); - - xub_StrLen nPos = 0; - bool bForSelection = true; - bool bForParagraph = false; - if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 ))) - { - // ... for the current selection - aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() ); - bForSelection = true; - } - else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 ))) - { - // ... for the current paragraph language - aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() ); - bForSelection = true; - bForParagraph = true; - } - else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 ))) - { - // ... as default document language - aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() ); - bForSelection = false; - } + // ... for the current selection + aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() ); + bForSelection = true; + } + else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 ))) + { + // ... for the current paragraph language + aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() ); + bForSelection = true; + bForParagraph = true; + } + else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 ))) + { + // ... as default document language + aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() ); + bForSelection = false; + } - if (bForParagraph) - { - bRestoreSelection = true; - SwLangHelper::SelectPara( rEditView, aSelection ); - aSelection = pOLV->GetSelection(); - } - if (!bForSelection) // document language to be changed... - { - rSh.StartAction(); - rSh.LockView( TRUE ); - rSh.Push(); + if (bForParagraph) + { + bRestoreSelection = true; + SwLangHelper::SelectPara( rEditView, aSelection ); + aSelection = pOLV->GetSelection(); + } + if (!bForSelection) // document language to be changed... + { + rSh.StartAction(); + rSh.LockView( TRUE ); + rSh.Push(); - // prepare to apply new language to all text in document - rSh.SelAll(); - rSh.ExtendedSelectAll(); - } + // prepare to apply new language to all text in document + rSh.SelAll(); + rSh.ExtendedSelectAll(); + } + + if (aNewLangTxt == aStrNone) + SwLangHelper::SetLanguage_None( rSh, pOLV, aSelection, bForSelection, aEditAttr ); + else if (aNewLangTxt == aStrResetLangs) + SwLangHelper::ResetLanguages( rSh, pOLV, aSelection, bForSelection ); + else + SwLangHelper::SetLanguage( rSh, pOLV, aSelection, aNewLangTxt, bForSelection, aEditAttr ); - if (aNewLangTxt != aStrNone) - SwLangHelper::SetLanguage( rSh, pEditEngine, aSelection, aNewLangTxt, bForSelection, aEditAttr ); + // ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks + // when setting a new language attribute + if (bForSelection) + { + const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions(); + ULONG nCntrl = pEditEngine->GetControlWord(); + // turn off + if (!pVOpt->IsOnlineSpell()) + nCntrl &= ~EE_CNTRL_ONLINESPELLING; else - SwLangHelper::SetLanguage_None( rSh, pEditEngine, aSelection, bForSelection, aEditAttr ); + nCntrl &= ~EE_CNTRL_ONLINESPELLING; + pEditEngine->SetControlWord(nCntrl); - // ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks - // when setting a new language attribute - if (bForSelection) - { - const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions(); - ULONG nCntrl = pEditEngine->GetControlWord(); - // turn off - if (!pVOpt->IsOnlineSpell()) - nCntrl &= ~EE_CNTRL_ONLINESPELLING; - else - nCntrl &= ~EE_CNTRL_ONLINESPELLING; - pEditEngine->SetControlWord(nCntrl); - - //turn back on - if (pVOpt->IsOnlineSpell()) - nCntrl |= EE_CNTRL_ONLINESPELLING; - else - nCntrl &= ~EE_CNTRL_ONLINESPELLING; - pEditEngine->SetControlWord(nCntrl); - - pEditEngine->CompleteOnlineSpelling(); - rEditView.Invalidate(); - } + //turn back on + if (pVOpt->IsOnlineSpell()) + nCntrl |= EE_CNTRL_ONLINESPELLING; + else + nCntrl &= ~EE_CNTRL_ONLINESPELLING; + pEditEngine->SetControlWord(nCntrl); - if (!bForSelection) - { - // need to release view and restore selection... - rSh.Pop( FALSE ); - rSh.LockView( FALSE ); - rSh.EndAction(); - } + pEditEngine->CompleteOnlineSpelling(); + rEditView.Invalidate(); + } + + if (!bForSelection) + { + // need to release view and restore selection... + rSh.Pop( FALSE ); + rSh.LockView( FALSE ); + rSh.EndAction(); } } + } - // invalidate slot to get the new language displayed - pViewFrame->GetBindings().Invalidate( rReq.GetSlot() ); + // invalidate slot to get the new language displayed + pViewFrame->GetBindings().Invalidate( rReq.GetSlot() ); - rReq.Done(); - return bRestoreSelection; + rReq.Done(); + return bRestoreSelection; } - void SetLanguage(SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet) + void SetLanguage( SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ) { - SetLanguage(rWrtSh,0,ESelection(),rLangText,bIsForSelection,rCoreSet); + SetLanguage( rWrtSh, 0 , ESelection(), rLangText, bIsForSelection, rCoreSet ); } - void SetLanguage(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet) + void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet ) { const LanguageType nLang = SvtLanguageTable().GetType( rLangText ); if (nLang != LANGUAGE_DONTKNOW) { USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ); + EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL; + DBG_ASSERT( !pOLV || pEditEngine, "OutlinerView without EditEngine???" ); + //get ScriptType USHORT nLangWhichId = 0; bool bIsSingleScriptType = true; @@ -267,6 +274,9 @@ namespace SwLangHelper } if (bIsSingleScriptType) { + // change language for selection or paragraph + // (for paragraph is handled by previosuly having set the selection to the + // whole paragraph) if (bIsForSelection) { // apply language to current selection @@ -282,7 +292,7 @@ namespace SwLangHelper rWrtSh.SetAttr( rCoreSet ); } } - else // change document language + else // change language for all text { // set document default language switch (nLangWhichId) @@ -303,12 +313,12 @@ namespace SwLangHelper } } - void SetLanguage_None(SwWrtShell &rWrtSh,bool bIsForSelection, SfxItemSet &rCoreSet ) + void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet ) { - SetLanguage_None(rWrtSh,0,ESelection(),bIsForSelection,rCoreSet); + SetLanguage_None( rWrtSh,0,ESelection(),bIsForSelection,rCoreSet ); } - void SetLanguage_None(SwWrtShell &rWrtSh, EditEngine* pEditEngine,ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ) + void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet ) { // EditEngine IDs const USHORT aLangWhichId_EE[3] = @@ -328,7 +338,12 @@ namespace SwLangHelper if (bIsForSelection) { - // apply language to current selection + // change language for selection or paragraph + // (for paragraph is handled by previosuly having set the selection to the + // whole paragraph) + + EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL; + DBG_ASSERT( !pOLV || pEditEngine, "OutlinerView without EditEngine???" ); if (pEditEngine) { for (sal_uInt16 i = 0; i < 3; ++i) @@ -343,7 +358,7 @@ namespace SwLangHelper rWrtSh.SetAttr( rCoreSet ); } } - else // change document language + else // change language for all text { SvUShortsSort aAttribs; for (sal_uInt16 i = 0; i < 3; ++i) @@ -358,6 +373,39 @@ namespace SwLangHelper } } + void ResetLanguages( SwWrtShell &rWrtSh, bool bIsForSelection ) + { + ResetLanguages( rWrtSh, 0 , ESelection(), bIsForSelection ); + } + + void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection ) + { + (void) bIsForSelection; + (void) aSelection; + + // reset language for current selection. + // The selection should already have been expanded to the whole paragraph or + // to all text in the document if those are the ranges where to reset + // the language attributes + + if (pOLV) + { + EditView &rEditView = pOLV->GetEditView(); + rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE ); + rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CJK ); + rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CTL ); + } + else + { + SvUShortsSort aAttribs; + aAttribs.Insert( RES_CHRATR_LANGUAGE ); + aAttribs.Insert( RES_CHRATR_CJK_LANGUAGE ); + aAttribs.Insert( RES_CHRATR_CTL_LANGUAGE ); + rWrtSh.ResetAttr( &aAttribs ); + } + } + + /// @returns : the language for the selected text that is set for the /// specified attribute (script type). /// If there are more than one languages used LANGUAGE_DONTKNOW will be returned. @@ -453,7 +501,7 @@ namespace SwLangHelper /// 'In use' means the language(s) matching the script type(s) of the /// selected text. Or in other words, the language a spell checker would use. /// If there is more than one language LANGUAGE_DONTKNOW will be returned. - LanguageType GetCurrentLanguage(SfxItemSet aSet,USHORT nScriptType ) + LanguageType GetCurrentLanguage( SfxItemSet aSet, USHORT nScriptType ) { //set language attribute to use according to the script type USHORT nLangWhichId = 0; @@ -520,7 +568,7 @@ namespace SwLangHelper return aText; } - String GetTextForLanguageGuessing(EditEngine* rEditEngine, ESelection aDocSelection ) + String GetTextForLanguageGuessing( EditEngine* rEditEngine, ESelection aDocSelection ) { // string for guessing language String aText; diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 77de4c0821ff..736221981631 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -341,6 +341,7 @@ void SwTextShell::Execute(SfxRequest &rReq) const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") ); const String aDocumentLangPrefix( String::CreateFromAscii("Default_") ); const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") ); + const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") ); SfxItemSet aCoreSet( GetPool(), RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, @@ -379,10 +380,12 @@ void SwTextShell::Execute(SfxRequest &rReq) rWrtSh.SelAll(); rWrtSh.ExtendedSelectAll(); } - if (aNewLangTxt != aStrNone) - SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet ); - else + if (aNewLangTxt == aStrNone) SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet ); + else if (aNewLangTxt == aStrResetLangs) + SwLangHelper::ResetLanguages( rWrtSh, bForSelection ); + else + SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet ); } // restore selection... -- cgit From 00212019d055f897eb78fc13e54259d903d896ab Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Thu, 29 Oct 2009 17:19:58 +0100 Subject: applied patch for #i106057# --- sw/source/filter/ww8/wrtww8.cxx | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 6601f874c60f..2f9619151378 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2664,19 +2664,24 @@ void WW8Export::WriteFkpPlcUsw() // Write SttbfAssoc WW8SttbAssoc * pSttbfAssoc = dynamic_cast (pDoc->getExternalData(::sw::STTBF_ASSOC).get()); - ::std::vector aStrings; - - ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); - ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end(); - for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin(); - aIt != aItEnd; aIt++) + // --> OD 2009-10-19 #i106057# + if ( pSttbfAssoc ) + // <-- { - String aStr(aIt->getStr()); - aStrings.push_back(aStr); - } + ::std::vector aStrings; - WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, - pFib->lcbSttbfAssoc); + ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); + ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end(); + for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin(); + aIt != aItEnd; aIt++) + { + String aStr(aIt->getStr()); + aStrings.push_back(aStr); + } + + WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, + pFib->lcbSttbfAssoc); + } } Strm().Seek( 0 ); @@ -2685,10 +2690,15 @@ void WW8Export::WriteFkpPlcUsw() ::ww8::WW8FibData * pFibData = dynamic_cast (pDoc->getExternalData(::sw::FIB).get()); - pFib->fReadOnlyRecommended = - pFibData->getReadOnlyRecommended() ? 1 : 0; - pFib->fWriteReservation = - pFibData->getWriteReservation() ? 1 : 0; + // --> OD 2009-10-19 #i106057# + if ( pFibData ) + // <-- + { + pFib->fReadOnlyRecommended = + pFibData->getReadOnlyRecommended() ? 1 : 0; + pFib->fWriteReservation = + pFibData->getWriteReservation() ? 1 : 0; + } pFib->Write( Strm() ); // FIB } -- cgit From b5587d29c621778d4d0adff9016cebb845b112b4 Mon Sep 17 00:00:00 2001 From: "Henning Brinkmann[hbrinkm]" Date: Fri, 13 Nov 2009 17:17:57 +0100 Subject: hb33patches1:#i59648# applied patch --- sw/source/filter/ww8/wrtww8gr.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index aaafe0ee49fc..d85d391665d8 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -605,7 +605,7 @@ void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly, substitute the final size and loose on retaining the scaling factor but still keep the correct display size anyway. */ - if ( (aGrTwipSz.Width() > USHRT_MAX) || (aGrTwipSz.Height() > USHRT_MAX) + if ( (aGrTwipSz.Width() > SHRT_MAX) || (aGrTwipSz.Height() > SHRT_MAX) || (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0) ) { aGrTwipSz.Width() = nWidth; -- cgit From 2523b874cd4bad0618a1b20d41fa3fdff3a3f4f4 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Wed, 25 Nov 2009 16:52:25 +0000 Subject: #i51258# thesaurus for right click context menu --- sw/source/core/crsr/crstrvl1.cxx | 20 +++-- sw/source/core/crsr/swcrsr.cxx | 12 +-- sw/source/filter/ww8/wrtww8.cxx | 3 +- sw/source/ui/config/viewopt.cxx | 7 +- sw/source/ui/docvw/postit.cxx | 24 +++--- sw/source/ui/inc/view.hxx | 6 ++ sw/source/ui/shells/annotsh.cxx | 42 ++++++++-- sw/source/ui/shells/drwtxtex.cxx | 168 ++++++++++++++++++++++----------------- sw/source/ui/shells/drwtxtsh.cxx | 2 +- sw/source/ui/shells/textsh1.cxx | 52 ++++++++++++ sw/source/ui/uiview/view.src | 4 +- sw/source/ui/uiview/viewling.cxx | 167 +++++++++++++++++++------------------- sw/source/ui/uiview/viewstat.cxx | 2 +- sw/source/ui/web/web.src | 4 +- 14 files changed, 318 insertions(+), 195 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/crsr/crstrvl1.cxx b/sw/source/core/crsr/crstrvl1.cxx index dac68007e2dd..6834f4632db3 100644 --- a/sw/source/core/crsr/crstrvl1.cxx +++ b/sw/source/core/crsr/crstrvl1.cxx @@ -36,26 +36,30 @@ #include #include -BOOL SwCrsrShell::IsStartWord() const +BOOL SwCrsrShell::IsStartWord( sal_Int16 nWordType ) const { - return pCurCrsr->IsStartWord(); + return pCurCrsr->IsStartWord( nWordType ); } -BOOL SwCrsrShell::IsEndWord() const + +BOOL SwCrsrShell::IsEndWord( sal_Int16 nWordType ) const +{ + return pCurCrsr->IsEndWord( nWordType ); +} + +BOOL SwCrsrShell::IsInWord( sal_Int16 nWordType ) const { - return pCurCrsr->IsEndWord(); + return pCurCrsr->IsInWord( nWordType ); } + BOOL SwCrsrShell::IsStartSentence() const { return pCurCrsr->IsStartEndSentence( false ); } + BOOL SwCrsrShell::IsEndSentence() const { return pCurCrsr->IsStartEndSentence( true ); } -BOOL SwCrsrShell::IsInWord() const -{ - return pCurCrsr->IsInWord(); -} BOOL SwCrsrShell::GoStartWord() diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index ea5853916b8c..8a80f2d40421 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1144,19 +1144,19 @@ short SwCursor::MaxReplaceArived() } -BOOL SwCursor::IsStartWord() const +BOOL SwCursor::IsStartWord( sal_Int16 nWordType ) const { - return IsStartWordWT( WordType::ANYWORD_IGNOREWHITESPACES ); + return IsStartWordWT( nWordType ); } -BOOL SwCursor::IsEndWord() const +BOOL SwCursor::IsEndWord( sal_Int16 nWordType ) const { - return IsEndWordWT( WordType::ANYWORD_IGNOREWHITESPACES ); + return IsEndWordWT( nWordType ); } -BOOL SwCursor::IsInWord() const +BOOL SwCursor::IsInWord( sal_Int16 nWordType ) const { - return IsInWordWT( WordType::ANYWORD_IGNOREWHITESPACES ); + return IsInWordWT( nWordType ); } BOOL SwCursor::GoStartWord() diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 53587bca451c..2aecdf0f0b7a 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3575,7 +3575,8 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer void MSWordExportBase::OutputEndNode( const SwEndNode &rNode ) { #ifdef DEBUG - ::std::clog << "" << dbg_out(&rNode) << ::std::endl; +// someone who knows what he wants should make this linkable when building with 'debug=t' ... +// ::std::clog << "" << dbg_out(&rNode) << ::std::endl; #endif ww8::WW8TableNodeInfo::Pointer_t pNodeInfo = mpTableInfo->getTableNodeInfo( &rNode ); diff --git a/sw/source/ui/config/viewopt.cxx b/sw/source/ui/config/viewopt.cxx index 661a73f312ad..1869ef7085ef 100644 --- a/sw/source/ui/config/viewopt.cxx +++ b/sw/source/ui/config/viewopt.cxx @@ -115,6 +115,7 @@ BOOL SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const && bFormView == rOpt.IsFormView() && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields + && bIdle == rOpt.bIdle #ifndef PRODUCT // korrespondieren zu den Angaben in ui/config/cfgvw.src && bTest1 == rOpt.IsTest1() @@ -229,7 +230,7 @@ SwViewOption::SwViewOption() : { // Initialisierung ist jetzt etwas einfacher // alle Bits auf 0 - nCoreOptions = VIEWOPT_1_IDLE | VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH | + nCoreOptions = VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH | VIEWOPT_1_REF | VIEWOPT_1_GRAPHIC | VIEWOPT_1_TABLE | VIEWOPT_1_DRAW | VIEWOPT_1_CONTROL | @@ -246,6 +247,8 @@ SwViewOption::SwViewOption() : bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly(); + bIdle = true; + #ifndef PRODUCT // korrespondieren zu den Angaben in ui/config/cfgvw.src bTest1 = bTest2 = bTest3 = bTest4 = @@ -280,6 +283,7 @@ SwViewOption::SwViewOption(const SwViewOption& rVOpt) bBookview = rVOpt.bBookview; mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; + bIdle = rVOpt.bIdle; #ifndef PRODUCT bTest1 = rVOpt.bTest1 ; @@ -320,6 +324,7 @@ SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt ) bBookview = rVOpt.bBookview; mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; + bIdle = rVOpt.bIdle; #ifndef PRODUCT bTest1 = rVOpt.bTest1 ; diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx index e693f87e7a35..caaf26020c23 100644 --- a/sw/source/ui/docvw/postit.cxx +++ b/sw/source/ui/docvw/postit.cxx @@ -384,26 +384,30 @@ void PostItTxt::Command( const CommandEvent& rCEvt ) } else { - SfxPopupMenuManager* aMgr = mpMarginWin->DocView()->GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel()); - XubString aText = ((PopupMenu*)aMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR ); + SfxPopupMenuManager* pMgr = mpMarginWin->DocView()->GetViewFrame()->GetDispatcher()->Popup( 0, this, &rCEvt.GetMousePosPixel() ); + XubString aText = ((PopupMenu*)pMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR ); SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, mpMarginWin->GetAuthor()); aText = aRewriter.Apply(aText); - ((PopupMenu*)aMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText); - // SwPostItLinkForwarder_Impl aFwd( ((PopupMenu*)aMgr->GetSVMenu())->pSvMenu->GetSelectHdl(), mpPostIt ); - // ((PopupMenu*)aMgr->GetSVMenu())->pSvMenu->SetSelectHdl( LINK(&aFwd, SwPostItLinkForwarder_Impl, Select) ); + ((PopupMenu*)pMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR, aText); - ((PopupMenu*)aMgr->GetSVMenu())->SetSelectHdl( LINK(this, PostItTxt, Select) ); + ((PopupMenu*)pMgr->GetSVMenu())->SetSelectHdl( LINK(this, PostItTxt, Select) ); + Point aPos; if (rCEvt.IsMouseEvent()) - ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,rCEvt.GetMousePosPixel()); + aPos = rCEvt.GetMousePosPixel(); else { const Size aSize = GetSizePixel(); - const Point aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); - ((PopupMenu*)aMgr->GetSVMenu())->Execute(this,aPos); + aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); } - delete aMgr; + + //!! call different Execute function to get rid of the new thesaurus sub menu + //!! pointer created in the call to Popup. + //!! Otherwise we would have a memory leak (see also #i107205#) + //((PopupMenu*)pMgr->GetSVMenu())->Execute( this, aPos ); + pMgr->Execute( aPos, this ); + delete pMgr; } } else diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 7ddfc2775299..13205e249e0f 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -437,6 +437,12 @@ public: virtual USHORT PrepareClose( BOOL bUI = TRUE, BOOL bForBrowsing = FALSE ); virtual void MarginChanged(); + // replace word/selection with text from the thesaurus + // (this code has special handling for "in word" character) + void InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bValidSelection ); + bool IsValidSelectionForThesaurus() const; + String GetThesaurusLookUpText( bool bSelection ) const; + // Shell sofort wechseln -> fuer GetSelectionObject void StopShellTimer(); diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 38d3ca021a72..6e8bc651c1ff 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -30,14 +30,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include -#include #include #include #include #include #include + +#include +#include #include #include #include @@ -121,8 +124,8 @@ #include #include -#include "swabstdlg.hxx" //CHINA001 -#include "chrdlg.hrc" //CHINA001 +#include "swabstdlg.hxx" +#include "chrdlg.hrc" #include "misc.hrc" #include @@ -1132,7 +1135,17 @@ void SwAnnotationShell::ExecLingu(SfxRequest &rReq) bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,rView,rSh); break; } - case FN_THESAURUS_DLG: + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); + break; + } + case SID_THESAURUS: { pOLV->StartThesaurus(); break; @@ -1240,8 +1253,25 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) SwLangHelper::GetLanguageStatus(pOLV,rSet); break; } + + case SID_THES: + { + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); + lang::Locale aLocale( SvxCreateLocale( nLang ) ); + if (!bIsLookUpWord || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + break; + } + // disable "Thesaurus" if the language is not supported - case FN_THESAURUS_DLG: + case SID_THESAURUS: { const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, @@ -1251,7 +1281,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) )) - rSet.DisableItem( FN_THESAURUS_DLG ); + rSet.DisableItem( SID_THESAURUS ); } break; case SID_HANGUL_HANJA_CONVERSION: diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 11874ca5b151..6e7d31297e8e 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -30,90 +30,84 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef _SVX_PARAITEM_HXX //autogen -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef _SVX_CNTRITEM_HXX //autogen -#include -#endif -#include -#include -#include -#include -#include -#include -#include +#include + +#include +#include #include -#include #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include #include -#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include + +#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // fuer SpellPointer +#include #include +#include +#include #include -#include #include -#include // fuer SpellPointer -#include #include -#include - -#include -#include +#include +#include +#include +#include -#include -#include -#include #include "swabstdlg.hxx" #include "chrdlg.hrc" #include "misc.hrc" -//modified on Jul. 30th -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include using namespace ::com::sun::star; @@ -151,6 +145,18 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh); break; } + + case SID_THES: + { + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); + break; + } + case SID_ATTR_CHAR_FONT: case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: @@ -572,7 +578,27 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);; break; } - case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST; + + case SID_THES: + { + String aStatusVal; + LanguageType nLang = LANGUAGE_NONE; + bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() ); + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); + lang::Locale aLocale( SvxCreateLocale( nLang ) ); + if (!bIsLookUpWord || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + + //! avoid puting the same item as SfxBoolItem at the end of this function + nSlotId = 0; + break; + } + + case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST; case SID_ATTR_PARA_ADJUST_RIGHT: eAdjust = SVX_ADJUST_RIGHT; goto ASK_ADJUST; case SID_ATTR_PARA_ADJUST_CENTER: eAdjust = SVX_ADJUST_CENTER; goto ASK_ADJUST; case SID_ATTR_PARA_ADJUST_BLOCK: eAdjust = SVX_ADJUST_BLOCK; goto ASK_ADJUST; @@ -623,19 +649,17 @@ ASK_ESCAPE: } break; - case FN_THESAURUS_DLG: + case SID_THESAURUS: { // disable "Thesaurus" if the language is not supported const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage())) ); - LanguageType nLang = ((const SvxLanguageItem &) - rItem).GetLanguage(); - // + LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage(); + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); - if (!xThes.is() || nLang == LANGUAGE_NONE || - !xThes->hasLocale( SvxCreateLocale( nLang ) )) - rSet.DisableItem( FN_THESAURUS_DLG ); + if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) )) + rSet.DisableItem( SID_THESAURUS ); nSlotId = 0; } break; diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 40909287d8d6..9a40834daf55 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -400,7 +400,7 @@ void SwDrawTextShell::ExecDrawLingu(SfxRequest &rReq) { switch(rReq.GetSlot()) { - case FN_THESAURUS_DLG: + case SID_THESAURUS: pOLV->StartThesaurus(); break; diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 736221981631..6fa27d002415 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -30,7 +30,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + +#include #include + #include #include #include @@ -402,6 +405,23 @@ void SwTextShell::Execute(SfxRequest &rReq) break; } + case SID_THES: + { + // replace word/selection with text from selected sub menu entry + String aReplaceText; + SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , sal_False ); + if (pItem2) + aReplaceText = pItem2->GetValue(); + if (aReplaceText.Len() > 0) + { + SwView &rView = rWrtSh.GetView(); + const bool bSelection = rWrtSh.HasSelection(); + const String aLookUpText = rView.GetThesaurusLookUpText( bSelection ); + rView.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection ); + } + } + break; + case SID_CHARMAP: { InsertSymbol( rReq ); @@ -1380,6 +1400,38 @@ void SwTextShell::GetState( SfxItemSet &rSet ) } break; + case SID_THES: + { + // is there a valid selection to get text from? + String aText; + sal_Bool bValid = !rSh.HasSelection() || + (rSh.IsSelOnePara() && !rSh.IsMultiSelection()); + // prevent context menu from showing when cursor is not in or at the end of a word + // (GetCurWord will return the next word if there is none at the current position...) + const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD; + bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType ); + if (bValid && bWord) + aText = rSh.HasSelection()? rSh.GetSelTxt() : rSh.GetCurWord(); + + LanguageType nLang = rSh.GetCurLang(); + lang::Locale aLocale = SvxCreateLocale( nLang ); + String aLangText( MsLangId::convertLanguageToIsoString( nLang ) ); + + // set word and locale to look up as status value + String aStatusVal( aText ); + aStatusVal.AppendAscii( "#" ); + aStatusVal += aLangText; + + rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); + + // disable "Thesaurus" context menu entry if there is nothing to look up + uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); + if (aText.Len() == 0 || + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + rSet.DisableItem( SID_THES ); + } + break; + case FN_NUMBER_NEWSTART : if(!rSh.GetCurNumRule()) rSet.DisableItem(nWhich); diff --git a/sw/source/ui/uiview/view.src b/sw/source/ui/uiview/view.src index beb4f423ba28..3e830d531530 100644 --- a/sw/source/ui/uiview/view.src +++ b/sw/source/ui/uiview/view.src @@ -302,8 +302,8 @@ ToolBox RID_TOOLS_TOOLBOX }; ToolBoxItem { - Identifier = FN_THESAURUS_DLG; - HelpID = FN_THESAURUS_DLG; + Identifier = SID_THESAURUS; + HelpID = SID_THESAURUS; Hide = TRUE; }; ToolBoxItem diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 588c30a9844d..11f0d2cb3673 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -133,7 +133,7 @@ void SwView::ExecLingu(SfxRequest &rReq) { switch(rReq.GetSlot()) { - case FN_THESAURUS_DLG: + case SID_THESAURUS: StartThesaurus(); rReq.Ignore(); break; @@ -282,47 +282,26 @@ void SwView::StartTextConversion( */ SpellKontext(sal_True); - SwViewOption* pVOpt = (SwViewOption*)pWrtShell->GetViewOptions(); - sal_Bool bOldIdle = pVOpt->IsIdle(); + const SwViewOption* pVOpt = pWrtShell->GetViewOptions(); + const sal_Bool bOldIdle = pVOpt->IsIdle(); pVOpt->SetIdle( sal_False ); sal_Bool bOldIns = pWrtShell->IsInsMode(); pWrtShell->SetInsMode( sal_True ); + sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection() || + pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext(); - { - sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection() || - pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext(); - -// sal_Bool bIsSpellSpecial = sal_True; - - sal_Bool bStart = bSelection || pWrtShell->IsStartOfDoc(); - sal_Bool bOther = !bSelection && !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY); + sal_Bool bStart = bSelection || pWrtShell->IsStartOfDoc(); + sal_Bool bOther = !bSelection && !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY); -/* - if( bOther && !bIsSpellSpecial ) - // kein Sonderbereich eingeschaltet - { - // Ich will auch in Sonderbereichen trennen - QueryBox aBox( &GetEditWin(), SW_RES( DLG_SPECIAL_FORCED ) ); - if( aBox.Execute() == RET_YES && xProp.is()) - { - sal_Bool bTrue = sal_True; - Any aTmp(&bTrue, ::getBooleanCppuType()); - xProp->setPropertyValue( C2U(UPN_IS_SPELL_SPECIAL), aTmp ); - } - else - return; // Nein Es wird nicht gespellt - } -*/ - { - const uno::Reference< lang::XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - SwHHCWrapper aWrap( this, xMgr, nSourceLang, nTargetLang, pTargetFont, - nOptions, bIsInteractive, - bStart, bOther, bSelection ); - aWrap.Convert(); - } + { + const uno::Reference< lang::XMultiServiceFactory > xMgr( + comphelper::getProcessServiceFactory() ); + SwHHCWrapper aWrap( this, xMgr, nSourceLang, nTargetLang, pTargetFont, + nOptions, bIsInteractive, + bStart, bOther, bSelection ); + aWrap.Convert(); } pWrtShell->SetInsMode( bOldIns ); @@ -569,6 +548,70 @@ void SwView::HyphenateDocument() } } +/*-------------------------------------------------------------------- + --------------------------------------------------------------------*/ + +bool SwView::IsValidSelectionForThesaurus() const +{ + // must not be a multi-selection, and if it is a selection it needs + // to be within a single paragraph + + const bool bMultiSel = pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext(); + const sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); + return !bMultiSel && (!bSelection || pWrtShell->IsSelOnePara() ); +} + + +String SwView::GetThesaurusLookUpText( bool bSelection ) const +{ + return bSelection ? pWrtShell->GetSelTxt() : pWrtShell->GetCurWord(); +} + + +void SwView::InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bSelection ) +{ + sal_Bool bOldIns = pWrtShell->IsInsMode(); + pWrtShell->SetInsMode( sal_True ); + + pWrtShell->StartAllAction(); + pWrtShell->StartUndo(UNDO_DELETE); + + if( !bSelection ) + { + if(pWrtShell->IsEndWrd()) + pWrtShell->Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE ); + + pWrtShell->SelWrd(); + + // make sure the selection build later from the + // data below does not include footnotes and other + // "in word" character to the left and right in order + // to preserve those. Therefore count those "in words" + // in order to modify the selection accordingly. + const sal_Unicode* pChar = rLookUpText.GetBuffer(); + xub_StrLen nLeft = 0; + while (pChar && *pChar++ == CH_TXTATR_INWORD) + ++nLeft; + pChar = rLookUpText.Len() ? rLookUpText.GetBuffer() + rLookUpText.Len() - 1 : 0; + xub_StrLen nRight = 0; + while (pChar && *pChar-- == CH_TXTATR_INWORD) + ++nRight; + + // adjust existing selection + SwPaM *pCrsr = pWrtShell->GetCrsr(); + pCrsr->GetPoint()->nContent/*.nIndex*/ -= nRight; + pCrsr->GetMark()->nContent/*.nIndex*/ += nLeft; + } + + pWrtShell->Insert( rSynonmText ); + + pWrtShell->EndUndo(UNDO_DELETE); + pWrtShell->EndAllAction(); + + pWrtShell->SetInsMode( bOldIns ); +} + + /*-------------------------------------------------------------------- Beschreibung: Thesaurus starten --------------------------------------------------------------------*/ @@ -576,10 +619,7 @@ void SwView::HyphenateDocument() void SwView::StartThesaurus() { - if( pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext() ) - return; - sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); - if( bSelection && !pWrtShell->IsSelOnePara() ) + if (!IsValidSelectionForThesaurus()) return; SfxErrorContext aContext( ERRCTX_SVX_LINGU_THESAURUS, aEmptyStr, pEditWin, @@ -608,10 +648,9 @@ void SwView::StartThesaurus() Link aOldLnk = pSpell->ChgErrorLink(LINK(this, SwView, SpellError)); #endif - // get initial LookUp text - String aTmp = bSelection ? - pWrtShell->GetSelTxt() : pWrtShell->GetCurWord(); + const sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); + String aTmp = GetThesaurusLookUpText( bSelection ); Reference< XThesaurus > xThes( ::GetThesaurus() ); SvxThesaurusDialog *pDlg = NULL; @@ -661,54 +700,12 @@ void SwView::StartThesaurus() } if ( pDlg->Execute()== RET_OK ) - { - sal_Bool bOldIns = pWrtShell->IsInsMode(); - pWrtShell->SetInsMode( sal_True ); - - pWrtShell->StartAllAction(); - pWrtShell->StartUndo(UNDO_DELETE); - - if( !bSelection ) - { - if(pWrtShell->IsEndWrd()) - pWrtShell->Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE ); - - pWrtShell->SelWrd(); - - // make sure the selection build later from the - // data below does not include footnotes and other - // "in word" character to the left and right in order - // to preserve those. Therefore count those "in words" - // in order to modify the selection accordingly. - const sal_Unicode* pChar = aTmp.GetBuffer(); - xub_StrLen nLeft = 0; - while (pChar && *pChar++ == CH_TXTATR_INWORD) - ++nLeft; - pChar = aTmp.Len() ? aTmp.GetBuffer() + aTmp.Len() - 1 : 0; - xub_StrLen nRight = 0; - while (pChar && *pChar-- == CH_TXTATR_INWORD) - ++nRight; - - // adjust existing selection - SwPaM *pCrsr = pWrtShell->GetCrsr(); - pCrsr->GetPoint()->nContent/*.nIndex*/ -= nRight; - pCrsr->GetMark()->nContent/*.nIndex*/ += nLeft; - } - - pWrtShell->Insert( pDlg->GetWord() ); - - pWrtShell->EndUndo(UNDO_DELETE); - pWrtShell->EndAllAction(); - - pWrtShell->SetInsMode( bOldIns ); - - } + InsertThesaurusSynonym( pDlg->GetWord(), aTmp, bSelection ); } delete pDlg; pVOpt->SetIdle( bOldIdle ); - } /*-------------------------------------------------------------------- diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index 7563a7b5e779..d9338d49262b 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -306,7 +306,7 @@ void SwView::GetState(SfxItemSet &rSet) rSet.DisableItem( nWhich ); } break; - case FN_THESAURUS_DLG: + case SID_THESAURUS: { SwWrtShell &rSh = GetWrtShell(); if (2 <= rSh.GetCrsrCnt()) // multi selection? diff --git a/sw/source/ui/web/web.src b/sw/source/ui/web/web.src index 06b4da304170..0fa63aabf98c 100644 --- a/sw/source/ui/web/web.src +++ b/sw/source/ui/web/web.src @@ -141,8 +141,8 @@ ToolBox RID_WEBTOOLS_TOOLBOX }; ToolBoxItem { - Identifier = FN_THESAURUS_DLG; - HelpID = FN_THESAURUS_DLG; + Identifier = SID_THESAURUS; + HelpID = SID_THESAURUS; Hide = TRUE; }; ToolBoxItem -- cgit From 2920e86466ecaffcce2c31ed7d066f5e5544b44b Mon Sep 17 00:00:00 2001 From: "Henning Brinkmann[hbrinkm]" Date: Mon, 30 Nov 2009 16:52:00 +0100 Subject: hb33patches1: #i106569# applied patch --- sw/source/filter/ww8/ww8par.cxx | 20 +++++++++++++++++++- sw/source/filter/ww8/ww8par.hxx | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index b9fd20dc1cba..673efc69d0bc 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2589,6 +2589,16 @@ bool SwWW8ImplReader::HandlePageBreakChar() //itself ignores them in this case. if (!nInTable) { + //xushanchuan add for issue106569 + BOOL IsTemp=TRUE; + SwTxtNode* pTemp = pPaM->GetNode()->GetTxtNode(); + if ( pTemp && !( pTemp->GetTxt().Len() ) && ( bFirstPara || bFirstParaOfPage ) ) + { + IsTemp = FALSE; + AppendTxtNode(*pPaM->GetPoint()); + pTemp->SetAttr(*GetDfltAttr(RES_PARATR_NUMRULE)); + } + //xushanchuan end bPgSecBreak = true; pCtrlStck->KillUnlockedAttrs(*pPaM->GetPoint()); /* @@ -2597,7 +2607,9 @@ bool SwWW8ImplReader::HandlePageBreakChar() paragraph end, but nevertheless, numbering (and perhaps other similiar constructs) do not exist on the para. */ - if (!bWasParaEnd) + //xushanchuan add for issue106569 + if (!bWasParaEnd && IsTemp) + //xushanchuan end { bParaEndAdded = true; if (0 >= pPaM->GetPoint()->nContent.GetIndex()) @@ -2633,6 +2645,10 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) sal_Char cInsert = '\x0'; bool bRet = false; + //xushanchuan add for issue106569 + if ( 0xc != nWCharVal ) + bFirstParaOfPage = false; + //xushanchuan end switch (nWCharVal) { case 0: @@ -3172,6 +3188,7 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType) // <-- rDoc.InsertPoolItem(*pPaM, SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0); + bFirstParaOfPage = true;//xushanchuan add for issue106569 bPgSecBreak = false; } } @@ -3263,6 +3280,7 @@ SwWW8ImplReader::SwWW8ImplReader(BYTE nVersionPara, SvStorage* pStorage, bWasParaEnd = false; bDropCap = false; bFirstPara = true; + bFirstParaOfPage = false;//xushanchuan add for issue106569 bParaAutoBefore = false; bParaAutoAfter = false; nProgress = 0; diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 93a20df1576c..94ed0c3d9f4b 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1099,7 +1099,7 @@ private: // the very 1st Line Numbering and ignore the rest) bool bFirstPara; // first paragraph? - + bool bFirstParaOfPage;//cs2c--xushanchuan add for bug11210 bool bParaAutoBefore; bool bParaAutoAfter; -- cgit From 3aa0aa1db307d2d88c612b808ec06411b3036b97 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 11 Jan 2010 15:58:29 +0100 Subject: cws tl74: merge problems --- sw/source/ui/lingu/olmenu.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'sw/source') diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 0b6a67070e1c..a5634768ba54 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -63,12 +63,7 @@ #include #include #include -#include -#include -#include -#include #include -#include #include #include #include @@ -80,6 +75,7 @@ #include #include #include +#include #include #include #include @@ -295,7 +291,7 @@ void SwSpellPopup::fillLangPopupMenu( { for (USHORT i = 0; i < rLocales.getLength(); ++i) { - if (aLangItems.size() == nMaxCount) + if (aLangItems.size() == (size_t)nMaxCount) break; const lang::Locale& rLocale = rLocales[i]; if (lcl_checkScriptType( nScriptType, aLanguageTable.GetType( rLocale.Language ))) @@ -575,7 +571,7 @@ bGrammarResults(false) Image rImg = ::GetImage( xFrame, OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); - SetItemImage( MN_SPELLING, rImg ); + SetItemImage( MN_SPELLING_DLG, rImg ); ////////////////////////////////////////////////////////////////////////////////// @@ -708,7 +704,7 @@ aInfo16( SW_RES(IMG_INFO_16) ) Image rImg = ::GetImage( xFrame, OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); - SetItemImage( MN_SPELLING, rImg ); + SetItemImage( MN_SPELLING_DLG, rImg ); ////////////////////////////////////////////////////////////////////////////////// @@ -740,7 +736,7 @@ void SwSpellPopup::Execute( USHORT nId ) if ((MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) || (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END)) { - USHORT nAltIdx = (MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ? + sal_Int32 nAltIdx = (MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ? nId - MN_SUGGESTION_START : nId - MN_AUTOCORR_START; DBG_ASSERT( 0 <= nAltIdx && nAltIdx < aSuggestions.getLength(), "index out of range" ); if (0 <= nAltIdx && nAltIdx < aSuggestions.getLength() && (bGrammarResults || xSpellAlt.is())) -- cgit From 7a0436ff74b08cc03fd14730e14fcc8b558a2ecb Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 12 Jan 2010 14:07:54 +0100 Subject: cws tl74: build errors/warnings after merge --- sw/source/ui/shells/drwtxtex.cxx | 5 ++++- sw/source/ui/shells/textsh1.cxx | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'sw/source') diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 1f30dff31930..4abef9982d8b 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -42,12 +42,15 @@ #include #include #include -#include +#include #include #include #include #include #include +#include +#include +#include #include #include #include diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 3de0c2fd5b28..a98f201d3959 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -414,10 +414,10 @@ void SwTextShell::Execute(SfxRequest &rReq) aReplaceText = pItem2->GetValue(); if (aReplaceText.Len() > 0) { - SwView &rView = rWrtSh.GetView(); + SwView &rView2 = rWrtSh.GetView(); const bool bSelection = rWrtSh.HasSelection(); - const String aLookUpText = rView.GetThesaurusLookUpText( bSelection ); - rView.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection ); + const String aLookUpText = rView2.GetThesaurusLookUpText( bSelection ); + rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection ); } } break; -- cgit From dc964072aee8f92ff5792d36b24a2e5b6507ff05 Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Mon, 25 Jan 2010 11:29:30 +0100 Subject: hb33patches01: #i105645#: applied patch --- sw/source/core/layout/tabfrm.cxx | 156 +-------------------------------------- 1 file changed, 2 insertions(+), 154 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 61f08281e5f9..893938242aca 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -1685,62 +1685,6 @@ BOOL MA_FASTCALL lcl_InnerCalcLayout( SwFrm *pFrm, return bRet; } -void MA_FASTCALL lcl_FirstTabCalc( SwTabFrm *pTab ) -{ - SWRECTFN( pTab ) - if ( !pTab->IsFollow() && !pTab->GetTable()->IsTblComplex() ) - { - SwLayoutFrm* pRow = (SwLayoutFrm*)pTab->Lower(); - // --> FME 2006-07-17 #134526# TabFrm without a lower? Better we check - // it before crashing. However, I still don't know how this can happen! - while ( pRow ) - { - SwLayoutFrm *pCell = (SwLayoutFrm*)pRow->Lower(); - SwFrm *pCnt = pCell->Lower(); - // --> OD 2006-11-08 #i70641# - make code robust - if ( pCnt ) - { - pCnt->Calc(); - const long nCellHeight = (pCell->Frm().*fnRect->fnGetHeight)(); - const long nCellY = (pCell->Frm().*fnRect->fnGetTop)()-1; - const long nCntHeight = (pCnt->Frm().*fnRect->fnGetHeight)(); - const long nCntY = (pCnt->Frm().*fnRect->fnGetTop)()-1; - if ( 0 != (pCell = (SwLayoutFrm*)pCell->GetNext()) ) - { - do - { - (pCell->Frm().*fnRect->fnSetTopAndHeight)( nCellY, nCellHeight ); - (pCell->Prt().*fnRect->fnSetHeight)( nCellHeight ); - pCell->_InvalidateAll(); - - pCnt = pCell->Lower(); - if ( pCnt ) - { - (pCnt->Frm().*fnRect->fnSetTopAndHeight)(nCntY, nCntHeight); - (pCnt->Prt().*fnRect->fnSetHeight)( nCntHeight ); - pCnt->_InvalidateAll(); - } - - pCell = (SwLayoutFrm*)pCell->GetNext(); - } while ( pCell ); - } - - SwTwips nRowTop = (pRow->Frm().*fnRect->fnGetTop)(); - SwTwips nUpBot = (pTab->GetUpper()->Frm().*fnRect->fnGetBottom)(); - if( (*fnRect->fnYDiff)( nUpBot, nRowTop ) < 0 ) - break; - } - // <-- - pRow = (SwLayoutFrm*)pRow->GetNext(); - } - } - SwFrm *pUp = pTab->GetUpper(); - long nBottom = (pUp->*fnRect->fnGetPrtBottom)(); - if ( pTab->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) - nBottom += pUp->Grow( LONG_MAX, TRUE ); - lcl_CalcLowers( (SwLayoutFrm*)pTab->Lower(), pTab, LONG_MAX, false ); -} - void MA_FASTCALL lcl_RecalcRow( SwRowFrm& rRow, long nBottom ) { // --> OD 2004-10-05 #i26945# - For correct appliance of the 'straightforward @@ -2151,17 +2095,13 @@ void SwTabFrm::MakeAll() if ( !bValidSize || !bValidPrtArea ) { - // HB #i101593# no optimization as it leeds to not layouting certain nested tables - // const BOOL bOptLower = (Frm().*fnRect->fnGetHeight)() == 0; - const BOOL bOptLower = FALSE; - const long nOldPrtWidth = (Prt().*fnRect->fnGetWidth)(); const long nOldFrmWidth = (Frm().*fnRect->fnGetWidth)(); const Point aOldPrtPos = (Prt().*fnRect->fnGetPos)(); Format( pAttrs ); SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout(); - if ( /*!bOptLower &&*/ pLayout && + if ( pLayout && ((Prt().*fnRect->fnGetWidth)() != nOldPrtWidth || (Frm().*fnRect->fnGetWidth)() != nOldFrmWidth) ) { @@ -2172,100 +2112,8 @@ void SwTabFrm::MakeAll() pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), this ); pAttrs = pAccess->Get(); } - if ( !bOptLower && aOldPrtPos != (Prt().*fnRect->fnGetPos)() ) + if ( aOldPrtPos != (Prt().*fnRect->fnGetPos)() ) aNotify.SetLowersComplete( FALSE ); - - if ( bOptLower && Lower() ) - { - //MA 24. May. 95: Optimierungsversuch! - //Ganz nigel nagel neu das Teil. Damit wir nicht n-fach - //MakeAll'en formatieren wir flugs den Inhalt. - //Das erste Format mussten wir allerdings abwarten, damit - //die Breiten Stimmen! - //MA: Fix, Kein Calc wenn evtl. noch Seitengebunde Flys - //an den Cntnt haengen (siehe frmtool.cxx, ~SwCntntNotify). - SwDoc *pDoc = GetFmt()->GetDoc(); - if ( !pDoc->GetSpzFrmFmts()->Count() || - pDoc->IsLoaded() || pDoc->IsNewDoc() ) - { - //MA 28. Nov. 95: Und wieder ein Trick, gleich mal sehen - //ob ein Rueckfluss lohnt. - if ( bMoveable && !GetPrev() ) - { - GetLeaf( MAKEPAGE_NONE, FALSE ); //setzt das BackMoveJump - if ( SwFlowFrm::IsMoveBwdJump() ) - { - BOOL bDummy; - SwFtnBossFrm *pOldBoss = bFtnsInDoc ? - FindFtnBossFrm( TRUE ) : 0; - const BOOL bOldPrev = GetPrev() != 0; - if ( MoveBwd( bDummy ) ) - { - SWREFRESHFN( this ) - bMovedBwd = TRUE; - if ( bFtnsInDoc ) - MoveLowerFtns( 0, pOldBoss, 0, TRUE ); - - long nOldTop = (Frm().*fnRect->fnGetTop)(); - MakePos(); - if( nOldTop != (Frm().*fnRect->fnGetTop)() ) - { - SwHTMLTableLayout *pHTMLLayout = - GetTable()->GetHTMLTableLayout(); - if( pHTMLLayout ) - { - delete pAccess; - bCalcLowers |= pHTMLLayout->Resize( - pHTMLLayout->GetBrowseWidthByTabFrm( - *this ), FALSE ); - pAccess= new SwBorderAttrAccess( - SwFrm::GetCache(), this ); - pAttrs = pAccess->Get(); - } - } - - if ( bOldPrev != (0 != GetPrev()) ) - { - //Abstand nicht vergessen! - bValidPrtArea = FALSE; - Format( pAttrs ); - } - if ( bKeep && KEEPTAB ) - { - // --> OD 2005-09-28 #b6329202# - // Consider case that table is inside another - // table, because it has to be avoided, that - // superior table is formatted. - // Thus, find next content, table or section - // and, if a section is found, get its first - // content. -// SwFrm *pNxt = FindNextCnt(); -// // FindNextCnt geht ggf. in einen Bereich -// // hinein, in eine Tabelle allerdings auch -// if( pNxt && pNxt->IsInTab() ) -// pNxt = pNxt->FindTabFrm(); -// if ( pNxt ) -// { -// pNxt->Calc(); -// if ( !GetNext() ) -// bValidPos = FALSE; -// } - if ( 0 != lcl_FormatNextCntntForKeep( this ) && - !GetNext() ) - { - bValidPos = FALSE; - } - // <-- - } - } - } - } - ::lcl_FirstTabCalc( this ); - bValidSize = bValidPrtArea = FALSE; - Format( pAttrs ); - aNotify.SetLowersComplete( TRUE ); - } - } } //Wenn ich der erste einer Kette bin koennte ich mal sehen ob -- cgit From 382d6a28327cd53e6fe1da612a1086b1e5242e20 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Tue, 26 Jan 2010 15:05:10 +0100 Subject: cws tl74: #i107721# further changes to new thesaurus dialog --- sw/source/ui/uiview/viewling.cxx | 54 +--------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) mode change 100644 => 100755 sw/source/ui/uiview/viewling.cxx (limited to 'sw/source') diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx old mode 100644 new mode 100755 index 111704c90c42..50ff6cae2295 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -265,21 +265,9 @@ void SwView::StartTextConversion( // do not do text conversion if it is active elsewhere if (GetWrtShell().HasConvIter()) { -// MessBox( 0, WB_OK, String( SW_RES( STR_SPELL_TITLE ) ), -// String( SW_RES( STR_MULT_INTERACT_SPELL_WARN ) ) ).Execute(); return; } -/* - SfxErrorContext aContext( ERRCTX_SVX_LINGU_SPELLING, aEmptyStr, pEditWin, - RID_SVXERRCTX, DIALOG_MGR() ); - Reference< XSpellChecker1 > xSpell = ::GetSpellChecker(); - if(!xSpell.is()) - { // keine Arme keine Kekse - ErrorHandler::HandleError( ERRCODE_SVX_LINGU_LINGUNOTEXISTS ); - return; - } -*/ SpellKontext(sal_True); const SwViewOption* pVOpt = pWrtShell->GetViewOptions(); @@ -642,12 +630,6 @@ void SwView::StartThesaurus() sal_Bool bOldIdle = pVOpt->IsIdle(); pVOpt->SetIdle( sal_False ); -#ifdef TL_NEVER -//!!! hier mu� noch was getan werden... (Umsetzung der Funktionalitaet) - // ErrorLink setzen, alten merken - Link aOldLnk = pSpell->ChgErrorLink(LINK(this, SwView, SpellError)); -#endif - // get initial LookUp text const sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection(); String aTmp = GetThesaurusLookUpText( bSelection ); @@ -656,47 +638,13 @@ void SwView::StartThesaurus() SvxThesaurusDialog *pDlg = NULL; if ( !xThes.is() || !xThes->hasLocale( SvxCreateLocale( eLang ) ) ) - { SpellError( &eLang ); - } else { // create dialog { //Scope for SwWait-Object SwWait aWait( *GetDocShell(), sal_True ); - pDlg = new SvxThesaurusDialog( &GetEditWin(), - xThes, aTmp, eLang ); - } - - { - // Hier wird der Thesaurus-Dialog im Applikationsfenster zentriert, - // und zwar oberhalb oder unterhalb der Cursorposition, je nachdem, - // wo mehr Platz ist. - - // Current Word: - SwRect aRect( pWrtShell->GetCharRect() ); - Point aTopPos = aRect.Pos(); - Point aBtmPos( aTopPos.X(), aRect.Bottom() ); - aTopPos = GetEditWin().LogicToPixel( aTopPos ); - aTopPos = GetEditWin().OutputToScreenPixel( aTopPos ); - aBtmPos = GetEditWin().LogicToPixel( aBtmPos ); - aBtmPos = GetEditWin().OutputToScreenPixel( aBtmPos ); - // ::frame::Desktop: - Rectangle aRct = GetEditWin().GetDesktopRectPixel(); - Point aWinTop( aRct.TopLeft() ); - Point aWinBtm( aRct.BottomRight() ); - if ( aTopPos.Y() - aWinTop.Y() > aWinBtm.Y() - aBtmPos.Y() ) - aWinBtm.Y() = aTopPos.Y(); - else - aWinTop.Y() = aBtmPos.Y(); - - Size aSz = pDlg->GetSizePixel(); - if ( aWinBtm.Y() - aWinTop.Y() > aSz.Height() ) - { - aWinTop.X() = ( aWinTop.X() + aWinBtm.X() - aSz.Width() ) / 2; - aWinTop.Y() = ( aWinTop.Y() + aWinBtm.Y() - aSz.Height() ) / 2; - pDlg->SetPosPixel( aWinTop ); - } + pDlg = new SvxThesaurusDialog( &GetEditWin(), xThes, aTmp, eLang ); } if ( pDlg->Execute()== RET_OK ) -- cgit From 9869559159a38726912bed85f28e076c2848156b Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Wed, 17 Feb 2010 11:06:26 +0100 Subject: hb33patches1: #i109325# applied patch --- sw/source/filter/ww8/ww8scan.cxx | 7 ++----- sw/source/filter/ww8/ww8scan.hxx | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 55834f5c0816..bde7bc39f3c4 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2124,7 +2124,7 @@ xub_StrLen WW8ScannerBase::WW8ReadString( SvStream& rStrm, String& rStr, // Bei nStartPos < 0 wird das erste Element des PLCFs genommen WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, long nFilePos, long nPLCF, - long nStruct, long nStartPos, bool bNoEnd) + long nStruct, long nStartPos) : nIdx(0), nStru(nStruct) { nIMax = ( nPLCF - 4 ) / ( 4 + nStruct ); @@ -2140,8 +2140,6 @@ WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, long nFilePos, long nPLCF, pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] ); nIdx = 0; #endif // OSL_BIGENDIAN - if( bNoEnd ) - nIMax++; if( nStruct ) // Pointer auf Inhalts-Array pPLCF_Contents = (BYTE*)&pPLCF_PosArray[nIMax + 1]; else @@ -4007,8 +4005,7 @@ WW8PLCFx_Book::WW8PLCFx_Book(SvStream* pTblSt, const WW8Fib& rFib) { pBook[0] = new WW8PLCFspecial(pTblSt,rFib.fcPlcfbkf,rFib.lcbPlcfbkf,4); - pBook[1] = new WW8PLCFspecial( pTblSt, rFib.fcPlcfbkl, rFib.lcbPlcfbkl, - 0, -1, true); + pBook[1] = new WW8PLCFspecial(pTblSt,rFib.fcPlcfbkl,rFib.lcbPlcfbkl,0); rtl_TextEncoding eStructChrSet = WW8Fib::GetFIBCharset(rFib.chseTables); diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 85c80ba51025..9223773826a5 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -223,7 +223,7 @@ private: long nStru; public: WW8PLCFspecial( SvStream* pSt, long nFilePos, long nPLCF, - long nStruct, long nStartPos = -1, bool bNoEnd = false); + long nStruct, long nStartPos = -1 ); ~WW8PLCFspecial() { delete[] pPLCF_PosArray; } long GetIdx() const { return nIdx; } void SetIdx( long nI ) { nIdx = nI; } -- cgit From 40ce8f33c47d06fd1fd8dc2ba866e15e09cf6cf1 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 1 Mar 2010 12:00:01 +0100 Subject: cws tl74: include statements fixed --- sw/source/ui/shells/drwtxtex.cxx | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'sw/source') diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 23a466b54208..c95ad7e64c1c 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -85,23 +85,23 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include -- cgit From 61a3c00d1ffcbe24140dfc143eab08a82fbe507c Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Tue, 30 Mar 2010 10:53:20 +0200 Subject: hb33patches1: #i110463# applied patch and verified --- sw/source/filter/ww8/wrtww8.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 6bf7ecbb8cdf..f295f564581e 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1023,7 +1023,8 @@ bool WW8_WrFkp::Combine() return false; if( nIMax ) memcpy( pFkp + ( nIMax + 1 ) * 4, pOfs, nIMax * nItemSize ); - DELETEZ( pOfs ); + delete[] pOfs; + pOfs = 0; ((BYTE*)pFkp)[511] = nIMax; bCombined = true; -- cgit From 110334e229b3e0a03da71cc60937d1d161c5c3df Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Tue, 6 Apr 2010 10:22:30 +0200 Subject: hb33patches1: #i110560# applied patch --- sw/source/filter/ww8/docxattributeoutput.cxx | 92 ++++++++++------------------ sw/source/filter/ww8/docxexport.cxx | 24 ++------ sw/source/filter/ww8/docxexportfilter.cxx | 2 +- sw/source/filter/ww8/wrtw8nds.cxx | 2 +- sw/source/filter/ww8/wrtww8gr.cxx | 8 +-- sw/source/filter/ww8/ww8atr.cxx | 4 +- 6 files changed, 45 insertions(+), 87 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bb26e670928a..2e22e3518c90 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -731,9 +731,7 @@ void DocxAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eChar if ( *pIt < 0x0020 ) // filter out the control codes { impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt ); -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "Ignored control code %x in a text run.", *pIt ); -#endif + OSL_TRACE( "Ignored control code %x in a text run.", *pIt ); } break; } @@ -744,23 +742,17 @@ void DocxAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eChar void DocxAttributeOutput::RawText( const String& /*rText*/, bool /*bForceUnicode*/, rtl_TextEncoding /*eCharSet*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet )\n" ); -#endif + OSL_TRACE("TODO DocxAttributeOutput::RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet )\n" ); } void DocxAttributeOutput::StartRuby( const SwTxtNode& /*rNode*/, const SwFmtRuby& /*rRuby*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby )\n" ); -#endif + OSL_TRACE("TODO DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby )\n" ); } void DocxAttributeOutput::EndRuby() { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::EndRuby()\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::EndRuby()\n" ); } bool DocxAttributeOutput::AnalyzeURL( const String& rUrl, const String& rTarget, String* pLinkURL, String* pMark ) @@ -849,9 +841,7 @@ void DocxAttributeOutput::FieldVanish( const String& rTxt, ww::eField eType ) void DocxAttributeOutput::Redline( const SwRedlineData* /*pRedline*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::Redline( const SwRedlineData* pRedline )\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::Redline( const SwRedlineData* pRedline )\n" ); } /// Append the number as 2-digit when less than 10. @@ -936,9 +926,7 @@ void DocxAttributeOutput::StartRedline( const SwRedlineData* pRedlineData ) break; case nsRedlineType_t::REDLINE_FORMAT: -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::StartRedline()\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::StartRedline()\n" ); default: break; } @@ -960,9 +948,7 @@ void DocxAttributeOutput::EndRedline() break; case nsRedlineType_t::REDLINE_FORMAT: -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::EndRedline()\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::EndRedline()\n" ); break; default: break; @@ -973,9 +959,7 @@ void DocxAttributeOutput::EndRedline() void DocxAttributeOutput::FormatDrop( const SwTxtNode& /*rNode*/, const SwFmtDrop& /*rSwFmtDrop*/, USHORT /*nStyle*/, ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/, ww8::WW8TableNodeInfoInner::Pointer_t ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop& rSwFmtDrop, USHORT nStyle )\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop& rSwFmtDrop, USHORT nStyle )\n" ); } void DocxAttributeOutput::ParagraphStyle( USHORT nStyle ) @@ -990,7 +974,7 @@ void DocxAttributeOutput::ParagraphStyle( USHORT nStyle ) void DocxAttributeOutput::InTable() { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::InTable()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::InTable()\n" ); #endif } @@ -998,7 +982,7 @@ void DocxAttributeOutput::InTable() void DocxAttributeOutput::TableRowProperties( bool /*bHeader*/, long /*nCellHeight*/, bool /*bCannotSplit*/, bool /*bRightToLeft*/ ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::TableRowProperties()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::TableRowProperties()\n" ); #endif } #endif @@ -1439,9 +1423,7 @@ void DocxAttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer void DocxAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t /*pNodeInfo*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO: DocxAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo )\n" ); -#endif + OSL_TRACE( "TODO: DocxAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo )\n" ); } void DocxAttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner ) @@ -1455,16 +1437,12 @@ void DocxAttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointe void DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO: DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )\n" ); -#endif + OSL_TRACE( "TODO: DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )\n" ); } void DocxAttributeOutput::TableRowEnd( sal_uInt32 /*nDepth*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO: DocxAttributeOutput::TableRowEnd( sal_uInt32 nDepth = 1 )\n" ); -#endif + OSL_TRACE( "TODO: DocxAttributeOutput::TableRowEnd( sal_uInt32 nDepth = 1 )\n" ); } void DocxAttributeOutput::StartStyles() @@ -1483,7 +1461,7 @@ void DocxAttributeOutput::DefaultStyle( USHORT nStyle ) { // are these the values of enum ww::sti (see ../inc/wwstyles.hxx)? #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::DefaultStyle( USHORT nStyle )- %d\n", nStyle ); + OSL_TRACE( "TODO DocxAttributeOutput::DefaultStyle( USHORT nStyle )- %d\n", nStyle ); #else (void) nStyle; // to quiet the warning #endif @@ -1492,7 +1470,7 @@ void DocxAttributeOutput::DefaultStyle( USHORT nStyle ) void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize ) - some stuff still missing\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size& rSize ) - some stuff still missing\n" ); #endif // create the relation ID OString aRelId; @@ -1710,7 +1688,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po break; default: #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Point& rNdTopLeft ) - frame type '%s'\n", + OSL_TRACE( "TODO DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Point& rNdTopLeft ) - frame type '%s'\n", rFrame.GetWriterType() == sw::Frame::eTxtBox? "eTxtBox": ( rFrame.GetWriterType() == sw::Frame::eOle? "eOle": ( rFrame.GetWriterType() == sw::Frame::eFormControl? "eFormControl": "???" ) ) ); @@ -1839,7 +1817,7 @@ void DocxAttributeOutput::SectionBreak( BYTE nC, const WW8_SepInfo* pSectionInfo break; default: #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "Unknown section break to write: %d\n", nC ); + OSL_TRACE( "Unknown section break to write: %d\n", nC ); #endif break; } @@ -1879,7 +1857,7 @@ void DocxAttributeOutput::SectionLineNumbering( ULONG /*nRestartNo*/, const SwLi { // see 2.6.8 lnNumType (Line Numbering Settings) #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::SectionLineNumbering()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::SectionLineNumbering()\n" ); #endif } @@ -1965,7 +1943,7 @@ void DocxAttributeOutput::SectionPageNumbering( USHORT nNumType, USHORT nPageRes // see 2.6.12 pgNumType (Page Numbering Settings) #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::SectionPageNumbering()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::SectionPageNumbering()\n" ); #endif } @@ -2073,7 +2051,7 @@ void DocxAttributeOutput::NumberingDefinition( USHORT nId, const SwNumRule &rRul #if OSL_DEBUG_LEVEL > 0 // TODO ww8 version writes this, anything to do about it here? if ( rRule.IsContinusNum() ) - fprintf( stderr, "TODO DocxAttributeOutput::NumberingDefinition()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::NumberingDefinition()\n" ); #else (void) rRule; // to quiet the warning... #endif @@ -2265,7 +2243,7 @@ void DocxAttributeOutput::CharCrossedOut( const SvxCrossedOutItem& rCrossedOut ) void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& /*rEscapement*/ ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::CharEscapement()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::CharEscapement()\n" ); #endif } @@ -2382,7 +2360,7 @@ void DocxAttributeOutput::CharWeight( const SvxWeightItem& rWeight ) void DocxAttributeOutput::CharAutoKern( const SvxAutoKernItem& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::CharAutoKern()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::CharAutoKern()\n" ); #endif } @@ -2554,7 +2532,7 @@ void DocxAttributeOutput::TextINetFormat( const SwFmtINetFmt& rLink ) void DocxAttributeOutput::TextCharFormat( const SwFmtCharFmt& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::TextCharFormat()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::TextCharFormat()\n" ); #endif } @@ -2577,14 +2555,14 @@ void DocxAttributeOutput::RefField( const SwField& rFld, const String& rRef ) void DocxAttributeOutput::HiddenField( const SwField& /*rFld*/ ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::HiddenField()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::HiddenField()\n" ); #endif } void DocxAttributeOutput::PostitField( const SwField* /* pFld*/ ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::PostitField()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::PostitField()\n" ); #endif } @@ -2970,7 +2948,7 @@ void DocxAttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize ) if ( m_rExport.bOutFlyFrmAttrs ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatFrameSize() - Fly frames\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatFrameSize() - Fly frames\n" ); #endif } else if ( m_rExport.bOutPageDescs ) @@ -2993,7 +2971,7 @@ void DocxAttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize ) void DocxAttributeOutput::FormatPaperBin( const SvxPaperBinItem& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatPaperBin()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatPaperBin()\n" ); #endif } @@ -3002,7 +2980,7 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace ) if ( m_rExport.bOutFlyFrmAttrs ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "DocxAttributeOutput::FormatLRSpace() - Fly frames\n" ); + OSL_TRACE( "DocxAttributeOutput::FormatLRSpace() - Fly frames\n" ); #endif } else if ( m_rExport.bOutPageDescs ) @@ -3093,28 +3071,28 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace ) void DocxAttributeOutput::FormatSurround( const SwFmtSurround& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatSurround()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatSurround()\n" ); #endif } void DocxAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatVertOrientation()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatVertOrientation()\n" ); #endif } void DocxAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatHorizOrientation()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatHorizOrientation()\n" ); #endif } void DocxAttributeOutput::FormatAnchor( const SwFmtAnchor& ) { #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatAnchor()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatAnchor()\n" ); #endif } @@ -3129,7 +3107,7 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush ) } #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatBackground()\n" ); + OSL_TRACE( "TODO DocxAttributeOutput::FormatBackground()\n" ); #endif } @@ -3215,9 +3193,7 @@ void DocxAttributeOutput::FormatKeep( const SvxFmtKeepItem& ) void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxAttributeOutput::FormatTextGrid()\n" ); -#endif + OSL_TRACE( "TODO DocxAttributeOutput::FormatTextGrid()\n" ); } void DocxAttributeOutput::FormatLineNumbering( const SwFmtLineNumber& rNumbering ) diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index bbfec465973a..46e79679655a 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -342,9 +342,7 @@ void DocxExport::OutputField( const SwField* pFld, ww::eField eFldType, const St void DocxExport::WriteFormData( const ::sw::mark::IFieldmark& /*rFieldmark*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::WriteFormData()\n" ); -#endif + OSL_TRACE( "TODO DocxExport::WriteFormData()\n" ); } void DocxExport::DoComboBox(const rtl::OUString& rName, @@ -404,9 +402,7 @@ void DocxExport::DoComboBox(const rtl::OUString& rName, void DocxExport::DoFormText(const SwInputField* /*pFld*/) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::ForFormText()\n" ); -#endif + OSL_TRACE( "TODO DocxExport::ForFormText()\n" ); } void DocxExport::ExportDocument_Impl() @@ -430,9 +426,7 @@ void DocxExport::ExportDocument_Impl() void DocxExport::OutputPageSectionBreaks( const SwTxtNode& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::OutputPageSectionBreaks( const SwTxtNode& )\n" ); -#endif + OSL_TRACE( "TODO DocxExport::OutputPageSectionBreaks( const SwTxtNode& )\n" ); } @@ -480,23 +474,17 @@ void DocxExport::OutputEndNode( const SwEndNode& rEndNode ) void DocxExport::OutputTableNode( const SwTableNode& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::OutputTableNode( const SwTableNode& )\n" ); -#endif + OSL_TRACE( "TODO DocxExport::OutputTableNode( const SwTableNode& )\n" ); } void DocxExport::OutputGrfNode( const SwGrfNode& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::OutputGrfNode( const SwGrfNode& )\n" ); -#endif + OSL_TRACE( "TODO DocxExport::OutputGrfNode( const SwGrfNode& )\n" ); } void DocxExport::OutputOLENode( const SwOLENode& ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "TODO DocxExport::OutputOLENode( const SwOLENode& )\n" ); -#endif + OSL_TRACE( "TODO DocxExport::OutputOLENode( const SwOLENode& )\n" ); } ULONG DocxExport::ReplaceCr( BYTE ) diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx index 5f23f23a8dd5..13715fcd2bbe 100644 --- a/sw/source/filter/ww8/docxexportfilter.cxx +++ b/sw/source/filter/ww8/docxexportfilter.cxx @@ -47,7 +47,7 @@ DocxExportFilter::DocxExportFilter( const uno::Reference< lang::XMultiServiceFac bool DocxExportFilter::exportDocument() { - fprintf( stderr, "DocxExportFilter::exportDocument()\n" ); // DEBUG remove me + OSL_TRACE(, "DocxExportFilter::exportDocument()\n" ); // DEBUG remove me // get SwDoc* uno::Reference< uno::XInterface > xIfc( getModel(), uno::UNO_QUERY ); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 23fa8ecb2c34..9757cc42f79f 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2709,7 +2709,7 @@ void MSWordExportBase::OutputContentNode( const SwCntntNode& rNode ) break; default: #if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "Unhandled node, type == %d\n", rNode.GetNodeType() ); + OSL_TRACE("Unhandled node, type == %d\n", rNode.GetNodeType() ); #endif break; } diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 1116c5354e76..a659abfa3c7f 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -94,9 +94,7 @@ using namespace nsFieldFlags; void WW8Export::OutputGrfNode( const SwGrfNode& /*rNode*/ ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "WW8Export::OutputGrfNode( const SwGrfNode& )\n" ); -#endif + OSL_TRACE("WW8Export::OutputGrfNode( const SwGrfNode& )\n" ); ASSERT( mpParentFrame, "frame not set!" ); if ( mpParentFrame ) { @@ -216,9 +214,7 @@ bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet, void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) { -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "WW8Export::OutputOLENode( const SwOLENode& rOLENode )\n" ); -#endif + OSL_TRACE("WW8Export::OutputOLENode( const SwOLENode& rOLENode )\n" ); BYTE *pSpecOLE; BYTE *pDataAdr; short nSize; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index c1c254a47f8d..ec3806409073 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -5254,9 +5254,7 @@ void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt ) break; default: -#if OSL_DEBUG_LEVEL > 0 - fprintf( stderr, "Unhandled SfxPoolItem with id %d.\n", rHt.Which() ); -#endif + OSL_TRACE("Unhandled SfxPoolItem with id %d.\n", rHt.Which() ); break; } } -- cgit From dce8fe3766891c22b2a228bdd71f949e7006ab0d Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Wed, 21 Apr 2010 15:19:04 +0200 Subject: hb33patches1: #i111038# applied patch and verified --- sw/source/filter/ww8/ww8par.cxx | 11 +++++++++-- sw/source/filter/ww8/ww8par.hxx | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index e03816d7776c..f33c66a4ce4b 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1681,6 +1681,13 @@ void SwWW8ImplReader::Read_HdFtText(long nStart, long nLen, SwFrmFmt* pHdFtFmt) *pPaM->GetPoint() = aTmpPos; } + +bool SwWW8ImplReader::isValid_HdFt_CP(WW8_CP nHeaderCP) const +{ + //each CP of Plcfhdd MUST be less than FibRgLw97.ccpHdd + return (nHeaderCP < pWwFib->ccpHdr) ? true : false; +} + bool SwWW8ImplReader::HasOwnHeaderFooter(BYTE nWhichItems, BYTE grpfIhdt, int nSect) { @@ -1700,7 +1707,7 @@ bool SwWW8ImplReader::HasOwnHeaderFooter(BYTE nWhichItems, BYTE grpfIhdt, else { pHdFt->GetTextPosExact( static_cast< short >(nNumber + (nSect+1)*6), start, nLen); - bOk = ( 2 <= nLen ); + bOk = ( 2 <= nLen ) && isValid_HdFt_CP(start); } if (bOk) @@ -1752,7 +1759,7 @@ void SwWW8ImplReader::Read_HdFt(bool bIsTitle, int nSect, else { pHdFt->GetTextPosExact( static_cast< short >(nNumber + (nSect+1)*6), start, nLen); - bOk = ( 2 <= nLen ); + bOk = ( 2 <= nLen ) && isValid_HdFt_CP(start); } bool bUseLeft diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 68d77972c7ef..df8a9bd8c5d4 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1112,6 +1112,8 @@ private: void Read_HdFtTextAsHackedFrame(long nStart, long nLen, SwFrmFmt &rHdFtFmt, sal_uInt16 nPageWidth); + bool isValid_HdFt_CP(WW8_CP nHeaderCP) const; + bool HasOwnHeaderFooter(BYTE nWhichItems, BYTE grpfIhdt, int nSect); void HandleLineNumbering(const wwSection &rSection); -- cgit From c22ef304c317170d3a224908cd4e7d7f967f9168 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Tue, 4 May 2010 12:15:53 +0200 Subject: #i110750# - remove unused method - thx cmc --- sw/source/core/inc/frame.hxx | 4 ---- sw/source/core/layout/layact.cxx | 18 ------------------ 2 files changed, 22 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 552555e925f9..e1560a230d7a 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -250,10 +250,6 @@ class SwFrm: public SwClient friend SwFrm *SaveCntnt( SwLayoutFrm *, SwFrm* pStart = NULL ); friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow ); - //Checkt ob sich beim MakePos die Pos des Frm aendert oder nicht - //layact.cxx - friend BOOL CheckPos( SwFrm *pFrm ); - #if OSL_DEBUG_LEVEL > 1 //entfernt leere SwSectionFrms aus einer Kette friend SwFrm* SwClearDummies( SwFrm* pFrm ); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 14bc23bb97a4..7156faa17738 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1661,24 +1661,6 @@ BOOL SwLayAction::FormatLayoutFly( SwFlyFrm* pFly ) return bChanged || bTabChanged; } -// OD 31.10.2002 #104100# -// NOTE: no adjustments for vertical layout support necessary -BOOL CheckPos( SwFrm *pFrm ) -{ - if ( !pFrm->GetValidPosFlag() ) - { - Point aOld( pFrm->Frm().Pos() ); - pFrm->MakePos(); - if ( aOld != pFrm->Frm().Pos() ) - { - pFrm->Frm().Pos( aOld ); - pFrm->_InvalidatePos(); - return FALSE; - } - } - return TRUE; -} - // OD 31.10.2002 #104100# // Implement vertical layout support BOOL SwLayAction::FormatLayoutTab( SwTabFrm *pTab, BOOL bAddRect ) -- cgit From 7aa662cde0ffa955fa68b72ba28052e33b6aa362 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Tue, 4 May 2010 15:01:14 +0200 Subject: #i101131# method - adjust conversion due to type mismatch --- sw/source/core/unocore/unosett.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 980306be3aec..ab486b71ed04 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1659,9 +1659,14 @@ uno::Sequence SwXNumberingRules::GetNumberingRuleByIndex( aPropertyValues.Insert(pData, aPropertyValues.Count()); } Size aSize = rFmt.GetGraphicSize(); - aSize.Width() = TWIP_TO_MM100( aSize.Width() ); - aSize.Height() = TWIP_TO_MM100( aSize.Height() ); - pData = new PropValData((void*)&aSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0)); + // --> OD 2010-05-04 #i101131# - applying patch from CMC + // adjust conversion due to type mismatch between and +// aSize.Width() = TWIP_TO_MM100( aSize.Width() ); +// aSize.Height() = TWIP_TO_MM100( aSize.Height() ); +// pData = new PropValData((void*)&aSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0)); + awt::Size aAwtSize(TWIP_TO_MM100(aSize.Width()), TWIP_TO_MM100(aSize.Height())); + pData = new PropValData((void*)&aAwtSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0)); + // <-- aPropertyValues.Insert(pData, aPropertyValues.Count()); const SwFmtVertOrient* pOrient = rFmt.GetGraphicOrientation(); -- cgit From ec2b51bbf8c3f999703eee3a6da4db5075caf4de Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 5 May 2010 15:19:33 +0200 Subject: #i111284# method - correct treatment of list level indents --- sw/source/core/text/itrcrsr.cxx | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 438f7c246287..34c0a9843986 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -57,6 +57,9 @@ #include "pordrop.hxx" #include "crstate.hxx" // SwCrsrMoveState #include // SwMultiPortion +// --> OD 2010-05-05 #i111284# +#include +// <-- // Nicht reentrant !!! // wird in GetCharRect gesetzt und im UnitUp/Down ausgewertet. @@ -143,6 +146,27 @@ void lcl_GetCharRectInsideField( SwTxtSizeInfo& rInf, SwRect& rOrig, } } +// --> OD 2010-05-05 #i111284# +namespace { + bool AreListLevelIndentsApplicableAndLabelAlignmentActive( const SwTxtNode& rTxtNode ) + { + bool bRet( false ); + + if ( rTxtNode.AreListLevelIndentsApplicable() ) + { + const SwNumFmt& rNumFmt = + rTxtNode.GetNumRule()->Get( static_cast(rTxtNode.GetActualListLevel()) ); + if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + bRet = true; + } + } + + return bRet; + } +} // end of anonymous namespace +// <-- + /************************************************************************* * SwTxtMargin::CtorInitTxtMargin() *************************************************************************/ @@ -156,7 +180,9 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) const SvxLRSpaceItem &rSpace = pFrm->GetTxtNode()->GetSwAttrSet().GetLRSpace(); // --> OD 2009-09-08 #i95907#, #b6879723# - const bool bListLevelIndentsApplicable = pFrm->GetTxtNode()->AreListLevelIndentsApplicable(); + // --> OD 2010-05-05 #i111284# + const bool bListLevelIndentsApplicableAndLabelAlignmentActive( + AreListLevelIndentsApplicableAndLabelAlignmentActive( *(pFrm->GetTxtNode()) ) ); // <-- // @@ -181,9 +207,10 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) nLMWithNum - pNode->GetLeftMarginWithNum( sal_False ) - // --> OD 2009-09-08 #i95907#, #b6879723# + // --> OD 2010-05-05 #i111284# // rSpace.GetLeft() + // rSpace.GetTxtLeft(); - ( bListLevelIndentsApplicable + ( bListLevelIndentsApplicableAndLabelAlignmentActive ? 0 : ( rSpace.GetLeft() - rSpace.GetTxtLeft() ) ); // <-- @@ -191,8 +218,9 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) else { // --> OD 2009-09-08 #i95907#, #b6879723# + // --> OD 2010-05-05 #i111284# // if ( !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) - if ( bListLevelIndentsApplicable || + if ( bListLevelIndentsApplicableAndLabelAlignmentActive || !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) // <-- { @@ -202,9 +230,10 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) nLMWithNum - pNode->GetLeftMarginWithNum( sal_False ) - // --> OD 2009-09-08 #i95907#, #b6879723# + // --> OD 2010-05-05 #i111284# // rSpace.GetLeft() + // rSpace.GetTxtLeft(); - ( bListLevelIndentsApplicable + ( bListLevelIndentsApplicableAndLabelAlignmentActive ? 0 : ( rSpace.GetLeft() - rSpace.GetTxtLeft() ) ); // <-- @@ -292,10 +321,11 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) nFirstLineOfs = nFLOfst; // --> OD 2009-09-08 #i95907#, #b6879723# + // --> OD 2010-05-05 #i111284# // if ( pFrm->IsRightToLeft() || // !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) if ( pFrm->IsRightToLeft() || - bListLevelIndentsApplicable || + bListLevelIndentsApplicableAndLabelAlignmentActive || !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) // <-- { -- cgit From 5acd245bc94d176c2ab9692a3351b34e70ad82e7 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 6 May 2010 09:02:51 +0200 Subject: #i111172# method - adjust handling of existing indent in case that the text node is already inside a list. --- sw/source/ui/wrtsh/wrtsh1.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 57e76a9cff61..68eb67e8b219 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -1387,7 +1387,17 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum) // <-- if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 ) { - const SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs; + // --> OD 2010-05-05 #i111172# + // If text node is already inside a list, assure that the indents + // are the same. Thus, adjust the indent change value by subtracting + // indents of to be applied list style. + SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs; + if ( pTxtNode->GetNumRule() ) + { + const SwNumFmt aFmt( aNumRule.Get( 0 ) ); + nIndentChange -= aFmt.GetIndentAt() + aFmt.GetFirstLineIndent(); + } + // <-- aNumRule.ChangeIndent( nIndentChange ); } } -- cgit From f7a9e946427e9ba8878c2617362aa4a17d20e490 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 6 May 2010 17:02:44 +0200 Subject: #i103711# - workaround in case that a paragraph only overrules the left indent, but not the first line indent of the applied list style --- sw/source/filter/ww8/ww8par.cxx | 45 +++++++++++++++++++++++++++++----------- sw/source/filter/ww8/ww8par.hxx | 13 ++++++++++-- sw/source/filter/ww8/ww8par3.cxx | 4 +++- sw/source/filter/ww8/ww8par6.cxx | 27 ++++++++++++++++++++++-- 4 files changed, 72 insertions(+), 17 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index a290e8f30790..e1b623b2d5c5 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -844,13 +844,28 @@ long lcl_GetTrueMargin(const SvxLRSpaceItem &rLR, const SwNumFmt &rFmt, return nExtraListIndent > 0 ? nExtraListIndent : 0; } -void SyncIndentWithList(SvxLRSpaceItem &rLR, const SwNumFmt &rFmt) +// --> OD 2010-05-06 #i103711# +void SyncIndentWithList( SvxLRSpaceItem &rLR, + const SwNumFmt &rFmt, + const bool bFirstLineOfstSet ) { - long nWantedFirstLinePos; - long nExtraListIndent = lcl_GetTrueMargin(rLR, rFmt, nWantedFirstLinePos); - rLR.SetTxtLeft(nWantedFirstLinePos - nExtraListIndent); - rLR.SetTxtFirstLineOfst(0); + if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + long nWantedFirstLinePos; + long nExtraListIndent = lcl_GetTrueMargin(rLR, rFmt, nWantedFirstLinePos); + rLR.SetTxtLeft(nWantedFirstLinePos - nExtraListIndent); + rLR.SetTxtFirstLineOfst(0); + } + else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + if ( !bFirstLineOfstSet && + rFmt.GetFirstLineIndent() != 0 ) + { + rLR.SetTxtFirstLineOfst( rFmt.GetFirstLineIndent() ); + } + } } +// <-- const SwNumFmt* SwWW8FltControlStack::GetNumFmtFromStack(const SwPosition &rPos, const SwTxtNode &rTxtNode) @@ -907,16 +922,19 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, pNum = GetNumFmtFromStack(*aRegion.GetPoint(), *pTxtNode); if (!pNum) + { pNum = GetNumFmtFromTxtNode(*pTxtNode); + } - // --> OD 2008-06-03 #i86652# -// if (pNum) - if ( pNum && - pNum->GetPositionAndSpaceMode() == - SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - // <-- + if ( pNum ) { - SyncIndentWithList(aNewLR, *pNum); + // --> OD 2010-05-06 #i103711# + const bool bFirstLineIndentSet = + ( rReader.maTxtNodesHavingFirstLineOfstSet.end() != + rReader.maTxtNodesHavingFirstLineOfstSet.find( pNode ) ); + SyncIndentWithList( aNewLR, *pNum, + bFirstLineIndentSet ); + // <-- } if (aNewLR == aOldLR) @@ -3185,6 +3203,9 @@ SwWW8ImplReader::SwWW8ImplReader(BYTE nVersionPara, SvStorage* pStorage, maGrfNameGenerator(bNewDoc,String('G')), maParaStyleMapper(rD), maCharStyleMapper(rD), + // --> OD 2010-05-06 #i103711# + maTxtNodesHavingFirstLineOfstSet(), + // <-- pMSDffManager(0), mpAtnNames(0), pAuthorInfos(0), diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 099ecca83d6a..15817c1eb2c1 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -956,6 +956,10 @@ private: WW8PLCFMan* pPlcxMan; std::map aLinkStringMap; + // --> OD 2010-05-06 #i103711# + std::set maTxtNodesHavingFirstLineOfstSet; + // <-- + WW8RStyle* pStyles; // Pointer auf die Style-Einleseklasse SwFmt* pAktColl; // gerade zu erzeugende Collection // ( ist ausserhalb einer Style-Def immer 0 ) @@ -1155,7 +1159,10 @@ private: void ImportTox( int nFldId, String aStr ); void EndSprm( USHORT nId ); - void NewAttr( const SfxPoolItem& rAttr ); + // --> OD 2010-05-06 #i103711# + void NewAttr( const SfxPoolItem& rAttr, + const bool bFirstLineOfStSet = false ); + // <-- bool GetFontParams(USHORT, FontFamily&, String&, FontPitch&, rtl_TextEncoding&); @@ -1612,7 +1619,9 @@ public: // eigentlich private, geht aber leider nur public bool CanUseRemoteLink(const String &rGrfName); void UseListIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt); void SetStyleIndent(SwWW8StyInf &rStyleInfo, const SwNumFmt &rFmt); -void SyncIndentWithList(SvxLRSpaceItem &rLR, const SwNumFmt &rFmt); +void SyncIndentWithList( SvxLRSpaceItem &rLR, + const SwNumFmt &rFmt, + const bool bFirstLineOfStSet ); long GetListFirstLineIndent(const SwNumFmt &rFmt); String BookmarkToWriter(const String &rBookmark); bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 465d07c0d2b5..9437495439f7 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -1697,7 +1697,9 @@ void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt) { SvxLRSpaceItem aLR(ItemGet(*rStyle.pFmt, RES_LR_SPACE)); if (rStyle.bListReleventIndentSet) - SyncIndentWithList(aLR, rFmt); + { + SyncIndentWithList( aLR, rFmt, false ); + } else { aLR.SetTxtLeft(0); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 5c10a7b005bd..210618134280 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2715,7 +2715,8 @@ bool SwWW8ImplReader::TestSameApo(const ApoTestResults &rApo, # Attribut - Verwaltung #**************************************************************************/ -void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr ) +void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr, + const bool bFirstLineOfStSet ) { if( !bNoAttrImport ) // zum Ignorieren von Styles beim Doc-Einfuegen { @@ -2725,11 +2726,24 @@ void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr ) pAktColl->SetFmtAttr(rAttr); } else if (pAktItemSet) + { pAktItemSet->Put(rAttr); + } else if (rAttr.Which() == RES_FLTR_REDLINE) + { mpRedlineStack->open(*pPaM->GetPoint(), rAttr); + } else + { pCtrlStck->NewAttr(*pPaM->GetPoint(), rAttr); + // --> OD 2010-05-06 #i103711# + if ( bFirstLineOfStSet ) + { + const SwNode* pNd = &(pPaM->GetPoint()->nNode.GetNode()); + maTxtNodesHavingFirstLineOfstSet.insert( pNd ); + } + // <-- + } if (mpPostProcessAttrsInfo && mpPostProcessAttrsInfo->mbCopy) mpPostProcessAttrsInfo->mItemSet.Put(rAttr); @@ -3958,6 +3972,10 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) } } + // --> OD 2010-05-06 #i103711# + bool bFirstLinOfstSet( false ); + // <-- + switch (nId) { //sprmPDxaLeft @@ -3998,7 +4016,10 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) aLR.SetTxtFirstLineOfst(nPara); if (pAktColl) + { pCollA[nAktColl].bListReleventIndentSet = true; + } + bFirstLinOfstSet = true; break; //sprmPDxaRight case 16: @@ -4010,7 +4031,9 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) return; } - NewAttr(aLR); + // --> OD 2010-05-06 #i103711# + NewAttr( aLR, bFirstLinOfstSet ); + // <-- } // Sprm 20 -- cgit From 4a43faa47e43285d044bffb6719702e3c1aee501 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 10 May 2010 19:01:40 +0200 Subject: sw33bf04: #i111286#: crash when pasting footnote into frame (patch by dtardon) --- sw/source/core/txtnode/ndtxt.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index d6770321768f..bf50d63be411 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1588,6 +1588,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, // Del-Array fuer alle RefMarks ohne Ausdehnung SwpHts aRefMrkArr; + USHORT nDeletedDummyChars(0); //Achtung: kann ungueltig sein!! for (USHORT n = 0; ( n < nSize ); ++n) { @@ -1681,9 +1682,19 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, } else { - pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt, - nAttrEnd, nsSetAttrMode::SETATTR_NOTXTATRCHR ); - lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest ); + pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt - nDeletedDummyChars, + nAttrEnd - nDeletedDummyChars, nsSetAttrMode::SETATTR_NOTXTATRCHR ); + if (pNewHt) + { + lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest ); + } + else if (pHt->HasDummyChar()) + { + // The attribute that has failed to be copied would insert + // dummy char, so positions of the following attributes have + // to be shifted by one to compensate for that missing char. + ++nDeletedDummyChars; + } } if( RES_TXTATR_REFMARK == nWhich && !pEndIdx && !bCopyRefMark ) -- cgit From 21305385b5bfb9392b7368852a048c5393c62e96 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 10 May 2010 19:07:52 +0200 Subject: sw33bf04: #i111286#: clean up footnote cruft in SwTxtNode::CopyText() --- sw/source/core/txtnode/atrftn.cxx | 38 ++++++++++++++++++++++---------------- sw/source/core/txtnode/ndtxt.cxx | 25 ++++--------------------- 2 files changed, 26 insertions(+), 37 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 7d6b8959787b..45f6c5da2baf 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -289,39 +289,45 @@ void SwTxtFtn::SetNumber( const USHORT nNewNum, const XubString* pStr ) } // Die Fussnoten duplizieren -void SwTxtFtn::CopyFtn( SwTxtFtn *pDest ) const +void SwTxtFtn::CopyFtn(SwTxtFtn & rDest, SwTxtNode & rDestNode) const { - if ( m_pStartNode && pDest->GetStartNode() ) + if (m_pStartNode && !rDest.GetStartNode()) { - // die Fussnoten koennen in unterschiedlichen Dokumenten stehen !! - SwDoc* pDstDoc = pDest->m_pTxtNode->GetDoc(); + // dest missing node section? create it here! + // (happens in SwTxtNode::CopyText if pDest == this) + rDest.MakeNewTextSection( rDestNode.GetNodes() ); + } + if (m_pStartNode && rDest.GetStartNode()) + { + // footnotes not necessarily in same document! + SwDoc *const pDstDoc = rDestNode.GetDoc(); SwNodes &rDstNodes = pDstDoc->GetNodes(); - // Wir kopieren nur den Inhalt der Sektion + // copy only the content of the section SwNodeRange aRg( *m_pStartNode, 1, *m_pStartNode->GetNode().EndOfSectionNode() ); - // Wir fuegen auf dem Ende von pDest ein, d.h. die Nodes - // werden angehaengt. nDestLen haelt die Anzahl der CntNodes - // in pDest _vor_ dem Kopieren. - SwNodeIndex aStart( *(pDest->GetStartNode()) ); + // insert at the end of rDest, i.e., the nodes are appended. + // nDestLen contains number of CntntNodes in rDest _before_ copy. + SwNodeIndex aStart( *(rDest.GetStartNode()) ); SwNodeIndex aEnd( *aStart.GetNode().EndOfSectionNode() ); ULONG nDestLen = aEnd.GetIndex() - aStart.GetIndex() - 1; m_pTxtNode->GetDoc()->CopyWithFlyInFly( aRg, 0, aEnd, TRUE ); - // Wenn die Dest-Sektion nicht leer war, so muessen die alten - // Nodes geloescht werden: - // Vorher: Src: SxxxE, Dst: SnE - // Nachher: Src: SxxxE, Dst: SnxxxE - // und Src: SxxxE, Dst: SxxxE + // in case the destination section was not empty, delete the old nodes + // before: Src: SxxxE, Dst: SnE + // now: Src: SxxxE, Dst: SnxxxE + // after: Src: SxxxE, Dst: SxxxE aStart++; rDstNodes.Delete( aStart, nDestLen ); } - // Der benutzerdefinierte String muss auch uebertragen werden. + // also copy user defined number string if( GetFtn().aNumber.Len() ) - ((SwFmtFtn&)pDest->GetFtn()).aNumber = GetFtn().aNumber; + { + const_cast(rDest.GetFtn()).aNumber = GetFtn().aNumber; + } } diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index bf50d63be411..29afeae8725d 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1278,11 +1278,11 @@ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr * const pHt, ASSERT( nWhich == pHt->Which(), "Falsche Hint-Id" ); switch( nWhich ) { - // Wenn wir es mit einem Fussnoten-Attribut zu tun haben, - // muessen wir natuerlich auch den Fussnotenbereich kopieren. + // copy nodesarray section with footnote content case RES_TXTATR_FTN : + ASSERT(pDest, "lcl_CopyHint: no destination text node?"); static_cast(pHt)->CopyFtn( - static_cast(pNewHt)); + *static_cast(pNewHt), *pDest); break; // Beim Kopieren von Feldern in andere Dokumente @@ -1660,24 +1660,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, pNewHt = MakeTxtAttr( *GetDoc(), pHt->GetAttr(), nAttrStt, nAttrEnd ); -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -//JP 23.04.95: erstmal so gesondert hier behandeln. Am Besten ist es -// aber im CopyFtn wenn die pDestFtn keinen StartNode hat, -// sich diesen dann anlegt. -// Aber so kurz vor der BETA besser nicht anfassen. - if( RES_TXTATR_FTN == nWhich ) - { - SwTxtFtn* pFtn = (SwTxtFtn*)pNewHt; - pFtn->ChgTxtNode( this ); - pFtn->MakeNewTextSection( GetNodes() ); - lcl_CopyHint( nWhich, pHt, pFtn, 0, 0 ); - pFtn->ChgTxtNode( 0 ); - } - else -//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - { - lcl_CopyHint( nWhich, pHt, pNewHt, 0, pDest ); - } + lcl_CopyHint(nWhich, pHt, pNewHt, 0, pDest); aArr.C40_INSERT( SwTxtAttr, pNewHt, aArr.Count() ); } else -- cgit From 8883e76b265da21a3b42f6906bc4f62e0b8a4684 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Tue, 11 May 2010 15:33:35 +0200 Subject: #i105414# workaround in case that a paragraph only overrules the first line indent, but not the left indent of the applied list style --- sw/source/filter/ww8/ww8par.cxx | 21 ++++++++++++++++++--- sw/source/filter/ww8/ww8par.hxx | 13 +++++++++++-- sw/source/filter/ww8/ww8par3.cxx | 5 ++++- sw/source/filter/ww8/ww8par6.cxx | 23 +++++++++++++++++++++-- 4 files changed, 54 insertions(+), 8 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index e1b623b2d5c5..5698627ef580 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -845,9 +845,11 @@ long lcl_GetTrueMargin(const SvxLRSpaceItem &rLR, const SwNumFmt &rFmt, } // --> OD 2010-05-06 #i103711# +// --> OD 2010-05-11 #i105414# void SyncIndentWithList( SvxLRSpaceItem &rLR, const SwNumFmt &rFmt, - const bool bFirstLineOfstSet ) + const bool bFirstLineOfstSet, + const bool bLeftIndentSet ) { if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { @@ -858,11 +860,16 @@ void SyncIndentWithList( SvxLRSpaceItem &rLR, } else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { - if ( !bFirstLineOfstSet && + if ( !bFirstLineOfstSet && bLeftIndentSet && rFmt.GetFirstLineIndent() != 0 ) { rLR.SetTxtFirstLineOfst( rFmt.GetFirstLineIndent() ); } + else if ( bFirstLineOfstSet && !bLeftIndentSet && + rFmt.GetIndentAt() != 0 ) + { + rLR.SetTxtLeft( rFmt.GetIndentAt() ); + } } } // <-- @@ -932,8 +939,13 @@ void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, const bool bFirstLineIndentSet = ( rReader.maTxtNodesHavingFirstLineOfstSet.end() != rReader.maTxtNodesHavingFirstLineOfstSet.find( pNode ) ); + // --> OD 2010-05-11 #i105414# + const bool bLeftIndentSet = + ( rReader.maTxtNodesHavingLeftIndentSet.end() != + rReader.maTxtNodesHavingLeftIndentSet.find( pNode ) ); SyncIndentWithList( aNewLR, *pNum, - bFirstLineIndentSet ); + bFirstLineIndentSet, + bLeftIndentSet ); // <-- } @@ -3206,6 +3218,9 @@ SwWW8ImplReader::SwWW8ImplReader(BYTE nVersionPara, SvStorage* pStorage, // --> OD 2010-05-06 #i103711# maTxtNodesHavingFirstLineOfstSet(), // <-- + // --> OD 2010-05-11 #i105414# + maTxtNodesHavingLeftIndentSet(), + // <-- pMSDffManager(0), mpAtnNames(0), pAuthorInfos(0), diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 15817c1eb2c1..25db4954daa3 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -959,6 +959,9 @@ private: // --> OD 2010-05-06 #i103711# std::set maTxtNodesHavingFirstLineOfstSet; // <-- + // --> OD 2010-05-11 #i105414# + std::set maTxtNodesHavingLeftIndentSet; + // <-- WW8RStyle* pStyles; // Pointer auf die Style-Einleseklasse SwFmt* pAktColl; // gerade zu erzeugende Collection @@ -1160,8 +1163,10 @@ private: void EndSprm( USHORT nId ); // --> OD 2010-05-06 #i103711# + // --> OD 2010-05-11 #i105414# void NewAttr( const SfxPoolItem& rAttr, - const bool bFirstLineOfStSet = false ); + const bool bFirstLineOfStSet = false, + const bool bLeftIndentSet = false ); // <-- bool GetFontParams(USHORT, FontFamily&, String&, FontPitch&, @@ -1619,9 +1624,13 @@ public: // eigentlich private, geht aber leider nur public bool CanUseRemoteLink(const String &rGrfName); void UseListIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt); void SetStyleIndent(SwWW8StyInf &rStyleInfo, const SwNumFmt &rFmt); +// --> OD 2010-05-06 #i103711# +// --> OD 2010-05-11 #i105414# void SyncIndentWithList( SvxLRSpaceItem &rLR, const SwNumFmt &rFmt, - const bool bFirstLineOfStSet ); + const bool bFirstLineOfStSet, + const bool bLeftIndentSet ); +// <-- long GetListFirstLineIndent(const SwNumFmt &rFmt); String BookmarkToWriter(const String &rBookmark); bool RTLGraphicsHack(SwTwips &rLeft, SwTwips nWidth, diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 9437495439f7..0b8616d54652 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -1698,7 +1698,10 @@ void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFmt &rFmt) SvxLRSpaceItem aLR(ItemGet(*rStyle.pFmt, RES_LR_SPACE)); if (rStyle.bListReleventIndentSet) { - SyncIndentWithList( aLR, rFmt, false ); + // --> OD 2010-05-06 #i103711# + // --> OD 2010-05-11 #i105414# + SyncIndentWithList( aLR, rFmt, false, false ); + // <-- } else { diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 210618134280..86d644a94356 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2716,7 +2716,8 @@ bool SwWW8ImplReader::TestSameApo(const ApoTestResults &rApo, #**************************************************************************/ void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr, - const bool bFirstLineOfStSet ) + const bool bFirstLineOfStSet, + const bool bLeftIndentSet ) { if( !bNoAttrImport ) // zum Ignorieren von Styles beim Doc-Einfuegen { @@ -2743,6 +2744,13 @@ void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr, maTxtNodesHavingFirstLineOfstSet.insert( pNd ); } // <-- + // --> OD 2010-05-11 #i105414# + if ( bLeftIndentSet ) + { + const SwNode* pNd = &(pPaM->GetPoint()->nNode.GetNode()); + maTxtNodesHavingLeftIndentSet.insert( pNd ); + } + // <-- } if (mpPostProcessAttrsInfo && mpPostProcessAttrsInfo->mbCopy) @@ -3975,6 +3983,9 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) // --> OD 2010-05-06 #i103711# bool bFirstLinOfstSet( false ); // <-- + // --> OD 2010-05-11 #i105414# + bool bLeftIndentSet( false ); + // <-- switch (nId) { @@ -3984,7 +3995,12 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) case 0x845E: aLR.SetTxtLeft( nPara ); if (pAktColl) + { pCollA[nAktColl].bListReleventIndentSet = true; + } + // --> OD 2010-05-11 #i105414# + bLeftIndentSet = true; + // <-- break; //sprmPDxaLeft1 case 19: @@ -4019,7 +4035,9 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) { pCollA[nAktColl].bListReleventIndentSet = true; } + // --> OD 2010-05-06 #i103711# bFirstLinOfstSet = true; + // <-- break; //sprmPDxaRight case 16: @@ -4032,7 +4050,8 @@ void SwWW8ImplReader::Read_LR( USHORT nId, const BYTE* pData, short nLen ) } // --> OD 2010-05-06 #i103711# - NewAttr( aLR, bFirstLinOfstSet ); + // --> OD 2010-05-11 #i105414# + NewAttr( aLR, bFirstLinOfstSet, bLeftIndentSet ); // <-- } -- cgit From 7a39ca8220816b276c111b23a37ab88a12c1578c Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 12 May 2010 12:44:10 +0200 Subject: sw33bf04: #i105562# - correct handling of empty set list style due to outline level attribute --- sw/source/core/txtnode/ndtxt.cxx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index d6770321768f..765e142a3edd 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -4386,6 +4386,10 @@ namespace { if ( pNumRuleItem.GetValue().Len() > 0 ) { mbAddTxtNodeToList = true; + // --> OD 2010-05-12 #i105562# + // + mrTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr(); + // <-- } } break; @@ -4397,10 +4401,6 @@ namespace { dynamic_cast(pItem); ASSERT( pListIdItem.GetValue().Len() > 0, " - empty list id attribute not excepted. Serious defect -> please inform OD." ); -// const SfxStringItem& rListIdItemOfTxtNode = -// dynamic_cast( -// rTxtNode.GetAttr( RES_PARATR_LIST_ID )); -// if ( pListIdItem.GetValue() != rListIdItemOfTxtNode.GetValue() ) const String sListIdOfTxtNode = rTxtNode.GetListId(); if ( pListIdItem.GetValue() != sListIdOfTxtNode ) { @@ -4514,11 +4514,6 @@ namespace { { const SfxStringItem* pListIdItem = dynamic_cast(pItem); -// const SfxStringItem& rListIdItemOfTxtNode = -// dynamic_cast( -// mrTxtNode.GetAttr( RES_PARATR_LIST_ID )); -// if ( pListIdItem && -// pListIdItem->GetValue() != rListIdItemOfTxtNode.GetValue() ) const String sListIdOfTxtNode = mrTxtNode.GetListId(); if ( pListIdItem && pListIdItem->GetValue() != sListIdOfTxtNode ) @@ -4923,7 +4918,9 @@ namespace { mrTxtNode.AddToList(); } // --> OD 2008-11-19 #i70748# - else if ( dynamic_cast(mrTxtNode.GetAttr( RES_PARATR_OUTLINELEVEL, FALSE )).GetValue() > 0 ) + // --> OD 2010-05-12 #i105562# + else if ( mrTxtNode.GetpSwAttrSet() && + dynamic_cast(mrTxtNode.GetAttr( RES_PARATR_OUTLINELEVEL, FALSE )).GetValue() > 0 ) { mrTxtNode.SetEmptyListStyleDueToSetOutlineLevelAttr(); } -- cgit From 907de08acf34563b376f895d66f05c29310366bd Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 12 May 2010 16:03:59 +0200 Subject: sw33bf04: #i91658# method - remove unnecessary assertion --- sw/source/core/doc/htmltbl.cxx | 34 +++++++--------------------------- sw/source/core/docnode/swbaslnk.cxx | 10 ++++++---- sw/source/filter/html/htmlform.cxx | 8 +++++--- sw/source/filter/html/swhtml.cxx | 2 +- 4 files changed, 19 insertions(+), 35 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index e762de8489e3..a3e28fc0e425 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -377,32 +377,12 @@ USHORT SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc ) return (USHORT)pPageFrm->Prt().Width(); } - // Sonst versuchen wir es ueber die ViewShell - USHORT nWidth = GetBrowseWidthByVisArea( rDoc ); - if( !nWidth ) - { - // Und wenn das auch nicht geht, gibt es noch die ActualSize an der - // DocShell. - if( rDoc.GetDocShell() && GetpApp() && GetpApp()->GetDefaultDevice() ) - { - // this case shouldn't happen because the filter always waits until - // a view has been created -/* - nWidth = (USHORT)Application::GetDefaultDevice() - ->PixelToLogic( rDoc.GetDocShell()->GetActualSize(), - MapMode( MAP_TWIP ) ).Width(); -*/ - ASSERT( nWidth, "No browse width available" ); - } -#ifdef DBG_UTIL - else - { - // und wenn das auch nicht klappt, gibt es zur Zeit keine Breite - ASSERT( nWidth, "No browse width available" ); - } -#endif - } - return nWidth; + // --> OD 2010-05-12 #i91658# + // Assertion removed which state that no browse width is available. + // Investigation reveals that all calls can handle the case that no browse + // width is provided. + return GetBrowseWidthByVisArea( rDoc ); + // <-- } USHORT SwHTMLTableLayout::GetBrowseWidthByTabFrm( @@ -1859,7 +1839,7 @@ BOOL SwHTMLTableLayout::Resize( USHORT nAbsAvail, BOOL bRecalc, // weil sond die Umschaltung von relativ nach absolut nicht funktioniert. if( pDoc->GetRootFrm() && pDoc->get(IDocumentSettingAccess::BROWSE_MODE) ) { - USHORT nVisAreaWidth = GetBrowseWidthByVisArea( *pDoc ); + const USHORT nVisAreaWidth = GetBrowseWidthByVisArea( *pDoc ); if( nVisAreaWidth < nAbsAvail && !FindFlyFrmFmt() ) nAbsAvail = nVisAreaWidth; } diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx index df6c8dc8c9f2..cb804b102c0e 100644 --- a/sw/source/core/docnode/swbaslnk.cxx +++ b/sw/source/core/docnode/swbaslnk.cxx @@ -357,17 +357,19 @@ BOOL SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd ) 0 != (pANd = pDoc->GetNodes()[pAPos->nNode]) && 0 != (pTblNd = pANd->FindTableNode()) ) { - BOOL bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); + const BOOL bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); SwHTMLTableLayout *pLayout = pTblNd->GetTable().GetHTMLTableLayout(); if( pLayout ) { - USHORT nBrowseWidth = - pLayout->GetBrowseWidthByTable( *pDoc ); - if( nBrowseWidth ) + const USHORT nBrowseWidth = + pLayout->GetBrowseWidthByTable( *pDoc ); + if ( nBrowseWidth ) + { pLayout->Resize( nBrowseWidth, TRUE, TRUE, bLastGrf ? HTMLTABLE_RESIZE_NOW : 500 ); + } } } } diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 4fd450cbffd5..bb1567d978f6 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -547,18 +547,20 @@ void SwHTMLImageWatcher::init( sal_Int32 Width, sal_Int32 Height ) 0 != (pANd = pDoc->GetNodes()[pAPos->nNode]) && 0 != (pTblNd = pANd->FindTableNode()) ) { - sal_Bool bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); + const sal_Bool bLastGrf = !pTblNd->GetTable().DecGrfsThatResize(); SwHTMLTableLayout *pLayout = pTblNd->GetTable().GetHTMLTableLayout(); if( pLayout ) { - sal_uInt16 nBrowseWidth = + const sal_uInt16 nBrowseWidth = pLayout->GetBrowseWidthByTable( *pDoc ); - if( nBrowseWidth ) + if ( nBrowseWidth ) + { pLayout->Resize( nBrowseWidth, sal_True, sal_True, bLastGrf ? HTMLTABLE_RESIZE_NOW : 500 ); + } } } } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 1e4f975ba3ec..fba6a477757d 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -4957,7 +4957,7 @@ USHORT SwHTMLParser::ToTwips( USHORT nPixel ) const SwTwips SwHTMLParser::GetCurrentBrowseWidth() { - SwTwips nWidth = SwHTMLTableLayout::GetBrowseWidth( *pDoc ); + const SwTwips nWidth = SwHTMLTableLayout::GetBrowseWidth( *pDoc ); if( nWidth ) return nWidth; -- cgit From 99ee7093162c1922a2740e4731b82a1528283e3c Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 14 May 2010 13:52:41 +0200 Subject: sw33bf04: #i111177#: work around unxsols4 compiler bug --- sw/source/core/unocore/unoftn.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index 44991960ac25..d0d74fa023c7 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -78,7 +78,9 @@ public: , m_rThis(rThis) , m_bIsEndnote(bIsEndnote) , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis)) - , m_bIsDescriptor(0 == pFootnote) +// #i111177#: unxsols4 (Sun C++ 5.9 SunOS_sparc) generates wrong code for this +// , m_bIsDescriptor(0 == pFootnote) + , m_bIsDescriptor((0 == pFootnote) ? true : false) , m_pFmtFtn(pFootnote) { } -- cgit From c9d620f5dd472902fe6d5aed93ed55dec6dd7f7b Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Fri, 14 May 2010 16:36:40 +0200 Subject: sw33bf04: #160026# method - property "Help" does not exist and asking for it causes exception --> asking for property "HelpText" --- sw/source/filter/ww8/wrtw8esh.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 6686ae5b13d7..004eef715822 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -170,10 +170,20 @@ void WW8Export::DoComboBox(uno::Reference xPropSet) rtl::OUString sHelp; { - uno::Any aTmp = xPropSet->getPropertyValue(C2U("Help")); - const rtl::OUString *pStr = (const rtl::OUString *)aTmp.getValue(); - if (pStr) - sHelp = *pStr; + // --> OD 2010-05-14 #160026# + // property "Help" does not exist and due to the no-existence an exception is thrown. +// uno::Any aTmp = xPropSet->getPropertyValue(C2U("Help")); + try + { + uno::Any aTmp = xPropSet->getPropertyValue(C2U("HelpText")); + // <-- + const rtl::OUString *pStr = (const rtl::OUString *)aTmp.getValue(); + if (pStr) + sHelp = *pStr; + } + catch( uno::Exception& ) + {} + // <-- } rtl::OUString sToolTip; -- cgit From f4609c4c294a62023b6cd6baeb6a73d44992dec3 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 17 May 2010 15:50:18 +0200 Subject: sw33bf04: #i101009#: doccomp.cxx: avoid creating redlines including EndOfContent --- sw/source/core/doc/doccomp.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'sw/source') diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 6451aebd4251..6e7d125e6d1d 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1480,6 +1480,17 @@ void SwCompareData::SetRedlinesToDoc( BOOL bUseDocInfo ) pTmp->GetPoint()->nNode++; pTmp->GetPoint()->nContent.Assign( pTmp->GetCntntNode(), 0 ); } + // --> mst 2010-05-17 #i101009# + // prevent redlines that end on structural end node + if (& rDoc.GetNodes().GetEndOfContent() == + & pTmp->GetPoint()->nNode.GetNode()) + { + pTmp->GetPoint()->nNode--; + SwCntntNode *const pContentNode( pTmp->GetCntntNode() ); + pTmp->GetPoint()->nContent.Assign( pContentNode, + (pContentNode) ? pContentNode->Len() : 0 ); + } + // <-- rDoc.DeleteRedline( *pTmp, false, USHRT_MAX ); @@ -1499,6 +1510,17 @@ void SwCompareData::SetRedlinesToDoc( BOOL bUseDocInfo ) pTmp->GetPoint()->nNode++; pTmp->GetPoint()->nContent.Assign( pTmp->GetCntntNode(), 0 ); } + // --> mst 2010-05-17 #i101009# + // prevent redlines that end on structural end node + if (& rDoc.GetNodes().GetEndOfContent() == + & pTmp->GetPoint()->nNode.GetNode()) + { + pTmp->GetPoint()->nNode--; + SwCntntNode *const pContentNode( pTmp->GetCntntNode() ); + pTmp->GetPoint()->nContent.Assign( pContentNode, + (pContentNode) ? pContentNode->Len() : 0 ); + } + // <-- } while( pInsRing != ( pTmp = (SwPaM*)pTmp->GetNext() )); SwRedlineData aRedlnData( nsRedlineType_t::REDLINE_INSERT, nAuthor, aTimeStamp, aEmptyStr, 0, 0 ); -- cgit From 33ddea2d2bdb996a7f8eb7189b311bafa0de367e Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 18 May 2010 14:22:07 +0200 Subject: sw33bf04: #i97421#: fix loop in AppendRedline: SwUndoDelete::Redo(): recreate redline save data (based on patch by majun51). SwDoc::AppendRedline(): fix loop on DELETE/INSERT without extent. --- sw/source/core/doc/docredln.cxx | 19 +++++++++++++------ sw/source/core/undo/undel.cxx | 10 +++++++++- sw/source/core/undo/undobj.cxx | 7 ++++++- 3 files changed, 28 insertions(+), 8 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 000da4987cbf..6d8ac96b94c2 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -914,17 +914,24 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) case POS_INSIDE: { - pNewRedl->PushData( *pRedl, FALSE ); if( *pRStt == *pStt ) { - pRedl->SetStart( *pEnd, pRStt ); - // neu einsortieren - pRedlineTbl->Remove( n ); - pRedlineTbl->Insert( pRedl, n ); - bDec = true; + // --> mst 2010-05-17 #i97421# + // redline w/out extent loops + if (*pStt != *pEnd) + // <-- + { + pNewRedl->PushData( *pRedl, FALSE ); + pRedl->SetStart( *pEnd, pRStt ); + // re-insert + pRedlineTbl->Remove( n ); + pRedlineTbl->Insert( pRedl, n ); + bDec = true; + } } else { + pNewRedl->PushData( *pRedl, FALSE ); if( *pREnd != *pEnd ) { pNew = new SwRedline( *pRedl ); diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 593382fd999e..b0860e3a7816 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -863,7 +863,15 @@ void SwUndoDelete::Redo( SwUndoIter& rUndoIter ) SetPaM( rPam ); if( pRedlSaveData ) - rDoc.DeleteRedline( rPam, false, USHRT_MAX ); + { + bool bSuccess = FillSaveData(rPam, *pRedlSaveData, TRUE); + OSL_ENSURE(bSuccess, + "SwUndoDelete::Redo: used to have redline data, but now none?"); + if (!bSuccess) + { + delete pRedlSaveData, pRedlSaveData = 0; + } + } if( !bDelFullPara ) { diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 2c341cb53bf5..1a71a705b2fb 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -1120,7 +1120,12 @@ void SwRedlineSaveData::RedlineToDoc( SwPaM& rPam ) if (rDoc.GetDocShell() && (pRedl->GetComment() != String(::rtl::OUString::createFromAscii(""))) ) rDoc.GetDocShell()->Broadcast(SwRedlineHint(pRedl,SWREDLINE_INSERTED)); // - rDoc.AppendRedline( pRedl, true ); +#if OSL_DEBUG_LEVEL > 0 + bool const bSuccess = +#endif + rDoc.AppendRedline( pRedl, true ); + OSL_ENSURE(bSuccess, + "SwRedlineSaveData::RedlineToDoc: insert redline failed"); rDoc.SetRedlineMode_intern( eOld ); } -- cgit From b865a8f1e4ded4e1177c0f80d99293fefe74bebe Mon Sep 17 00:00:00 2001 From: Henning Brinkmann Date: Thu, 20 May 2010 11:17:02 +0200 Subject: hb33patches1: #i100709#: applied patch --- sw/source/filter/ww8/wrtw8esh.cxx | 19 ++----------------- sw/source/filter/ww8/ww8par3.cxx | 17 +++++++---------- 2 files changed, 9 insertions(+), 27 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 6686ae5b13d7..f2cbc71eceed 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -270,25 +270,10 @@ void WW8Export::DoCheckBox(uno::Reference xPropSet) sal_Int16 nTemp = 0; xPropSet->getPropertyValue(C2U("DefaultState")) >>= nTemp; - sal_uInt32 nIsDefaultChecked(nTemp); + aFFData.setDefaultResult(nTemp); xPropSet->getPropertyValue(C2U("State")) >>= nTemp; - sal_uInt32 nIsChecked(nTemp); - - if (nIsDefaultChecked != nIsChecked) - { - switch (nIsChecked) - { - case false: - aFFData.setResult(0); - break; - case true: - aFFData.setResult(1); - break; - default: - ASSERT(!this, "how did that happen"); - } - } + aFFData.setResult(nTemp); ::rtl::OUString aStr; static ::rtl::OUString sName(C2U("Name")); diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 465d07c0d2b5..58f5496b4575 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2207,20 +2207,17 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, { *pDataStream >> nDefaultChecked; nChecked = nDefaultChecked; - //Don't know the details yet - switch (nHeaderByte) + + sal_uInt8 iRes = (nHeaderByte >> 2) & 0x1F; + switch (iRes) { - case 0x65: //01100101 - //use defaults ? + case 1: //checked + nChecked = true; break; - case 0x1: //00000001 - //swap to unchecked from checked (#114841)? + case 25: //undefined, Undefined checkboxes are treated as unchecked + case 0: //unchecked nChecked = false; break; - case 0x5: //00000101 - //change to checked - nChecked = true; - break; default: ASSERT(!this, "unknown option, please report to cmc"); break; -- cgit From 047c38908df32c7de6634b1d5963b0df71d4e6e8 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 21 May 2010 15:19:08 +0200 Subject: sw33bf04: #i58606#: ~SwExtTextInput(): do not do anything if in SwDoc dtor --- sw/source/core/doc/extinput.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index 2b2c809c3cb2..f627870932f9 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -54,6 +54,9 @@ SwExtTextInput::SwExtTextInput( const SwPaM& rPam, Ring* pRing ) SwExtTextInput::~SwExtTextInput() { + SwDoc *const pDoc = GetDoc(); + if (pDoc->IsInDtor()) { return; /* #i58606# */ } + SwTxtNode* pTNd = GetPoint()->nNode.GetNode().GetTxtNode(); if( pTNd ) { @@ -69,7 +72,6 @@ SwExtTextInput::~SwExtTextInput() // damit Undo / Redlining usw. richtig funktioniert, // muss ueber die Doc-Schnittstellen gegangen werden !!! - SwDoc* pDoc = GetDoc(); if(eInputLanguage != LANGUAGE_DONTKNOW) { // --> FME 2005-02-11 #i41974# Only set language attribute -- cgit From d20b81017eb53c5c19a8aed6d5f785c469f91808 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 21 May 2010 15:21:49 +0200 Subject: sw33bf04: #i85766#: prevent field expansion in clipboard: SwField: add a String member to cache the value. SwField: wrap Expand() and Copy() methods to use/update cache. update all callers to pass the clipboard flag to new SwField::ExpandField(). --- sw/source/core/crsr/crstrvl.cxx | 5 ++--- sw/source/core/crsr/findtxt.cxx | 4 +++- sw/source/core/doc/docfld.cxx | 20 +++++++++++++++----- sw/source/core/edit/edattr.cxx | 6 +----- sw/source/core/edit/edfld.cxx | 5 ++--- sw/source/core/fields/cellfml.cxx | 3 ++- sw/source/core/fields/fldbas.cxx | 17 +++++++++++++++++ sw/source/core/tox/txmsrt.cxx | 5 +++-- sw/source/core/txtnode/atrfld.cxx | 13 ++++++++----- sw/source/core/txtnode/ndtxt.cxx | 14 ++++++++++---- sw/source/core/txtnode/thints.cxx | 3 ++- sw/source/core/undo/SwUndoField.cxx | 12 +++++++----- sw/source/filter/ascii/ascatr.cxx | 3 ++- sw/source/filter/html/htmlfldw.cxx | 2 +- sw/source/filter/rtf/rtfatr.cxx | 9 ++++++--- sw/source/filter/ww8/ww8atr.cxx | 10 +++++----- sw/source/ui/dbui/dbinsdlg.cxx | 29 +++-------------------------- sw/source/ui/docvw/edtwin2.cxx | 18 ++---------------- sw/source/ui/fldui/fldmgr.cxx | 2 +- sw/source/ui/fldui/fldpage.cxx | 14 +------------- 20 files changed, 93 insertions(+), 101 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 9ea80b899a6d..495339bc4b98 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -34,9 +34,7 @@ #include #include #include -#ifndef _SVX_SVDOBJ_HXX #include -#endif #include #include #include @@ -718,7 +716,8 @@ BOOL SwCrsrShell::MoveFldType( const SwFieldType* pFldType, BOOL bNext, SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField( (SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) ); - pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex() ); + pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex(), + pDoc->IsClipBoard() ); pTxtFld->ChgTxtNode( pTNd ); } diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index bb458ad49643..5a383d1d0b1b 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -145,7 +145,9 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart, // Fuer das Ende merken wir uns die Ersetzungen und entferenen // hinterher alle am Stringende (koenten ja 'normale' 0x7f drinstehen BOOL bEmpty = RES_TXTATR_FIELD != pHt->Which() || - !((SwTxtFld*)pHt)->GetFld().GetFld()->Expand().Len(); + !(static_cast(pHt) + ->GetFld().GetFld()->ExpandField( + rNd.GetDoc()->IsClipBoard()).Len()); if ( bEmpty && nStart == nAkt ) { rArr.Insert( nAkt, rArr.Count() ); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index ebac34bf3540..f4e80e9de52a 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -1241,13 +1241,18 @@ void SwDoc::FldsToExpand( SwHash**& ppHashTbl, USHORT& rTblSize, // Eintrag in den HashTable eintragen // Eintrag vorhanden ? pFnd = Find( rName, ppHashTbl, rTblSize, &nPos ); + String const value(pFld->ExpandField(IsClipBoard())); if( pFnd ) + { // Eintrag in der HashTabelle aendern - ((_HashStr*)pFnd)->aSetStr = pFld->Expand(); + static_cast<_HashStr*>(pFnd)->aSetStr = value; + } else + { // neuen Eintrag einfuegen *(ppHashTbl + nPos ) = new _HashStr( rName, - pFld->Expand(), (_HashStr*)*(ppHashTbl + nPos)); + value, static_cast<_HashStr *>(*(ppHashTbl + nPos))); + } } break; } @@ -1413,13 +1418,18 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) // Eintrag vorhanden ? USHORT nPos; SwHash* pFnd = Find( rName, pHashStrTbl, nStrFmtCnt, &nPos ); + String const value(pFld->ExpandField(IsClipBoard())); if( pFnd ) + { // Eintrag in der HashTabelle aendern - ((_HashStr*)pFnd)->aSetStr = pFld->Expand(); + static_cast<_HashStr*>(pFnd)->aSetStr = value; + } else + { // neuen Eintrag einfuegen *(pHashStrTbl + nPos ) = new _HashStr( rName, - pFld->Expand(), (_HashStr*)*(pHashStrTbl + nPos)); + value, static_cast<_HashStr *>(*(pHashStrTbl + nPos))); + } } break; case RES_GETEXPFLD: @@ -2724,7 +2734,7 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, //pDstFld->ChangeFormat( rSrcFld.GetFormat() ); //pDstFld->SetLanguage( rSrcFld.GetLanguage() ); - SwField * pNewFld = rSrcFld.Copy(); + SwField * pNewFld = rSrcFld.CopyField(); pDstFmtFld->SetFld(pNewFld); switch( nFldWhich ) diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 9e1cf28f0eb1..b46c202b882a 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -31,14 +31,10 @@ #include -#ifndef _SVX_TSTPITEM_HXX //autogen #include -#endif #include #include -#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_ #include -#endif #include #include #include @@ -461,7 +457,7 @@ BOOL lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, xub_StrLen nPos, const SwField* const pFld = pAttr->GetFld().GetFld(); if (pFld) { - sExp += pFld->Expand(); + sExp += pFld->ExpandField(rTNd.GetDoc()->IsClipBoard()); } } } diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index a919da9a6515..1e4f699fa203 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -42,9 +42,7 @@ #include #include #include -#ifndef _DBMGR_HXX #include -#endif #include #include @@ -226,7 +224,8 @@ void SwEditShell::FieldToText( SwFieldType* pType ) *pFmtFld->GetTxtFld()->GetStart() ); // Feldinhalt durch Text ersetzen - String aEntry( pFmtFld->GetFld()->Expand() ); + String const aEntry( + pFmtFld->GetFld()->ExpandField(GetDoc()->IsClipBoard()) ); pPaM->SetMark(); pPaM->Move( fnMoveForward ); GetDoc()->DeleteRange( *pPaM ); diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index aa46869bca1a..182ed12d6ddd 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -203,7 +203,8 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const break; default: - nRet = rCalcPara.rCalc.Calculate( pFld->Expand() ).GetDouble(); + String const value(pFld->ExpandField(pDoc->IsClipBoard())); + nRet = rCalcPara.rCalc.Calculate(value).GetDouble(); } } else diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index ec65d0644bba..c47bd63e70ad 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -437,6 +437,23 @@ BOOL SwField::IsFixed() const return bRet; } +String SwField::ExpandField(bool const bInClipboard) const +{ + if (!bInClipboard) // #i85766# do not expand fields in clipboard documents + { + m_Cache = Expand(); + } + return m_Cache; +} + +SwField * SwField::CopyField() const +{ + SwField *const pNew = Copy(); + // #i85766# cache expansion of source (for clipboard) + pNew->m_Cache = Expand(); + return pNew; +} + /*-------------------------------------------------------------------- Beschreibung: Numerierung expandieren --------------------------------------------------------------------*/ diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 5cfffeaf5229..61f873b010b7 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -870,8 +870,9 @@ USHORT SwTOXAuthority::GetLevel() const -----------------------------------------------------------------------*/ void SwTOXAuthority::_GetText( String& rTxt, String& ) { - // - rTxt = m_rField.GetFld()->Expand(); + bool const isClipBoard( + m_rField.GetTxtFld()->GetTxtNode().GetDoc()->IsClipBoard()); + rTxt = m_rField.GetFld()->ExpandField(isClipBoard); } /* -----------------21.09.99 12:50------------------- diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 3ddd3189bf6c..5c75f79954a7 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include "reffld.hxx" #include "ddefld.hxx" @@ -68,7 +69,7 @@ SwFmtFld::SwFmtFld( const SwField &rFld ) SwClient( rFld.GetTyp() ), pTxtAttr( 0 ) { - pField = rFld.Copy(); + pField = rFld.CopyField(); } // #i24434# @@ -83,7 +84,7 @@ SwFmtFld::SwFmtFld( const SwFmtFld& rAttr ) if(rAttr.GetFld()) { rAttr.GetFld()->GetTyp()->Add(this); - pField = rAttr.GetFld()->Copy(); + pField = rAttr.GetFld()->CopyField(); } } @@ -254,9 +255,10 @@ BOOL SwFmtFld::IsProtect() const |* *************************************************************************/ -SwTxtFld::SwTxtFld( SwFmtFld& rAttr, xub_StrLen nStartPos ) +SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos, + bool const bInClipboard) : SwTxtAttr( rAttr, nStartPos ) - , m_aExpand( rAttr.GetFld()->Expand() ) + , m_aExpand( rAttr.GetFld()->ExpandField(bInClipboard) ) , m_pTxtNode( 0 ) { rAttr.pTxtAttr = this; @@ -283,7 +285,8 @@ void SwTxtFld::Expand() const ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" ); const SwField* pFld = GetFld().GetFld(); - XubString aNewExpand( pFld->Expand() ); + XubString aNewExpand( + pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) ); if( aNewExpand == m_aExpand ) { diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 7474cb50fe4a..dd66bcbef379 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2994,8 +2994,10 @@ void SwTxtNode::Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt, rTxt.Erase( nPos, 1 ); if( bExpandFlds ) { - const XubString aExpand( ((SwTxtFld*)pAttr)->GetFld(). - GetFld()->Expand() ); + const XubString aExpand( + static_cast(pAttr)->GetFld() + .GetFld()->ExpandField( + GetDoc()->IsClipBoard())); rTxt.Insert( aExpand, nPos ); nPos = nPos + aExpand.Len(); nEndPos = nEndPos + aExpand.Len(); @@ -3142,7 +3144,9 @@ BOOL SwTxtNode::GetExpandTxt( SwTxtNode& rDestNd, const SwIndex* pDestIdx, { case RES_TXTATR_FIELD: { - const XubString aExpand( ((SwTxtFld*)pHt)->GetFld().GetFld()->Expand() ); + XubString const aExpand( + static_cast(pHt)->GetFld().GetFld() + ->ExpandField(GetDoc()->IsClipBoard())); if( aExpand.Len() ) { aDestIdx++; // dahinter einfuegen; @@ -3238,7 +3242,9 @@ const ModelToViewHelper::ConversionMap* const SwTxtAttr* pAttr = (*pSwpHints2)[i]; if ( RES_TXTATR_FIELD == pAttr->Which() ) { - const XubString aExpand( ((SwTxtFld*)pAttr)->GetFld().GetFld()->Expand() ); + const XubString aExpand( + static_cast(pAttr)->GetFld().GetFld() + ->ExpandField(GetDoc()->IsClipBoard())); if ( aExpand.Len() > 0 ) { const xub_StrLen nFieldPos = *pAttr->GetStart(); diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index a2e326777383..9f6c7f6eb7bd 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1042,7 +1042,8 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr, pNew = new SwTxtINetFmt( (SwFmtINetFmt&)rNew, nStt, nEnd ); break; case RES_TXTATR_FIELD: - pNew = new SwTxtFld( (SwFmtFld&)rNew, nStt ); + pNew = new SwTxtFld( static_cast(rNew), nStt, + rDoc.IsClipBoard() ); break; case RES_TXTATR_FLYCNT: { diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx index fe189d5adf50..8a3c6c507c93 100644 --- a/sw/source/core/undo/SwUndoField.cxx +++ b/sw/source/core/undo/SwUndoField.cxx @@ -63,12 +63,14 @@ SwPosition SwUndoField::GetPosition() } SwUndoFieldFromDoc::SwUndoFieldFromDoc(const SwPosition & rPos, - const SwField & _aOldField, - const SwField & _aNewField, + const SwField & rOldField, + const SwField & rNewField, SwMsgPoolItem * _pHnt, BOOL _bUpdate, SwUndoId _nId) - : SwUndoField(rPos,_nId), pOldField(_aOldField.Copy()), - pNewField(_aNewField.Copy()), pHnt(_pHnt), - bUpdate(_bUpdate) + : SwUndoField(rPos,_nId) + , pOldField(rOldField.CopyField()) + , pNewField(rNewField.CopyField()) + , pHnt(_pHnt) + , bUpdate(_bUpdate) { ASSERT(pOldField, "No old field!"); ASSERT(pNewField, "No new field!"); diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index eadaea834d80..71adf763e49e 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -124,7 +124,8 @@ BOOL SwASC_AttrIter::OutAttr( xub_StrLen nSwPos ) switch( pHt->Which() ) { case RES_TXTATR_FIELD: - sOut = ((SwTxtFld*)pHt)->GetFld().GetFld()->Expand(); + sOut = static_cast(pHt)->GetFld().GetFld() + ->ExpandField(rWrt.pDoc->IsClipBoard()); break; case RES_TXTATR_FTN: diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 2e67ffcde1f8..50b7bdc7ddc8 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -305,7 +305,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, } // Inhalt des Feldes ausgeben - String sExpand( pFld->Expand() ); + String const sExpand( pFld->ExpandField(rWrt.pDoc->IsClipBoard()) ); sal_Bool bNeedsCJKProcessing = sal_False; if( sExpand.Len() ) { diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx index a569f91e5966..1e3697c7a67d 100644 --- a/sw/source/filter/rtf/rtfatr.cxx +++ b/sw/source/filter/rtf/rtfatr.cxx @@ -2902,7 +2902,8 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) case RES_HIDDENTXTFLD: if( TYP_CONDTXTFLD == ((SwHiddenTxtField*)pFld)->GetSubType() ) - RTFOutFuncs::Out_String( rWrt.Strm(), pFld->Expand(), + RTFOutFuncs::Out_String( rWrt.Strm(), + pFld->ExpandField(rWrt.pDoc->IsClipBoard()), rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); else { @@ -2958,7 +2959,8 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) rWrt.Strm() >> cCh; if( ' ' != cCh ) // vorweg immer einen Trenner rWrt.Strm() << ' '; - RTFOutFuncs::Out_String( rWrt.Strm(), pFld->Expand(), + RTFOutFuncs::Out_String( rWrt.Strm(), + pFld->ExpandField(rWrt.pDoc->IsClipBoard()), rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); } break; @@ -2967,7 +2969,8 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) if( aFldStt.Len() ) { rWrt.Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << ' '; - RTFOutFuncs::Out_String( rWrt.Strm(), pFld->Expand(), + RTFOutFuncs::Out_String( rWrt.Strm(), + pFld->ExpandField(rWrt.pDoc->IsClipBoard()), rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); rWrt.Strm() << "}}"; rRTFWrt.bOutFmtAttr = FALSE; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index c1c254a47f8d..8bf79cc74a6c 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1743,9 +1743,9 @@ static void InsertSpecialChar( WW8Export& rWrt, BYTE c, aItems.GetData()); } -String lcl_GetExpandedField(const SwField &rFld) +String lcl_GetExpandedField(const SwField &rFld, SwDoc const& rDoc) { - String sRet(rFld.Expand()); + String sRet(rFld.ExpandField(rDoc.IsClipBoard())); //replace LF 0x0A with VT 0x0B sRet.SearchAndReplaceAll(0x0A, 0x0B); @@ -1871,7 +1871,7 @@ void WW8Export::OutputField( const SwField* pFld, ww::eField eFldType, { String sOut; if( pFld ) - sOut = lcl_GetExpandedField(*pFld); + sOut = lcl_GetExpandedField(*pFld, *pDoc); else sOut = rFldCmd; if( sOut.Len() ) @@ -2598,7 +2598,7 @@ void WW8AttributeOutput::RefField( const SwField &rFld, const String &rRef) sStr.APPEND_CONST_ASC( "\" " ); m_rWW8Export.OutputField( &rFld, ww::eREF, sStr, WRITEFIELD_START | WRITEFIELD_CMD_START | WRITEFIELD_CMD_END ); - String sVar = lcl_GetExpandedField( rFld ); + String sVar = lcl_GetExpandedField( rFld, *GetExport().pDoc ); if ( sVar.Len() ) { if ( m_rWW8Export.IsUnicode() ) @@ -2614,7 +2614,7 @@ void WW8AttributeOutput::RefField( const SwField &rFld, const String &rRef) void WW8AttributeOutput::WriteExpand( const SwField* pFld ) { - String sExpand( lcl_GetExpandedField( *pFld ) ); + String sExpand( lcl_GetExpandedField( *pFld, *GetExport().pDoc ) ); if ( m_rWW8Export.IsUnicode() ) SwWW8Writer::WriteString16( m_rWW8Export.Strm(), sExpand, false ); else diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 97455d9e2514..b44ee246ac41 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -33,15 +33,10 @@ #include "dbinsdlg.hxx" -#ifndef INCLUDED_MEMORY #include -#define INCLUDED_MEMORY -#endif -#ifndef INCLUDED_FLOAT_H #include -#define INCLUDED_FLOAT_H -#endif + #include #include #include @@ -65,9 +60,7 @@ #include #include #include -#ifndef __SV_MNEMONIC_HXX #include -#endif #include #include #include @@ -78,24 +71,16 @@ #include #include #include -#ifndef _SWTABLEREP_HXX //autogen #include -#endif #include #include #include #include #include #include -#ifndef _WVIEW_HXX #include -#endif -#ifndef _DOCSH_HXX #include -#endif -#ifndef _DBMGR_HXX #include -#endif #include #include #include @@ -108,19 +93,11 @@ #include #include -#ifndef _DBINSDLG_HRC #include -#endif -#ifndef _DBUI_HRC #include -#endif -#ifndef _CMDID_H #include -#endif -#ifndef _HELPID_H #include -#endif #include #include #include @@ -1380,8 +1357,8 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence& rSelection, case _DB_Column::DB_COL_FIELD: { - SwDBField* pFld = (SwDBField*)pDBCol->DB_ColumnData. - pField->Copy(); + SwDBField *const pFld = static_cast( + pDBCol->DB_ColumnData.pField->CopyField()); double nValue = DBL_MAX; Reference< XPropertySet > xColumnProps; diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx index d605ef993457..8f003538db6f 100644 --- a/sw/source/ui/docvw/edtwin2.cxx +++ b/sw/source/ui/docvw/edtwin2.cxx @@ -35,9 +35,7 @@ #include #endif -#ifndef _HELP_HXX //autogen #include -#endif #include #include #include @@ -46,24 +44,15 @@ #include #include #include -#ifndef _OUTLINER_HXX //autogen -#define _EEITEMID_HXX #include -#endif #include #include #include #include -#ifndef _MODCFG_HXX #include -#endif -#ifndef _VIEW_HXX #include -#endif #include -#ifndef _DOCSH_HXX #include -#endif #include #include #include @@ -80,12 +69,8 @@ #include #include #include -#ifndef _DOCVW_HRC #include -#endif -#ifndef _UTLUI_HRC #include -#endif #include #include @@ -320,7 +305,8 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) { USHORT nOldSubType = pFld->GetSubType(); ((SwField*)pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD); - sTxt = pFld->Expand(); + sTxt = + pFld->ExpandField(rSh.GetDoc()->IsClipBoard()); ((SwField*)pFld)->SetSubType(nOldSubType); } break; diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index 3499c8875093..95001f897702 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -1435,7 +1435,7 @@ void SwFldMgr::UpdateCurFld(ULONG nFormat, } else { - pTmpFld = pCurFld->Copy(); + pTmpFld = pCurFld->CopyField(); bDelete = true; } diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index 39a6a98d764b..265a53dc6646 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -42,28 +42,16 @@ #include #include #include -#ifndef _DOCSH_HXX #include -#endif #include -#ifndef _VIEW_HXX #include -#endif #include #include -#ifndef _FLDTDLG_HXX #include -#endif -#ifndef _FLDPAGE_HXX #include -#endif #include -#ifndef _CMDID_H #include -#endif -#ifndef _GLOBALS_HRC #include -#endif #include using namespace ::com::sun::star; @@ -218,7 +206,7 @@ BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1, } else // Feld aendern { - SwField * pTmpFld = m_pCurFld->Copy(); + SwField *const pTmpFld = m_pCurFld->CopyField(); String sPar1(rPar1); String sPar2(rPar2); -- cgit From 96cd75686a6da042a029510c5fa36a781190905e Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 25 May 2010 17:01:06 +0200 Subject: sw33bf04: #i111677#: swdtflvr.cxx: call SetClipBoard() for clipboard docs --- sw/source/ui/dochdl/swdtflvr.cxx | 52 +++++++++++++++++++++++++--------------- sw/source/ui/inc/swdtflvr.hxx | 2 -- 2 files changed, 33 insertions(+), 21 deletions(-) (limited to 'sw/source') diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 7778b3848f45..95d6cf685fc0 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -322,6 +322,19 @@ SwTransferable::~SwTransferable() // ----------------------------------------------------------------------- +static SwDoc * lcl_GetDoc(SwDocFac & rDocFac) +{ + SwDoc *const pDoc = rDocFac.GetDoc(); + ASSERT( pDoc, "Document not found" ); + if (pDoc) + { + pDoc->SetClipBoard( true ); + } + return pDoc; +} + +// ----------------------------------------------------------------------- + void SwTransferable::ObjectReleased() { SwModule *pMod = SW_MOD(); @@ -443,7 +456,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) } pClpDocFac = new SwDocFac; - SwDoc* pTmpDoc = pClpDocFac->GetDoc(); + SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac); pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen @@ -530,8 +543,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) case SOT_FORMATSTR_ID_DRAWING: { - SwDoc *pDoc = pClpDocFac->GetDoc(); - ASSERT( pDoc, "Document not found" ); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); bOK = SetObject( pDoc->GetDrawModel(), SWTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor ); } @@ -539,21 +551,22 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) case SOT_FORMAT_STRING: { - SwDoc* pDoc = pClpDocFac->GetDoc(); - ASSERT( pDoc, "Document not found" ); - pDoc->SetClipBoard( true ); - bOK = SetObject( pDoc, - SWTRANSFER_OBJECTTYPE_STRING, rFlavor ); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_STRING, rFlavor ); } break; case SOT_FORMAT_RTF: - bOK = SetObject( pClpDocFac->GetDoc(), - SWTRANSFER_OBJECTTYPE_RTF, rFlavor ); + { + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_RTF, rFlavor ); + } break; case SOT_FORMATSTR_ID_HTML: - bOK = SetObject( pClpDocFac->GetDoc(), - SWTRANSFER_OBJECTTYPE_HTML, rFlavor ); + { + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_HTML, rFlavor ); + } break; case SOT_FORMATSTR_ID_SVXB: @@ -597,7 +610,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) // default: if( !aDocShellRef.Is() ) { - SwDoc *pDoc = pClpDocFac->GetDoc(); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); SwDocShell* pNewDocSh = new SwDocShell( pDoc, SFX_CREATE_MODE_EMBEDDED ); aDocShellRef = pNewDocSh; @@ -805,7 +818,8 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) pOrigGrf = pClpBitmap; pClpDocFac = new SwDocFac; - pWrtShell->Copy( pClpDocFac->GetDoc() ); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + pWrtShell->Copy( pDoc ); if (pOrigGrf && !pOrigGrf->GetBitmap().IsEmpty()) AddFormat( SOT_FORMATSTR_ID_SVXB ); @@ -827,7 +841,7 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) else if ( nSelection == nsSelectionType::SEL_OLE ) { pClpDocFac = new SwDocFac; - SwDoc *pDoc = pClpDocFac->GetDoc(); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); aDocShellRef = new SwDocShell( pDoc, SFX_CREATE_MODE_EMBEDDED); aDocShellRef->DoInitNew( NULL ); pWrtShell->Copy( pDoc ); @@ -857,8 +871,7 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) if( pWrtShell->IsAddMode() && pWrtShell->SwCrsrShell::HasSelection() ) pWrtShell->CreateCrsr(); - SwDoc* pTmpDoc = pClpDocFac->GetDoc(); - pTmpDoc->SetClipBoard( true ); + SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac); pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen @@ -1017,7 +1030,8 @@ int SwTransferable::CalculateAndCopy() String aStr( pWrtShell->Calculate() ); pClpDocFac = new SwDocFac; - pWrtShell->Copy( pClpDocFac->GetDoc(), &aStr); + SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac); + pWrtShell->Copy(pDoc, & aStr); eBufferType = TRNSFR_DOCUMENT; AddFormat( FORMAT_STRING ); @@ -1037,7 +1051,7 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, SwWait aWait( *pWrtShell->GetView().GetDocShell(), TRUE ); pClpDocFac = new SwDocFac; - SwDoc* pCDoc = pClpDocFac->GetDoc(); + SwDoc *const pCDoc = lcl_GetDoc(*pClpDocFac); SwNodes& rNds = pCDoc->GetNodes(); SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() ); diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx index 84b3309f70bc..a239f13f1ec2 100644 --- a/sw/source/ui/inc/swdtflvr.hxx +++ b/sw/source/ui/inc/swdtflvr.hxx @@ -26,12 +26,10 @@ ************************************************************************/ #ifndef _SWDTFLVR_HXX #define _SWDTFLVR_HXX -#ifndef _TRANSFER_HXX #include #include -#endif #include #include #include -- cgit From 2aaba84b23c9b23a78a5ec813b5d4a4584f59318 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 25 May 2010 17:02:28 +0200 Subject: sw33bf04: #i111677#: prevent number string expansion in clipboard: SwTxtNode: add member: number string cache. [how to add this to SwNodeNum is not obvious, so add it to SwTxtNode.] SwTxtNode::GetNumString(): use cached number string in clipboard. SwTxtNode::CopyText(): cache source number string in clipboard. --- sw/source/core/txtnode/ndtxt.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sw/source') diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index dd66bcbef379..25b1e913c82e 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1486,6 +1486,13 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest, xub_StrLen nTxtStartIdx = rStart.GetIndex(); xub_StrLen nDestStart = rDestStart.GetIndex(); // alte Pos merken + if (pDest->GetDoc()->IsClipBoard() && this->GetNum()) + { + // #i111677# cache expansion of source (for clipboard) + pDest->m_pNumStringCache.reset( + new ::rtl::OUString(this->GetNumString())); + } + if( !nLen ) { // wurde keine Laenge angegeben, dann Kopiere die Attribute @@ -2771,6 +2778,11 @@ BOOL SwTxtNode::HasBullet() const //i53420 added max outline parameter XubString SwTxtNode::GetNumString( const bool _bInclPrefixAndSuffixStrings, const unsigned int _nRestrictToThisLevel ) const { + if (GetDoc()->IsClipBoard() && m_pNumStringCache.get()) + { + // #i111677# do not expand number strings in clipboard documents + return *m_pNumStringCache; + } const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; if ( pRule && IsCountedInList() && -- cgit From 135fceba66df52704efc8dd3b458fa338ce3e0e0 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 25 May 2010 17:04:49 +0200 Subject: sw33bf04: #i111727#: SwDoc::DeleteRange should adjust cursors (via PaMCorrAbs) --- sw/source/core/doc/docedt.cxx | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index c9ee5b00e181..31484ac303dd 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -1604,17 +1604,9 @@ bool SwDoc::DeleteAndJoinImpl( SwPaM & rPam, } // <-- { - // dann eine Kopie vom Cursor erzeugen um alle Pams aus den - // anderen Sichten aus dem Loeschbereich zu verschieben - // ABER NICHT SICH SELBST !! - SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); - ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() ); - - const bool bSuccess( DeleteRangeImpl( aDelPam ) ); + bool const bSuccess( DeleteRangeImpl( rPam ) ); if (!bSuccess) return false; - - *rPam.GetPoint() = *aDelPam.GetPoint(); } if( bJoinTxt ) @@ -1625,7 +1617,24 @@ bool SwDoc::DeleteAndJoinImpl( SwPaM & rPam, return true; } -bool SwDoc::DeleteRangeImpl( SwPaM & rPam, const bool ) +bool SwDoc::DeleteRangeImpl(SwPaM & rPam, const bool) +{ + // move all cursors out of the deleted range. + // but first copy the given PaM, because it could be a cursor that + // would be moved! + SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); + ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() ); + + bool const bSuccess( DeleteRangeImplImpl( aDelPam ) ); + if (bSuccess) + { // now copy position from temp copy to given PaM + *rPam.GetPoint() = *aDelPam.GetPoint(); + } + + return bSuccess; +} + +bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam) { SwPosition *pStt = (SwPosition*)rPam.Start(), *pEnd = (SwPosition*)rPam.End(); -- cgit From 85df13fa783ecb5de7f9e688cdabcebd9d91e447 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 27 May 2010 15:31:26 +0200 Subject: sw33bf04: #i111172# method - further adjustment of handling existing indent when current text node is already in a list. --- sw/source/ui/wrtsh/wrtsh1.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 1cda074998a2..04f87e877aa5 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -1395,7 +1395,10 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum) if ( pTxtNode->GetNumRule() ) { const SwNumFmt aFmt( aNumRule.Get( 0 ) ); - nIndentChange -= aFmt.GetIndentAt() + aFmt.GetFirstLineIndent(); + if ( aFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + nIndentChange -= aFmt.GetIndentAt() + aFmt.GetFirstLineIndent(); + } } // <-- aNumRule.ChangeIndent( nIndentChange ); -- cgit From 5e3011965958fd47da7b6a21c835fee27a5b60e8 Mon Sep 17 00:00:00 2001 From: obo Date: Fri, 11 Jun 2010 09:30:32 +0200 Subject: masterfix: #i10000# bNothingSelected obsolete --- sw/source/ui/lingu/olmenu.cxx | 1 - 1 file changed, 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 959f566da9a2..934cfc19e22b 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -315,7 +315,6 @@ void SwSpellPopup::fillLangPopupMenu( { //make a check mark for the current language pPopupMenu->CheckItem( nItemId, TRUE ); - bNothingSelected = false; } rLangTable[ nItemId ] = aEntryTxt; ++nItemId; -- cgit