diff options
author | Henning Brinkmann <hbrinkm@openoffice.org> | 2011-03-02 11:45:40 +0100 |
---|---|---|
committer | Henning Brinkmann <hbrinkm@openoffice.org> | 2011-03-02 11:45:40 +0100 |
commit | 734a555defd1171ebda586f5c572f3b1897e70e0 (patch) | |
tree | 659d6c0a353ddf1758e387155344524b2d9f501a | |
parent | b8076454ae2bf26358cbc81ae43d47b4d4caeb46 (diff) | |
parent | 254cd28dc50edbd218eaab9faf684238304189a9 (diff) |
merge
-rw-r--r-- | sw/source/core/crsr/bookmrk.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/findattr.cxx | 31 | ||||
-rw-r--r-- | sw/source/core/doc/docedt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/xml/swxml.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.hxx | 15 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlmeta.cxx | 26 | ||||
-rw-r--r-- | sw/source/ui/docvw/AnnotationWin.cxx | 44 | ||||
-rw-r--r-- | sw/source/ui/index/idxmrk.src | 34 |
10 files changed, 149 insertions, 52 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 33d70e337e..18c4c2bbdd 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -109,7 +109,7 @@ namespace sw { namespace mark , m_aName(rName) { lcl_FixPosition(*m_pPos1); - if(aPaM.HasMark()) + if (aPaM.HasMark() && (*aPaM.GetMark() != *aPaM.GetPoint())) { MarkBase::SetOtherMarkPos(*(aPaM.GetMark())); lcl_FixPosition(*m_pPos2); diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 0869e934fa..1bf7035221 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -311,15 +311,33 @@ void SwAttrCheckArr::SetNewSet( const SwTxtNode& rTxtNd, const SwPaM& rPam ) pItem = aIter.NextItem(); } } + +static bool +lcl_IsAttributeIgnorable(xub_StrLen const nNdStart, xub_StrLen const nNdEnd, + _SwSrchChrAttr const& rTmp) +{ + // #i115528#: if there is a paragraph attribute, it has been added by the + // SwAttrCheckArr ctor, and nFound is 1. + // if the paragraph is entirely covered by hints that override the paragraph + // attribute, then this function must find an attribute to decrement nFound! + // so check for an empty search range, let attributes that start/end there + // cover it, and hope for the best... + return ((nNdEnd == nNdStart) + ? ((rTmp.nEnd < nNdStart) || (nNdEnd < rTmp.nStt)) + : ((rTmp.nEnd <= nNdStart) || (nNdEnd <= rTmp.nStt))); +} + int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) { _SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() ); - // alle die nicht im Bereich sind -> ignorieren - if( aTmp.nEnd <= nNdStt || aTmp.nStt >= nNdEnd ) + + // ignore all attributes not in search range + if (lcl_IsAttributeIgnorable(nNdStt, nNdEnd, aTmp)) + { return Found(); + } const SfxPoolItem* pItem; - // -------------------------------------------------------------- // Hier wird jetzt ausdruecklich auch in Zeichenvorlagen gesucht // -------------------------------------------------------------- @@ -473,9 +491,12 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) { _SwSrchChrAttr aTmp( rAttr.GetAttr(), *rAttr.GetStart(), *rAttr.GetAnyEnd() ); - // alle die nicht im Bereich sind -> ignorieren - if( aTmp.nEnd < nNdStt || aTmp.nStt >= nNdEnd ) + + // ignore all attributes not in search range + if (lcl_IsAttributeIgnorable(nNdStt, nNdEnd, aTmp)) + { return Found(); + } const SfxPoolItem* pItem; // -------------------------------------------------------------- diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 877fa9956a..51477abaf1 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -2521,8 +2521,6 @@ SetRedlineMode( eOld ); rPam.GetMark()->nNode = aPtNd; rPam.GetMark()->nContent.Assign( aPtNd.GetNode().GetCntntNode(), nPtCnt ); - if( bJoinTxt ) - rPam.Move( fnMoveBackward ); if( pUndoRpl ) { diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 42ed7cde8e..534cd00921 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -155,12 +155,16 @@ namespace ++ppMark) { ::sw::mark::IMark* const pBkmk = ppMark->get(); - bool hasOther = pBkmk->IsExpanded(); + ::sw::mark::CrossRefBookmark *const pCrossRefMark( + dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk)); + bool const hasOther = pBkmk->IsExpanded(); const SwPosition& rStartPos = pBkmk->GetMarkStart(); if(rStartPos.nNode == nOwnNode) { - const sal_uInt8 nType = hasOther ? BKM_TYPE_START : BKM_TYPE_START_END; + // #i109272#: cross reference marks: need special handling! + sal_uInt8 const nType = (hasOther || pCrossRefMark) + ? BKM_TYPE_START : BKM_TYPE_START_END; rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr( new SwXBookmarkPortion_Impl( SwXBookmark::CreateXBookmark(rDoc, *pBkmk), @@ -173,8 +177,10 @@ namespace auto_ptr<SwPosition> pCrossRefEndPos; const SwPosition* pEndPos = NULL; if(hasOther) + { pEndPos = &rEndPos; - else if(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk)) + } + else if (pCrossRefMark) { // Crossrefbookmarks only remember the start position but have to span the whole paragraph pCrossRefEndPos = auto_ptr<SwPosition>(new SwPosition(rEndPos)); diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index ba92c69202..7a23a98e15 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -925,18 +925,19 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con } } - sal_uInt32 nWarn = 0; - sal_uInt32 nWarn2 = 0; // read storage streams + + // #i103539#: always read meta.xml for generator + sal_uInt32 const nWarn = ReadThroughComponent( + xStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory, + (bOASIS ? "com.sun.star.comp.Writer.XMLOasisMetaImporter" + : "com.sun.star.comp.Writer.XMLMetaImporter"), + aEmptyArgs, rName, sal_False ); + + sal_uInt32 nWarn2 = 0; if( !(IsOrganizerMode() || IsBlockMode() || aOpt.IsFmtsOnly() || bInsertMode) ) { - nWarn = ReadThroughComponent( - xStorage, xModelComp, "meta.xml", "Meta.xml", xServiceFactory, - (bOASIS ? "com.sun.star.comp.Writer.XMLOasisMetaImporter" - : "com.sun.star.comp.Writer.XMLMetaImporter"), - aEmptyArgs, rName, sal_False ); - nWarn2 = ReadThroughComponent( xStorage, xModelComp, "settings.xml", NULL, xServiceFactory, (bOASIS ? "com.sun.star.comp.Writer.XMLOasisSettingsImporter" diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index ce282d4d2d..5a930513fd 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -419,23 +419,23 @@ SvXMLImportContext *SwXMLImport::CreateContext( pContext = CreateMetaContext(rLocalName); } else if ( XML_NAMESPACE_OFFICE==nPrefix && + IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) ) + { + pContext = new SwXMLDocStylesContext_Impl( *this, nPrefix, rLocalName, + xAttrList ); + } + else if ( XML_NAMESPACE_OFFICE==nPrefix && IsXMLToken( rLocalName, XML_DOCUMENT ) ) { uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( mxServiceFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.xml.dom.SAXDocumentBuilder")), uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetModel(), UNO_QUERY_THROW); + uno::Reference<document::XDocumentProperties> const xDocProps( + GetDocumentProperties()); // flat OpenDocument file format pContext = new SwXMLOfficeDocContext_Impl( *this, nPrefix, rLocalName, - xAttrList, xDPS->getDocumentProperties(), xDocBuilder); - } - else if ( XML_NAMESPACE_OFFICE==nPrefix && - IsXMLToken( rLocalName, XML_DOCUMENT_STYLES ) ) - { - pContext = new SwXMLDocStylesContext_Impl( *this, nPrefix, rLocalName, - xAttrList ); + xAttrList, xDocProps, xDocBuilder); } // <-- else diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index 54610c4e4f..520d3c7a1b 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -25,14 +25,18 @@ * ************************************************************************/ -#ifndef _XMLIMP_HXX -#define _XMLIMP_HXX +#ifndef SW_XMLIMP_HXX +#define SW_XMLIMP_HXX + +#include <com/sun/star/document/XDocumentProperties.hpp> #include <sot/storage.hxx> + #include <xmloff/xmlictxt.hxx> -#include "xmlitmap.hxx" #include <xmloff/xmlimp.hxx> +#include "xmlitmap.hxx" + class SwDoc; class SwPaM; class SvXMLUnitConverter; @@ -211,6 +215,11 @@ public: // initialize XForms virtual void initXForms(); + + // get the document properties, but only if they actually need importing + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> + GetDocumentProperties() const; }; inline const SvXMLUnitConverter& SwXMLImport::GetTwipUnitConverter() const diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx index 225ab05390..351006c08d 100644 --- a/sw/source/filter/xml/xmlmeta.cxx +++ b/sw/source/filter/xml/xmlmeta.cxx @@ -57,22 +57,34 @@ using namespace ::xmloff::token; // --------------------------------------------------------------------- +uno::Reference<document::XDocumentProperties> +SwXMLImport::GetDocumentProperties() const +{ + if (IsOrganizerMode() || IsStylesOnlyMode() || + IsBlockMode() || IsInsertMode()) + { + return 0; + } + uno::Reference<document::XDocumentPropertiesSupplier> const xDPS( + GetModel(), UNO_QUERY_THROW); + return xDPS->getDocumentProperties(); +} + SvXMLImportContext *SwXMLImport::CreateMetaContext( const OUString& rLocalName ) { SvXMLImportContext *pContext = 0; - if( !(IsStylesOnlyMode() || IsInsertMode()) ) + if (getImportFlags() & IMPORT_META) { - uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( + uno::Reference<xml::sax::XDocumentHandler> const xDocBuilder( mxServiceFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.xml.dom.SAXDocumentBuilder")), - uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetModel(), UNO_QUERY_THROW); + uno::UNO_QUERY_THROW); + uno::Reference<document::XDocumentProperties> const xDocProps( + GetDocumentProperties()); pContext = new SvXMLMetaDocumentContext(*this, - XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); + XML_NAMESPACE_OFFICE, rLocalName, xDocProps, xDocBuilder); } if( !pContext ) diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx index 4675805e52..7419ee060e 100644 --- a/sw/source/ui/docvw/AnnotationWin.cxx +++ b/sw/source/ui/docvw/AnnotationWin.cxx @@ -111,15 +111,23 @@ void SwAnnotationWin::UpdateData() { if ( Engine()->IsModified() ) { - SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); - SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); - SwField* pOldField = mpFld->Copy(); + IDocumentUndoRedo & rUndoRedo( + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo()); + ::std::auto_ptr<SwField> pOldField; + if (rUndoRedo.DoesUndo()) + { + pOldField.reset(mpFld->Copy()); + } mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( - new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); - delete pOldField; + if (rUndoRedo.DoesUndo()) + { + SwTxtFld *const pTxtFld = mpFmtFld->GetTxtFld(); + SwPosition aPosition( pTxtFld->GetTxtNode() ); + aPosition.nContent = *pTxtFld->GetStart(); + rUndoRedo.AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + } // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one) Mgr().SetLayout(); // #i98686# if we have several views, all notes should update their text @@ -242,15 +250,23 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText) // lets insert an undo step so the initial text can be easily deleted // but do not use UpdateData() directly, would set modified state again and reentrance into Mgr Engine()->SetModifyHdl( Link() ); - SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld(); - SwPosition aPosition( pTxtFld->GetTxtNode() ); - aPosition.nContent = *pTxtFld->GetStart(); - SwField* pOldField = mpFld->Copy(); + IDocumentUndoRedo & rUndoRedo( + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo()); + ::std::auto_ptr<SwField> pOldField; + if (rUndoRedo.DoesUndo()) + { + pOldField.reset(mpFld->Copy()); + } mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( - new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); - delete pOldField; + if (rUndoRedo.DoesUndo()) + { + SwTxtFld *const pTxtFld = mpFmtFld->GetTxtFld(); + SwPosition aPosition( pTxtFld->GetTxtNode() ); + aPosition.nContent = *pTxtFld->GetStart(); + rUndoRedo.AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + } Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) ); Engine()->ClearModifyFlag(); Engine()->GetUndoManager().Clear(); diff --git a/sw/source/ui/index/idxmrk.src b/sw/source/ui/index/idxmrk.src index e0a1a4df9c..fc38d7c6d2 100644 --- a/sw/source/ui/index/idxmrk.src +++ b/sw/source/ui/index/idxmrk.src @@ -287,6 +287,14 @@ ModalDialog DLG_EDIT_IDXMARK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 118 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModalDialog DLG_EDIT_IDXMARK_CJK { @@ -306,6 +314,14 @@ ModalDialog DLG_EDIT_IDXMARK_CJK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 118 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModelessDialog DLG_INSIDXMARK { @@ -328,6 +344,14 @@ ModelessDialog DLG_INSIDXMARK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 138 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModelessDialog DLG_INSIDXMARK_CJK { @@ -349,6 +373,14 @@ ModelessDialog DLG_INSIDXMARK_CJK #define COL_BUTTONS_2 (COL_BUTTONS+26) #define WINDOW_HEIGHT 138 IDX_DIALOG_WINDOW + #undef IDX_WIN_WIDTH + #undef GB_HEIGHT + #undef DCB_INDEX_WIDTH + #undef PHONETIC_HIDDEN + #undef LIST_WIDTH + #undef COL_BUTTONS + #undef COL_BUTTONS_2 + #undef WINDOW_HEIGHT }; ModalDialog DLG_NEW_USER_IDX { @@ -529,6 +561,7 @@ ModalDialog DLG_EDIT_AUTHMARK Size = MAP_APPFONT ( 218 , 118 ) ; #define RADIO_BUTTON_HEIGHT 0 AUTH_DIALOG_WINDOW + #undef RADIO_BUTTON_HEIGHT }; ModelessDialog DLG_INSAUTHMARK { @@ -543,6 +576,7 @@ ModelessDialog DLG_INSAUTHMARK Size = MAP_APPFONT ( 218 , 118 + RADIO_BUTTON_HEIGHT) ; // Moveable = TRUE ; AUTH_DIALOG_WINDOW + #undef RADIO_BUTTON_HEIGHT }; ModalDialog DLG_CREATE_AUTH_ENTRY { |